73 w2 =
mathsFunc::square(w_over_rmax * particleHandler.getLargestParticle()->getRadius());
84 cutoff = 5.0 * sqrt(w2);
86 cutoff = 3.0 * sqrt(w2);
91 std::cerr <<
"error in CG_function" << std::endl;
99 for (
unsigned int i = 0; i < Points.size(); i++)
100 Points[i].set_zero();
102 for (
unsigned int i = 0; i < Points.size(); i++)
108 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
110 (*it)->setPreviousPosition((*it)->getPosition());
124 nxMirrored = nyMirrored = nzMirrored = 0;
137 setCGTimeAveragingInterval(0);
154 ignoreFixedParticles =
true;
155 StressTypeForFixedParticles = 1;
158 periodicWalls =
true;
160 mirrorAtDomainBoundary =
false;
161 setSuperExact(
false);
162 VelocityProfile.resize(0);
166 setDoTimeAverage(
true);
168 nTimeAverageReset = -1;
170 setDoVariance(
false);
172 setDoGradient(
false);
173 doDoublePoints =
false;
210 for (
unsigned int i = 0; i <
timeAverage.size(); i++)
253 setName(name.c_str());
255 if (!strcmp(getName().c_str(),
"c3d"))
258 std::cout <<
"MDCLR data" << std::endl;
265 if (readRestartFile()==0)
267 std::cout <<
"no restart file given: using default density 1" << std::endl;
284 std::cerr <<
"fstatistics.exe filename [-options]" << std::endl
285 <<
"Type -help for more information" << std::endl;
290 if (!strcmp(argv[1],
"-help"))
296 std::string filename(argv[1]);
297 constructor(filename);
300 readStatArguments(argc, argv);
308 is.open(filename, std::fstream::in);
309 if (!is.is_open() || is.bad())
311 std::cout <<
"Loading data file " << filename <<
" failed" << std::endl;
316 std::string line_string;
317 getline(is, line_string);
319 is >> dummy >> dummy;
320 is >> dummy >> dummy;
321 double xmin, xmax, ymin, ymax, zmin, zmax;
322 is >> dummy >> xmin >> xmax >> ymin >> ymax >> zmin >> zmax;
323 VelocityProfile_Min =
Vec3D(xmin, ymin, zmin);
325 is >> dummy >> nx >> ny >> nz;
326 double dx = (xmax - xmin) / (nx - 1);
327 double dy = (ymax - ymin) / (ny - 1);
328 double dz = (zmax - zmin) / (nz - 1);
329 VelocityProfile_D =
Vec3D(dx, dy, dz);
330 std::string statType;
331 is >> dummy >> statType;
332 getline(is, line_string);
333 getline(is, line_string);
345 VelocityProfile.resize(nx * ny * nz);
349 for (
int i = 0; i < nx; i++)
350 for (
int j = 0; j < ny; j++)
351 for (
int k = 0; k < nz; k++)
353 is >> dummy >> dummy >> dummy >> dummy >> rho >> M.
X >> M.
Y >> M.
Z;
354 getline(is, line_string);
355 VelocityProfile[n] = M / rho;
361 std::cout <<
"Loaded data file " << filename << std::endl;
370 l = modf((Position.
X - VelocityProfile_Min.X) / VelocityProfile_D.X, &i);
371 m = modf((Position.
Y - VelocityProfile_Min.Y) / VelocityProfile_D.Y, &j);
372 n = modf((Position.
Z - VelocityProfile_Min.Z) / VelocityProfile_D.Z, &k);
379 int ix =
static_cast<int>((i * ny + j) * nz + k);
382 V.
X = VelocityProfile[ix].X;
384 V.
X = VelocityProfile[ix].X * (1 - l) + VelocityProfile[ix + ny * nz].
X * l;
386 V.
Y = VelocityProfile[ix].Y;
388 V.
Y = VelocityProfile[ix].Y * (1 - m) + VelocityProfile[ix + nz].
Y * m;
390 V.
Z = VelocityProfile[ix].Z;
392 V.
Z = VelocityProfile[ix].Z * (1 - n) + VelocityProfile[ix + 1].
Z * n;
401 for (
int i = 2; i < argc; i += 2)
403 std::cout <<
"interpreting input argument " << argv[i];
405 std::cout <<
" " << argv[i + 1];
406 std::cout << std::endl;
408 if (!strcmp(argv[i],
"-CGtype"))
411 if (!strcmp(argv[i + 1],
"HeavisideSphere"))
415 else if (!strcmp(argv[i + 1],
"Gaussian"))
421 setCGShape(argv[i + 1]);
424 else if (!strcmp(argv[i],
"-w"))
426 double old = getCGWidth();
427 setCGWidth(atof(argv[i + 1]));
428 std::cout <<
" w changed from " << old <<
" to " << getCGWidth() << std::endl;
430 else if (!strcmp(argv[i],
"-help"))
435 else if (!strcmp(argv[i],
"-velocityprofile"))
437 loadVelocityProfile(argv[i + 1]);
439 else if (!strcmp(argv[i],
"-h"))
441 set_h(atof(argv[i + 1]));
443 else if (!strcmp(argv[i],
"-hx"))
445 set_hx(atof(argv[i + 1]));
447 else if (!strcmp(argv[i],
"-hy"))
449 set_hy(atof(argv[i + 1]));
451 else if (!strcmp(argv[i],
"-hz"))
453 set_hz(atof(argv[i + 1]));
455 else if (!strcmp(argv[i],
"-n"))
457 setN(atoi(argv[i + 1]));
459 else if (!strcmp(argv[i],
"-nx"))
461 setNX(atoi(argv[i + 1]));
463 else if (!strcmp(argv[i],
"-ny"))
465 setNY(atoi(argv[i + 1]));
467 else if (!strcmp(argv[i],
"-nz"))
469 setNZ(atoi(argv[i + 1]));
471 else if (!strcmp(argv[i],
"-x"))
473 setXMinStat(atof(argv[i + 1]));
474 setXMaxStat(atof(argv[i + 2]));
477 else if (!strcmp(argv[i],
"-y"))
479 setYMinStat(atof(argv[i + 1]));
480 setYMaxStat(atof(argv[i + 2]));
483 else if (!strcmp(argv[i],
"-z"))
485 setZMinStat(atof(argv[i + 1]));
486 setZMaxStat(atof(argv[i + 2]));
489 else if (!strcmp(argv[i],
"-positions"))
491 loadPositions(argv[i+1]);
493 else if (!strcmp(argv[i],
"-indSpecies"))
495 indSpecies = atoi(argv[i + 1]);
497 else if (!strcmp(argv[i],
"-rmin"))
499 rmin = atof(argv[i + 1]);
501 else if (!strcmp(argv[i],
"-rmax"))
503 rmax = atof(argv[i + 1]);
505 else if (!strcmp(argv[i],
"-hmax"))
507 hmax = atof(argv[i + 1]);
509 else if (!strcmp(argv[i],
"-periodicwalls"))
511 setDoPeriodicWalls(atoi(argv[i + 1]));
513 else if (!strcmp(argv[i],
"-walls"))
515 setCGWidthalls(atoi(argv[i + 1]));
517 else if (!strcmp(argv[i],
"-verbosity"))
519 setVerbosityLevel(atoi(argv[i + 1]));
521 else if (!strcmp(argv[i],
"-verbose"))
526 else if (!strcmp(argv[i],
"-format"))
528 format = atoi(argv[i + 1]);
530 else if (!strcmp(argv[i],
"-doDoublePoints"))
532 if (argc <= i + 1 || argv[i + 1][0] ==
'-')
534 setDoDoublePoints(
true);
538 setDoDoublePoints(atoi(argv[i + 1]));
539 std::cout <<
"set doDoublePoints=" << getDoDoublePoints() << std::endl;
541 else if (!strcmp(argv[i],
"-w_over_rmax"))
543 setCGWidth_over_rmax(atof(argv[i + 1]));
545 else if (!strcmp(argv[i],
"-tmin"))
547 setCGTimeMin(atof(argv[i + 1]));
549 else if (!strcmp(argv[i],
"-tmax"))
551 setTimeMaxStat(atof(argv[i + 1]));
553 else if (!strcmp(argv[i],
"-tint"))
555 setCGTimeAveragingInterval(atof(argv[i + 1]));
559 else if (!strcmp(argv[i],
"-stepsize"))
561 int stepSize = atoi(argv[i + 1]);
562 setStepSize(stepSize);
564 else if (!strcmp(argv[i],
"-loaddatafile"))
566 readDataFile(argv[i + 1]);
567 setCGTimeMin(getTime());
568 setTimeMaxStat(getTimeMax());
570 else if (!strcmp(argv[i],
"-statfilename") | !strcmp(argv[i],
"-o"))
572 statFile.setName(argv[i + 1]);
576 else if (!strcmp(argv[i],
"-timeaverage"))
578 setDoTimeAverage(atoi(argv[i + 1]));
580 else if (!strcmp(argv[i],
"-timeaveragereset"))
582 nTimeAverageReset = atoi(argv[i + 1]);
584 else if (!strcmp(argv[i],
"-gradient"))
587 if (argc <= i + 1 || argv[i + 1][0] ==
'-')
593 setDoGradient(atoi(argv[i + 1]));
595 else if (!strcmp(argv[i],
"-timevariance"))
598 if (argc <= i + 1 || argv[i + 1][0] ==
'-')
604 setDoVariance(atoi(argv[i + 1]));
606 else if (!strcmp(argv[i],
"-superexact"))
609 if (argc <= i + 1 || argv[i + 1][0] ==
'-')
615 setSuperExact(atoi(argv[i + 1]));
617 else if (!strcmp(argv[i],
"-ignoreFixedParticles"))
620 if (argc <= i + 1 || argv[i + 1][0] ==
'-')
622 setDoIgnoreFixedParticles(
true);
626 setDoIgnoreFixedParticles(atoi(argv[i + 1]));
628 else if (!strcmp(argv[i],
"-StressTypeForFixedParticles"))
630 StressTypeForFixedParticles = atoi(argv[i + 1]);
632 else if (!strcmp(argv[i],
"-mirrorAtDomainBoundary"))
634 setMirrorAtDomainBoundary(atof(argv[i + 1]));
636 else if (!strcmp(argv[i],
"-stattype") || !strcmp(argv[i],
"-statType"))
640 else if (readNextArgument(i, argc, argv))
646 std::cerr <<
"Error: option unknown: " << argv[i] << std::endl;
656 std::cout <<
"fstatistics.exe filename [-options]: " << std::endl
657 <<
"This program evaluates statistical data from .fstat, .data, and. restart files and writes it into a .stat file" << std::endl << std::endl;
658 std::cout <<
"OPTIONS:" << std::endl << std::endl;
659 std::cout <<
"-stattype [X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,AZ,RZ,R,A]: " << std::endl
660 <<
"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
661 <<
"-CGtype [HeavisideSphere,Gaussian]: " << std::endl
662 <<
"Averaging function; default: Gaussian" << std::endl << std::endl
663 <<
"-w,-w_over_rmax [Mdouble]: " << std::endl
664 <<
"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
665 <<
"-n,nx,ny,nz [uint]: " << std::endl
666 <<
"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
667 <<
"-h,hx,hy,hz [Mdouble]: " << std::endl
668 <<
"Defines the amount of grid points by setting the mesh size " << std::endl << std::endl
669 <<
"-x,y,z [Mdouble Mdouble]: " << std::endl
670 <<
"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
671 <<
"-indSpecies [int]: " << std::endl
672 <<
"-rmin,rmax [Mdouble]: " << std::endl
673 <<
"-hmax [Mdouble]: " << std::endl
674 <<
"Allows to only obtain statistics for specific particles" << std::endl << std::endl
675 <<
"-periodicwalls [bool]: " << std::endl
676 <<
"neglects periodic walls" << std::endl << std::endl
677 <<
"-walls [uint]: " << std::endl
678 <<
"only takes into account the first n walls" << std::endl << std::endl
679 <<
"-verbosity [uint]: " << std::endl
680 <<
"amount of screen output (0 minimal, 1 normal, 2 maximal)" << std::endl << std::endl
681 <<
"-verbose: " << std::endl
682 <<
"identical to -verbosity 2" << std::endl << std::endl
683 <<
"-format [uint]: " << std::endl
684 <<
"???" << std::endl << std::endl
685 <<
"-tmin,tmax,tint [Mdouble]: " << std::endl
686 <<
"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
687 <<
"-stepsize [uint]: " << std::endl
688 <<
"to skip some timesteps. Default: 1 " << std::endl << std::endl
689 <<
"-statfilename [std::string]: " << std::endl
690 <<
"to change the name of the output file" << std::endl << std::endl
691 <<
"-timeaverage [bool]: " << std::endl
692 <<
"To average in time (1) or to print statistics for all time steps (0). Default: 1" << std::endl << std::endl
693 <<
"-timevariance [bool]: " << std::endl
694 <<
"to print the time variance; only for time averaged data. Default: ?" << std::endl << std::endl
695 <<
"-gradient: " << std::endl
696 <<
"to plot the first derivative of each statistical value" << std::endl << std::endl
697 <<
"-ignoreFixedParticles: " << std::endl
698 <<
"-StressTypeForFixedParticles: " << std::endl
699 <<
"-mirrorAtDomainBoundary [Mdouble]" << std::endl << std::endl
700 <<
"" << std::endl << std::endl
701 <<
"OUTPUT:" << std::endl << std::endl
702 <<
"1-3: Coordinates " << std::endl
703 <<
"4: Nu " << std::endl
704 <<
"5: Density " << std::endl
705 <<
"6-8: Momentum " << std::endl
706 <<
"9-11: DisplacementMomentum " << std::endl
707 <<
"12-17: Displacement" << std::endl
708 <<
"18-23: MomentumFlux" << std::endl
709 <<
"24-29: DisplacementMomentumFlux" << std::endl
710 <<
"30-32: EnergyFlux " << std::endl
711 <<
"33-41: NormalStress " << std::endl
712 <<
"42-50: TangentialStress " << std::endl
713 <<
"51-53: NormalTraction " << std::endl
714 <<
"54-56: TangentialTraction " << std::endl
715 <<
"57-62: Fabric " << std::endl
716 <<
"63-65: CollisionalHeatFlux " << std::endl
717 <<
"66: Dissipation " << std::endl
718 <<
"67: Potential " << std::endl
719 <<
"68-70: LocalAngularMomentum " << std::endl
720 <<
"71-79: LocalAngularMomentumFlux " << std::endl
721 <<
"80-88: ContactCoupleStress " << std::endl;
728 if (!strcmp(new_,
"Heaviside"))
732 double heavisidecoeff[] = {1};
733 set_Polynomial(heavisidecoeff, numcoeff, dim);
735 else if (!strcmp(new_,
"Linear"))
739 double lincoeff[] = {-1, 1};
740 set_Polynomial(lincoeff, numcoeff, dim);
742 else if (!strcmp(new_,
"Lucy"))
746 double lucycoeff[] = {-3, 8, -6, 0, 1};
747 set_Polynomial(lucycoeff, numcoeff, dim);
749 else if (!strcmp(new_,
"Gaussian"))
754 else if (!strcmp(new_,
"HeavisideSphere"))
761 std::cerr <<
"Error: unknown CG_type: " << new_ << std::endl;
764 setPolynomialName(new_);
771 if (new_ ==
Polynomial && CGPolynomial.getOrder() < 0)
773 std::cerr <<
"Polynomial is not specified" << std::endl;
783 std::stringstream ss;
784 ss <<
"Statistical parameters: name=" << getName()
791 ss <<
"HeavisideSphere";
799 ss << getPolynomialName();
803 std::cerr <<
"error in CG_function" << std::endl;
807 ss <<
", w=" << sqrt(w2)
808 <<
", cutoff=" << cutoff
809 <<
",\n tStat=[" << getCGTimeMin() <<
"," << getTimeMaxStat() <<
"]"
810 <<
", xStat=[" << getXMinStat() <<
"," << getXMaxStat() <<
"]"
811 <<
", yStat=[" << getYMinStat() <<
"," << getYMaxStat() <<
"]"
812 <<
", zStat=[" << getZMinStat() <<
"," << getZMaxStat() <<
"]"
813 <<
",\n ignoreFixedParticles=" << ignoreFixedParticles
814 <<
", StressTypeForFixedParticles=" << StressTypeForFixedParticles
815 <<
",\n mirrorAtDomainBoundary=" << getMirrorAtDomainBoundary()
816 <<
",\n doTimeAverage=" << getDoTimeAverage()
817 <<
", doVariance=" << getDoVariance()
818 <<
", doGradient=" << getDoGradient()
819 <<
", verbosity=" << verbosity
829 std::stringstream ss;
830 ss <<
"w " << sqrt(getCGWidthSquared())
831 <<
" dim " << getSystemDimensions()
832 <<
" domainStat " << getXMinStat() <<
" " << getXMaxStat()
833 <<
" " << getYMinStat() <<
" " << getYMaxStat()
834 <<
" " << getZMinStat() <<
" " << getZMaxStat()
835 <<
" n " << nx <<
" " << ny <<
" " << nz
836 <<
" statType " << statType;
838 ss <<
" CGPolynomial " << CGPolynomial;
840 ss <<
" CG_type " << CG_type <<
" cutoff " << cutoff;
847 ss <<
" doTimeAverage";
848 if (nTimeAverageReset != -1)
849 ss <<
" nTimeAverageReset " << nTimeAverageReset;
851 if (indSpecies != -1)
852 ss <<
" indSpecies " << indSpecies;
854 ss <<
" rmin " << rmin;
856 ss <<
" rmax " << rmax;
858 ss <<
" hmax " << hmax;
862 ss <<
" noPeriodicWalls";
863 if (!ignoreFixedParticles)
864 ss <<
" includeFixedParticles";
865 if (StressTypeForFixedParticles != 1)
866 ss <<
" StressTypeForFixedParticles " << StressTypeForFixedParticles;
876 for (
unsigned int i = 0; i < P.size(); i++)
892 if (getCGTimeAveragingInterval() != 0.0)
894 setCGTimeMin(getTime());
895 setTimeMaxStat(getCGTimeMin() + getCGTimeAveragingInterval());
896 std::cout <<
"tint set, time goes from: " << getCGTimeMin() <<
" to: " << getTimeMaxStat() << std::endl;
901 statFile.getFstream() << Points.begin()->write_variable_names() << std::endl;
902 statFile.getFstream() << print_CG() << std::endl;
906 std::cout << std::endl;
908 std::cout << std::endl << printStat() << std::endl;
915 static unsigned int count = 0;
918 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
920 (*it)->setPreviousPosition((*it)->getPosition());
926 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
928 (*it)->setPreviousPosition((*it)->getPosition());
938 std::cout <<
"writing statistics for t=" << getTime() << std::endl;
941 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getTime() << std::endl;
942 for (
unsigned int i = 0; i < Points.size(); i++)
943 statFile.getFstream() << Points[i];
947 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getTime() << std::endl;
948 for (
unsigned int i = 0; i < dx.size(); i++)
949 statFile.getFstream() << dx[i];
950 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getTime() << std::endl;
951 for (
unsigned int i = 0; i < dy.size(); i++)
952 statFile.getFstream() << dy[i];
953 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getTime() << std::endl;
954 for (
unsigned int i = 0; i < dz.size(); i++)
955 statFile.getFstream() << dz[i];
963 if (getDoTimeAverage())
964 write_time_average_statistics();
971 if (check_current_time_for_statistics() && usethese)
973 if (getMirrorAtDomainBoundary() != 0.0)
975 for (
unsigned int i = 0; i < Points.size(); i++)
977 if (Points[i].mirrorParticle >= 0)
980 Points[Points[i].mirrorParticle] += Points[i];
981 Points[i].set_zero();
984 dx[Points[i].mirrorParticle] += dx[i];
985 dy[Points[i].mirrorParticle] += dy[i];
986 dz[Points[i].mirrorParticle] += dz[i];
993 if (getDoTimeAverage())
995 for (
unsigned int i = 0; i < timeAverage.size(); i++)
997 timeAverage[i] += Points[i];
999 timeVariance[i] += Points[i].getSquared();
1000 if (getDoGradient())
1002 dxTimeAverage[i] += dx[i];
1003 dyTimeAverage[i] += dy[i];
1004 dzTimeAverage[i] += dz[i];
1008 if (nTimeAverage == nTimeAverageReset)
1010 std::cout <<
"write time average" << std::endl;
1011 write_time_average_statistics();
1013 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1014 timeAverage[i].set_zero();
1025 template<StatType T>
1028 static bool first =
true;
1031 std::cout << std::endl <<
"averaging " << nTimeAverage <<
" timesteps " << std::endl;
1032 if (nTimeAverage == 0)
1034 fprintf(stderr,
"\n\n\tERROR :: Can not do TimeAverage of 0 timesteps\n\n");
1040 std::cout <<
"first" << nTimeAverage << std::endl;
1041 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1043 timeAverage[i].firstTimeAverage(nTimeAverage);
1044 if (getDoVariance())
1046 timeVariance[i].firstTimeAverage(nTimeAverage);
1047 timeVariance[i] -= timeAverage[i].getSquared();
1049 if (getDoGradient())
1051 dxTimeAverage[i].firstTimeAverage(nTimeAverage);
1052 dyTimeAverage[i].firstTimeAverage(nTimeAverage);
1053 dzTimeAverage[i].firstTimeAverage(nTimeAverage);
1060 std::cout <<
"next" << nTimeAverage << std::endl;
1061 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1063 timeAverage[i] /= nTimeAverage;
1064 if (getDoVariance())
1066 timeVariance[i] /= nTimeAverage;
1067 timeVariance[i] -= timeAverage[i].getSquared();
1069 if (getDoGradient())
1071 dxTimeAverage[i] /= nTimeAverage;
1072 dyTimeAverage[i] /= nTimeAverage;
1073 dzTimeAverage[i] /= nTimeAverage;
1079 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getCGTimeMin() <<
" " << getTime() << std::endl;
1080 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1081 statFile.getFstream() << timeAverage[i];
1084 std::cout <<
"Averages: " << avg.print() << std::endl;
1086 if (getDoVariance())
1089 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getCGTimeMin() <<
" " << getTime() <<
" " << std::endl;
1090 for (
unsigned int i = 0; i < timeVariance.size(); i++)
1091 statFile.getFstream() << timeVariance[i];
1095 if (getDoGradient())
1098 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getCGTimeMin() <<
" " << getTime() <<
" " << std::endl;
1099 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1100 statFile.getFstream() << dxTimeAverage[i];
1101 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getCGTimeMin() <<
" " << getTime() <<
" " << std::endl;
1102 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1103 statFile.getFstream() << dyTimeAverage[i];
1104 statFile.getFstream() << std::left << std::setprecision(8) << std::setw(6) << getCGTimeMin() <<
" " << getTime() <<
" " << std::endl;
1105 for (
unsigned int i = 0; i < timeAverage.size(); i++)
1106 statFile.getFstream() << dzTimeAverage[i];
1109 setCGTimeMin(getTime());
1112 template<StatType T>
1115 std::cout <<
"set " <<
" positions" << std::endl;
1116 dataFile.setCounter(0);
1117 fStatFile.setCounter(0);
1121 dataFile.open(std::fstream::in);
1123 fStatFile.open(std::fstream::in);
1129 for (
int i = 1; i < 10000; i++)
1131 if (readNextDataFile(format))
1133 fStatFile.openNextFile(std::fstream::in);
1137 if (getTime() >= getCGTimeMin())
1138 setCGTimeMin(getTime() - getTimeStep());
1145 std::cout <<
"Input from " << dataFile.getName() << std::endl;
1146 std::cout <<
"Input from " << fStatFile.getName() << std::endl;
1147 std::cout <<
"Output to " << statFile.getName() << std::endl << std::endl;
1150 initialiseStatistics();
1167 std::cout << std::endl;
1180 findNextExistingDataFile(getCGTimeMin());
1182 findNextExistingDataFile(getCGTimeMin(),
false);
1183 for (
unsigned int i = 1; i < dataFile.getCounter(); i++)
1189 std::cout <<
"Start statistics" << std::endl;
1192 if (getTime() > getTimeMaxStat())
1195 <<
"reached end t=" << std::setprecision(9) << getTime()
1196 <<
" tmaxStat=" << std::setprecision(9) << getTimeMaxStat()
1200 else if (getTime() < getCGTimeMin())
1203 std::cout <<
"Jumping statistics t=" << getTime() <<
" tminStat()=" << getCGTimeMin() << std::endl;
1209 std::cout <<
"Get statistics for t=" << std::setprecision(9) << getTime() << std::endl;
1211 std::cout <<
"#particles=" << particleHandler.getNumberOfObjects() << std::endl;
1214 wallHandler.clear();
1217 boundaryHandler.clear();
1220 gather_force_statistics_from_fstat_and_data();
1221 processStatistics(
true);
1226 for (
unsigned int i = 1; i < getStepSize(); i++)
1229 readNextDataFile(format);
1232 }
while (readNextDataFile(format));
1234 if (getTime() < getTimeMaxStat())
1235 setTimeMaxStat(getTime());
1242 template<StatType T>
1245 if (particleHandler.getNumberOfObjects() < 1)
1247 std::vector<BaseParticle*>::iterator it = particleHandler.begin();
1248 setXMin((*it)->getPosition().X - (*it)->getRadius());
1249 setYMin((*it)->getPosition().Y - (*it)->getRadius());
1250 setZMin((*it)->getPosition().Z - (*it)->getRadius());
1251 setXMax((*it)->getPosition().X + (*it)->getRadius());
1252 setYMax((*it)->getPosition().Y + (*it)->getRadius());
1253 setZMax((*it)->getPosition().Z + (*it)->getRadius());
1254 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1256 setXMin(std::min(getXMin(), (*it)->getPosition().X - (*it)->getRadius()));
1257 setYMin(std::min(getYMin(), (*it)->getPosition().Y - (*it)->getRadius()));
1258 setZMin(std::min(getZMin(), (*it)->getPosition().Z - (*it)->getRadius()));
1259 setXMax(std::max(getXMax(), (*it)->getPosition().X + (*it)->getRadius()));
1260 setYMax(std::max(getYMax(), (*it)->getPosition().Y + (*it)->getRadius()));
1261 setZMax(std::max(getZMax(), (*it)->getPosition().Z + (*it)->getRadius()));
1265 template<StatType T>
1273 std::string dummyStr;
1278 getline(p3p_file, dummyStr);
1280 std::cout << dummyStr << std::endl;
1285 std::cout <<
"t= " << getTime() <<
": loading " << N <<
" particles ..." << std::endl;
1286 getline(p3p_file, dummyStr);
1289 getline(p3p_file, dummyStr);
1291 std::cout << dummyStr << std::endl;
1292 if (p3p_file.eof() || p3p_file.peek() == -1)
1294 std::cout <<
"reached end of p3p file" << std::endl;
1299 if (particleHandler.getNumberOfObjects() < N)
1300 while (particleHandler.getNumberOfObjects() < N)
1301 particleHandler.copyAndAddObject(P0);
1303 while (particleHandler.getNumberOfObjects() > N)
1304 particleHandler.removeLastObject();
1308 Vec3D position, velocity, angle, angularVelocity;
1310 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1312 p3p_file >> dummyInt;
1313 (*it)->setIndex(dummyInt);
1315 p3p_file >> dummyInt;
1316 (*it)->setIndSpecies(dummyInt - 1);
1318 (*it)->setRadius(pow(dummy / (4. / 3. *
constants::pi), 1. / 3.));
1320 (*it)->setMass(dummy);
1325 (*it)->setPosition(position);
1326 (*it)->setVelocity(velocity);
1327 (*it)->setAngularVelocity(angularVelocity);
1332 getline(p3p_file, dummyStr);
1334 std::cout << dummyStr << std::endl;
1342 template<StatType T>
1346 std::string p3p_filename = getName().c_str();
1347 p3p_filename +=
".p3p";
1349 std::string p3c_filename = getName().c_str();
1350 p3c_filename +=
".p3c";
1352 std::string p3w_filename = getName().c_str();
1353 p3w_filename +=
".p3w";
1359 std::cerr <<
"Warning could not open " << p3p_filename << std::endl;
1361 p3p_filename = getName().c_str();
1362 p3p_filename +=
".p4p";
1364 p3c_filename = getName().c_str();
1365 p3c_filename +=
".p4c";
1367 p3w_filename = getName().c_str();
1368 p3w_filename +=
".p4w";
1372 std::cerr <<
"could not open " << p3p_filename << std::endl;
1376 std::cout <<
"opened " << p3p_filename << std::endl;
1381 read_next_from_p3p_file();
1384 if (getTime() >= getCGTimeMin())
1385 setCGTimeMin(getTime() - getTimeStep());
1388 dataFile.open(std::fstream::out);
1390 setParticleDimensions(3);
1398 initialiseStatistics();
1404 Mdouble mass = particleHandler.getLargestParticle()->getMass();
1406 if (species!=
nullptr)
1408 std::cout <<
"Collision Time " << species->getCollisionTime(mass)
1409 <<
" and restitution coefficient " << species->getRestitutionCoefficient(mass)
1410 <<
" for mass " << mass << std::endl
1418 std::cout << std::endl;
1423 std::cout << std::endl;
1427 std::cout <<
"Start statistics" << std::endl;
1430 if (getTime() > getTimeMaxStat())
1432 std::cout <<
"reached end t=" << std::setprecision(9) << getTime() <<
" tmaxStat=" << std::setprecision(9) << getTimeMaxStat() << std::endl;
1435 else if (getTime() >= getCGTimeMin())
1438 std::cout <<
"Get statistics for t=" << std::setprecision(9) << getTime() << std::endl;
1440 std::cout <<
"#particles=" << particleHandler.getNumberOfObjects() << std::endl;
1443 wallHandler.clear();
1446 boundaryHandler.clear();
1449 gather_force_statistics_from_p3c(version);
1450 processStatistics(
true);
1457 <<
"Jumping statistics t=" << getTime()
1458 <<
" tminStat()=" << getCGTimeMin() << std::endl;
1462 for (
unsigned int i = 1; i < getStepSize(); i++)
1465 read_next_from_p3p_file();
1468 }
while (read_next_from_p3p_file());
1470 if (getTime() < getTimeMaxStat())
1471 setTimeMaxStat(getTime());
1480 template<StatType T>
1483 std::string dummyStr;
1487 getline(p3c_file, dummyStr);
1488 std::cout << dummyStr << std::endl;
1493 std::cout <<
"ignoring t= " << getTime() <<
": loading " << N <<
" contacts ..." << std::endl;
1494 getline(p3c_file, dummyStr);
1496 getline(p3c_file, dummyStr);
1497 std::cout << dummyStr << std::endl;
1499 for (
int i = 0; i < N; i++)
1500 getline(p3c_file, dummyStr);
1503 getline(p3w_file, dummyStr);
1505 std::cout << dummyStr << std::endl;
1510 std::cout <<
"ignoring t= " << getTime() <<
": loading " << N <<
" wall contacts ..." << std::endl;
1511 getline(p3w_file, dummyStr);
1513 getline(p3w_file, dummyStr);
1515 for (
int i = 0; i < N; i++)
1516 getline(p3w_file, dummyStr);
1521 template<StatType T>
1524 std::string dummyStr;
1528 getline(p3c_file, dummyStr);
1530 std::cout << dummyStr << std::endl;
1535 std::cout <<
"t= " << getTime() <<
": loading " << N <<
" contacts ..." << std::endl;
1536 getline(p3c_file, dummyStr);
1538 getline(p3c_file, dummyStr);
1540 std::cout << dummyStr << std::endl;
1545 unsigned int Nmax = 0;
1546 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1547 Nmax = std::max(Nmax, (*it)->getIndex());
1548 static std::vector<int> index;
1549 index.resize(Nmax+1);
1552 for (std::vector<BaseParticle*>::iterator it = particleHandler.begin(); it != particleHandler.end(); ++it)
1554 index[(*it)->getIndex()] = i;
1571 int index1_p3, index2_p3;
1573 Vec3D Contact, Force;
1575 Vec3D P1_P2_normal, P1_P2_tangential;
1583 for (
int i = 0; i < N; i++)
1601 index1 = index[index1_p3];
1602 index2 = index[index2_p3];
1603 P1 = particleHandler.getObject(index1);
1604 P2 = particleHandler.getObject(index2);
1609 std::cout <<
"#forces=" << std::setprecision(9) << P1_P2_normal.
Y <<
"|" << getYMax()-getYMin() << std::endl;
1610 if (2.0*P1_P2_normal.
X > getXMax()-getXMin())
1611 P1_P2_normal.
X -= getXMax()-getXMin();
1612 else if (2.0*P1_P2_normal.
X < getXMin()-getXMax())
1613 P1_P2_normal.
X += getXMax()-getXMin();
1615 else if (2.0*P1_P2_normal.
Y > getYMax()-getYMin())
1616 P1_P2_normal.
Y -= getYMax()-getYMin();
1617 else if (2.0*P1_P2_normal.
Y < getYMin()-getYMax())
1618 P1_P2_normal.
Y += getYMax()-getYMin();
1620 else if (2.0*P1_P2_normal.
Z > getZMax()-getZMin())
1621 P1_P2_normal.
Z -= getZMax()-getZMin();
1622 else if (2.0*P1_P2_normal.
Z < getZMin()-getZMax())
1623 P1_P2_normal.
Z += getZMax()-getZMin();
1624 std::cout <<
"#forces=" << std::setprecision(9) << P1_P2_normal.
Y <<
"|" << getYMax()-getYMin() << std::endl;
1627 P1_P2_normal /= dist;
1634 P1_P2_tangential = Force + fdotn * P1_P2_normal;
1638 P1_P2_tangential =
Vec3D(0, 0, 0);
1642 P1_P2_tangential /= fdott;
1645 std::cout <<
"#forces=" << P1_P2_normal <<
"|" << fdotn << std::endl;
1646 gatherContactStatistics(index1, index2, Contact, delta, 0, fdotn, fdott, P1_P2_normal, -P1_P2_tangential);
1647 gatherContactStatistics(index2, index1, Contact, delta, 0, fdotn, fdott, -P1_P2_normal, P1_P2_tangential);
1651 std::cout <<
"#forces=" << counter << std::endl;
1653 getline(p3c_file, dummyStr);
1655 std::cout << dummyStr << std::endl;
1657 gather_force_statistics_from_p3w(version, index);
1661 template<StatType T>
1664 std::string dummyStr;
1668 getline(p3w_file, dummyStr);
1670 std::cout << dummyStr << std::endl;
1675 std::cout <<
"t= " << getTime() <<
": loading " << N <<
" wall contacts ..." << std::endl;
1676 getline(p3w_file, dummyStr);
1678 getline(p3w_file, dummyStr);
1680 std::cout << dummyStr << std::endl;
1696 Vec3D Contact, Force, Branch;
1698 Vec3D P1_P2_normal, P1_P2_tangential;
1705 for (
int i = 0; i < N; i++)
1722 index1 = index[index1_p3];
1724 P1 = particleHandler.getObject(index1);
1735 P1_P2_normal = Branch / dist;
1738 P1_P2_tangential = Force + fdotn * P1_P2_normal;
1742 P1_P2_tangential =
Vec3D(0, 0, 0);
1746 P1_P2_tangential /= fdott;
1749 gatherContactStatistics(index1, index2, Contact, delta, 0, fdotn, fdott, P1_P2_normal, -P1_P2_tangential);
1753 std::cout <<
"#wall forces=" << counter << std::endl;
1755 getline(p3w_file, dummyStr);
1757 std::cout << dummyStr << std::endl;
1762 template<StatType T>
1765 std::cout <<
"set " <<
" positions" << std::endl;
1766 int N = positions_.size();
1769 std::cout <<
"setting " << N <<
" positions" << std::endl;
1771 for (
int i = 0; i<N; i++) {
1772 Points[i].setPosition(positions_[i]);
1780 (getXMaxStat() - getXMinStat()) / nx,
1781 (getYMaxStat() - getYMinStat()) / ny,
1782 (getZMaxStat() - getZMinStat()) / nz);
1785 getXMaxStat() + getXMinStat(),
1786 getYMaxStat() + getYMinStat(),
1787 getZMaxStat() + getZMinStat());
1794 int num[3] = {0, 0, 0};
1795 if (getMirrorAtDomainBoundary() != 0.0)
1797 if (statType ==
X || statType ==
XY || statType ==
XZ || statType ==
XYZ)
1801 num[0] =
static_cast<int>(std::floor(std::max(getMirrorAtDomainBoundary(), getCutoff()) / diff.
X));
1803 Min.
X -= num[0] * diff.
X;
1805 if (statType ==
Y || statType ==
XY || statType ==
YZ || statType ==
XYZ)
1807 num[1] =
static_cast<int>(std::floor(std::max(getMirrorAtDomainBoundary(), getCutoff()) / diff.
Y));
1809 Min.
Y -= num[1] * diff.
Y;
1811 if (statType ==
Z || statType ==
XZ || statType ==
XZ || statType ==
XYZ)
1813 num[2] =
static_cast<int>(std::floor(std::max(getMirrorAtDomainBoundary(), getCutoff()) / diff.
Z));
1815 Min.
Z -= num[2] * diff.
Z;
1820 N = std::max(nx, 1) * std::max(ny, 1) * std::max(nz, 1);
1824 for (
int i = 0; i < std::max(nx, 1); i++)
1825 for (
int j = 0; j < std::max(ny, 1); j++)
1826 for (
int k = 0; k < std::max(nz, 1); k++)
1828 Points[n].setPosition(
Vec3D((nx > 1) ? (Min.
X + diff.
X * (i + 0.5)) : avg.
X,
1829 (ny > 1) ? (Min.
Y + diff.
Y * (j + 0.5)) : avg.
Y,
1830 (nz > 1) ? (Min.
Z + diff.
Z * (k + 0.5)) : avg.
Z));
1832 Points[n].setPosition(Points[n].getPosition()
1833 -
Vec3D((i % 2) ? (0.99 * diff.
X) : 0, (j % 2) ? (0.99 * diff.
Y) : 0, (k % 2) ? (0.99 * diff.
Z) : 0));
1834 if (getMirrorAtDomainBoundary() != 0.0)
if ((i < num[0]) || (i > nx - num[0]) || (j < num[1]) || (j > ny - num[1]) || (k < num[2]) || (k > nz - num[2]))
1836 Points[n].mirrorParticle = n +
1837 +((i < num[0]) ? (2 * (num[0] - i) - 1) * ny * nz : 0) + ((i > nx - num[0]) ? (2 * (nx - num[0] - i) + 1) * ny * nz : 0)
1838 + ((j < num[1]) ? (2 * (num[1] - j) - 1) * nz : 0) + ((j > ny - num[1]) ? (2 * (ny - num[1] - j) + 1) * nz : 0)
1839 + ((k < num[2]) ? (2 * (num[2] - k) - 1) : 0) + ((k > nz - num[2]) ? (2 * (nz - num[2] - k) + 1) : 0);
1844 if (statType ==
RAZ || statType ==
RZ || statType ==
RA || statType ==
AZ || statType ==
R || statType ==
A)
1846 for (
unsigned int k = 0; k < Points.size(); k++)
1848 Points[k].setPosition(Points[k].getPosition().getFromCylindricalCoordinates());
1852 for (
int i = 0; i<N; i++)
1854 Points[i].setCGInverseVolume();
1855 Points[i].set_zero();
1857 if (getDoGradient())
1862 for (
int n = 0; n < N; n++)
1864 dx[n].setPosition(Points[n].getPosition());
1865 dx[n].mirrorParticle = Points[n].mirrorParticle;
1867 dy[n].setPosition(Points[n].getPosition());
1868 dy[n].mirrorParticle = Points[n].mirrorParticle;
1870 dz[n].setPosition(Points[n].getPosition());
1871 dz[n].mirrorParticle = Points[n].mirrorParticle;
1877 if (getDoTimeAverage())
1879 timeAverage.resize(N);
1882 for (
int i = 0; i < std::max(nx, 1); i++)
1883 for (
int j = 0; j < std::max(ny, 1); j++)
1884 for (
int k = 0; k < std::max(nz, 1); k++)
1886 timeAverage[n].setPosition(Points[n].getPosition());
1887 timeAverage[n].set_zero();
1888 timeAverage[n].mirrorParticle = Points[n].mirrorParticle;
1893 if (getDoVariance())
1895 timeVariance.resize(N);
1896 for (
int n = 0; n < N; n++)
1898 timeVariance[n].setPosition(timeAverage[n].getPosition());
1899 timeVariance[n].mirrorParticle = Points[n].mirrorParticle;
1900 timeVariance[n].set_zero();
1904 if (getDoGradient())
1906 dxTimeAverage.resize(N);
1907 dyTimeAverage.resize(N);
1908 dzTimeAverage.resize(N);
1909 for (
int n = 0; n < N; n++)
1911 dxTimeAverage[n].setPosition(timeAverage[n].getPosition());
1912 dxTimeAverage[n].mirrorParticle = Points[n].mirrorParticle;
1913 dxTimeAverage[n].set_zero();
1914 dyTimeAverage[n].setPosition(timeAverage[n].getPosition());
1915 dyTimeAverage[n].mirrorParticle = Points[n].mirrorParticle;
1916 dyTimeAverage[n].set_zero();
1917 dzTimeAverage[n].setPosition(timeAverage[n].getPosition());
1918 dzTimeAverage[n].mirrorParticle = Points[n].mirrorParticle;
1919 dzTimeAverage[n].set_zero();
1926 template<StatType T>
1931 is.open(filename, std::fstream::in);
1932 if (!is.is_open() || is.bad())
1934 std::cout <<
"Loading positions file " << filename <<
" failed" << std::endl;
1940 positions_.resize(N);
1941 for (
int i=0; i<N; i++)
1943 is >> positions_[i];
1947 std::cout <<
"Loaded " << positions_.size() <<
" positions from file " << filename << std::endl;
1952 template<StatType T>
1957 fStatFile.openNextFile();
1959 std::cout <<
"Using fstat file counter: " << fStatFile.getCounter() << std::endl;
1966 getline(fStatFile.getFstream(), dummy);
1967 getline(fStatFile.getFstream(), dummy);
1968 getline(fStatFile.getFstream(), dummy);
1970 while ((fStatFile.getFstream().peek() != -1) && (fStatFile.getFstream().peek() !=
'#'))
1971 getline(fStatFile.getFstream(), dummy);
1975 template<StatType T>
1984 template<StatType T>
1987 Vec3D P1_P2_VelocityAverage, P1_P2_VelocityDifference, P1_P2_Force;
1989 if (check_current_time_for_statistics())
1992 if (particleHandler.getObject(index1)->isFixed())
1997 P1_P2_normal_ *= -1;
2000 if (satisfiesInclusionCriteria(particleHandler.getObject(index1)))
2002 P1_P2_normal = P1_P2_normal_;
2004 if (getSystemDimensions() == 2)
2009 P1_P2_distance = particleHandler.getObject(index1)->getRadius() - delta;
2011 P1 = Contact - P1_P2_normal * P1_P2_distance;
2012 norm_dist = P1_P2_distance;
2013 P1_P2_VelocityAverage = (particleHandler.getObject(index1)->getVelocity()) / 2;
2014 P1_P2_VelocityDifference = (particleHandler.getObject(index1)->getVelocity());
2016 if (StressTypeForFixedParticles == 3)
2019 P1_P2_distance += 300;
2021 P2 += 300 * P1_P2_normal;
2023 norm_dist = P1_P2_distance;
2026 else if (particleHandler.getObject(index2)->isFixed() || !satisfiesInclusionCriteria(particleHandler.getObject(index2)))
2028 if (particleHandler.getObject(index2)->isFixed() && StressTypeForFixedParticles == 3)
2031 P1_P2_distance = particleHandler.getObject(index1)->getRadius() + particleHandler.getObject(index2)->getRadius() - delta;
2032 P1 = Contact + P1_P2_normal * (0.5 * P1_P2_distance);
2033 P2 = Contact - P1_P2_normal * (0.5 * P1_P2_distance);
2034 if (P1_P2_normal.Z < 0)
2038 P1_P2_normal *= -1.0;
2042 P1_P2_distance = setInfinitelyLongDistance();
2044 P2 = P1 - P1_P2_normal * P1_P2_distance;
2045 if (P1_P2_normal.Z < 0)
2046 std::cout << P1_P2_distance <<
" z" << P1.Z <<
" " << P2.Z <<
" f" << fdotn << std::endl;
2049 else if (StressTypeForFixedParticles == 1 || (!particleHandler.getObject(index2)->isFixed() && StressTypeForFixedParticles == 3))
2052 P1_P2_distance = particleHandler.getObject(index1)->getRadius() + particleHandler.getObject(index2)->getRadius() - delta;
2053 P1 = Contact + P1_P2_normal * (0.5 * P1_P2_distance);
2056 P1_P2_distance = particleHandler.getObject(index1)->getRadius() - delta / 2;
2057 P2 = P1 - P1_P2_normal * P1_P2_distance;
2062 P1_P2_distance = particleHandler.getObject(index1)->getRadius() + particleHandler.getObject(index2)->getRadius() - delta;
2063 P1 = Contact + P1_P2_normal * (0.5 * P1_P2_distance);
2064 P2 = Contact - P1_P2_normal * (0.5 * P1_P2_distance);
2067 norm_dist = P1_P2_distance;
2069 P1_P2_VelocityAverage = particleHandler.getObject(index2)->getVelocity() / 2;
2070 P1_P2_VelocityDifference = -particleHandler.getObject(index2)->getVelocity();
2075 if (particleHandler.getObject(index2)->isFixed())
2076 std::cout <<
"ERROR" << std::endl;
2077 P1_P2_distance = particleHandler.getObject(index1)->getRadius() + particleHandler.getObject(index2)->getRadius() - delta;
2079 P1 = Contact + P1_P2_normal * (0.5 * P1_P2_distance);
2080 P2 = Contact - P1_P2_normal * (0.5 * P1_P2_distance);
2082 norm_dist = P1_P2_distance * particleHandler.getObject(index1)->getRadius() / (particleHandler.getObject(index2)->getRadius() + particleHandler.getObject(index1)->getRadius());
2083 P1_P2_VelocityAverage = (particleHandler.getObject(index1)->getVelocity() + particleHandler.getObject(index2)->getVelocity()) / 2;
2084 P1_P2_VelocityDifference = (particleHandler.getObject(index1)->getVelocity() - particleHandler.getObject(index2)->getVelocity());
2093 P1_P2_NormalStress =
Matrix3D::dyadic(P1_P2_normal, P1_P2_normal) * (fdotn * norm_dist);
2094 P1_P2_TangentialStress =
Matrix3D::dyadic(P1_P2_tangential, P1_P2_normal) * (fdott * norm_dist);
2095 P1_P2_NormalTraction = P1_P2_normal * fdotn;
2096 P1_P2_TangentialTraction = P1_P2_tangential * fdott;
2097 P1_P2_ContactCoupleStress =
Matrix3D::dyadic(P1_P2_NormalTraction + P1_P2_TangentialTraction, -0.5 * P1_P2_normal * norm_dist);
2098 P1_P2_Contact = Contact;
2100 P1_P2_Potential = 0.0;
2101 P1_P2_Force = fdotn * P1_P2_normal + fdott * P1_P2_tangential;
2102 P1_P2_Dissipation =
Vec3D::dot(P1_P2_VelocityDifference, P1_P2_Force) / 2;
2103 P1_P2_CollisionalHeatFlux = P1_P2_normal * (P1_P2_distance / 2 *
Vec3D::dot(P1_P2_VelocityAverage, fdotn * P1_P2_normal + fdott * P1_P2_tangential)) + P1_P2_Potential * P1_P2_VelocityAverage;
2105 P1_P2_distance *= sqrt(Points[0].dotNonAveraged(P1_P2_normal, P1_P2_normal));
2109 if (P1_P2_distance > 1e-12)
2110 P1_P2_normal = (P1 - P2) / P1_P2_distance;
2112 P1_P2_normal =
Vec3D(0.0, 0.0, 0.0);
2116 if (index2 < 0 || particleHandler.getObject(index2)->isFixed() || !satisfiesInclusionCriteria(particleHandler.getObject(index2)))
2120 if (StressTypeForFixedParticles != 0)
2122 evaluate_force_statistics();
2124 if (StressTypeForFixedParticles != 3 || !(index2 < 0 || particleHandler.getObject(index2)->isFixed()))
2127 if (StressTypeForFixedParticles == 0)
2135 evaluate_wall_force_statistics(P);
2140 evaluate_force_statistics();
2147 template<StatType T>
2153 fStatFile.openNextFile(std::fstream::in);
2154 getline(fStatFile.getFstream(), dummy);
2155 getline(fStatFile.getFstream(), dummy);
2156 getline(fStatFile.getFstream(), dummy);
2159 static int index1, index2;
2160 static Vec3D Contact;
2161 static Mdouble delta, ctheta, fdotn, fdott;
2162 static Vec3D P1_P2_normal_, P1_P2_tangential;
2168 while ((fStatFile.getFstream().peek() != -1) && (fStatFile.getFstream().peek() !=
'#'))
2184 fStatFile.getFstream()
2194 >> P1_P2_tangential;
2196 fStatFile.getFstream().ignore(256,
'\n');
2198 gatherContactStatistics(index1, index2, Contact, delta, ctheta, fdotn, fdott, P1_P2_normal_, P1_P2_tangential);
2202 std::cout <<
"#forces=" << counter <<
", t=" << time << std::endl;
2206 template<StatType T>
2212 for (
unsigned int k = wp; k < boundaryHandler.getNumberOfObjects(); k++)
2220 evaluate_force_statistics(k + 1);
2228 evaluate_force_statistics(k + 1);
2238 static unsigned int counter = 0;
2239 for (
unsigned int i = 0; i < Points.size(); i++)
2241 psi = Points[i].CG_integral(P1, P2, P1_P2_normal, P1_P2_distance, rpsi);
2245 if (!std::isfinite(psi))
2247 std::cerr <<
"error: psi =" << psi <<
" is infinite for "
2250 <<
", P1_P2_normal=" << P1_P2_normal
2251 <<
", P1_P2_distance=" << P1_P2_distance
2252 <<
", t=" << getTime() << std::endl;
2255 Points[i].ContactCoupleStress += (
Matrix3D::cross(P1_P2_Contact * psi, P1_P2_ContactCoupleStress) -
Matrix3D::cross(rpsi, P1_P2_ContactCoupleStress)) * (-0.5);
2256 Points[i].NormalStress += P1_P2_NormalStress * psi;
2257 Points[i].TangentialStress += P1_P2_TangentialStress * psi;
2258 Points[i].Fabric += P1_P2_Fabric * psi;
2259 Points[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * psi;
2260 Points[i].Dissipation += P1_P2_Dissipation * psi;
2261 Points[i].Potential += P1_P2_Potential * psi;
2262 if (getDoGradient())
2264 Vec3D d_psi = Points[i].CG_integral_gradient(P1, P2, P1_P2_normal, P1_P2_distance);
2266 dx[i].NormalStress += P1_P2_NormalStress * d_psi.
X;
2267 dx[i].TangentialStress += P1_P2_TangentialStress * d_psi.
X;
2268 dx[i].Fabric += P1_P2_Fabric * d_psi.
X;
2269 dx[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
X;
2270 dx[i].Dissipation += P1_P2_Dissipation * d_psi.
X;
2271 dx[i].Potential += P1_P2_Potential * d_psi.
X;
2273 dy[i].NormalStress += P1_P2_NormalStress * d_psi.
Y;
2274 dy[i].TangentialStress += P1_P2_TangentialStress * d_psi.
Y;
2275 dy[i].Fabric += P1_P2_Fabric * d_psi.
Y;
2276 dy[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
Y;
2277 dy[i].Dissipation += P1_P2_Dissipation * d_psi.
Y;
2278 dy[i].Potential += P1_P2_Potential * d_psi.
Y;
2280 dz[i].NormalStress += P1_P2_NormalStress * d_psi.
Z;
2281 dz[i].TangentialStress += P1_P2_TangentialStress * d_psi.
Z;
2282 dz[i].Fabric += P1_P2_Fabric * d_psi.
Z;
2283 dz[i].CollisionalHeatFlux += P1_P2_CollisionalHeatFlux * d_psi.
Z;
2284 dz[i].Dissipation += P1_P2_Dissipation * d_psi.
Z;
2285 dz[i].Potential += P1_P2_Potential * d_psi.
Z;
2293 template<StatType T>
2298 for (
unsigned int k = wp; k < boundaryHandler.getNumberOfObjects(); k++)
2305 evaluate_force_statistics(k + 1);
2312 for (
unsigned int i = 0; i < Points.size(); i++)
2314 phi = Points[i].CG_function(P);
2317 Points[i].NormalTraction += P1_P2_NormalTraction * phi;
2318 Points[i].TangentialTraction += P1_P2_TangentialTraction * phi;
2319 if (getDoGradient())
2322 Vec3D d_phi = Points[i].CG_gradient(P, phi);
2323 dx[i].NormalTraction += P1_P2_NormalTraction * d_phi.
X;
2324 dy[i].NormalTraction += P1_P2_NormalTraction * d_phi.
Y;
2325 dz[i].NormalTraction += P1_P2_NormalTraction * d_phi.
Z;
2326 dx[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
X;
2327 dy[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
Y;
2328 dz[i].TangentialTraction += P1_P2_TangentialTraction * d_phi.
Z;
2335 template<StatType T>
2338 if (check_current_time_for_statistics())
2341 for (
unsigned int i = 0; i < Points.size(); i++)
2342 Points[i].setCGInverseVolume();
2344 for (std::vector<BaseParticle*>::iterator P = particleHandler.begin(); P != particleHandler.end(); ++P)
2348 if ((!ignoreFixedParticles) && (*P)->isFixed())
2355 if (satisfiesInclusionCriteria(*P) && !(*P)->isFixed())
2357 evaluate_particle_statistics(P);
2364 template<StatType T>
2368 bool doDisplacement =
false;
2372 for (
unsigned int k = wp; k < boundaryHandler.getNumberOfObjects(); k++)
2381 evaluate_particle_statistics(P, k + 1);
2392 evaluate_particle_statistics(P, k + 1);
2402 if (VelocityProfile.size())
2403 V = getVelocityProfile((*P)->getPosition());
2405 for (
unsigned int i = 0; i < Points.size(); i++)
2407 phi = Points[i].CG_function((*P)->getPosition());
2410 if (!std::isfinite(phi))
2414 <<
"error: phi =" << phi
2415 <<
" is infinite for P=" << (*P)->getPosition()
2416 <<
", Point=" << Points[i].getPosition()
2420 Points[i].Nu += (*P)->getVolume() * phi;
2421 Points[i].Density += (*P)->getMass() * phi;
2422 if (VelocityProfile.size())
2424 Points[i].Momentum += ((*P)->getVelocity() - V) * ((*P)->getMass() * phi);
2429 Points[i].Momentum += (*P)->getVelocity() * ((*P)->getMass() * phi);
2432 Points[i].DisplacementMomentum += (*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()) * ((*P)->getMass() * phi);
2433 Points[i].DisplacementMomentumFlux +=
MatrixSymmetric3D::selfDyadic((*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount())) * ((*P)->getMass() * phi);
2434 Points[i].EnergyFlux += (*P)->getVelocity() * ((*P)->getMass() * (*P)->getVelocity().getLengthSquared() / 2 * phi);
2436 Vec3D LocalAngularMomentum =
Vec3D::cross(Points[0].clearAveragedDirections((*P)->getPosition() - Points[i].getPosition()), (*P)->getVelocity()) * (*P)->getMass()
2437 + (*P)->getAngularVelocity() * (*P)->getInertia();
2438 Points[i].LocalAngularMomentum += phi * LocalAngularMomentum;
2439 Points[i].LocalAngularMomentumFlux +=
Matrix3D::dyadic(LocalAngularMomentum, (*P)->getVelocity() * phi);
2442 if (getDoGradient())
2445 Vec3D d_phi = Points[i].CG_gradient((*P)->getPosition(), phi);
2450 for (std::vector<BaseParticle*>::iterator Q = particleHandler.begin(); Q != particleHandler.end(); ++Q)
2452 double phiQ = Points[i].CG_function((*Q)->getPosition());
2453 Points[i].Displacement +=
MatrixSymmetric3D::symmetrisedDyadic((*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()) - (*Q)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()), d_phi) * ((*P)->getMass() * (*Q)->getMass() * phiQ);
2458 dx[i].Nu += (*P)->getVolume() * d_phi.
X;
2459 dx[i].Density += (*P)->getMass() * d_phi.
X;
2460 dx[i].Momentum += (*P)->getVelocity() * ((*P)->getMass() * d_phi.
X);
2461 dx[i].DisplacementMomentum += (*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()) * ((*P)->getMass() * d_phi.
X);
2463 dx[i].DisplacementMomentumFlux +=
MatrixSymmetric3D::selfDyadic((*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount())) * ((*P)->getMass() * d_phi.
X);
2464 dx[i].EnergyFlux += (*P)->getVelocity() * ((*P)->getMass() * (*P)->getVelocity().getLengthSquared() / 2 * d_phi.
X);
2466 dy[i].Nu += (*P)->getVolume() * d_phi.
Y;
2467 dy[i].Density += (*P)->getMass() * d_phi.
Y;
2468 dy[i].Momentum += (*P)->getVelocity() * ((*P)->getMass() * d_phi.
Y);
2469 dy[i].DisplacementMomentum += (*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()) * ((*P)->getMass() * d_phi.
Y);
2471 dy[i].DisplacementMomentumFlux +=
MatrixSymmetric3D::selfDyadic((*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount())) * ((*P)->getMass() * d_phi.
Y);
2472 dy[i].EnergyFlux += (*P)->getVelocity() * ((*P)->getMass() * (*P)->getVelocity().getLengthSquared() / 2 * d_phi.
Y);
2474 dz[i].Nu += (*P)->getVolume() * d_phi.
Z;
2475 dz[i].Density += (*P)->getMass() * d_phi.
Z;
2476 dz[i].Momentum += (*P)->getVelocity() * ((*P)->getMass() * d_phi.
Z);
2477 dz[i].DisplacementMomentum += (*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount()) * ((*P)->getMass() * d_phi.
Z);
2479 dz[i].DisplacementMomentumFlux +=
MatrixSymmetric3D::selfDyadic((*P)->getDisplacement2(getXMin(), getXMax(), getYMin(), getYMax(), getZMin(), getZMax(), getTimeStep() * dataFile.getSaveCount())) * ((*P)->getMass() * d_phi.
Z);
2480 dz[i].EnergyFlux += (*P)->getVelocity() * ((*P)->getMass() * (*P)->getVelocity().getLengthSquared() / 2 * d_phi.
Z);
2599 return std::min(std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2600 std::max((getXMaxStat() - P2.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P2.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X)),
2601 std::max((getYMaxStat() - P2.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P2.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y));
2605 return std::min(std::max((getYMaxStat() - P2.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P2.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y),
2606 std::max((getXMaxStat() - P2.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P2.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X));
2610 return std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2611 std::max((getXMaxStat() - P2.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P2.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X));
2615 return std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2616 std::max((getYMaxStat() - P2.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P2.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y));
2620 return std::max((getXMaxStat() - P2.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P2.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X);
2624 return std::max((getYMaxStat() - P2.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P2.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y);
2629 return std::min(std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2630 std::max((getXMaxStat() - P1.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P1.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X)),
2631 std::max((getYMaxStat() - P1.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P1.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y));
2635 return std::min(std::max((getYMaxStat() - P1.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P1.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y),
2636 std::max((getXMaxStat() - P1.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P1.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X));
2640 return std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2641 std::max((getXMaxStat() - P1.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P1.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X));
2645 return std::min(fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z),
2646 std::max((getYMaxStat() - P1.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P1.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y));
2650 return std::max((getXMaxStat() - P1.X + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X, -(P1.X - getXMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.X);
2654 return std::max((getYMaxStat() - P1.Y + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y, -(P1.Y - getYMinStat() + 5 * sqrt(getCGWidthSquared())) / P1_P2_normal.Y);
2658 return fabs((P1.Z - getZMinStat() + 5 * getCGWidth()) / P1_P2_normal.Z);
2665 template<StatType T>
2668 if (statFile.saveCurrentTimestep(getNtimeSteps()))
2672 processStatistics(
true);
StatisticsVector()
Basic constructor only calls constructor()
void readStatArguments(int argc, char *argv[])
bool periodicWalls
Turns off periodic walls before evaluation (needed for averaging, because we do not yet check if part...
StatisticsPoint< T > average(std::vector< StatisticsPoint< T > > &P)
Output average of statistical variables.
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
virtual void write(std::ostream &os, bool writeAllParticles=true) const
Loads all MD data and plots statistics for all timesteps in the .data file.
Mdouble getDistance(BaseParticle &p)
Returns the distance of the wall to the particle.
std::string printStat()
Outputs member variable values to a std::string.
The DPMBase header includes quite a few header files, defining all the handlers, which are essential...
Mdouble X
the vector components
each time-step will be written into/read from separate files numbered consecutively, with numbers padded by zeros to a minimum of four digits: name_.0000, name_.0001, ..
bool walls
Turns off walls before evaluation.
StatType statType
Possible values X,Y,Z,XY,XZ,YZ,XYZ,RAZ,RA,RZ,AZ,R,A are used to determine if the statistics are avera...
void initialiseStatistics()
Initializes statistics, i.e. setting w2, setting the grid and writing the header lines in the ...
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
void write_time_average_statistics()
Writes out time averaged statistics.
void shiftPositions(Vec3D &P1, Vec3D &P2)
only needed in StatisticsVector
void shiftPosition(BaseParticle *p)
shifts the particle
void processStatistics(bool usethese)
Processes all gathered statistics and resets them afterwards. (Processing means either calculating ti...
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 domain is set to the domain of the MD problem (indicated by setting the stat-domain va...
void constructor()
this is the actual constructor, sets up all basic things
bool loadPositions(const char *filename)
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.
bool readNextDataFile(unsigned int format)
void jump_p3c()
get force statistics from particle collisions
void setCGShape(const char *new_)
std::vector< StatisticsPoint< T > > dx
A vector that stores the gradient in x of all statistical variables at a given position.
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
virtual void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
void setSystemDimensions(unsigned int newDim)
Allows for the dimension of the simulation to be changed.
void evaluate_wall_force_statistics(Vec3D P, int wp=0)
get force statistics (i.e. first particle is a wall particle)
T square(T val)
squares a number
int nx
Grid size nx,ny,nz (by default the points of evaluation are placed in an grid on the domain [xminStat...
virtual void outputXBallsData(std::ostream &os) const
This function writes the location of the walls and particles in a format the XBalls program can read...
Mdouble getLengthSquared() const
Calculates the squared length of this Vec3D: .
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
bool read_next_from_p3p_file()
Defines a pair of periodic walls. Inherits from BaseBoundary.
CG
enum used to store the type of coarse-graining function used
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
int nTimeAverage
A counter needed to average over time.
void setCGWidth2(Mdouble new_)
Set CG variables w2 and CG_invvolume.
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::vector< StatisticsPoint< T > > dzTimeAverage
a vector used to sum up all statistical gradients in dz for time-averaging
Mdouble indSpecies
defines the species for which statistics are extracted (-1 for all species)
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 tminStat
Statistical output will only be created if t>tminStat.
Mdouble rmin
defines the minimum radius of the particles for which statistics are extracted
Vec3D getVelocityProfile(Vec3D Position)
NORMALIZED_POLYNOMIAL< T > CGPolynomial
Stores the Polynomial, if the cg function is an axisymmetric function Polynomial in r...
all data will be written into/ read from a single file called name_
static Matrix3D cross(const Vec3D &a, const Matrix3D &b)
'Special' cross product; CP of vector with each column of a matrix
void statistics_from_fstat_and_data()
get StatisticsPoint
void evaluate_particle_statistics(std::vector< BaseParticle * >::iterator P, int wp=0)
Calculates statistics for a single Particle.
virtual void writeXBallsScript() const
This writes a script which can be used to load the xballs problem to display the data just generated...
Mdouble distance(const BaseParticle &P)
Returns the distance of the wall to the particle and sets left_wall = true, if the left wall is the w...
int format
format of the data input file
bool doTimeAverage
Determines if output is averaged over time.
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Mdouble getRadius() const
Returns the particle's radius_.
bool readNextDataFile(unsigned int format=0)
Reads the next data file with default format=0. However, one can modify the format based on whether t...
std::vector< StatisticsPoint< T > > timeVariance
a vector used to sum up the variance in time of all statistical values
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Mdouble mirrorAtDomainBoundary
0: Statistics near the wall are equal to statistics away from the wall; 1: Statistics are mirrored at...
bool doVariance
Determines if variance is outputted.
static MatrixSymmetric3D symmetrisedDyadic(const Vec3D &a, const Vec3D &b)
Calculates the symmetrised dyadic product of two Vec3D: .
std::vector< StatisticsPoint< T > > Points
A vector that stores the values of the statistical variables at a given position. ...
static MatrixSymmetric3D selfDyadic(const Vec3D &a)
Calculates the dyadic product of a Vec3D with itself: .
void shiftPositions(Vec3D &postition1, Vec3D &postion2)
shifts two positions
Mdouble getLength() const
Calculates the length of this Vec3D: .
int verbosity
Determines how much is outputted to the terminal.
void outputStatistics()
Calculates statistics for Particles (i.e. not collisions)
CG CG_type
coarse graining type (Gaussian, Heaviside, Polynomial)
void gatherContactStatistics()
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.
virtual void writeRestartFile()
Stores all the particle data for current save time step. Calls the write function.
void writeOutputFiles()
Writes the simulation data onto all the files i.e. .data, .ene, .fstat ...
std::vector< StatisticsPoint< T > > timeAverage
A vector used to sum up all statistical values in Points for time-averaging.
each time-step will be written into/read from separate files numbered consecutively: name_...
Contains material and contact force properties.
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.
unsigned int getIndSpecies() const
Returns the index of the Species of this BaseInteractable.
void finishStatistics()
Finish all statistics (i.e. write out final data)
bool ignoreFixedParticles
Determines if fixed particles contribute to particle statistics (density, ...)
void setPositions()
Set position of StatisticsPoint points and set variables to 0.
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::setCGShape
Implementation of a 3D vector (by Vitaliy).
bool openFile(std::fstream &file, std::string filename, std::fstream::openmode mode)
Provides a simple interface for opening a file.
int StressTypeForFixedParticles
Stress type for fixed particles.
void shiftPosition(BaseParticle *P)
shifts the particle (after distance set the left_wall value)
Mdouble rmax
defines the maximum radius of the particles for which statistics are extracted
Mdouble getTime() const
Access function for the time.
std::string print_CG()
Output coarse graining variables.
bool doGradient
Determines if gradient is outputted.
void gather_force_statistics_from_p3c(int version)
get force statistics from particle collisions
int nxMirrored
extension of grid size from mirrored points