CGFields::StandardFields Class Reference

Contains the computed field values, like density, momentum and stress. More...

#include <StandardFields.h>

+ Inheritance diagram for CGFields::StandardFields:

Public Member Functions

 StandardFields ()
 Default constructor, sets all field values to zero. More...
 
 StandardFields (const StandardFields &P)=default
 Default copy constructor, copies the values of all fields. More...
 
 ~StandardFields ()=default
 Destructor, it simply destructs the StandardFields and all the objects it contains. More...
 
void write (std::ostream &os) const
 Writes class content into an output stream, typically a stat file. More...
 
void output (std::ostream &os) const
 Writes human-readable class content into an output stream, typically a stat file. More...
 
void setZero ()
 Sets all fields to zero. More...
 
StandardFields getSquared () const
 Returns the square of all field values (to calculate standard deviation). More...
 
StandardFieldsoperator= (const StandardFields &P)
 Copies all field values. More...
 
StandardFieldsoperator+= (const StandardFields &P)
 Adds the field values on the RHS to the LHS of the equation. More...
 
StandardFieldsoperator-= (const StandardFields &P)
 Subtracts the field values on the RHS from the LHS of the equation. More...
 
StandardFieldsoperator/= (Mdouble a)
 Divides the field values on the LHS by the RHS of the equation. More...
 
StandardFields operator* (Mdouble a) const
 Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer. More...
 
void addParticleStatistics (Mdouble phi, const StandardFields &currentInteraction)
 This function should be called from within a loop over all particles to compute all the fields that are defined as a sum over all particles (e.g. density, momentum). More...
 
void addParticleDifferentialStatistics (Vec3D &dphi, const StandardFields &currentInteraction)
 
void addInteractionStatistics (Mdouble psi, const StandardFields &currentInteraction)
 This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions (e.g. stress). More...
 
void addContactPointStatistics (Mdouble phi, const StandardFields &currentInteraction)
 This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions with external objects (e.g. IFD). More...
 
void setFields (const BaseInteraction &c, IntegralType type)
 
void setCylindricalFields (const BaseInteraction &c, IntegralType type)
 
void setFields (const BaseParticle &p)
 
void setCylindricalFields (const BaseParticle &p)
 
Mdouble getVolumeFraction () const
 
Mdouble getDensity () const
 
Vec3D getMomentum () const
 
MatrixSymmetric3D getMomentumFlux () const
 
Matrix3D getContactStress () const
 
Vec3D getInteractionForceDensity () const
 
Mdouble getParticleSizeDensity (size_t i) const
 
std::array< Mdouble, 6 > getParticleSizeDensity () const
 
std::array< Mdouble, 6 > getParticleSizeMomenta () const
 
std::array< Mdouble, 6 > getCentralParticleSizeMomenta () const
 
std::array< Mdouble, 6 > getStandardisedParticleSizeMomenta () const
 
void outputStandardisedParticleSizeMomenta (std::ostream &os) const
 
- Public Member Functions inherited from CGFields::BaseFields
void setCG (BaseCG *cg)
 
BaseCGgetCG ()
 

Static Public Member Functions

static void writeNames (std::ostream &os, unsigned countVariables)
 
static bool doInteractionStatistics ()
 Returns true if the class contains fields that are defined as a sum over all Interactions (e.g. stress), else returns false. More...
 
static bool evaluateFixedParticles ()
 
static bool isDifferentialField ()
 

Protected Member Functions

void setContactStress (Matrix3D contactStress)
 
void addContactStress (Matrix3D contactStress)
 
void setInteractionForceDensity (Vec3D interactionForceDensity)
 
void addInteractionForceDensity (Vec3D interactionForceDensity)
 

Private Attributes

Mdouble volumeFraction_
 
Mdouble density_
 
Vec3D momentum_
 
MatrixSymmetric3D momentumFlux_
 
Matrix3D contactStress_
 
Vec3D interactionForceDensity_
 
std::array< Mdouble, 6 > particleSizeDensity_
 

