28 else if (S==
Gaussian) os <<
"Gaussian";
41 DisplacementMomentum.set_zero();
42 Displacement.set_zero();
43 MomentumFlux.set_zero();
44 DisplacementMomentumFlux.set_zero();
45 EnergyFlux.set_zero();
46 TangentialStress.set_zero();
47 NormalStress.set_zero();
48 TangentialStress.set_zero();
49 NormalTraction.set_zero();
50 TangentialTraction.set_zero();
52 CollisionalHeatFlux.set_zero();
55 LocalAngularMomentum.set_zero();
56 LocalAngularMomentumFlux.set_zero();
57 ContactCoupleStress.set_zero();
110 template <StatType T>
135 template <StatType T>
160 template <StatType T>
166 DisplacementMomentum /= a;
169 DisplacementMomentumFlux /= a;
172 TangentialStress /= a;
174 TangentialTraction /= a;
176 CollisionalHeatFlux /= a;
179 LocalAngularMomentum /= a;
180 LocalAngularMomentumFlux /= a;
181 ContactCoupleStress /= a;
186 template <StatType T>
192 DisplacementMomentum.set_zero();
193 Displacement.set_zero();
194 DisplacementMomentumFlux.set_zero();
196 DisplacementMomentum /= n-1;
198 DisplacementMomentumFlux /= n-1;
203 TangentialStress /= n;
205 TangentialTraction /= n;
207 CollisionalHeatFlux /= n;
210 LocalAngularMomentum /= n;
211 LocalAngularMomentumFlux /= n;
212 ContactCoupleStress /= n;
215 template <StatType T>
217 return sqr(P.
X-Position.X)+
sqr(P.
Y-Position.Y)+
sqr(P.
Z-Position.Z);
232 template <StatType T>
234 return P.
X*Q.
X + P.
Y*Q.
Y + P.
Z*Q.
Z;
237 template <StatType T>
239 Mdouble dist2 = get_distance2(PI);
241 return (get_w2()<dist2)?0.0:get_CG_invvolume();
242 }
else if (get_CG_type()==
Gaussian) {
243 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume() * exp(-dist2/(2.0*get_w2()));
245 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume()*evaluatePolynomial(sqrt(dist2)/get_cutoff());
246 }
else { std::cerr <<
"error in CG_function" << std::endl; exit(-1); }
250 template <StatType T>
252 Mdouble dist2 = get_distance2(PI);
254 if (get_w2()<dist2)
return 0.0;
256 Mdouble wn = sqrt(get_w2()-dist2);
257 return get_CG_invvolume()*2.0*wn;
261 }
else if (get_CG_type()==
Gaussian) {
262 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume() * exp(-dist2/(2.0*get_w2()));
264 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume()*evaluatePolynomial(sqrt(dist2)/get_cutoff());
265 }
else { std::cerr <<
"error in CG_function_2D" << std::endl; exit(-1); }
268 template <StatType T>
270 Mdouble dist2 = get_distance2(PI);
272 return (get_w2()<dist2)?0.0:(get_CG_invvolume()*
constants::pi*(get_w2()-dist2));
273 }
else if (get_CG_type()==
Gaussian) {
274 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume() * exp(-dist2/(2.0*get_w2()));
276 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume()*evaluatePolynomial(sqrt(dist2)/get_cutoff());
277 }
else { std::cerr <<
"error in CG_function_1D" << std::endl; exit(-1); }
280 template <StatType T>
284 return (P-Position)*(phi/get_w2());
286 Mdouble r=GetLength(Position-P)/get_w();
287 return get_CG_invvolume()*evaluatePolynomialGradient(r)/r/get_w2()*(Position-P);
288 }
else { std::cerr <<
"error in CG_gradient" << std::endl; exit(-1); }
292 template <StatType T>
294 Vec3D P_P1 = Position - P1;
295 Vec3D P_P2 = Position - P2;
296 Mdouble a = dot(P_P1,P1_P2_normal);
297 Mdouble b = dot(P_P2,P1_P2_normal);
298 Vec3D tangential = P_P1 - a * P1_P2_normal;
301 Mdouble wsq2 = sqrt(2*get_w2());
303 return Vec3D(0.0,0.0,(exp(-
sqr(a/wsq2))-exp(-
sqr(b/wsq2)))/f/(P2.Z-P1.Z));
305 double wn2 = get_w2() - dot(tangential,tangential);
306 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
310 double wn = sqrt(wn2);
312 double delta = w*1e-3;
313 double I = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
315 Vec3D delta_P_P2 = P_P2 +Vec3D(delta,0,0);
316 a = dot(delta_P_P1,P1_P2_normal);
317 b = dot(delta_P_P2,P1_P2_normal);
318 tangential = delta_P_P1 - a * P1_P2_normal;
319 wn = sqrt(get_w2() - dot(tangential,tangential));
320 double Ix = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
321 delta_P_P1 = P_P1 +Vec3D(0,delta,0);
322 delta_P_P2 = P_P2 +Vec3D(0,delta,0);
323 a = dot(delta_P_P1,P1_P2_normal);
324 b = dot(delta_P_P2,P1_P2_normal);
325 tangential = delta_P_P1 - a * P1_P2_normal;
326 wn = sqrt(get_w2() - dot(tangential,tangential));
327 double Iy = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
328 delta_P_P1 = P_P1 +Vec3D(0,0,delta);
329 delta_P_P2 = P_P2 +Vec3D(0,0,delta);
330 a = dot(delta_P_P1,P1_P2_normal);
331 b = dot(delta_P_P2,P1_P2_normal);
332 tangential = delta_P_P1 - a * P1_P2_normal;
333 wn = sqrt(get_w2() - dot(tangential,tangential));
334 double Iz = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
335 return Vec3D(Ix-I,Iy-I,Iz-I)/delta;
337 }
else {
return Vec3D(0,0,0);}
342 template <StatType T>
344 Vec3D P_P1 = Position - P1;
345 Vec3D P_P2 = Position - P2;
346 Mdouble a = dot(P_P1,P1_P2_normal);
347 Mdouble b = dot(P_P2,P1_P2_normal);
348 Vec3D tangential = P_P1 - a * P1_P2_normal;
351 Mdouble wsq2 = sqrt(2*get_w2());
353 return (exp(-
sqr(a/wsq2))-exp(-
sqr(b/wsq2)))/f/(P2.Z-P1.Z);
355 double wn2 = get_w2() - dot(tangential,tangential);
356 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
358 }
else if ((P1_P2_distance<1e-12)|(GetLength2(tangential)<1e-24)) {
360 std::cout <<
"normal is parallel to the averaging direction: "
361 <<
" P1_P2_distance " << P1_P2_distance
362 <<
" tangential " << tangential << std::endl;
366 double wn = sqrt(wn2);
369 double delta = w*3e-6;
371 Vec3D delta_P_P1 = P_P1 +
Vec3D(delta,delta,delta);
372 Vec3D delta_P_P2 = P_P2 +Vec3D(delta,delta,delta);
373 a = dot(delta_P_P1,P1_P2_normal);
374 b = dot(delta_P_P2,P1_P2_normal);
375 tangential = delta_P_P1 - a * P1_P2_normal;
376 wn = sqrt(get_w2() - dot(tangential,tangential));
377 double I2 = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,dot(tangential,tangential)/w)*w / P1_P2_distance;
379 delta_P_P1 = P_P1 -Vec3D(delta,delta,delta);
380 delta_P_P2 = P_P2 -Vec3D(delta,delta,delta);
381 a = dot(delta_P_P1,P1_P2_normal);
382 b = dot(delta_P_P2,P1_P2_normal);
383 tangential = delta_P_P1 - a * P1_P2_normal;
384 wn = sqrt(get_w2() - dot(tangential,tangential));
385 double I1 = get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,dot(tangential,tangential)/w)*w / P1_P2_distance;
387 return (I2-I1)/(2.*delta);
398 template <StatType T>
403 Vec3D P_P1 = Position - P1;
404 Mdouble a = dot(P_P1,P1_P2_normal);
405 if ( a > get_cutoff() )
return 0.0;
406 Vec3D P_P2 = Position - P2;
407 Mdouble b = dot(P_P2,P1_P2_normal);
408 if ( -b > get_cutoff() )
return 0.0;
410 Vec3D tangential = P_P1 - a * P1_P2_normal;
411 if (dot(tangential,tangential)>get_cutoff2())
return 0.0;
414 Mdouble wn2 = get_w2() - dot(tangential,tangential);
415 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
419 return get_CG_invvolume()*( std::min(b,wn)-std::max(a,-wn) ) / P1_P2_distance;
421 }
else if (get_CG_type()==
Gaussian) {
422 static Mdouble InvVolumeExp = compute_Gaussian_invvolume(gb->get_dim_particle()-1);
424 static Mdouble P1_P2_distance_for_cutoff=-1, InvVolumeErf=-1;
425 if (P1_P2_distance_for_cutoff!=P1_P2_distance) {
426 P1_P2_distance_for_cutoff = P1_P2_distance;
428 Mdouble bmax = get_cutoff()+P1_P2_distance;
429 InvVolumeErf = P1_P2_distance/(
430 erf(bmax/w_sqrt_2)*bmax+w_sqrt_2/
constants::sqrt_pi*exp(-bmax*bmax/(w_sqrt_2*w_sqrt_2))
431 -erf(amax/w_sqrt_2)*amax-w_sqrt_2/
constants::sqrt_pi*exp(-amax*amax/(w_sqrt_2*w_sqrt_2)));
434 Mdouble psi=exp(-dot(tangential,tangential)/(2.0*get_w2())) * InvVolumeExp
435 * ( erf(b/w_sqrt_2) - erf(a/w_sqrt_2) ) * InvVolumeErf /2./P1_P2_distance;
439 double wn2 = get_w2() - dot(tangential,tangential);
440 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
443 double wn = sqrt(wn2);
445 return get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
448 }
else { std::cerr <<
"error in CG_integral" << std::endl; exit(-1); }
452 template <StatType T>
456 Vec3D P_P1 = Position - P1;
457 Mdouble a = dot(P_P1,P1_P2_normal);
458 if ( a > get_cutoff() )
return 0.0;
459 Vec3D P_P2 = Position - P2;
460 Mdouble b = dot(P_P2,P1_P2_normal);
461 if ( -b > get_cutoff() )
return 0.0;
463 Vec3D tangential = P_P1 - a * P1_P2_normal;
464 if (dot(tangential,tangential)>get_cutoff2())
return 0.0;
466 Mdouble wn2 = get_w2() - dot(tangential,tangential);
467 if ((wn2<=0) || (a*fabs(a)>=wn2) || (b*fabs(b)<=-wn2)) {
472 if (std::max(fabs(a),fabs(b))<1e-20) {
473 return get_CG_invvolume() * 2 * wn;
475 return get_CG_invvolume() / P1_P2_distance
479 }
else if (get_CG_type()==
Gaussian) {
480 if (dot(P1_P2_normal,P1_P2_normal)<1e-20) {
483 return get_CG_invvolume() * exp(-dot(P_P1,P_P1)/(2.0*get_w2()));
485 static Mdouble InvVolumeExp = compute_Gaussian_invvolume(gb->get_dim_particle()-2);
487 static Mdouble P1_P2_distance_for_cutoff=-1, InvVolumeErf=-1;
488 if (P1_P2_distance_for_cutoff!=P1_P2_distance) {
489 P1_P2_distance_for_cutoff = P1_P2_distance;
491 Mdouble bmax = get_cutoff()+P1_P2_distance;
492 InvVolumeErf = P1_P2_distance/(
493 erf(bmax/w_sqrt_2)*bmax+w_sqrt_2/
constants::sqrt_pi*exp(-bmax*bmax/(w_sqrt_2*w_sqrt_2))
494 -erf(amax/w_sqrt_2)*amax-w_sqrt_2/
constants::sqrt_pi*exp(-amax*amax/(w_sqrt_2*w_sqrt_2))
495 ) / averagingVolume();
500 Mdouble psi = exp(-dot(tangential,tangential)/(2.0*get_w2())) * InvVolumeExp
501 * ( erf(b/w_sqrt_2) - erf(a/w_sqrt_2) ) * InvVolumeErf /2./P1_P2_distance;
502 Mdouble phi1 = get_CG_invvolume() * exp(-dot(P_P1,P_P1)/(2.0*get_w2()));
503 Mdouble phi2 = get_CG_invvolume() * exp(-dot(P_P2,P_P2)/(2.0*get_w2()));
504 rpsi_scalar = -a/P1_P2_distance*psi + get_w2()/P1_P2_distance/P1_P2_distance*(phi1-phi2);
507 double wn2 = get_w2() - dot(tangential,tangential);
508 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
510 }
else if (P1_P2_distance<1e-20) {
512 return CG_function_1D(P_P1);
514 double wn = sqrt(wn2);
516 return get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,tangential.
GetLength()/w)*w / P1_P2_distance;
519 }
else { std::cerr <<
"error in CG_integral_2D" << std::endl; exit(-1); }
523 template <StatType T>
527 Vec3D P_P1 = Position - P1;
528 Mdouble a = dot(P_P1,P1_P2_normal);
529 if ( a > get_cutoff() )
return 0.0;
530 Vec3D P_P2 = Position - P2;
531 Mdouble b = dot(P_P2,P1_P2_normal);
532 if ( -b > get_cutoff() )
return 0.0;
534 Vec3D tangential = P_P1 - a * P1_P2_normal;
535 if (dot(tangential,tangential)>get_cutoff2())
return 0.0;
537 Mdouble wn2 = get_w2() - dot(tangential,tangential);
538 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
542 if (std::max(fabs(a),fabs(b))<1e-20) {
546 return get_CG_invvolume() / P1_P2_distance
550 }
else if (get_CG_type()==
Gaussian) {
551 if (fabs(b-a)<1e-20) {
552 return get_CG_invvolume() * exp(-dot(P_P1,P_P1)/(2.0*get_w2()));
555 static Mdouble P1_P2_distance_for_cutoff=-1, InvVolumeErf=-1;
556 if (P1_P2_distance_for_cutoff!=P1_P2_distance) {
557 P1_P2_distance_for_cutoff = P1_P2_distance;
559 Mdouble bmax = get_cutoff()+P1_P2_distance;
560 InvVolumeErf = P1_P2_distance/(
561 erf(bmax/w_sqrt_2)*bmax+w_sqrt_2/
constants::sqrt_pi*exp(-bmax*bmax/(w_sqrt_2*w_sqrt_2))
562 -erf(amax/w_sqrt_2)*amax-w_sqrt_2/
constants::sqrt_pi*exp(-amax*amax/(w_sqrt_2*w_sqrt_2))
563 ) / averagingVolume();
567 Mdouble psi = ( erf(b/w_sqrt_2) - erf(a/w_sqrt_2) ) * InvVolumeErf /2./P1_P2_distance;
568 Mdouble phi1 = get_CG_invvolume() * exp(-dot(P_P1,P_P1)/(2.0*get_w2()));
569 Mdouble phi2 = get_CG_invvolume() * exp(-dot(P_P2,P_P2)/(2.0*get_w2()));
570 rpsi_scalar = -a/P1_P2_distance*psi + get_w2()/P1_P2_distance/P1_P2_distance*(phi1-phi2);
574 double wn2 = get_w2() - dot(tangential,tangential);
575 if ((wn2<=0) | (a*fabs(a)>=wn2) | (b*fabs(b)<=-wn2)) {
577 }
else if ((P1_P2_distance<1e-12)|(GetLength2(tangential)<1e-24)) {
583 return CG_function_1D(P1);
585 double wn = sqrt(wn2);
587 return get_CG_invvolume()*evaluateIntegral(std::max(a,-wn)/w,std::min(b,wn)/w,dot(tangential,tangential)/w)*w / P1_P2_distance;
589 }
else { std::cerr <<
"error in CG_integral_1D" << std::endl; exit(-1); }
590 std::cout<<
"eind testje"<< rpsi_scalar<<std::endl;
593 template <StatType T>
595 std::stringstream ss;
601 <<
"DisplacementMomentumX "
602 <<
"DisplacementMomentumY "
603 <<
"DisplacementMomentumZ "
616 <<
"DisplacementMomentumFluxXX "
617 <<
"DisplacementMomentumFluxXY "
618 <<
"DisplacementMomentumFluxXZ "
619 <<
"DisplacementMomentumFluxYY "
620 <<
"DisplacementMomentumFluxYZ "
621 <<
"DisplacementMomentumFluxZZ "
634 <<
"TangentialStressXX "
635 <<
"TangentialStressXY "
636 <<
"TangentialStressXZ "
637 <<
"TangentialStressYX "
638 <<
"TangentialStressYY "
639 <<
"TangentialStressYZ "
640 <<
"TangentialStressZX "
641 <<
"TangentialStressZY "
642 <<
"TangentialStressZZ "
643 <<
"NormalTractionX "
644 <<
"NormalTractionY "
645 <<
"NormalTractionZ "
646 <<
"TangentialTractionX "
647 <<
"TangentialTractionY "
648 <<
"TangentialTractionZ "
655 <<
"CollisionalHeatFluxX "
656 <<
"CollisionalHeatFluxY "
657 <<
"CollisionalHeatFluxZ "
660 <<
"LocalAngularMomentumX "
661 <<
"LocalAngularMomentumY "
662 <<
"LocalAngularMomentumZ "
663 <<
"LocalAngularMomentumFluxXX "
664 <<
"LocalAngularMomentumFluxXY "
665 <<
"LocalAngularMomentumFluxXZ "
666 <<
"LocalAngularMomentumFluxYX "
667 <<
"LocalAngularMomentumFluxYY "
668 <<
"LocalAngularMomentumFluxYZ "
669 <<
"LocalAngularMomentumFluxZX "
670 <<
"LocalAngularMomentumFluxZY "
671 <<
"LocalAngularMomentumFluxZZ "
672 <<
"ContactCoupleStressXX "
673 <<
"ContactCoupleStressXY "
674 <<
"ContactCoupleStressXZ "
675 <<
"ContactCoupleStressYX "
676 <<
"ContactCoupleStressYY "
677 <<
"ContactCoupleStressYZ "
678 <<
"ContactCoupleStressZX "
679 <<
"ContactCoupleStressZY "
680 <<
"ContactCoupleStressZZ ";
684 template <StatType T>
687 std::stringstream ss;
689 <<
", Density " << Density
690 <<
",\n Momentum " << Momentum
691 <<
",\n DisplacementMomentum " << DisplacementMomentum
692 <<
",\n Displacement " << Displacement
693 <<
",\n MomentumFlux " << MomentumFlux
694 <<
",\n DisplacementMomentumFlux " << DisplacementMomentumFlux
695 <<
",\n EnergyFlux " << EnergyFlux
696 <<
",\n NormalStress " << NormalStress
697 <<
",\n TangentialStress " << TangentialStress
698 <<
",\n NormalTraction " << NormalTraction
699 <<
",\n TangentialTraction " << TangentialTraction
700 <<
",\n Fabric " << Fabric
701 <<
",\n CollisionalHeatFlux " << CollisionalHeatFlux
702 <<
",\n Dissipation " << Dissipation
703 <<
",\n Potential " << Potential
704 <<
",\n LocalAngularMomentum " << LocalAngularMomentum
705 <<
",\n LocalAngularMomentumFlux " << LocalAngularMomentumFlux
706 <<
",\n ContactCoupleStress " << ContactCoupleStress;
710 template <StatType T>
713 std::stringstream ss;
714 ss<<
"Nu " << sqrt(Nu)
715 <<
", Density " << sqrt(Density)
716 <<
", Momentum " << sqrt(Momentum)
717 <<
", DisplacementMomentum " << sqrt(DisplacementMomentum)
718 <<
", Displacement " << sqrt(Displacement)
719 <<
", MomentumFlux " << sqrt(MomentumFlux)
720 <<
", DisplacementMomentumFlux " << sqrt(DisplacementMomentumFlux)
721 <<
", EnergyFlux " << sqrt(EnergyFlux)
722 <<
", NormalStress " << sqrt(NormalStress)
723 <<
", TangentialStress " << sqrt(TangentialStress)
724 <<
", NormalTraction " << sqrt(NormalTraction)
725 <<
", TangentialTraction " << sqrt(TangentialTraction)
726 <<
", Fabric " << sqrt(Fabric)
727 <<
", CollisionalHeatFlux " << sqrt(CollisionalHeatFlux)
728 <<
", Dissipation " << sqrt(Dissipation)
729 <<
", Potential " << sqrt(Potential)
730 <<
", LocalAngularMomentum " << LocalAngularMomentum
731 <<
", LocalAngularMomentumFlux " << LocalAngularMomentumFlux
732 <<
", ContactCoupleStress " << ContactCoupleStress;
737 template <StatType T>
740 std::stringstream ss;
745 <<
" " << DisplacementMomentum
746 <<
" " << Displacement
747 <<
" " << MomentumFlux
748 <<
" " << DisplacementMomentumFlux
750 <<
" " << NormalStress
751 <<
" " << TangentialStress
752 <<
" " << NormalTraction
753 <<
" " << TangentialTraction
755 <<
" " << CollisionalHeatFlux
756 <<
" " << Dissipation
758 <<
" " << LocalAngularMomentum
759 <<
" " << LocalAngularMomentumFlux
760 <<
" " << ContactCoupleStress;
764 template <StatType T>
766 CG_invvolume = compute_Gaussian_invvolume(dim);
769 template <StatType T>
771 if (dim==0) {
return 1.; }
777 CG_invvolume =
cubic(CG_invvolume);
782 CG_invvolume =
sqr(CG_invvolume);
784 CG_invvolume /= 1-exp( -get_cutoff2() / (2*get_w2()) );
791 template <StatType T>
794 CG_invvolume = 1.0/(4.0/3.0*
constants::pi*sqrt(get_w2())*get_w2());
797 template <StatType T>
799 if (dim==3) CG_invvolume = 1.0/(sqrt(get_w2())*get_w2());
800 else if (dim==2) CG_invvolume = 1.0/get_w2();
801 else CG_invvolume = 1.0/sqrt(get_w2());
806 set_Heaviside_invvolume();
807 }
else if (get_CG_type()==
Gaussian) {
808 set_Gaussian_invvolume(nonaveragedDim());
810 set_Polynomial_invvolume(nonaveragedDim());
811 }
else { std::cerr <<
"error in CG_function" << std::endl; exit(-1); }
812 CG_invvolume /= averagingVolume();
835 return ((gb->get_dim_particle()!=3)?(1.0):(get_zmaxStat()-get_zminStat()));
838 return (get_ymaxStat()-get_yminStat());
841 return (get_xmaxStat()-get_xminStat());
844 return (get_ymaxStat()-get_yminStat())
845 * ((gb->get_dim_particle()!=3)?(1.0):(get_zmaxStat()-get_zminStat()));
848 return (get_xmaxStat()-get_xminStat())
849 * ((gb->get_dim_particle()!=3)?(1.0):(get_zmaxStat()-get_zminStat()));
852 return (get_xmaxStat()-get_xminStat())
853 * (get_ymaxStat()-get_yminStat());
856 return (get_xmaxStat()-get_xminStat())
857 * (get_ymaxStat()-get_yminStat())
858 * ((gb->get_dim_particle()!=3)?(1.0):(get_zmaxStat()-get_zminStat()));
868 return CG_function_2D(PI);
871 Mdouble dist2 = get_distance2(PI);
876 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume()
877 * exp(-(R2+RI2+Z2)/(2.0*get_w2())) *
besselFunc::I0(sqrt(R2*RI2)/get_w2());
878 }
else { std::cerr <<
"error in CG_function<RZ>" << std::endl; exit(-1); }
881 std::cerr <<
"error in CG_function<AZ>" << std::endl; exit(-1);
884 Mdouble dist2 = get_distance2(PI);
888 return (get_cutoff2()<dist2)?0.0:get_CG_invvolume()
889 * exp(-(R2+RI2)/(2.0*get_w2())) *
besselFunc::I0(sqrt(R2*RI2)/get_w2());
890 }
else { std::cerr <<
"error in CG_function<R>" << std::endl; exit(-1); }
893 std::cerr <<
"error in CG_function<A>" << std::endl; exit(-1);
897 return CG_function_2D(PI);
900 return CG_function_2D(PI);
903 return CG_function_2D(PI);
906 return CG_function_1D(PI);
909 return CG_function_1D(PI);
912 return CG_function_1D(PI);
915 return get_CG_invvolume();
921 return Vec3D(0.0,P.
Y - Position.Y,P.
Z - Position.Z)*(phi/get_w2());
922 }
else { std::cerr <<
"error in CG_gradient<YZ>" << std::endl; exit(-1); }
927 return Vec3D(P.
X - Position.X,0.0,P.
Z - Position.Z)*(phi/get_w2());
928 }
else { std::cerr <<
"error in CG_gradient<XZ>" << std::endl; exit(-1); }
933 return Vec3D(P.
X - Position.X,P.
Y - Position.Y,0.0)*(phi/get_w2());
934 }
else { std::cerr <<
"error in CG_gradient<XY>" << std::endl; exit(-1); }
940 return Vec3D((P.
X - Position.X)*(phi/get_w2()),0.0,0.0);
942 Mdouble r=fabs(Position.X-P.
X)/get_w();
943 return Vec3D(get_CG_invvolume()*evaluatePolynomialGradient(r)/r/get_w2()*(Position.X-P.
X),0,0);
944 }
else { std::cerr <<
"error in CG_gradient<X>" << std::endl; exit(-1); }
949 return Vec3D(0.0,(P.
Y - Position.Y)*(phi/get_w2()),0.0);
951 Mdouble r=fabs(Position.Y-P.
Y)/get_w();
952 return Vec3D(0,get_CG_invvolume()*evaluatePolynomialGradient(r)/r/get_w2()*(Position.Y-P.
Y),0);
953 }
else { std::cerr <<
"error in CG_gradient<Y>" << std::endl; exit(-1); }
958 return Vec3D(0.0,0.0,(P.
Z - Position.Z)*(phi/get_w2()));
960 Mdouble r=fabs(Position.Z-P.
Z)/get_w();
961 return Vec3D(0,0,get_CG_invvolume()*evaluatePolynomialGradient(r)/r/get_w2()*(Position.Z-P.
Z));
962 }
else { std::cerr <<
"error in CG_gradient<Z>" << std::endl; exit(-1); }
966 return Vec3D(0.0,0.0,0.0);
984 Mdouble psi = CG_integral_2D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
989 Vec3D P=(P1+P2)/2;
return CG_function(P);
992 std::cerr <<
"error in CG_function<AZ>" << std::endl; exit(-1);
995 Vec3D P=(P1+P2)/2;
return CG_function(P);
998 std::cerr <<
"error in CG_function<A>" << std::endl; exit(-1);
1003 Mdouble psi = CG_integral_2D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1004 rpsi=
Vec3D(Position.X*psi,Position.Y*psi,P1.
Z*psi-(P1.
Z-P2.
Z)*rpsi_scalar);
1009 Mdouble psi = CG_integral_2D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1010 rpsi=
Vec3D(Position.X*psi,P1.
Y*psi-(P1.
Y-P2.
Y)*rpsi_scalar,Position.Z*psi);
1015 Mdouble psi = CG_integral_2D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1016 rpsi=
Vec3D(P1.
X*psi-(P1.
X-P2.
X)*rpsi_scalar,Position.Y*psi,Position.Z*psi);
1021 Mdouble psi = CG_integral_1D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1022 rpsi=
Vec3D(Position.X*psi,P1.
Y*psi-(P1.
Y-P2.
Y)*rpsi_scalar,P1.
Z*psi-(P1.
Z-P2.
Z)*rpsi_scalar);
1027 Mdouble psi = CG_integral_1D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1028 rpsi=
Vec3D(P1.
X*psi-(P1.
X-P2.
X)*rpsi_scalar,Position.Y*psi,P1.
Z*psi-(P1.
Z-P2.
Z)*rpsi_scalar);
1033 Mdouble psi = CG_integral_1D(P1, P2, P1_P2_normal, P1_P2_distance, rpsi_scalar);
1034 rpsi=
Vec3D(P1.
X*psi-(P1.
X-P2.
X)*rpsi_scalar,P1.
Y*psi-(P1.
Y-P2.
Y)*rpsi_scalar,Position.Z*psi);
1038 Mdouble psi = get_CG_invvolume();
1044 return Vec3D(0,0,CG_integral_gradient_1D(P1, P2, P1_P2_normal, P1_P2_distance));
1048 template <StatType T> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<T> &stat) {
1050 if (stat.mirrorParticle<0) {
1052 os << stat.get_Position() <<
" " << stat.write() << std::endl;
1057 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<RAZ> &stat) {
1058 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1060 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<RA> &stat) {
1061 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1063 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<RZ> &stat) {
1064 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1066 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<AZ> &stat) {
1067 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1069 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<R> &stat) {
1070 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1072 template <> std::ostream& operator<< (std::ostream& os, const StatisticsPoint<A> &stat) {
1073 os.precision(16);
if (stat.mirrorParticle<0) os << stat.get_Position().GetCylindricalCoordinates() <<
" " << stat.write() << std::endl;
return os;
1112 0, 0, P.
X*Q.
YZ-P.
Y*Q.
XZ);}
1116 0, P.
Z*Q.
XZ-P.
X*Q.
ZZ, 0);}
1120 P.
Y*Q.
ZZ-P.
Z*Q.
YZ, 0, 0);}
Mdouble CG_function(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI)
Mdouble get_distance2(const Vec3D &P)
returns the coarse graining distance in the coordinates that are not averaged about ...
MatrixSymmetric3D DisplacementMomentumFlux
Momentum flux from linear displacement, .
Matrix3D ContactCoupleStress
Mdouble Dissipation
Dissipation form collisions, .
Mdouble CG_function_1D(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI) averaged along a plane.
Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
gradient of phi
Mdouble CG_function_2D(const Vec3D &PI)
returns the value of the course graining function phi(P,PI) averaged along a line ...
void firstTimeAverage(const int n)
Defines a division operator needed to time-average values (because the displacement does not have a v...
std::ostream & operator<<(std::ostream &os, const CG S)
void set_Gaussian_invvolume(int dim)
sets CG_invvolume if CG_type=Gaussian
void set_CG_invvolume()
sets CG_invvolume
Matrix3D NormalStress
Stress from normal forces, .
void set_Heaviside_invvolume()
sets CG_invvolume if CG_type=HeaviSideSphere
Vec3D CollisionalHeatFlux
Heat flux from collisions, .
std::string write_variable_names()
Outputs names of statistical variables in computer-readable format.
CG
enum used to store the type of coarse-graining function used
Mdouble Nu
Particle volume fraction, .
Vec3D NormalTraction
Traction from normal forces, .
Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Returns the value of the coarse graining integral averaged along a line.
Vec3D DisplacementMomentum
Momentum from linear displacement, , where , with the time intervall between outputs.
MatrixSymmetric3D Fabric
Fabric tensor, .
std::string print() const
Outputs statistical variables in human-readable format.
Vec3D cross(Vec3D P, Vec3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
Vec3D LocalAngularMomentum
Vec3D CG_gradient(const Vec3D &P, const Mdouble phi)
gradient of phi
Vec3D EnergyFlux
Energy flux, .
Mdouble Density
Density, .
MatrixSymmetric3D Displacement
Linear displacement, .
std::string write() const
Outputs statistical variables in computer-readable format.
void set_zero()
Sets all statistical variables to zero.
StatisticsPoint< T > & operator+=(const StatisticsPoint< T > &P)
Defines a plus operator needed to average values ( )
StatisticsPoint< T > & operator/=(const Mdouble a)
Defines a division operator needed to average values ( )
Vec3D TangentialTraction
Traction from tangential forces, .
Matrix3D LocalAngularMomentumFlux
StatisticsPoint< T > & operator=(const StatisticsPoint< T > &P)
Defines a equal operator needed for copy constructor.
Vec3D clearAveragedDirections(Vec3D P)
Returns a vector where the averaged directions are zero.
Mdouble Potential
Elastic energy .
Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
This class stores statistical values for a given spatial position; to be used in combination with Sta...
MatrixSymmetric3D MomentumFlux
Momentum flux, .
StatisticsPoint< T > & operator-=(const StatisticsPoint< T > &P)
Defines a plus operator needed to calculate variance.
This class is used to extract statistical data from MD simulations.
StatisticsPoint< T > getSquared()
Squares all statistical variables; needed for variance.
double compute_Gaussian_invvolume(int dim)
computes CG_invvolume if CG_type=Gaussian
Mdouble CG_integral(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Vec3D &rpsi)
Returns the value of the coarse graining integral .
Mdouble GetLength() const
Matrix3D MatrixCross(Vec3D P, Matrix3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about...
Implementation of a 3D matrix.
Implementation of a 3D vector (by Vitaliy).
Vec3D Momentum
Momentum, .
Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Returns the value of the coarse graining integral averaged along a plane.
void set_Polynomial_invvolume(int dim)
sets CG_invvolume if CG_type=Polynomial
std::string print_sqrt() const
Outputs root of statistical variables in human-readable format.
Mdouble dot(const Vec3D &P, const Vec3D &Q)
Returns the dot product of two vectors in the coordinates that are not averaged about.
Matrix3D TangentialStress
Stress from tangential forces, .