StatisticsPoint.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef STATISTICSPOINT_H
27 #define STATISTICSPOINT_H
28 
30 enum CG_TYPE
31 {
33 };
34 
35 template<StatType T>
36 class StatisticsVector;
37 
38 template<StatType T>
39 struct StatisticsPoint;
40 
41 template<StatType T>
42 std::ostream& operator<<(std::ostream& os, const StatisticsPoint<T>& stat);
43 
45 template<StatType T>
47 {
48 public:
49 
50  //Constructors and Destructors
51 
54  {
55  this->Position.setZero();
56  mirrorParticle = -1;
57  //~ this->set_zero();
58  }
59 
62  {
63  *this = other;
64  mirrorParticle = -1;
65  }
66 
67  //set and get access functions
69  static void set_gb(StatisticsVector<T>* new_gb)
70  {
71  gb = new_gb;
72  }
73 
75  void setCGShape(const char* CG_type)
76  {
77  this->gb->setCGShape(CG_type);
78  }
79 
82  {
83  return this->gb->getCGShape();
84  }
85 
87  void setCGWidth2(Mdouble new_)
88  {
89  this->gb->setCGWidth2(new_);
90  }
91 
94  {
95  return this->gb->getCGWidthSquared();
96  }
97 
100  {
101  return this->gb->getCGWidth();
102  }
103 
106  {
107  return this->gb->getCutoff();
108  }
109 
112  {
113  return this->gb->getCutoff2();
114  }
115 
118  {
119  return this->gb->getXMaxStat();
120  }
121 
124  {
125  return this->gb->getYMaxStat();
126  }
127 
130  {
131  return this->gb->getZMaxStat();
132  }
133 
136  {
137  return this->gb->getXMinStat();
138  }
139 
142  {
143  return this->gb->getYMinStat();
144  }
145 
148  {
149  return this->gb->getZMinStat();
150  }
151 
153  void getN(int& nx_, int& ny_, int& nz_)
154  {
155  this->gb->getN(nx_, ny_, nz_);
156  }
157 
160  {
161  return gb->evaluatePolynomial(r);
162  }
163 
166  {
167  return gb->evaluatePolynomialGradient(r);
168  }
169 
172  {
173  return gb->evaluateIntegral(n1, n2, t);
174  }
175 
178 
180 
181  double averagingVolume();
182 
185  {
186  return this->CG_invvolume;
187  }
188 
190  void set_Gaussian_invvolume(int dim);
191 
193  double compute_Gaussian_invvolume(int dim);
194 
197 
200 
202  void setPosition(Vec3D new_)
203  {
204  this->Position = new_;
205  }
206 
209  {
210  return this->Position;
211  }
212 
214  friend std::ostream& operator<<<T>(std::ostream& os, const StatisticsPoint<T>& stat);
215 
217  void set_zero();
218 
221 
224 
227 
230 
233 
235  inline void firstTimeAverage(const int n);
236 
239 
241  Mdouble dotNonAveraged(const Vec3D& P, const Vec3D& Q);
242 
245 
248 
251 
254 
258 
262 
265  Vec3D CG_gradient(const Vec3D& P, const Mdouble phi);
266 
269  Vec3D CG_integral_gradient(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance);
270 
271  Mdouble CG_integral_gradient_1D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance);
272 
274  Mdouble CG_integral(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Vec3D& rpsi);
275 
278  Mdouble CG_integral_2D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
279 
282  Mdouble CG_integral_1D(Vec3D& P1, Vec3D& P2, Vec3D& P1_P2_normal, Mdouble P1_P2_distance, Mdouble& rpsi_scalar);
283 
285  std::string print() const;
286 
288  std::string print_sqrt() const;
289 
291  std::string write_variable_names();
292 
294  std::string write() const;
295 
296 public:
297  //Values of macroscopical fields at Position
333 
337 
340 
343 
344 private:
349 
350 };
351 
352 #endif
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
CG_TYPE
enum used to store the type of coarse-graining function used
Definition: StatisticsPoint.h:31
@ HeavisideSphere
Definition: StatisticsPoint.h:32
@ Polynomial
Definition: StatisticsPoint.h:32
@ Gaussian
Definition: StatisticsPoint.h:32
std::ostream & operator<<(std::ostream &os, const StatisticsPoint< T > &stat)
Implementation of a 3D matrix.
Definition: Matrix.h:38
Implementation of a 3D symmetric matrix.
Definition: MatrixSymmetric.h:37
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:62
Definition: Vector.h:51
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
This class stores statistical values for a given spatial position; to be used in combination with Sta...
Definition: StatisticsPoint.h:47
StatisticsPoint< T > & operator+=(const StatisticsPoint< T > &P)
Defines a plus operator needed to average values ( )
CG_TYPE getCGShape() const
see StatisticsVector::getCGShape
Definition: StatisticsPoint.h:81
Vec3D crossNonAveraged(Vec3D P, Vec3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about.
Mdouble CG_function_2D(const Vec3D &PI)
StatisticsPoint< T > & operator-=(const StatisticsPoint< T > &P)
Defines a plus operator needed to calculate variance.
Mdouble getYMinStat()
see StatisticsVector::getYMinStat
Definition: StatisticsPoint.h:141
Mdouble CG_integral_gradient_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
std::string print_sqrt() const
Outputs root of statistical variables in human-readable format.
Mdouble getCutoff2()
see StatisticsVector::getCutoff2
Definition: StatisticsPoint.h:111
Mdouble evaluatePolynomial(Mdouble r)
see StatisticsVector::evaluatePolynomial
Definition: StatisticsPoint.h:159
Mdouble CG_invvolume
Prefactor of CG function which depends on $w.
Definition: StatisticsPoint.h:339
MatrixSymmetric3D MomentumFlux
Momentum flux, .
Definition: StatisticsPoint.h:309
void setCGInverseVolume()
sets CG_invvolume
Vec3D CG_integral_gradient(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance)
StatisticsPoint< T > getSquared()
Squares all statistical variables; needed for variance.
Mdouble getYMaxStat()
see StatisticsVector::getYMaxStat
Definition: StatisticsPoint.h:123
Mdouble getCGWidth() const
see StatisticsVector::getCGWidth
Definition: StatisticsPoint.h:99
Vec3D CG_gradient(const Vec3D &P, const Mdouble phi)
double averagingVolume()
Matrix3D NormalStress
Stress from normal forces, .
Definition: StatisticsPoint.h:315
std::string write_variable_names()
Outputs names of statistical variables in computer-readable format.
std::string write() const
Outputs statistical variables in computer-readable format.
Matrix3D ContactCoupleStress
Definition: StatisticsPoint.h:336
Mdouble getXMaxStat()
see StatisticsVector::getXMaxStat
Definition: StatisticsPoint.h:117
Vec3D EnergyFlux
Energy flux, .
Definition: StatisticsPoint.h:313
Mdouble getCGWidthSquared() const
see StatisticsVector::getCGWidthSquared
Definition: StatisticsPoint.h:93
Mdouble getZMaxStat()
see StatisticsVector::getZMaxStat
Definition: StatisticsPoint.h:129
void set_Gaussian_invvolume(int dim)
sets CG_invvolume if CG_type=Gaussian
Mdouble Nu
Particle volume fraction, .
Definition: StatisticsPoint.h:299
MatrixSymmetric3D DisplacementMomentumFlux
Momentum flux from linear displacement, .
Definition: StatisticsPoint.h:311
double compute_Gaussian_invvolume(int dim)
computes CG_invvolume if CG_type=Gaussian
Vec3D NormalTraction
Traction from normal forces, .
Definition: StatisticsPoint.h:319
Mdouble evaluateIntegral(Mdouble n1, Mdouble n2, Mdouble t)
see StatisticsVector::evaluateIntegral
Definition: StatisticsPoint.h:171
void setCGWidth2(Mdouble new_)
see StatisticsVector::setCGWidth2
Definition: StatisticsPoint.h:87
Matrix3D LocalAngularMomentumFlux
Definition: StatisticsPoint.h:335
Matrix3D TangentialStress
Stress from tangential forces, .
Definition: StatisticsPoint.h:317
MatrixSymmetric3D Displacement
Linear displacement, .
Definition: StatisticsPoint.h:307
StatisticsPoint()
Constructor sets sensible values.
Definition: StatisticsPoint.h:53
Mdouble evaluatePolynomialGradient(Mdouble r)
see StatisticsVector::evaluatePolynomialGradient
Definition: StatisticsPoint.h:165
std::string print() const
Outputs statistical variables in human-readable format.
Vec3D LocalAngularMomentum
Definition: StatisticsPoint.h:334
void getN(int &nx_, int &ny_, int &nz_)
see StatisticsVector::get_n
Definition: StatisticsPoint.h:153
void set_Polynomial_invvolume(int dim)
sets CG_invvolume if CG_type=Polynomial
Mdouble getXMinStat()
see StatisticsVector::getXMinStat
Definition: StatisticsPoint.h:135
MatrixSymmetric3D Fabric
Fabric tensor, .
Definition: StatisticsPoint.h:323
Mdouble CG_integral_2D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)
Mdouble CG_function_1D(const Vec3D &PI)
Mdouble getCutoff()
see StatisticsVector::getCutoff
Definition: StatisticsPoint.h:105
void setCGShape(const char *CG_type)
see StatisticsVector::setCGShape
Definition: StatisticsPoint.h:75
Vec3D CollisionalHeatFlux
Definition: StatisticsPoint.h:326
Vec3D getPosition() const
returns Position
Definition: StatisticsPoint.h:208
Mdouble dotNonAveraged(const Vec3D &P, const Vec3D &Q)
Returns the dot product of two vectors in the coordinates that are not averaged about.
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 CG_function(const Vec3D &PI)
Returns the value of the course graining function phi(P,PI)
Mdouble Density
Density, .
Definition: StatisticsPoint.h:301
Mdouble Potential
Definition: StatisticsPoint.h:332
static void set_gb(StatisticsVector< T > *new_gb)
see StatisticsVector::setCGShape
Definition: StatisticsPoint.h:69
void set_Heaviside_invvolume()
sets CG_invvolume if CG_type=HeaviSideSphere
Vec3D Momentum
Momentum, .
Definition: StatisticsPoint.h:303
int mirrorParticle
indicates that a position is a (fake) particles used for periodic walls
Definition: StatisticsPoint.h:342
Mdouble getCGInverseVolume()
returns CG_invvolume
Definition: StatisticsPoint.h:184
StatisticsPoint< T > & operator/=(const Mdouble a)
Defines a division operator needed to average values ( )
StatisticsPoint(const StatisticsPoint &other)
Copy constructor; simply copies everything.
Definition: StatisticsPoint.h:61
Vec3D clearAveragedDirections(Vec3D P)
Returns a vector where the averaged directions are zero.
static StatisticsVector< T > * gb
Pointer to StatisticsVector (to obtain global parameters)
Definition: StatisticsPoint.h:346
Vec3D TangentialTraction
Traction from tangential forces, .
Definition: StatisticsPoint.h:321
Vec3D DisplacementMomentum
Momentum from linear displacement, , where , with the time intervall between outputs.
Definition: StatisticsPoint.h:305
Mdouble Dissipation
Definition: StatisticsPoint.h:329
void setPosition(Vec3D new_)
sets Position
Definition: StatisticsPoint.h:202
StatisticsPoint< T > & operator=(const StatisticsPoint< T > &P)
Defines a equal operator needed for copy constructor.
Matrix3D matrixCrossNonAveraged(Vec3D P, Matrix3D &Q)
Returns the cross product of two vectors in the coordinates that are not averaged about.
Vec3D Position
Position at which evaluation occurs.
Definition: StatisticsPoint.h:348
void firstTimeAverage(const int n)
Defines a division operator needed to time-average values (because the displacement does not have a v...
Mdouble getZMinStat()
see StatisticsVector::getZMinStat
Definition: StatisticsPoint.h:147
void set_zero()
Sets all statistical variables to zero.
Mdouble getDistanceSquaredNonAveraged(const Vec3D &P)
returns the coarse graining distance in the coordinates that are not averaged about
Mdouble CG_integral_1D(Vec3D &P1, Vec3D &P2, Vec3D &P1_P2_normal, Mdouble P1_P2_distance, Mdouble &rpsi_scalar)