Additional Inherited Members

- Protected Attributes inherited from CGFields::BaseFields
BaseCGcg_ = nullptr
 Stores a pointer to the baseCG instance to get e.g. the handler and time information. More...
 

Detailed Description

Contains the computed field values, like density, momentum and stress.

CGPoints inherits from this class; CGPoints::evaluate adds to the values of these variables.

Todo:
These are currently the only fields that are computed. However, this class is destined to be extended to contain additional information such as fabric, energy, local angular momentum. Also, a simpler version is planned, where only particle statistics are evaluated (density and momentum).

Constructor & Destructor Documentation

◆ StandardFields() [1/2]

CGFields::StandardFields::StandardFields ( )

Default constructor, sets all field values to zero.

12 {
13  setZero();
14 #ifdef DEBUG_CONSTRUCTOR
15  std::cerr << "StandardFields::StandardFields() finished" << std::endl;
16 #endif
17 }
void setZero()
Sets all fields to zero.
Definition: StandardFields.cc:63

References setZero().

◆ StandardFields() [2/2]

CGFields::StandardFields::StandardFields ( const StandardFields P)
default

Default copy constructor, copies the values of all fields.

◆ ~StandardFields()

CGFields::StandardFields::~StandardFields ( )
default

Destructor, it simply destructs the StandardFields and all the objects it contains.

Member Function Documentation

◆ addContactPointStatistics()

void CGFields::StandardFields::addContactPointStatistics ( Mdouble  phi,
const StandardFields currentInteraction 
)

This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions with external objects (e.g. IFD).

Parameters
[in]phithe value of the cg function for the contact point of c and the current CGPoint
[in]cthe interaction which is used in the cg function
197 {
198  interactionForceDensity_ += currentInteraction.getInteractionForceDensity() * phi;
199 }
Vec3D interactionForceDensity_
Definition: StandardFields.h:283

References getInteractionForceDensity(), and interactionForceDensity_.

◆ addContactStress()

void CGFields::StandardFields::addContactStress ( Matrix3D  contactStress)
inlineprotected
207  {
208  contactStress_ += contactStress;
209  }
Matrix3D contactStress_
Definition: StandardFields.h:273

References contactStress_.

Referenced by CGFields::StandardFieldsBinning::addParticleStatistics().

◆ addInteractionForceDensity()

void CGFields::StandardFields::addInteractionForceDensity ( Vec3D  interactionForceDensity)
inlineprotected
217  {
218  interactionForceDensity_ += interactionForceDensity;
219  }

References interactionForceDensity_.

Referenced by CGFields::StandardFieldsBinning::addParticleStatistics().

◆ addInteractionStatistics()

void CGFields::StandardFields::addInteractionStatistics ( Mdouble  psi,
const StandardFields currentInteraction 
)

This function should be called from within a loop over all Interactions to compute all the fields that are defined as a sum over all Interactions (e.g. stress).

Parameters
[in]psithe value of the line integral from C to P at the current CGPoint
[in]cthe contact which is used in the line integral
187 {
188  contactStress_ += currentInteraction.getContactStress() * psi;
189 }

References contactStress_, and getContactStress().

◆ addParticleDifferentialStatistics()

void CGFields::StandardFields::addParticleDifferentialStatistics ( Vec3D dphi,
const StandardFields currentInteraction 
)
179 {
180 }

◆ addParticleStatistics()

void CGFields::StandardFields::addParticleStatistics ( Mdouble  phi,
const StandardFields currentInteraction 
)

This function should be called from within a loop over all particles to compute all the fields that are defined as a sum over all particles (e.g. density, momentum).

