29 else if (S==
X) os <<
"X";
30 else if (S==
Y) os <<
"Y";
31 else if (S==
Z) os <<
"Z";
32 else if (S==
XY) os <<
"XY";
33 else if (S==
XZ) os <<
"XZ";
34 else if (S==
YZ) os <<
"YZ";
35 else if (S==
XYZ) os <<
"XYZ";
36 else if (S==
RAZ) os <<
"RAZ";
37 else if (S==
RA) os <<
"RA";
38 else if (S==
AZ) os <<
"AZ";
39 else if (S==
RZ) os <<
"RZ";
40 else if (S==
R) os <<
"R";
41 else if (S==
A) os <<
"A";
48 if (new_>0.0) w2 = new_;
49 else w2 =
sqr(w_over_rmax*getLargestParticle()->get_Radius());
55 }
else if (get_CG_type()==
Gaussian) {
56 if (get_superexact()) cutoff = 5.0*sqrt(w2);
57 else cutoff = 3.0*sqrt(w2);
59 }
else { std::cerr <<
"error in CG_function" << std::endl; exit(-1); }
64 for (
unsigned int i=0; i<Points.size(); i++) Points[i].set_zero();
65 if (get_doGradient())
for (
unsigned int i=0; i<Points.size(); i++) {
66 dx[i].set_zero(); dy[i].set_zero(); dz[i].set_zero();
68 for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
69 (*it)->set_PreviousPosition((*it)->get_Position());
82 nxMirrored=nyMirrored=nzMirrored=0;
114 ignoreFixedParticles =
true;
115 StressTypeForFixedParticles = 1;
118 periodicWalls =
true;
120 mirrorAtDomainBoundary =
false;
121 set_superexact(
false);
122 VelocityProfile.resize(0);
125 set_doTimeAverage(
true);
127 nTimeAverageReset = -1;
129 set_doVariance(
false);
131 set_doGradient(
false);
138 template <StatType T>
201 template <StatType T>
207 set_name(name.c_str());
209 if (!strcmp(get_name().c_str(),
"c3d")) {
211 std::cout <<
"MDCLR data" << std::endl;
223 template <StatType T>
228 std::cerr<<
"fstatistics.exe filename [-options]"<< std::endl
229 <<
"Type -help for more information" << std::endl;
234 if (!strcmp(argv[1],
"-help")) {
239 std::string filename(argv[1]);
240 constructor(filename);
243 readStatArguments(argc, argv);
246 template <StatType T>
251 is.open(filename, std::fstream::in);
252 if (!is.is_open()||is.bad()) {
253 std::cout <<
"Loading data file " << filename <<
" failed" << std::endl;
258 std::string line_string;
259 getline(is,line_string);
261 is >> dummy >> dummy;
262 is >> dummy >> dummy;
263 double xmin, xmax, ymin, ymax, zmin, zmax;
264 is >> dummy >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
265 VelocityProfile_Min =
Vec3D(xmin,ymin,zmin);
267 is >> dummy >> nx >> ny >> nz;
268 double dx = (xmax-xmin)/(nx-1);
269 double dy = (ymax-ymin)/(ny-1);
270 double dz = (zmax-zmin)/(nz-1);
271 VelocityProfile_D =
Vec3D(dx,dy,dz);
272 std::string statType;
273 is >> dummy >> statType;
274 getline(is,line_string);
275 getline(is,line_string);
287 VelocityProfile.resize(nx*ny*nz);
291 for (
int i=0; i<nx; i++)
292 for (
int j=0; j<ny; j++)
293 for (
int k=0; k<nz; k++) {
294 is >> dummy >> dummy >> dummy >> dummy >> rho >> M.
X >> M.
Y >> M.
Z;
295 getline(is,line_string);
296 VelocityProfile[n]=M/rho;
302 std::cout <<
"Loaded data file " << filename << std::endl;
306 template <StatType T>
311 l = modf ((
double)(Position.
X-VelocityProfile_Min.X)/VelocityProfile_D.X, &i);
312 m = modf ((
double)(Position.
Y-VelocityProfile_Min.Y)/VelocityProfile_D.Y, &j);
313 n = modf ((
double)(Position.
Z-VelocityProfile_Min.Z)/VelocityProfile_D.Z, &k);
317 int ix = (i*ny+j)*nz+k;
319 if (nx<=1) V.
X = VelocityProfile[ix].X;
320 else V.
X=VelocityProfile[ix].X*(1-l)+VelocityProfile[ix+ny*nz].
X*l;
321 if (ny<=1) V.
Y = VelocityProfile[ix].Y;
322 else V.
Y=VelocityProfile[ix].Y*(1-m)+VelocityProfile[ix+nz].
Y*m;
323 if (nz<=1) V.
Z = VelocityProfile[ix].Z;
324 else V.
Z=VelocityProfile[ix].Z*(1-n)+VelocityProfile[ix+1].
Z*n;
330 template <StatType T>
334 for (
unsigned int i = 2; i<argc; i+=2) {
335 std::cout <<
"interpreting input argument " << argv[i];
336 if (i+1<argc) std::cout <<
" " << argv[i+1];
337 std::cout << std::endl;
339 if (!strcmp(argv[i],
"-CGtype")) {
341 if (!strcmp(argv[i+1],
"HeavisideSphere")) {
343 }
else if (!strcmp(argv[i+1],
"Gaussian")) {
346 set_CG_type(argv[i+1]);
348 }
else if (!strcmp(argv[i],
"-w")) {
349 double old = get_w();
350 set_w (atof(argv[i+1]));
351 std::cout <<
" w changed from " << old <<
" to " << get_w() << std::endl;
352 }
else if (!strcmp(argv[i],
"-help")) {
355 }
else if (!strcmp(argv[i],
"-velocityprofile")) {
356 loadVelocityProfile(argv[i+1]);
357 }
else if (!strcmp(argv[i],
"-h")) {
358 set_h (atof(argv[i+1]));
359 }
else if (!strcmp(argv[i],
"-hx")) {
360 set_hx(atof(argv[i+1]));
361 }
else if (!strcmp(argv[i],
"-hy")) {
362 set_hy(atof(argv[i+1]));
363 }
else if (!strcmp(argv[i],
"-hz")) {
364 set_hz(atof(argv[i+1]));
365 }
else if (!strcmp(argv[i],
"-n")) {
366 set_n(atoi(argv[i+1]));
367 }
else if (!strcmp(argv[i],
"-nx")) {
368 set_nx(atoi(argv[i+1]));
369 }
else if (!strcmp(argv[i],
"-ny")) {
370 set_ny(atoi(argv[i+1]));
371 }
else if (!strcmp(argv[i],
"-nz")) {
372 set_nz(atoi(argv[i+1]));
373 }
else if (!strcmp(argv[i],
"-x")) {
374 set_xminStat(atof(argv[i+1]));
375 set_xmaxStat(atof(argv[i+2]));
377 }
else if (!strcmp(argv[i],
"-y")) {
378 set_yminStat(atof(argv[i+1]));
379 set_ymaxStat(atof(argv[i+2]));
381 }
else if (!strcmp(argv[i],
"-z")) {
382 set_zminStat(atof(argv[i+1]));
383 set_zmaxStat(atof(argv[i+2]));
385 }
else if (!strcmp(argv[i],
"-indSpecies")) {
386 indSpecies = atoi(argv[i+1]);
387 }
else if (!strcmp(argv[i],
"-rmin")) {
388 rmin = atof(argv[i+1]);
389 }
else if (!strcmp(argv[i],
"-rmax")) {
390 rmax = atof(argv[i+1]);
391 }
else if (!strcmp(argv[i],
"-hmax")) {
392 hmax = atof(argv[i+1]);
393 }
else if (!strcmp(argv[i],
"-periodicwalls")) {
394 set_periodicWalls(atoi(argv[i+1]));
395 }
else if (!strcmp(argv[i],
"-walls")) {
396 set_walls(atoi(argv[i+1]));
397 }
else if (!strcmp(argv[i],
"-verbosity")) {
398 set_verbosity(atoi(argv[i+1]));
399 }
else if (!strcmp(argv[i],
"-verbose")) {
402 }
else if (!strcmp(argv[i],
"-format")) {
403 format = atoi(argv[i+1]);
404 }
else if (!strcmp(argv[i],
"-doublePoints")) {
405 if (argc<=i+1||argv[i+1][0]==
'-') {
406 set_doublePoints(
true);
408 }
else set_doublePoints(atoi(argv[i+1]));
409 std::cout <<
"set doublePoints=" << get_doublePoints() << std::endl;
410 }
else if (!strcmp(argv[i],
"-w_over_rmax")) {
411 set_w_over_rmax(atof(argv[i+1]));
412 }
else if (!strcmp(argv[i],
"-tmin")) {
413 set_tminStat(atof(argv[i+1]));
414 }
else if (!strcmp(argv[i],
"-tmax")) {
415 set_tmaxStat(atof(argv[i+1]));
416 }
else if (!strcmp(argv[i],
"-tint")) {
417 set_tintStat(atof(argv[i+1]));
420 }
else if (!strcmp(argv[i],
"-stepsize")) {
421 int step_size = atoi(argv[i+1]);
422 set_step_size(step_size);
423 }
else if (!strcmp(argv[i],
"-loaddatafile")) {
424 load_from_data_file(argv[i+1]);
425 set_tminStat(get_t());
426 set_tmaxStat(get_tmax());
427 }
else if (!strcmp(argv[i],
"-statfilename") | !strcmp(argv[i],
"-o")) {
428 stat_filename.str(argv[i+1]);
431 }
else if (!strcmp(argv[i],
"-timeaverage")) {
432 set_doTimeAverage(atoi(argv[i+1]));
433 }
else if (!strcmp(argv[i],
"-timeaveragereset")) {
434 nTimeAverageReset = atoi(argv[i+1]);
435 }
else if (!strcmp(argv[i],
"-gradient")) {
437 if (argc<=i+1||argv[i+1][0]==
'-') {
438 set_doGradient(
true);
440 }
else set_doGradient(atoi(argv[i+1]));
441 }
else if (!strcmp(argv[i],
"-timevariance")) {
443 if (argc<=i+1||argv[i+1][0]==
'-') {
444 set_doVariance(
true);
446 }
else set_doVariance(atoi(argv[i+1]));
447 }
else if (!strcmp(argv[i],
"-superexact")) {
449 if (argc<=i+1||argv[i+1][0]==
'-') {
450 set_superexact(
true);
452 }
else set_superexact(atoi(argv[i+1]));
453 }
else if (!strcmp(argv[i],
"-ignoreFixedParticles")) {
455 if (argc<=i+1||argv[i+1][0]==
'-') {
456 set_ignoreFixedParticles(
true);
458 }
else set_ignoreFixedParticles(atoi(argv[i+1]));
459 }
else if (!strcmp(argv[i],
"-StressTypeForFixedParticles")) {
460 StressTypeForFixedParticles = atoi(argv[i+1]);
461 }
else if (!strcmp(argv[i],
"-mirrorAtDomainBoundary")) {
462 set_mirrorAtDomainBoundary(atof(argv[i+1]));
463 }
else if (!strcmp(argv[i],
"-stattype")) {
465 }
else if (readNextArgument(i, argc, argv)) {
468 std::cerr <<
"Error: option unknown: " << argv[i] << std::endl;
475 template <StatType T>
478 std::cout <<
"fstatistics.exe filename [-options]: " << std::endl
479 <<
"This program evaluates statistical data from .fstat, .data, and. restart files and writes it into a .stat file" << std::endl << std::endl;
480 std::cout <<
"OPTIONS:" << std::endl << std::endl;
481 std::cout <<
"-stattype [X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,AZ,RZ,R,A]: " << std::endl
482 <<
"Used to obtain statistics averaged in all coordinate directions but the ones specified; f.e. -stattype Z yields depth-profiles. Default is XYZ." << std::endl << std::endl
483 <<
"-CGtype [HeavisideSphere,Gaussian]: " << std::endl
484 <<
"Averaging function; default: Gaussian" << std::endl << std::endl
485 <<
"-w,-w_over_rmax [Mdouble]: " << std::endl
486 <<
"Averaging width, absolute or in multiples of the radius of the largest particle in the restart file; default: w_over_rmax=1" << std::endl << std::endl
487 <<
"-n,nx,ny,nz [uint]: " << std::endl
488 <<
"Specifies the amount of grid points in coordinate directions for which statistics are evaluated; use -n to set all 3 directions at once; is set to one in averaged directions (see stattype). Default n=1" << std::endl << std::endl
489 <<
"-h,hx,hy,hz [Mdouble]: " << std::endl
490 <<
"Defines the amount of grid points by setting the mesh size " << std::endl << std::endl
491 <<
"-x,y,z [Mdouble Mdouble]: " << std::endl
492 <<
"Specifies the domain of the grid; f.e. for -x 0 1 all grid points will have x-values within [0,1]. Default -x xmin xmax (from restart file)" << std::endl << std::endl
493 <<
"-indSpecies [int]: " << std::endl
494 <<
"-rmin,rmax [Mdouble]: " << std::endl
495 <<
"-hmax [Mdouble]: " << std::endl
496 <<
"Allows to only obtain statistics for specific particles" << std::endl << std::endl
497 <<
"-periodicwalls [bool]: " << std::endl
498 <<
"neglects periodic walls" << std::endl << std::endl
499 <<
"-walls [uint]: " << std::endl
500 <<
"only takes into account the first n walls" << std::endl << std::endl
501 <<
"-verbosity [uint]: " << std::endl
502 <<
"amount of screen output (0 minimal, 1 normal, 2 maximal)" << std::endl << std::endl
503 <<
"-verbose: " << std::endl
504 <<
"identical to -verbosity 2" << std::endl << std::endl
505 <<
"-format [uint]: " << std::endl
506 <<
"???" << std::endl << std::endl
507 <<
"-tmin,tmax,tint [Mdouble]: " << std::endl
508 <<
"redefines the time interval [tmin,tmax] for which statistics are evaluated. Default values from restart file; tint sets tmin to tmax-tint." << std::endl << std::endl
509 <<
"-stepsize [uint]: " << std::endl
510 <<
"to skip some timesteps. Default: 1 " << std::endl << std::endl
511 <<
"-statfilename [std::string]: " << std::endl
512 <<
"to change the name of the output file" << std::endl << std::endl
513 <<
"-timeaverage [bool]: " << std::endl
514 <<
"To average in time (1) or to print statistics for all time steps (0). Default: 1" << std::endl << std::endl
515 <<
"-timevariance [bool]: " << std::endl
516 <<
"to print the time variance; only for time averaged data. Default: ?" << std::endl << std::endl
517 <<
"-gradient: " << std::endl
518 <<
"to plot the first derivative of each statistical value" << std::endl << std::endl
519 <<
"-ignoreFixedParticles: " << std::endl
520 <<
"-StressTypeForFixedParticles: " << std::endl
521 <<
"-mirrorAtDomainBoundary [Mdouble]" << std::endl << std::endl
522 <<
"" << std::endl << std::endl
523 <<
"OUTPUT:" << std::endl << std::endl
524 <<
"1-3: Coordinates " << std::endl
525 <<
"4: Nu " << std::endl
526 <<
"5: Density " << std::endl
527 <<
"6-8: Momentum " << std::endl
528 <<
"9-11: DisplacementMomentum " << std::endl
529 <<
"12-17: Displacement" << std::endl
530 <<
"18-23: MomentumFlux" << std::endl
531 <<
"24-29: DisplacementMomentumFlux" << std::endl
532 <<
"30-32: EnergyFlux " << std::endl
533 <<
"33-41: NormalStress " << std::endl
534 <<
"42-50: TangentialStress " << std::endl
535 <<
"51-53: NormalTraction " << std::endl
536 <<
"54-56: TangentialTraction " << std::endl
537 <<
"57-62: Fabric " << std::endl
538 <<
"63-65: CollisionalHeatFlux " << std::endl
539 <<
"66: Dissipation " << std::endl
540 <<
"67: Potential " << std::endl
541 <<
"68-70: LocalAngularMomentum " << std::endl
542 <<
"71-79: LocalAngularMomentumFlux " << std::endl
543 <<
"80-88: ContactCoupleStress " << std::endl;
547 template <StatType T>
549 if (!strcmp(new_,
"Heaviside")) {
552 double heavisidecoeff[] = {1};
553 set_Polynomial(heavisidecoeff, numcoeff, dim);
554 }
else if (!strcmp(new_,
"Linear")) {
557 double lincoeff[] = {-1,1};
558 set_Polynomial(lincoeff, numcoeff, dim);
559 }
else if (!strcmp(new_,
"Lucy")) {
562 double lucycoeff[] = {-3,8,-6,0,1};
563 set_Polynomial(lucycoeff, numcoeff, dim);
564 }
else if (!strcmp(new_,
"Gaussian")) {
566 }
else if (!strcmp(new_,
"HeavisideSphere")) {
569 std::cerr <<
"Error: unknown CG_type: " << new_ << std::endl;
572 set_PolynomialName(new_);
576 template <StatType T>
578 if (new_==
Polynomial&&CGPolynomial.get_Order()<0) {std::cerr <<
"Polynomial is not specified" << std::endl; exit(-1);}
583 template <StatType T>
585 std::stringstream ss;
586 ss <<
"Statistical parameters: name=" << get_name()
592 ss <<
"HeavisideSphere";
593 }
else if (get_CG_type()==
Gaussian) {
596 ss << get_PolynomialName();
597 }
else { std::cerr <<
"error in CG_function" << std::endl; exit(-1); }
599 ss <<
", w=" << sqrt(w2)
600 <<
", cutoff=" << cutoff
601 <<
",\n tStat=[" << get_tminStat() <<
"," << get_tmaxStat() <<
"]"
602 <<
", xStat=[" << get_xminStat() <<
"," << get_xmaxStat() <<
"]"
603 <<
", yStat=[" << get_yminStat() <<
"," << get_ymaxStat() <<
"]"
604 <<
", zStat=[" << get_zminStat() <<
"," << get_zmaxStat() <<
"]"
605 <<
",\n ignoreFixedParticles=" << ignoreFixedParticles
606 <<
", StressTypeForFixedParticles=" << StressTypeForFixedParticles
607 <<
",\n mirrorAtDomainBoundary=" << get_mirrorAtDomainBoundary()
608 <<
",\n doTimeAverage=" << get_doTimeAverage()
609 <<
", doVariance=" << get_doVariance()
610 <<
", doGradient=" << get_doGradient()
611 <<
", verbosity=" << verbosity
618 template <StatType T>
620 std::stringstream ss;
621 ss <<
"w " << sqrt(get_w2())
622 <<
" dim " << get_dim()
623 <<
" domainStat " << get_xminStat() <<
" " << get_xmaxStat()
624 <<
" " << get_yminStat() <<
" " << get_ymaxStat()
625 <<
" " << get_zminStat() <<
" " << get_zmaxStat()
626 <<
" n " << nx <<
" " << ny <<
" " << nz
627 <<
" statType " << statType;
628 if (CG_type==
Polynomial) ss <<
" CGPolynomial " << CGPolynomial;
629 else ss <<
" CG_type " << CG_type <<
" cutoff " << cutoff;
630 if (doVariance) ss <<
" doVariance";
631 if (doGradient) ss <<
" doGradient";
633 ss <<
" doTimeAverage";
634 if (nTimeAverageReset!=-1) ss <<
" nTimeAverageReset " << nTimeAverageReset;
636 if (indSpecies!=-1) ss <<
" indSpecies " << indSpecies;
637 if (rmin!=0) ss <<
" rmin " << rmin;
638 if (rmax!=1e20) ss <<
" rmax " << rmax;
639 if (hmax!=1e20) ss <<
" hmax " << hmax;
640 if (!walls) ss <<
" noWalls";
641 if (!periodicWalls) ss <<
" noPeriodicWalls";
642 if (!ignoreFixedParticles) ss <<
" includeFixedParticles";
643 if (StressTypeForFixedParticles!=1) ss <<
" StressTypeForFixedParticles " << StressTypeForFixedParticles;
648 template <StatType T>
652 for (
unsigned int i=0; i<P.size(); i++) avg += P[i];
657 template <StatType T>
667 if (get_tintStat()) {
668 set_tminStat(get_t());
669 set_tmaxStat(get_tminStat() + get_tintStat());
670 std::cout <<
"tint set, time goes from: " << get_tminStat() <<
" to: " << get_tmaxStat() << std::endl;
674 if (!strcmp(get_stat_filename().c_str(),
"")) set_stat_filename();
675 if(!open_stat_file(std::fstream::out)) {std::cerr <<
"Problem opening stat file aborting" <<std::endl; exit(-1);};
677 get_stat_file() << Points.begin()->write_variable_names() << std::endl;
678 get_stat_file() << print_CG() << std::endl;
681 if (verbosity>1) std::cout << std::endl;
682 if (verbosity>0) std::cout << std::endl << print() << std::endl;
686 template <StatType T>
688 static unsigned int count = 0;
690 if (count)
for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
691 (*it)->set_PreviousPosition((*it)->get_Position());
696 if (!count)
for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
697 (*it)->set_PreviousPosition((*it)->get_Position());
704 template <StatType T>
707 std::cout <<
"writing statistics for t=" << get_t() << std::endl;
710 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
711 for (
unsigned int i=0; i<Points.size(); i++)
712 get_stat_file() << Points[i];
713 if (get_doGradient())
715 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
716 for (
unsigned int i=0; i<dx.size(); i++)
717 get_stat_file() << dx[i];
718 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
719 for (
unsigned int i=0; i<dy.size(); i++)
720 get_stat_file() << dy[i];
721 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_t() << std::endl;
722 for (
unsigned int i=0; i<dz.size(); i++)
723 get_stat_file() << dz[i];
728 template <StatType T>
731 if (get_doTimeAverage()) write_time_average_statistics();
735 template <StatType T>
738 if (check_current_time_for_statistics()&&usethese)
740 if (get_mirrorAtDomainBoundary()) {
741 for (
unsigned int i=0; i<Points.size(); i++) {
742 if (Points[i].mirrorParticle>=0) {
744 Points[Points[i].mirrorParticle]+=Points[i];
745 Points[i].set_zero();
746 if (get_doGradient()) {
747 dx[Points[i].mirrorParticle]+=dx[i];
748 dy[Points[i].mirrorParticle]+=dy[i];
749 dz[Points[i].mirrorParticle]+=dz[i];
756 if (get_doTimeAverage())
758 for (
unsigned int i=0; i<timeAverage.size(); i++)
760 timeAverage[i] += Points[i];
761 if (get_doVariance())
762 timeVariance[i] += Points[i].getSquared();
763 if (get_doGradient())
765 dxTimeAverage[i] += dx[i];
766 dyTimeAverage[i] += dy[i];
767 dzTimeAverage[i] += dz[i];
771 if (nTimeAverage==nTimeAverageReset) {
772 std::cout <<
"write time average" << std::endl;
773 write_time_average_statistics();
775 for (
unsigned int i=0; i<timeAverage.size(); i++)
776 timeAverage[i].set_zero();
787 template <StatType T>
790 static bool first =
true;
792 if (verbosity) std::cout << std::endl <<
"averaging " << nTimeAverage <<
" timesteps " << std::endl;
795 fprintf(stderr,
"\n\n\tERROR :: Can not do TimeAverage of 0 timesteps\n\n");
800 std::cout <<
"first" << nTimeAverage << std::endl;
801 for (
unsigned int i=0; i<timeAverage.size(); i++) {
802 timeAverage[i].firstTimeAverage(nTimeAverage);
803 if (get_doVariance()) {
804 timeVariance[i].firstTimeAverage(nTimeAverage);
805 timeVariance[i] -= timeAverage[i].getSquared();
807 if (get_doGradient()) {
808 dxTimeAverage[i].firstTimeAverage(nTimeAverage);
809 dyTimeAverage[i].firstTimeAverage(nTimeAverage);
810 dzTimeAverage[i].firstTimeAverage(nTimeAverage);
815 std::cout <<
"next" << nTimeAverage << std::endl;
816 for (
unsigned int i=0; i<timeAverage.size(); i++) {
817 timeAverage[i] /= nTimeAverage;
818 if (get_doVariance()) {
819 timeVariance[i] /= nTimeAverage;
820 timeVariance[i] -= timeAverage[i].getSquared();
822 if (get_doGradient()) {
823 dxTimeAverage[i] /= nTimeAverage;
824 dyTimeAverage[i] /= nTimeAverage;
825 dzTimeAverage[i] /= nTimeAverage;
831 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() <<
" " << get_t() << std::endl;
832 for (
unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << timeAverage[i];
835 std::cout <<
"Averages: " << avg.
print() << std::endl;
837 if (get_doVariance()) {
839 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() <<
" " << get_t() <<
" " << std::endl;
840 for (
unsigned int i=0; i<timeVariance.size(); i++)
841 get_stat_file() << timeVariance[i];
845 if (get_doGradient()) {
847 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() <<
" " << get_t() <<
" " << std::endl;
848 for (
unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dxTimeAverage[i];
849 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() <<
" " << get_t() <<
" " << std::endl;
850 for (
unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dyTimeAverage[i];
851 get_stat_file() << std::left << std::setprecision(8) << std::setw(6) << get_tminStat() <<
" " << get_t() <<
" " << std::endl;
852 for (
unsigned int i=0; i<timeAverage.size(); i++) get_stat_file() << dzTimeAverage[i];
855 set_tminStat(get_t());
859 template <StatType T>
864 open_data_file(std::fstream::in);
869 for (
int i=1; i<10000; i++) {
870 if(read_next_from_data_file(format))
break;
875 if (get_t()>=get_tminStat()) set_tminStat(get_t()-get_dt());
878 set_fstat_filename();
879 open_fstat_file(std::fstream::in);
885 std::cout <<
"Input from " << get_data_filename() << std::endl;
886 std::cout <<
"Input from " << get_fstat_filename() << std::endl;
887 std::cout <<
"Output to " << get_stat_filename() << std::endl << std::endl;
890 initialize_statistics();
893 Mdouble mass = get_Mass_from_Radius(getLargestParticle()->get_Radius());
894 if (verbosity>1) std::cout <<
"Collision Time " << get_collision_time(mass)
895 <<
" and restitution coefficient " << get_restitution_coefficient(mass)
896 <<
" for mass " << mass << std::endl
899 if (verbosity>2) {
MD::print(std::cout,
true); std::cout << std::endl;}
900 else if (verbosity) {
MD::print(std::cout); std::cout << std::endl;}
903 if (get_options_data()==2 && get_t()<get_tminStat()) {
904 if (verbosity>1) find_next_data_file(get_tminStat());
905 else find_next_data_file(get_tminStat(),
false);
906 for(
int i=1;i<get_file_counter();i++) jump_fstat();
911 std::cout<<
"Start statistics"<<std::endl;
913 if (get_t()>get_tmaxStat()) {
914 std::cout <<
"reached end t="<<std::setprecision (9) <<get_t()<<
" tmaxStat=" << std::setprecision (9) <<get_tmaxStat()<< std::endl;
break;
915 }
else if (get_t()>=get_tminStat()) {
916 if (verbosity>1) std::cout <<
"Get statistics for t=" << std::setprecision (9) << get_t() << std::endl;
917 else if (verbosity) std::cout <<
"Get statistics for t=" << std::setprecision (9) << get_t() <<
" \r";
918 if (verbosity>1) std::cout <<
"#particles="<< getParticleHandler().getNumberOfObjects() << std::endl;
920 if (!walls) getWallHandler().clear();
922 if (!periodicWalls) getBoundaryHandler().clear();
925 gather_force_statistics_from_fstat_and_data();
926 process_statistics(
true);
929 if (verbosity>1) std::cout<<
"Jumping statistics t="<<get_t()<<
" tminStat()="<<get_tminStat()<<std::endl;
933 if (get_options_data()!=2)
for (
unsigned int i=1; i<get_step_size(); i++) {
935 read_next_from_data_file(format);
938 }
while (read_next_from_data_file(format));
940 if (get_t()<get_tmaxStat()) set_tmaxStat(get_t());
943 get_data_file().close();
944 get_fstat_file().close();
947 template <StatType T>
949 if (getParticleHandler().getNumberOfObjects()<1)
return;
950 std::vector<BaseParticle*>::iterator it = getParticleHandler().begin();
951 set_xmin((*it)->get_Position().X-(*it)->get_Radius());
952 set_ymin((*it)->get_Position().Y-(*it)->get_Radius());
953 set_zmin((*it)->get_Position().Z-(*it)->get_Radius());
954 set_xmax((*it)->get_Position().X+(*it)->get_Radius());
955 set_ymax((*it)->get_Position().Y+(*it)->get_Radius());
956 set_zmax((*it)->get_Position().Z+(*it)->get_Radius());
957 for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
958 set_xmin(std::min(get_xmin(),(*it)->get_Position().X-(*it)->get_Radius()));
959 set_ymin(std::min(get_ymin(),(*it)->get_Position().Y-(*it)->get_Radius()));
960 set_zmin(std::min(get_zmin(),(*it)->get_Position().Z-(*it)->get_Radius()));
961 set_xmax(std::max(get_xmax(),(*it)->get_Position().X+(*it)->get_Radius()));
962 set_ymax(std::max(get_ymax(),(*it)->get_Position().Y+(*it)->get_Radius()));
963 set_zmax(std::max(get_zmax(),(*it)->get_Position().Z+(*it)->get_Radius()));
967 template <StatType T>
975 std::string dummyStr;
980 getline(p3p_file,dummyStr);
981 std::cout << dummyStr << std::endl;
983 p3p_file >> dummy; set_t(dummy);
985 std::cout <<
"t= " << get_t() <<
": loading " << N <<
" particles ..." << std::endl;
986 getline(p3p_file,dummyStr);
989 getline(p3p_file,dummyStr);
990 std::cout << dummyStr << std::endl;
991 if (p3p_file.eof()||p3p_file.peek()==-1) {std::cout <<
"reached end of p3p file" << std::endl;
return false;}
994 if(getParticleHandler().getNumberOfObjects()<N)
995 while(getParticleHandler().getNumberOfObjects()<N)
996 getParticleHandler().copyAndAddParticle(P0);
998 while(getParticleHandler().getNumberOfObjects()>N)
999 getParticleHandler().removeLastParticle();
1003 Vec3D position,velocity,angle,angularVelocity;
1005 for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
1006 p3p_file >> dummyInt; (*it)->set_Index(dummyInt);
1008 p3p_file >> dummyInt; (*it)->set_species(dummyInt-1);
1009 p3p_file >> dummy; (*it)->set_Radius(pow(dummy/(4./3.*
constants::pi),1./3.));
1010 p3p_file >> dummy; (*it)->set_Mass(dummy);
1015 (*it)->set_Position(position);
1016 (*it)->set_Velocity(velocity);
1017 (*it)->set_AngularVelocity(angularVelocity);
1022 getline(p3p_file,dummyStr);
1023 std::cout << dummyStr << std::endl;
1032 template <StatType T>
1036 std::string p3p_filename = problem_name.str().c_str(); p3p_filename +=
".p3p";
1037 bool opened = open_file (p3p_file, p3p_filename, 1,std::fstream::in);
1038 std::string p3c_filename = problem_name.str().c_str(); p3c_filename +=
".p3c";
1039 open_file (p3c_file, p3c_filename, 1,std::fstream::in);
1040 std::string p3w_filename = problem_name.str().c_str(); p3w_filename +=
".p3w";
1041 open_file (p3w_file, p3w_filename, 1,std::fstream::in);
1045 std::cerr <<
"Warning could not open " << p3p_filename << std::endl;
1047 p3p_filename = problem_name.str().c_str(); p3p_filename +=
".p4p";
1048 opened = open_file (p3p_file, p3p_filename, 1,std::fstream::in);
1049 p3c_filename = problem_name.str().c_str(); p3c_filename +=
".p4c";
1050 opened = open_file (p3c_file, p3c_filename, 1,std::fstream::in);
1051 p3w_filename = problem_name.str().c_str(); p3w_filename +=
".p4w";
1052 opened = open_file (p3w_file, p3w_filename, 1,std::fstream::in);
1054 std::cerr <<
"could not open " << p3p_filename << std::endl;
1058 std::cout <<
"opened " << p3p_filename << std::endl;
1063 read_next_from_p3p_file();
1066 if (get_t()>=get_tminStat()) set_tminStat(get_t()-get_dt());
1069 set_data_filename();
1070 open_data_file(std::fstream::out);
1073 Species[0].set_dim_particle(3);
1081 initialize_statistics();
1084 Mdouble mass = get_Mass_from_Radius(getLargestParticle()->get_Radius());
1085 if (verbosity>1) std::cout <<
"Collision Time " << get_collision_time(mass)
1086 <<
" and restitution coefficient " << get_restitution_coefficient(mass)
1087 <<
" for mass " << mass << std::endl
1090 if (verbosity>2) {
MD::print(std::cout,
true); std::cout << std::endl;}
1091 else if (verbosity) {
MD::print(std::cout); std::cout << std::endl;}
1094 std::cout<<
"Start statistics"<<std::endl;
1096 if (get_t()>get_tmaxStat()) {
1097 std::cout <<
"reached end t="<<std::setprecision (9) <<get_t() <<
" tmaxStat=" << std::setprecision (9) <<get_tmaxStat()<< std::endl;
1099 }
else if (get_t()>=get_tminStat()) {
1100 if (verbosity>1) std::cout <<
"Get statistics for t=" << std::setprecision (9) << get_t() << std::endl;
1101 else if (verbosity) std::cout <<
"Get statistics for t=" << std::setprecision (9) << get_t() <<
" \r";
1102 if (verbosity>1) std::cout <<
"#particles="<< getParticleHandler().getNumberOfObjects() << std::endl;
1104 if (!walls) getWallHandler().clear();
1106 if (!periodicWalls) getBoundaryHandler().clear();
1108 output_statistics();
1109 gather_force_statistics_from_p3c(version);
1110 process_statistics(
true);
1113 if (verbosity>1) std::cout
1114 <<
"Jumping statistics t=" << get_t()
1115 <<
" tminStat()=" << get_tminStat() << std::endl;
1119 for (
unsigned int i=1; i<get_step_size(); i++) {
1121 read_next_from_p3p_file();
1124 }
while (read_next_from_p3p_file());
1126 if (get_t()<get_tmaxStat()) set_tmaxStat(get_t());
1128 finish_statistics();
1135 template <StatType T>
1138 std::string dummyStr;
1142 getline(p3c_file, dummyStr);
1143 std::cout << dummyStr << std::endl;
1145 p3c_file >> dummy; set_t(dummy);
1147 std::cout <<
"ignoring t= " << get_t() <<
": loading " << N <<
" contacts ..." << std::endl;
1148 getline(p3c_file,dummyStr);
1150 getline(p3c_file,dummyStr);
1151 std::cout << dummyStr << std::endl;
1153 for (
int i=0; i<N; i++) getline(p3c_file,dummyStr);
1156 getline(p3w_file, dummyStr);
1157 std::cout << dummyStr << std::endl;
1159 p3w_file >> dummy; set_t(dummy);
1161 std::cout <<
"ignoring t= " << get_t() <<
": loading " << N <<
" wall contacts ..." << std::endl;
1162 getline(p3w_file,dummyStr);
1164 getline(p3w_file,dummyStr);
1166 for (
int i=0; i<N; i++) getline(p3w_file,dummyStr);
1171 template <StatType T>
1174 std::string dummyStr;
1178 getline(p3c_file, dummyStr);
1179 std::cout << dummyStr << std::endl;
1181 p3c_file >> dummy; set_t(dummy);
1183 std::cout <<
"t= " << get_t() <<
": loading " << N <<
" contacts ..." << std::endl;
1184 getline(p3c_file,dummyStr);
1186 getline(p3c_file,dummyStr);
1187 std::cout << dummyStr << std::endl;
1193 for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it)
1194 Nmax = std::max(Nmax,(*it)->get_Index());
1195 static std::vector<int> index;
1198 for (std::vector<BaseParticle*>::iterator it = getParticleHandler().begin(); it!=getParticleHandler().end(); ++it) {
1199 index[(*it)->get_Index()]=i;
1215 int index1_p3, index2_p3;
1217 Vec3D Contact, Force;
1219 Vec3D P1_P2_normal, P1_P2_tangential;
1227 for (
int i=0; i<N; i++) {
1241 index1=index[index1_p3];
1242 index2=index[index2_p3];
1243 P1 = getParticleHandler().getObject(index1);
1244 P2 = getParticleHandler().getObject(index2);
1246 dist = GetLength(P1_P2_normal);
1247 P1_P2_normal /= dist;
1252 fdotn = -Dot(Force,P1_P2_normal)/GetLength2(P1_P2_normal);
1253 P1_P2_tangential = Force + fdotn * P1_P2_normal;
1254 fdott = GetLength(P1_P2_tangential);
1256 P1_P2_tangential =
Vec3D(0,0,0);
1258 P1_P2_tangential /= fdott;
1261 gather_statistics_collision(index1,index2,Contact,delta,0,fdotn,fdott, P1_P2_normal,-P1_P2_tangential);
1262 gather_statistics_collision(index2,index1,Contact,delta,0,fdotn,fdott, -P1_P2_normal, P1_P2_tangential);
1266 if (verbosity>1) std::cout <<
"#forces="<< counter << std::endl;
1268 getline(p3c_file,dummyStr);
1269 std::cout << dummyStr << std::endl;
1271 gather_force_statistics_from_p3w(version,index);
1275 template <StatType T>
1278 std::string dummyStr;
1282 getline(p3w_file, dummyStr);
1283 std::cout << dummyStr << std::endl;
1285 p3w_file >> dummy; set_t(dummy);
1287 std::cout <<
"t= " << get_t() <<
": loading " << N <<
" wall contacts ..." << std::endl;
1288 getline(p3w_file,dummyStr);
1290 getline(p3w_file,dummyStr);
1291 std::cout << dummyStr << std::endl;
1307 Vec3D Contact, Force, Branch;
1309 Vec3D P1_P2_normal, P1_P2_tangential;
1316 for (
int i=0; i<N; i++) {
1329 index1=index[index1_p3];
1331 P1 = getParticleHandler().getObject(index1);
1338 dist = GetLength(Branch);
1339 P1_P2_normal = Branch / dist;
1341 fdotn = -Dot(Force,P1_P2_normal)/GetLength2(P1_P2_normal);
1342 P1_P2_tangential = Force + fdotn * P1_P2_normal;
1343 fdott = GetLength(P1_P2_tangential);
1345 P1_P2_tangential =
Vec3D(0,0,0);
1347 P1_P2_tangential /= fdott;
1350 gather_statistics_collision(index1,index2,Contact,delta,0,fdotn,fdott, P1_P2_normal, -P1_P2_tangential);
1353 if (verbosity>1) std::cout <<
"#wall forces="<< counter << std::endl;
1355 getline(p3w_file,dummyStr);
1356 std::cout << dummyStr << std::endl;
1364 template <StatType T>
1369 (get_xmaxStat()-get_xminStat())/nx,
1370 (get_ymaxStat()-get_yminStat())/ny,
1371 (get_zmaxStat()-get_zminStat())/nz);
1374 get_xmaxStat()+get_xminStat(),
1375 get_ymaxStat()+get_yminStat(),
1376 get_zmaxStat()+get_zminStat());
1384 if (get_mirrorAtDomainBoundary()) {
1385 if (statType==
X||statType==
XY||statType==
XZ||statType==
XYZ) {
1388 num[0] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.
X);
1390 Min.
X-=num[0]*diff.
X;
1392 if (statType==
Y||statType==
XY||statType==
YZ||statType==
XYZ) {
1393 num[1] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.
Y);
1395 Min.
Y-=num[1]*diff.
Y;
1397 if (statType==
Z||statType==
XZ||statType==
XZ||statType==
XYZ) {
1398 num[2] = floor(std::max(get_mirrorAtDomainBoundary(),get_cutoff())/diff.
Z);
1400 Min.
Z-=num[2]*diff.
Z;
1405 int N =std::max(nx,1)*std::max(ny,1)*std::max(nz,1);
1408 for (
int i=0; i<std::max(nx,1); i++)
1409 for (
int j=0; j<std::max(ny,1); j++)
1410 for (
int k=0; k<std::max(nz,1); k++) {
1411 Points[n].set_Position(
Vec3D( (nx>1)?(Min.
X+diff.
X*(i+0.5)):avg.
X,
1412 (ny>1)?(Min.
Y+diff.
Y*(j+0.5)):avg.
Y,
1413 (nz>1)?(Min.
Z+diff.
Z*(k+0.5)):avg.
Z ));
1414 if (doublePoints) Points[n].set_Position( Points[n].get_Position()
1415 -
Vec3D((i%2)?(0.99*diff.
X):0,(j%2)?(0.99*diff.
Y):0,(k%2)?(0.99*diff.
Z):0) );
1416 Points[n].set_CG_invvolume();
1417 Points[n].set_zero();
1418 if (get_mirrorAtDomainBoundary())
1419 if ((i<num[0])||(i>nx-num[0])||(j<num[1])||(j>ny-num[1])||(k<num[2])||(k>nz-num[2])) {
1420 Points[n].mirrorParticle = n +
1421 + ((i<num[0])?(2*(num[0]-i)-1)*ny*nz:0)+((i>nx-num[0])?(2*(nx-num[0]-i)+1)*ny*nz:0)
1422 + ((j<num[1])?(2*(num[1]-j)-1)*nz:0 )+((j>ny-num[1])?(2*(ny-num[1]-j)+1)*nz:0)
1423 + ((k<num[2])?(2*(num[2]-k)-1):0 )+((k>nz-num[2])?(2*(nz-num[2]-k)+1):0);
1427 if (statType==
RAZ || statType==
RZ || statType==
RA || statType==
AZ || statType==
R || statType==
A) {
1428 for (
unsigned int k=0; k<Points.size(); k++) {
1429 Points[k].set_Position(Points[k].get_Position().GetFromCylindricalCoordinates());
1432 if (get_doGradient()) {
1436 for (
int n=0; n<N; n++) {
1437 dx[n].set_Position(Points[n].get_Position());
1438 dx[n].mirrorParticle=Points[n].mirrorParticle;
1440 dy[n].set_Position(Points[n].get_Position());
1441 dy[n].mirrorParticle=Points[n].mirrorParticle;
1443 dz[n].set_Position(Points[n].get_Position());
1444 dz[n].mirrorParticle=Points[n].mirrorParticle;
1450 if (get_doTimeAverage()) {
1451 timeAverage.resize(N);
1453 for (
int i=0; i<std::max(nx,1); i++)
1454 for (
int j=0; j<std::max(ny,1); j++)
1455 for (
int k=0; k<std::max(nz,1); k++) {
1456 timeAverage[n].set_Position(Points[n].get_Position());
1457 timeAverage[n].set_zero();
1458 timeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1462 if (get_doVariance()) {
1463 timeVariance.resize(N);
1464 for (
int n=0; n<N; n++) {
1465 timeVariance[n].set_Position(timeAverage[n].get_Position());
1466 timeVariance[n].mirrorParticle=Points[n].mirrorParticle;
1467 timeVariance[n].set_zero();
1471 if (get_doGradient()) {
1472 dxTimeAverage.resize(N);
1473 dyTimeAverage.resize(N);
1474 dzTimeAverage.resize(N);
1475 for (
int n=0; n<N; n++) {
1476 dxTimeAverage[n].set_Position(timeAverage[n].get_Position());
1477 dxTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1478 dxTimeAverage[n].set_zero();
1479 dyTimeAverage[n].set_Position(timeAverage[n].get_Position());
1480 dyTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1481 dyTimeAverage[n].set_zero();
1482 dzTimeAverage[n].set_Position(timeAverage[n].get_Position());
1483 dzTimeAverage[n].mirrorParticle=Points[n].mirrorParticle;
1484 dzTimeAverage[n].set_zero();
1492 template <StatType T>
1495 if (get_options_fstat()==2) {
1496 increase_counter_fstat(std::fstream::in);
1497 if (verbosity>1) std::cout <<
"Using fstat file counter: "<<get_file_counter() << std::endl;
1501 getline (get_fstat_file(), dummy);
1502 getline (get_fstat_file(), dummy);
1503 getline (get_fstat_file(), dummy);
1505 while ( (get_fstat_file().peek() != -1) && (get_fstat_file().peek() !=
'#') )
1506 getline (get_fstat_file(), dummy);
1510 template <StatType T>
1517 template <StatType T>
1520 Vec3D P1_P2_VelocityAverage, P1_P2_VelocityDifference, P1_P2_Force;
1522 if(check_current_time_for_statistics())
1525 if (getParticleHandler().getObject(index1)->isFixed()) {
1526 int tmp = index1; index1 = index2; index2 = tmp;
1530 if (satisfiesInclusionCriteria(getParticleHandler().getObject(index1)))
1532 P1_P2_normal=P1_P2_normal_;
1534 if (get_dim()==2) Contact.
Z = 0.0;
1538 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()-delta;
1540 P1 = Contact-P1_P2_normal*P1_P2_distance;
1541 norm_dist=P1_P2_distance;
1542 P1_P2_VelocityAverage = (getParticleHandler().getObject(index1)->get_Velocity())/2;
1543 P1_P2_VelocityDifference = (getParticleHandler().getObject(index1)->get_Velocity());
1545 if (StressTypeForFixedParticles==3) {
1547 P1_P2_distance += 300;
1549 P2 += 300*P1_P2_normal;
1551 norm_dist=P1_P2_distance;
1554 else if (getParticleHandler().getObject(index2)->isFixed()||!satisfiesInclusionCriteria(getParticleHandler().getObject(index2)))
1556 if (getParticleHandler().getObject(index2)->isFixed()&&StressTypeForFixedParticles==3) {
1558 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1559 P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1560 P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance);
1561 if (P1_P2_normal.Z<0) {
1568 P1_P2_distance=setInfinitelyLongDistance();
1570 P2 = P1 - P1_P2_normal*P1_P2_distance;
1571 if (P1_P2_normal.Z<0) std::cout << P1_P2_distance <<
" z" << P1.Z <<
" " << P2.Z <<
" f" << fdotn << std::endl;
1573 }
else if (StressTypeForFixedParticles==1|| (!getParticleHandler().getObject(index2)->isFixed()&&StressTypeForFixedParticles==3)) {
1575 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1576 P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1579 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()-delta/2;
1580 P2 = P1 - P1_P2_normal*P1_P2_distance;
1583 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1584 P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1585 P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance);
1588 norm_dist=P1_P2_distance;
1590 P1_P2_VelocityAverage = getParticleHandler().getObject(index2)->get_Velocity()/2;
1591 P1_P2_VelocityDifference = -getParticleHandler().getObject(index2)->get_Velocity();
1596 if (getParticleHandler().getObject(index2)->isFixed()) std::cout <<
"ERROR" << std::endl;
1597 P1_P2_distance = getParticleHandler().getObject(index1)->get_Radius()+getParticleHandler().getObject(index2)->get_Radius()-delta;
1599 P1 = Contact+P1_P2_normal*(0.5*P1_P2_distance);
1600 P2 = Contact-P1_P2_normal*(0.5*P1_P2_distance);
1602 norm_dist=P1_P2_distance*getParticleHandler().getObject(index1)->get_Radius()/(getParticleHandler().getObject(index2)->get_Radius()+getParticleHandler().getObject(index1)->get_Radius());
1603 P1_P2_VelocityAverage = (getParticleHandler().getObject(index1)->get_Velocity()+getParticleHandler().getObject(index2)->get_Velocity())/2;
1604 P1_P2_VelocityDifference = (getParticleHandler().getObject(index1)->get_Velocity()-getParticleHandler().getObject(index2)->get_Velocity());
1609 P1_P2_Fabric =
SymmetrizedDyadic(P1_P2_normal, P1_P2_normal) * getParticleHandler().getObject(index1)->get_Volume(get_Species());
1613 P1_P2_NormalStress =
Dyadic(P1_P2_normal,P1_P2_normal) * (fdotn*norm_dist);
1614 P1_P2_TangentialStress =
Dyadic(P1_P2_tangential,P1_P2_normal) * (fdott*norm_dist);
1615 P1_P2_NormalTraction = P1_P2_normal * fdotn;
1616 P1_P2_TangentialTraction = P1_P2_tangential * fdott;
1617 P1_P2_ContactCoupleStress =
Dyadic(P1_P2_NormalTraction+P1_P2_TangentialTraction, -0.5*P1_P2_normal*norm_dist);
1618 P1_P2_Contact = Contact;
1619 P1_P2_Potential = (get_k()*
sqr(delta)+get_kt()*
sqr(ctheta))/2;
1620 P1_P2_Force = fdotn*P1_P2_normal+fdott*P1_P2_tangential;
1621 P1_P2_Dissipation = Dot(P1_P2_VelocityDifference,P1_P2_Force)/2;
1622 P1_P2_CollisionalHeatFlux = P1_P2_normal * (P1_P2_distance/2 * Dot(P1_P2_VelocityAverage,fdotn*P1_P2_normal+fdott*P1_P2_tangential)) + P1_P2_Potential * P1_P2_VelocityAverage;
1624 P1_P2_distance *= sqrt(Points[0].dot(P1_P2_normal,P1_P2_normal));
1628 if (P1_P2_distance>1e-12)
1629 P1_P2_normal = (P1-P2)/P1_P2_distance;
1631 P1_P2_normal =
Vec3D(0.0,0.0,0.0);
1635 if (index2<0 || getParticleHandler().getObject(index2)->isFixed() || !satisfiesInclusionCriteria(getParticleHandler().getObject(index2)))
1639 if (StressTypeForFixedParticles!=0) {
1640 evaluate_force_statistics();
1642 if (StressTypeForFixedParticles!=3 || !(index2<0 || getParticleHandler().getObject(index2)->isFixed())) {
1644 if (StressTypeForFixedParticles==0) {
1649 evaluate_wall_force_statistics(P);
1654 evaluate_force_statistics();
1661 template <StatType T>
1666 if (get_options_fstat()==2) increase_counter_fstat(std::fstream::in);
1667 getline (get_fstat_file(), dummy);
1668 getline (get_fstat_file(), dummy);
1669 getline (get_fstat_file(), dummy);
1673 static int index1, index2;
1674 static Vec3D Contact;
1675 static Mdouble delta, ctheta, fdotn, fdott;
1676 static Vec3D P1_P2_normal_, P1_P2_tangential;
1682 while ( (get_fstat_file().peek() != -1) && (get_fstat_file().peek() !=
'#') ) {
1707 >> P1_P2_tangential;
1709 get_fstat_file().ignore(256,
'\n');
1711 gather_statistics_collision(index1,index2,Contact,delta,ctheta,fdotn,fdott, P1_P2_normal_, P1_P2_tangential);
1714 if (verbosity>1) std::cout <<
"#forces="<< counter << std::endl;
1718 template <StatType T>
1723 for (
unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1730 evaluate_force_statistics(k+1);
1739 static unsigned int counter = 0;
1740 for (
unsigned int i=0; i<Points.size(); i++) {
1741 psi = Points[i].CG_integral(P1, P2, P1_P2_normal, P1_P2_distance, rpsi);
1744 if (!std::isfinite(psi)) {
1745 std::cerr <<
"error: psi =" << psi <<
" is infinite for P1=" << P1 <<
", P2=" << P2 <<
", t=" << get_t() << std::endl;
1748 Points[i].ContactCoupleStress += (
Cross(P1_P2_Contact*psi,P1_P2_ContactCoupleStress) -
Cross(rpsi,P1_P2_ContactCoupleStress))*(-0.5);
1749 Points[i].NormalStress += P1_P2_NormalStress * psi;
1750 Points[i].TangentialStress += P1_P2_TangentialStress * psi;
1751 Points[i].Fabric += P1_P2_Fabric * psi;
1752 Points[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * psi;
1753 Points[i].Dissipation += P1_P2_Dissipation * psi;
1754 Points[i].Potential += P1_P2_Potential * psi;
1755 if (get_doGradient()) {
1756 Vec3D d_psi = Points[i].CG_integral_gradient(P1, P2, P1_P2_normal, P1_P2_distance);
1758 dx[i].NormalStress += P1_P2_NormalStress * d_psi.
X;
1759 dx[i].TangentialStress += P1_P2_TangentialStress * d_psi.
X;
1760 dx[i].Fabric += P1_P2_Fabric * d_psi.
X;
1761 dx[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
X;
1762 dx[i].Dissipation += P1_P2_Dissipation * d_psi.
X;
1763 dx[i].Potential += P1_P2_Potential * d_psi.
X;
1765 dy[i].NormalStress += P1_P2_NormalStress * d_psi.
Y;
1766 dy[i].TangentialStress += P1_P2_TangentialStress * d_psi.
Y;
1767 dy[i].Fabric += P1_P2_Fabric * d_psi.
Y;
1768 dy[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
Y;
1769 dy[i].Dissipation += P1_P2_Dissipation * d_psi.
Y;
1770 dy[i].Potential += P1_P2_Potential * d_psi.
Y;
1772 dz[i].NormalStress += P1_P2_NormalStress * d_psi.
Z;
1773 dz[i].TangentialStress += P1_P2_TangentialStress * d_psi.
Z;
1774 dz[i].Fabric += P1_P2_Fabric * d_psi.
Z;
1775 dz[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
Z;
1776 dz[i].Dissipation += P1_P2_Dissipation * d_psi.
Z;
1777 dz[i].Potential += P1_P2_Potential * d_psi.
Z;
1786 template <StatType T>
1791 for (
unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1798 evaluate_force_statistics(k+1);
1805 for (
unsigned int i=0; i<Points.size(); i++) {
1806 phi = Points[i].CG_function(P);
1808 Points[i].NormalTraction += P1_P2_NormalTraction * phi;
1809 Points[i].TangentialTraction += P1_P2_TangentialTraction * phi;
1810 if (get_doGradient()) {
1812 Vec3D d_phi = Points[i].CG_gradient(P, phi);
1813 dx[i].NormalTraction += P1_P2_NormalTraction * d_phi.
X;
1814 dy[i].NormalTraction += P1_P2_NormalTraction * d_phi.
Y;
1815 dz[i].NormalTraction += P1_P2_NormalTraction * d_phi.
Z;
1816 dx[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
X;
1817 dy[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
Y;
1818 dz[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
Z;
1825 template <StatType T>
1827 if(check_current_time_for_statistics())
1830 for (
unsigned int i=0; i<Points.size(); i++)
1831 Points[i].set_CG_invvolume();
1833 for (std::vector<BaseParticle*>::iterator P = getParticleHandler().begin(); P!=getParticleHandler().end(); ++P) {
1836 if ((!ignoreFixedParticles) && (*P)->isFixed()) {
1837 (*P)->unfix(get_Species());
1842 if (satisfiesInclusionCriteria(*P) && !(*P)->isFixed()) {
1843 evaluate_particle_statistics(P);
1850 template <StatType T>
1853 bool doDisplacement =
false;
1856 for (
unsigned int k=wp; k<getBoundaryHandler().getNumberOfObjects(); k++)
1862 if (
sqr(dist-(*P)->get_Radius())<9.0*get_w2())
1865 evaluate_particle_statistics(P, k+1);
1874 if (VelocityProfile.size()) V = getVelocityProfile ((*P)->get_Position());
1876 for (
unsigned int i=0; i<Points.size(); i++) {
1877 phi = Points[i].CG_function((*P)->get_Position());
1879 if (!std::isfinite(phi)) {
1882 <<
"error: phi =" << phi
1883 <<
" is infinite for P=" << (*P)->get_Position()
1884 <<
", Point=" << Points[i].get_Position()
1888 Points[i].Nu += (*P)->get_Volume(get_Species()) * phi;
1889 Points[i].Density += (*P)->get_Mass() * phi;
1890 if (VelocityProfile.size()) {
1891 Points[i].Momentum += ((*P)->get_Velocity()-V) * ((*P)->get_Mass() * phi);
1892 Points[i].MomentumFlux +=
SymmetrizedDyadic((*P)->get_Velocity()-V, (*P)->get_Velocity()-V) * ((*P)->get_Mass() * phi);
1894 Points[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * phi);
1895 Points[i].MomentumFlux +=
SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * phi);
1897 Points[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * phi);
1898 Points[i].DisplacementMomentumFlux +=
SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * phi);
1899 Points[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * phi);
1901 Vec3D LocalAngularMomentum =
Cross(Points[0].clearAveragedDirections((*P)->get_Position()-Points[i].get_Position()), (*P)->get_Velocity()) * (*P)->get_Mass()
1902 + (*P)->get_AngularVelocity() * (*P)->get_Inertia();
1903 Points[i].LocalAngularMomentum += phi * LocalAngularMomentum;
1904 Points[i].LocalAngularMomentumFlux +=
Dyadic(LocalAngularMomentum, (*P)->get_Velocity() * phi);
1907 if (get_doGradient()) {
1909 Vec3D d_phi = Points[i].CG_gradient((*P)->get_Position(), phi);
1911 if (doDisplacement) {
1913 for (std::vector<BaseParticle*>::iterator Q = getParticleHandler().begin(); Q!=getParticleHandler().end(); ++Q) {
1914 double phiQ = Points[i].CG_function((*Q)->get_Position());
1915 Points[i].Displacement +=
SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) - (*Q)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), d_phi)
1916 * ((*P)->get_Mass() * (*Q)->get_Mass() * phiQ);
1921 dx[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.
X;
1922 dx[i].Density += (*P)->get_Mass() * d_phi.
X;
1923 dx[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.
X);
1924 dx[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.
X);
1925 dx[i].MomentumFlux +=
SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.
X);
1926 dx[i].DisplacementMomentumFlux +=
SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.
X);
1927 dx[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.
X);
1929 dy[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.
Y;
1930 dy[i].Density += (*P)->get_Mass() * d_phi.
Y;
1931 dy[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.
Y);
1932 dy[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.
Y);
1933 dy[i].MomentumFlux +=
SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.
Y);
1934 dy[i].DisplacementMomentumFlux +=
SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.
Y);
1935 dy[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.
Y);
1937 dz[i].Nu += (*P)->get_Volume(get_Species()) * d_phi.
Z;
1938 dz[i].Density += (*P)->get_Mass() * d_phi.
Z;
1939 dz[i].Momentum += (*P)->get_Velocity() * ((*P)->get_Mass() * d_phi.
Z);
1940 dz[i].DisplacementMomentum += (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()) * ((*P)->get_Mass() * d_phi.
Z);
1941 dz[i].MomentumFlux +=
SymmetrizedDyadic((*P)->get_Velocity(), (*P)->get_Velocity()) * ((*P)->get_Mass() * d_phi.
Z);
1942 dz[i].DisplacementMomentumFlux +=
SymmetrizedDyadic((*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount()), (*P)->get_Displacement2(get_xmin(),get_xmax(),get_ymin(),get_ymax(),get_zmin(),get_zmax(),get_dt()*get_savecount())) * ((*P)->get_Mass() * d_phi.
Z);
1943 dz[i].EnergyFlux += (*P)->get_Velocity() * ((*P)->get_Mass()*(*P)->get_Velocity().GetLength2()/2 * d_phi.
Z);
1983 return std::min(std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1984 std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X)),
1985 std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
1988 return std::min(std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y),
1989 std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
1992 return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1993 std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
1996 return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
1997 std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
2000 return std::max((get_xmaxStat()-P2.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P2.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X);
2003 return std::max((get_ymaxStat()-P2.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P2.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y);
2008 return std::min(std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2009 std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X)),
2010 std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
2013 return std::min(std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y),
2014 std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
2017 return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2018 std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X));
2021 return std::min(fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z),
2022 std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y));
2025 return std::max((get_xmaxStat()-P1.X+5*sqrt(get_w2()))/P1_P2_normal.X,-(P1.X-get_xminStat()+5*sqrt(get_w2()))/P1_P2_normal.X);
2028 return std::max((get_ymaxStat()-P1.Y+5*sqrt(get_w2()))/P1_P2_normal.Y,-(P1.Y-get_yminStat()+5*sqrt(get_w2()))/P1_P2_normal.Y);
2031 return fabs((P1.Z-get_zminStat()+5*get_w())/P1_P2_normal.Z);
StatisticsVector()
Basic constructor only calls constructor()
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
bool read_next_from_data_file(unsigned int format)
StatisticsPoint< T > average(std::vector< StatisticsPoint< T > > &P)
Output average of statistical variables.
void initialize_statistics()
Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the ...
void gather_force_statistics_from_fstat_and_data()
get force statistics from particle collisions
std::vector< StatisticsPoint< T > > dyTimeAverage
a vector used to sum up all statistical gradients in dy for time-averaging
void output_statistics()
Calculates statistics for Particles (i.e. not collisions)
void finish_statistics()
Finish all statistics (i.e. write out final data)
bool walls
Turns off walls before evaluation.
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
void write_time_average_statistics()
Writes out time averaged statistics.
bool satisfiesInclusionCriteria(BaseParticle *P)
Mdouble w_over_rmax
if w is not set manually then w will be set by multiplying this value by the largest particle radius ...
Mdouble tmaxStat
Statistical output will only be created if t
std::vector< StatisticsPoint< T > > dz
A vector that stores the gradient in z of all statistical variables at a given position.
Mdouble cutoff
The distance from the origin at which the cg function vanishes; cutoff=w for HeavisideSphere or Polyn...
void gather_force_statistics_from_p3w(int version, std::vector< int > &index)
get force statistics from particle collisions
std::vector< StatisticsPoint< T > > dy
A vector that stores the gradient in y of all statistical variables at a given position.
Mdouble xminStat
By default the points of evaluation are placed in an grid on the domain [xminStat,xmaxStat]x[yminStat,ymaxStat]x[zminStat,zmaxStat].
void constructor()
Sets up all basic things.
Matrix3D Cross(const Vec3D &A, const Matrix3D &B)
bool loadVelocityProfile(const char *filename)
Mdouble w2
coarse graining width squared; for HeavisideSphere and Gaussian
Mdouble tintStat
Statistical output will only be created if tmaxStat-tintStat< t< tmaxStat.
void write_statistics()
Writes regular statistics.
void jump_p3c()
get force statistics from particle collisions
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
void evaluate_wall_force_statistics(Vec3D P, int wp=0)
get force statistics (i.e. first particle is a wall particle)
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
void set_CG_type(const char *new_)
bool read_next_from_p3p_file()
virtual void save_restart_data()
Stores all MD data.
Defines a pair of periodic walls. The particles are in {x: position_left<=normal*x
Mdouble get_Radius() const
CG
enum used to store the type of coarse-graining function used
void set_w2(Mdouble new_)
Set CG variables w2 and CG_invvolume.
void set_Positions()
Set position of StatisticsPoint points and set variables to 0.
int nTimeAverage
A counter needed to average over time.
std::vector< StatisticsPoint< T > > dxTimeAverage
a vector used to sum up all statistical gradients in dx for time-averaging
std::ostream & operator<<(std::ostream &os, const StatType S)
std::string print()
Outputs member variable values to a std::string.
std::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
std::string print() const
Outputs statistical variables in human-readable format.
Mdouble get_t()
Access function for the time.
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
void shift_positions(Vec3D &PI, Vec3D &PJ)
shifts two particles
void evaluate_force_statistics(int wp=0)
get force statistics
void statistics_from_p3()
this is a modified version of statistics_from_fstat_and_data. It is used to read p3d files ...
Mdouble distance(BaseParticle &P)
Returns the distance of the wall to the particle, and sets left_wall = true, if the left wall is the ...
Mdouble tminStat
Statistical output will only be created if t>tminStat.
MatrixSymmetric3D SymmetrizedDyadic(Vec3D A, Vec3D B)
calculates the symmetrized dyadic product ( )
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
Vec3D getVelocityProfile(Vec3D Position)
void set_zero()
Sets all statistical variables to zero.
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
void statistics_from_fstat_and_data()
get StatisticsPoint
Matrix3D Dyadic(Vec3D A, Vec3D B)
calculates the dyadic product ( )
void evaluate_particle_statistics(std::vector< BaseParticle * >::iterator P, int wp=0)
Calculates statistics for a single Particle.
bool doTimeAverage
Determines if output is averaged over time.
void set_format(int new_)
void process_statistics(bool usethese)
Processes all gathered statistics and resets them afterwards. (Processing means either calculating ti...
void shift_position(BaseParticle *F0)
shifts the particle (after distance set the left_wall value)
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
const Vec3D & get_Position() const
Mdouble mirrorAtDomainBoundary
bool doVariance
Determines if variance is outputted.
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
A class that defines and solves a MD problem.
virtual void output_xballs_data()
Output xball data for Particle i.
This class stores statistical values for a given spatial position; to be used in combination with Sta...
int verbosity
0 no output 1 basic output (timesteps) 2 full output (number of forces and particles, md and stat parameters)
void gather_statistics_collision(int index1, int index2, Vec3D Contact, Mdouble delta, Mdouble ctheta, Mdouble fdotn, Mdouble fdott, Vec3D P1_P2_normal_, Vec3D P1_P2_tangential)
Calculates statistics for one collision (can be any kind of collision)
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
Mdouble hmax
defines the maximum height of the particles for which statistics are extracted
This class is used to extract statistical data from MD simulations.
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.
void set_dim(int new_dim)
Allows the dimension of the simulation to be changed.
Mdouble setInfinitelyLongDistance()
bool superexact
If true, cutoff radius for Gaussian is set to 5*w (from 3*w)
virtual void reset_statistics()
Set all statistical variables to zero.
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::set_CG_type
Implementation of a 3D vector (by Vitaliy).
bool read_next_from_data_file(unsigned int format=0)
by default format do not pass an argument; only specify format if you have to read a special format (...
int StressTypeForFixedParticles
0 no Stress from fixed particles 1 Stress from fixed particles distributed between Contact and flowin...
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
void readStatArguments(unsigned int argc, char *argv[])
std::string print_CG()
Output coarse graining variables.
bool doGradient
Determines if gradient is outputted.
virtual void print(std::ostream &os, bool print_all=false)
Outputs MD.
void gather_force_statistics_from_p3c(int version)
get force statistics from particle collisions
int nxMirrored
extension of grid size from mirrored points
virtual void create_xballs_script()
This creates a scipt which can be used to load the xballs problem to display the data just generated...