Parameters
[in]phithe value of the cg function at the current CGPoint
[in]currentInteractionthe fields which are produced due to the particle at its centre
169 {
170  volumeFraction_ += currentInteraction.getVolumeFraction() * phi;
171  density_ += currentInteraction.getDensity() * phi;
172  momentum_ += currentInteraction.getMomentum() * phi;
173  momentumFlux_ += currentInteraction.getMomentumFlux() * phi;
174  for (size_t i = 0; i < particleSizeDensity_.size(); ++i)
175  particleSizeDensity_[i] += currentInteraction.getParticleSizeDensity(i) * phi;
176 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Vec3D momentum_
Definition: StandardFields.h:249
MatrixSymmetric3D momentumFlux_
Definition: StandardFields.h:261
Mdouble density_
Definition: StandardFields.h:237
std::array< Mdouble, 6 > particleSizeDensity_
Definition: StandardFields.h:294
Mdouble volumeFraction_
Definition: StandardFields.h:229

References density_, getDensity(), getMomentum(), getMomentumFlux(), getParticleSizeDensity(), getVolumeFraction(), i, momentum_, momentumFlux_, particleSizeDensity_, and volumeFraction_.

Referenced by CGFields::StandardFieldsBinning::addParticleStatistics().

◆ doInteractionStatistics()

bool CGFields::StandardFields::doInteractionStatistics ( )
static

Returns true if the class contains fields that are defined as a sum over all Interactions (e.g. stress), else returns false.

If the functions returns false, addInteractionStatistics and addContactPointStatistics are never called.

Returns
True if the class contains fields that are defined as a sum over all Interactions, else false.
208 {
209  return true;
210 }

◆ evaluateFixedParticles()

static bool CGFields::StandardFields::evaluateFixedParticles ( )
inlinestatic
187  {
188  return false;
189  }

◆ getCentralParticleSizeMomenta()

std::array< Mdouble, 6 > CGFields::StandardFields::getCentralParticleSizeMomenta ( ) const
283 {
284  //https://en.wikipedia.org/wiki/Central_moment
285  auto momenta = getParticleSizeMomenta();
286  Mdouble mean = momenta[1];
287  momenta[5] += -5 * mean * momenta[4] + 10 * mean * mean * momenta[3]
288  - 10 * mean * mean * mean * momenta[2] + 4 * mean * mean * mean * mean * mean;
289  momenta[4] += -4 * mean * momenta[3] + 6 * mean * mean * momenta[2] - 3 * mean * mean * mean * mean;
290  momenta[3] += -3 * mean * momenta[2] + 2 * mean * mean * mean;
291  momenta[2] += -mean * mean;
292  return momenta;
293 }
std::array< Mdouble, 6 > getParticleSizeMomenta() const
Definition: StandardFields.cc:271

References getParticleSizeMomenta().

Referenced by getStandardisedParticleSizeMomenta().

◆ getContactStress()

Matrix3D CGFields::StandardFields::getContactStress ( ) const
inline

◆ getDensity()

Mdouble CGFields::StandardFields::getDensity ( ) const
inline
144  {
145  return density_;
146  }

References density_.

Referenced by addParticleStatistics(), and testCGHandler().

◆ getInteractionForceDensity()

Vec3D CGFields::StandardFields::getInteractionForceDensity ( ) const
inline

◆ getMomentum()

Vec3D CGFields::StandardFields::getMomentum ( ) const
inline
149  {
150  return momentum_;
151  }

References momentum_.

Referenced by addParticleStatistics().

◆ getMomentumFlux()

MatrixSymmetric3D CGFields::StandardFields::getMomentumFlux ( ) const
inline
154  {
155  return momentumFlux_;
156  }

References momentumFlux_.

Referenced by addParticleStatistics().

◆ getParticleSizeDensity() [1/2]

std::array<Mdouble, 6> CGFields::StandardFields::getParticleSizeDensity ( ) const
inline
174  {
175  return particleSizeDensity_;
176  }

References particleSizeDensity_.

◆ getParticleSizeDensity() [2/2]

Mdouble CGFields::StandardFields::getParticleSizeDensity ( size_t  i) const
inline
169  {
170  return particleSizeDensity_[i];
171  }

References i, and particleSizeDensity_.

Referenced by addParticleStatistics().

◆ getParticleSizeMomenta()

std::array< Mdouble, 6 > CGFields::StandardFields::getParticleSizeMomenta ( ) const
272 {
273  //https://en.wikipedia.org/wiki/Moment_(mathematics)
274  auto momenta = particleSizeDensity_;
275  for (size_t i = 1; i < particleSizeDensity_.size(); ++i)
276  {
277  momenta[i] /= particleSizeDensity_[0];
278  }
279  return momenta;
280 }

References i, and particleSizeDensity_.

Referenced by getCentralParticleSizeMomenta().

◆ getSquared()

StandardFields CGFields::StandardFields::getSquared ( ) const

Returns the square of all field values (to calculate standard deviation).

Returns
a CGField containing the square of the values in the current object
78 {
80  P.volumeFraction_ = mathsFunc::square(volumeFraction_);
81  P.density_ = mathsFunc::square(density_);
82  P.momentum_ = Vec3D::square(momentum_);
83  P.momentumFlux_ = MatrixSymmetric3D::square(momentumFlux_);
84  P.contactStress_ = Matrix3D::square(contactStress_);
85  P.interactionForceDensity_ = Vec3D::square(interactionForceDensity_);
86  P.particleSizeDensity_ = particleSizeDensity_;
87  for (auto& p : P.particleSizeDensity_) p *= p;
88  return P;
89 }
float * p
Definition: Tutorial_Map_using.cpp:9
StandardFields()
Default constructor, sets all field values to zero.
Definition: StandardFields.cc:11
static Matrix3D square(const Matrix3D &A)
Calculates the pointwise square.
Definition: Matrix.cc:277
static MatrixSymmetric3D square(const MatrixSymmetric3D &A)
Calculates the pointwise square.
Definition: MatrixSymmetric.cc:217
static Vec3D square(const Vec3D &a)
Calculates the pointwise square of a Vec3D.
Definition: Vector.cc:94
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
T square(const T val)
squares a number
Definition: ExtendedMath.h:86

References contactStress_, density_, interactionForceDensity_, momentum_, momentumFlux_, Global_Physical_Variables::P, p, particleSizeDensity_, Matrix3D::square(), MatrixSymmetric3D::square(), mathsFunc::square(), Vec3D::square(), and volumeFraction_.

◆ getStandardisedParticleSizeMomenta()

std::array< Mdouble, 6 > CGFields::StandardFields::getStandardisedParticleSizeMomenta ( ) const
296 {
297  auto momenta = getCentralParticleSizeMomenta();
298  Mdouble std = std::sqrt(momenta[2]);
299  momenta[3] /= std * std * std;
300  momenta[4] /= std * std * std * std;
301  momenta[5] /= std * std * std * std * std;
302  return momenta;
303 }
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
std::array< Mdouble, 6 > getCentralParticleSizeMomenta() const
Definition: StandardFields.cc:282

References getCentralParticleSizeMomenta(), and sqrt().

Referenced by outputStandardisedParticleSizeMomenta().

◆ getVolumeFraction()

Mdouble CGFields::StandardFields::getVolumeFraction ( ) const
inline
139  {
140  return volumeFraction_;
141  }

References volumeFraction_.

Referenced by addParticleStatistics().

◆ isDifferentialField()

static bool CGFields::StandardFields::isDifferentialField ( )
inlinestatic

A bool that determines if the derivative of the CG function has to be computed

196  {
197  return false;
198  }

◆ operator*()

StandardFields CGFields::StandardFields::operator* ( Mdouble  a) const

Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer.

Parameters
[in]athe scalar that we multiply with
Returns
the CGField to which the multiplied values are written
135 {
137  p.volumeFraction_ = volumeFraction_ * a;
138  p.density_ = density_ * a;
139  p.momentum_ = momentum_ * a;
140  p.momentumFlux_ = momentumFlux_ * a;
141  p.contactStress_ = contactStress_ * a;
142  p.interactionForceDensity_ = interactionForceDensity_ * a;
143  for (size_t i = 0; i < particleSizeDensity_.size(); ++i)
144  p.particleSizeDensity_[i] = particleSizeDensity_[i] * a;
145  return p;
146 }
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, contactStress_, density_, i, interactionForceDensity_, momentum_, momentumFlux_, p, particleSizeDensity_, and volumeFraction_.

◆ operator+=()

StandardFields & CGFields::StandardFields::operator+= ( const StandardFields P)

Adds the field values on the RHS to the LHS of the equation.

Parameters
[in]Pthe CGField that has to be added
Returns
the CGField to which the values are added
103 {
104  volumeFraction_ += P.volumeFraction_;
105  density_ += P.density_;
106  momentum_ += P.momentum_;
107  momentumFlux_ += P.momentumFlux_;
108  contactStress_ += P.contactStress_;
109  interactionForceDensity_ += P.interactionForceDensity_;
110  for (size_t i = 0; i < particleSizeDensity_.size(); ++i) particleSizeDensity_[i] += P.particleSizeDensity_[i];
111  return *this;
112 }

References contactStress_, density_, i, interactionForceDensity_, momentum_, momentumFlux_, Global_Physical_Variables::P, particleSizeDensity_, and volumeFraction_.

◆ operator-=()

StandardFields & CGFields::StandardFields::operator-= ( const StandardFields P)

Subtracts the field values on the RHS from the LHS of the equation.

Parameters
[in]Pthe CGField that has to be subtracted
Returns
the CGField from which the values are subtracted
119 {
120  volumeFraction_ -= P.volumeFraction_;
121  density_ -= P.density_;
122  momentum_ -= P.momentum_;
123  momentumFlux_ -= P.momentumFlux_;
124  contactStress_ -= P.contactStress_;
125  interactionForceDensity_ -= P.interactionForceDensity_;
126  for (size_t i = 0; i < particleSizeDensity_.size(); ++i) particleSizeDensity_[i] -= P.particleSizeDensity_[i];
127  return *this;
128 }

References contactStress_, density_, i, interactionForceDensity_, momentum_, momentumFlux_, Global_Physical_Variables::P, particleSizeDensity_, and volumeFraction_.

◆ operator/=()

StandardFields & CGFields::StandardFields::operator/= ( Mdouble  a)

Divides the field values on the LHS by the RHS of the equation.

Parameters
[in]athe scalar that we divide by
Returns
the CGField to which the divided values are written
153 {
154  volumeFraction_ /= a;
155  density_ /= a;
156  momentum_ /= a;
157  momentumFlux_ /= a;
158  contactStress_ /= a;
160  for (auto& p : particleSizeDensity_) p /= a;
161  return *this;
162 }

References a, contactStress_, density_, interactionForceDensity_, momentum_, momentumFlux_, p, particleSizeDensity_, and volumeFraction_.

◆ operator=()

StandardFields & CGFields::StandardFields::operator= ( const StandardFields P)
default

Copies all field values.

Parameters
[in]Pthe CGField that has to be copied
Returns
the CGField into which the values are copied

◆ output()

void CGFields::StandardFields::output ( std::ostream &  os) const

Writes human-readable class content into an output stream, typically a stat file.

Parameters
[in,out]osthe ostream into which the data is written.
52 {
53  os << "VolumeFraction " << volumeFraction_;
54  os << " Density " << density_;
55  os << " Momentum " << momentum_;
56  os << " MomentumFlux " << momentumFlux_;
57  os << " ContactStress " << contactStress_;
58  os << " InteractionForce " << interactionForceDensity_;
59  os << " ParticleSize";
60  for (const auto p : particleSizeDensity_) os << ' ' << p;
61 }

References contactStress_, density_, interactionForceDensity_, momentum_, momentumFlux_, p, particleSizeDensity_, and volumeFraction_.

◆ outputStandardisedParticleSizeMomenta()

void CGFields::StandardFields::outputStandardisedParticleSizeMomenta ( std::ostream &  os) const
260 {
261  //https://en.wikipedia.org/wiki/Moment_%28mathematics%29#Higher_moments
262  auto momenta = getStandardisedParticleSizeMomenta();
263  os << "Particle number: " << momenta[0] << '\n';
264  os << "Mean radius: " << momenta[1] << '\n';
265  os << "Standard deviation: " << std::sqrt(momenta[2]) << '\n';
266  os << "Skewness: " << momenta[3] << '\n'; //left- or right-sided
267  os << "Kurtosis: " << momenta[4] << '\n'; //heavy or light tailed (3 for normal distribution)
268  os << "5-th moment: " << momenta[5] << '\n'; //hyper skewness (0 for normal dist)
269 }
std::array< Mdouble, 6 > getStandardisedParticleSizeMomenta() const
Definition: StandardFields.cc:295

References getStandardisedParticleSizeMomenta(), and sqrt().

◆ setContactStress()

void CGFields::StandardFields::setContactStress ( Matrix3D  contactStress)
inlineprotected
202  {
203  contactStress_ = contactStress;
204  }

References contactStress_.

Referenced by CGFields::StandardFieldsBinning::setFields().

◆ setCylindricalFields() [1/2]

void CGFields::StandardFields::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
246 {
247  setFields(c, type);
250 }
void setFields(const BaseInteraction &c, IntegralType type)
Definition: StandardFields.cc:212
Matrix3D getCylindricalTensorField(const Vec3D &p) const
Returns the matrix in cylindrical coordinates.
Definition: Matrix.cc:373
Vec3D getCylindricalTensorField(const Vec3D &position) const
Returns this vector field at point p to cylindrical coordinates.
Definition: Vector.cc:280
int c
Definition: calibrate.py:100
type
Definition: compute_granudrum_aor.py:141

References calibrate::c, contactStress_, Matrix3D::getCylindricalTensorField(), Vec3D::getCylindricalTensorField(), interactionForceDensity_, setFields(), and compute_granudrum_aor::type.

◆ setCylindricalFields() [2/2]

void CGFields::StandardFields::setCylindricalFields ( const BaseParticle p)
253 {
254  setFields(p);
257 }
MatrixSymmetric3D getCylindricalTensorField(const Vec3D &p) const
Returns the matrix in cylindrical coordinates.
Definition: MatrixSymmetric.cc:305

References MatrixSymmetric3D::getCylindricalTensorField(), Vec3D::getCylindricalTensorField(), momentum_, momentumFlux_, p, and setFields().

◆ setFields() [1/2]

void CGFields::StandardFields::setFields ( const BaseInteraction c,
IntegralType  type 
)
213 {
214  //P is always real, but I not
215  if (type == IntegralType::I_TO_P)
216  {
217  contactStress_ = Matrix3D::dyadic(c.getForce(), c.getIP());
218  }
219  else if (type == IntegralType::I_TO_CONTACT)
220  {
221  interactionForceDensity_ = -c.getForce();
222  contactStress_ = Matrix3D::dyadic(c.getForce(), c.getIC());
223  }
224  else
225  {
226  interactionForceDensity_ = c.getForce();
227  contactStress_ = Matrix3D::dyadic(c.getForce(), c.getCP());
228  }
229 }
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:302

References calibrate::c, contactStress_, Matrix3D::dyadic(), I_TO_CONTACT, I_TO_P, interactionForceDensity_, and compute_granudrum_aor::type.

Referenced by setCylindricalFields(), and CGFields::StandardFieldsBinning::setFields().

◆ setFields() [2/2]

void CGFields::StandardFields::setFields ( const BaseParticle p)
232 {
233  volumeFraction_ = p.getVolume();
234  density_ = p.getMass();
235  momentum_ = p.getVelocity() * p.getMass();
236  momentumFlux_ = MatrixSymmetric3D::selfDyadic(p.getVelocity()) * p.getMass();
237  Mdouble particleSize = 1.0;
238  for (auto& ps : particleSizeDensity_)
239  {
240  ps = particleSize;
241  particleSize *= p.getRadius();
242  }
243 }
static MatrixSymmetric3D selfDyadic(const Vec3D &a)
Calculates the dyadic product of a Vec3D with itself: .
Definition: MatrixSymmetric.cc:242
int RealScalar int RealScalar int RealScalar RealScalar * ps
Definition: level1_cplx_impl.h:124

References density_, momentum_, momentumFlux_, p, particleSizeDensity_, ps, MatrixSymmetric3D::selfDyadic(), and volumeFraction_.

◆ setInteractionForceDensity()

void CGFields::StandardFields::setInteractionForceDensity ( Vec3D  interactionForceDensity)
inlineprotected
212  {
213  interactionForceDensity_ = interactionForceDensity;
214  }

References interactionForceDensity_.

Referenced by CGFields::StandardFieldsBinning::setFields().

◆ setZero()

void CGFields::StandardFields::setZero ( )

Sets all fields to zero.

64 {
65  volumeFraction_ = 0.0;
66  density_ = 0.0;
71  for (auto& p : particleSizeDensity_) p = 0;
72 }
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:54
void setZero()
Sets all elements to zero.
Definition: MatrixSymmetric.cc:49
void setZero()
Sets all elements to zero.
Definition: Vector.cc:23

References contactStress_, density_, interactionForceDensity_, momentum_, momentumFlux_, p, particleSizeDensity_, Matrix3D::setZero(), MatrixSymmetric3D::setZero(), Vec3D::setZero(), and volumeFraction_.

Referenced by StandardFields(), and CGFields::StandardFieldsBinning::StandardFieldsBinning().

◆ write()

void CGFields::StandardFields::write ( std::ostream &  os) const

Writes class content into an output stream, typically a stat file.

Parameters
[in,out]osthe ostream into which the data is written.
38 {
39  os << volumeFraction_;
40  os << ' ' << density_;
41  os << ' ' << momentum_;
42  os << ' ' << momentumFlux_;
43  os << ' ' << contactStress_;
44  os << ' ' << interactionForceDensity_;
45  for (const auto p : particleSizeDensity_) os << ' ' << p;
46 }

References contactStress_, density_, interactionForceDensity_, momentum_, momentumFlux_, p, particleSizeDensity_, and volumeFraction_.

◆ writeNames()

void CGFields::StandardFields::writeNames ( std::ostream &  os,
unsigned  countVariables 
)
static
Parameters
[in,out]osthe ostream into which the data is written.
[in]countVariablesThe number of variables in the field (including time), e.g. 1 for O, 4 for XYZ
24 {
25  os << countVariables + 1 << ":VolumeFraction "; //volume
26  os << countVariables + 2 << ":Density "; //mass
27  os << countVariables + 3 << '-' << countVariables + 5 << ":Momentum ";
28  os << countVariables + 6 << '-' << countVariables + 11 << ":MomentumFlux ";
29  os << countVariables + 12 << '-' << countVariables + 20 << ":ContactStress ";
30  os << countVariables + 21 << '-' << countVariables + 23 << ":InteractionForce ";
31  os << countVariables + 24 << '-' << countVariables + 29 << ":ParticleSize ";
32 }

Member Data Documentation

◆ contactStress_

Matrix3D CGFields::StandardFields::contactStress_
private

Contact stress, computed as the sum over all contacts between particle i and particle/wall/fixed particle j

\[\mathbf \sigma^{c}(\vec r,t)=\sum_{ij} \vec f_{ij} \otimes \vec l_{ij} \psi(\vec r,\vec r_i,\vec r_j),\]

with contact force \(\vec f_{ij}\), branch vector \(\vec l_{ij}= \vec c_{ij}-\vec r_i\), particle position \(\vec r_i\), contact point \(\vec c_{ij}\), and cg line integral \(\psi(\vec r,\vec r_i,\vec r_j)\), see CGFunctions::Gauss::evaluateCGIntegral.

Referenced by addContactStress(), addInteractionStatistics(), getContactStress(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setContactStress(), setCylindricalFields(), setFields(), setZero(), and write().

◆ density_

Mdouble CGFields::StandardFields::density_
private

(Mass) density, computed as the sum over all particles i

\[\rho(\vec r,t)=\sum_i m_i \phi(\vec r,\vec r_i)\]

with particle mass m_i and cg function \(\phi(\vec r,\vec r_i),\), see CGFunctions::Gauss::evaluateCGFunction.

Referenced by addParticleStatistics(), getDensity(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setFields(), setZero(), and write().

◆ interactionForceDensity_

Vec3D CGFields::StandardFields::interactionForceDensity_
private

Interaction force density, computed as the sum over all contacts between particle i and (external) wall/fixed particle j

\[\vec{IFD}(\vec r,t)=\sum_{ij} f_{ij} \phi(\vec r,\vec c_{ij}),\]

with contact force \(\vec f_{ij}\) and cg function \(\phi(\vec r,\vec r_i)\), see CGFunctions::Gauss::evaluateCGFunction.

Referenced by addContactPointStatistics(), addInteractionForceDensity(), getInteractionForceDensity(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setCylindricalFields(), setFields(), setInteractionForceDensity(), setZero(), and write().

◆ momentum_

Vec3D CGFields::StandardFields::momentum_
private

Momentum, computed as the sum over all particles i

\[\vec j(\vec r,t)=\sum_i m_i \vec v_i\phi(\vec r,\vec r_i),\]

with particle momentum \(m_i\vec v_i\) and cg function \(\phi(\vec r,\vec r_i)\), see CGFunctions::Gauss::evaluateCGFunction.

Velocity can be calculated in a post-processing step from momentum and density as

\[\vec V(\vec r,t) = \frac{\vec j(\vec r,t)}{\rho(\vec r,t)}.\]

Referenced by addParticleStatistics(), getMomentum(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setCylindricalFields(), setFields(), setZero(), and write().

◆ momentumFlux_

MatrixSymmetric3D CGFields::StandardFields::momentumFlux_
private

Momentum, computed as the sum over all particles i

\[\mathbf k(\vec r,t)=\sum_i m_i \vec v_i \otimes \vec v_i\phi(\vec r,\vec r_i),\]

with particle momentum flux \(m_i\vec v_i \otimes \vec v_i\) and cg function \(\phi(\vec r,\vec r_i)\), see CGFunctions::Gauss::evaluateCGFunction.

Kinetic stress can be calculated in a post-processing step from momentum flux and density as

\[\mathbf \sigma^{k} = \mathbf k - \rho \vec V \otimes \vec V.\]

Referenced by addParticleStatistics(), getMomentumFlux(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setCylindricalFields(), setFields(), setZero(), and write().

◆ particleSizeDensity_

std::array<Mdouble, 6> CGFields::StandardFields::particleSizeDensity_
private

Density of particle size, and powers of particle size,

\[ \vec{PS}_k(\vec r,t)= \sum_i r_i^k \phi(\vec r),\]

with radius \(r_i\).

Used to compute the first five moments of the particle size distribution,

\[ <r^k>(\vec r,t)= \vec{PS}_k / \vec{PS}_0, \]

with \(\vec{PS}_0\) denoting the number density.

Referenced by addParticleStatistics(), getParticleSizeDensity(), getParticleSizeMomenta(), getSquared(), operator*(), operator+=(), operator-=(), operator/=(), output(), setFields(), setZero(), and write().

◆ volumeFraction_

Mdouble CGFields::StandardFields::volumeFraction_
private

Particle volume fraction, computed as the sum over all particles i

\[\nu(\vec r,t)=\sum_i V_i \phi(\vec r,\vec r_i),\]

with particle volume V_i and cg function \(\phi(\vec r,\vec r_i)\), see CGFunctions::Gauss::evaluateCGFunction.

Referenced by addParticleStatistics(), getSquared(), getVolumeFraction(), operator*(), operator+=(), operator-=(), operator/=(), output(), setFields(), setZero(), and write().


The documentation for this class was generated from the following files: