CGFields::StandardFieldsBinning Class Reference

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

#include <StandardFieldsBinning.h>

+ Inheritance diagram for CGFields::StandardFieldsBinning:

Public Member Functions

 StandardFieldsBinning ()
 Default constructor, sets all field values to zero. More...
 
 StandardFieldsBinning (const StandardFieldsBinning &P)=default
 Default copy constructor, copies the values of all fields. More...
 
 ~StandardFieldsBinning ()=default
 Destructor, it simply destructs the StandardFieldsBinning and all the objects it contains. More...
 
void addParticleStatistics (Mdouble phi, const StandardFieldsBinning &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 StandardFieldsBinning &currentInteraction)
 
void addInteractionStatistics (Mdouble psi, const StandardFieldsBinning &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 StandardFieldsBinning &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)
 
- Public Member Functions inherited from CGFields::StandardFields
 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 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 ()
 
- Static Public Member Functions inherited from CGFields::StandardFields
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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from CGFields::StandardFields
void setContactStress (Matrix3D contactStress)
 
void addContactStress (Matrix3D contactStress)
 
void setInteractionForceDensity (Vec3D interactionForceDensity)
 
void addInteractionForceDensity (Vec3D interactionForceDensity)
 
- 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

◆ StandardFieldsBinning() [1/2]

CGFields::StandardFieldsBinning::StandardFieldsBinning ( )

Default constructor, sets all field values to zero.

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

References CGFields::StandardFields::setZero().

◆ StandardFieldsBinning() [2/2]

CGFields::StandardFieldsBinning::StandardFieldsBinning ( const StandardFieldsBinning P)
default

Default copy constructor, copies the values of all fields.

◆ ~StandardFieldsBinning()

CGFields::StandardFieldsBinning::~StandardFieldsBinning ( )
default

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

Member Function Documentation

◆ addContactPointStatistics()

void CGFields::StandardFieldsBinning::addContactPointStatistics ( Mdouble  phi,
const StandardFieldsBinning currentInteraction 
)
inline

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).

73 {};

◆ addInteractionStatistics()

void CGFields::StandardFieldsBinning::addInteractionStatistics ( Mdouble  psi,
const StandardFieldsBinning currentInteraction 
)
inline

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).

66 {};

◆ addParticleDifferentialStatistics()

void CGFields::StandardFieldsBinning::addParticleDifferentialStatistics ( Vec3D dphi,
const StandardFieldsBinning currentInteraction 
)
inline
59 {};

◆ addParticleStatistics()

void CGFields::StandardFieldsBinning::addParticleStatistics ( Mdouble  phi,
const StandardFieldsBinning 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
24  {
25  StandardFields::addParticleStatistics(phi, currentInteraction);
26 
27  addContactStress(currentInteraction.getContactStress()*phi);
28  addInteractionForceDensity(currentInteraction.getInteractionForceDensity()*phi);
29  }
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 a...
Definition: StandardFields.cc:168
void addInteractionForceDensity(Vec3D interactionForceDensity)
Definition: StandardFields.h:216
void addContactStress(Matrix3D contactStress)
Definition: StandardFields.h:206

References CGFields::StandardFields::addContactStress(), CGFields::StandardFields::addInteractionForceDensity(), CGFields::StandardFields::addParticleStatistics(), CGFields::StandardFields::getContactStress(), and CGFields::StandardFields::getInteractionForceDensity().

◆ doInteractionStatistics()

static bool CGFields::StandardFieldsBinning::doInteractionStatistics ( )
inlinestatic

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

Within binning all fields are evaluated on a per particle level so also the contact stress is averaged from the individual particles rather than from the individual interactions

92  {
93  return false;
94  }

◆ evaluateFixedParticles()

static bool CGFields::StandardFieldsBinning::evaluateFixedParticles ( )
inlinestatic
97  {
98  return false;
99  }

◆ isDifferentialField()

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

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

106  {
107  return false;
108  }

◆ setCylindricalFields() [1/2]

void CGFields::StandardFieldsBinning::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
inline
77 {};

◆ setCylindricalFields() [2/2]

void CGFields::StandardFieldsBinning::setCylindricalFields ( const BaseParticle p)
inline
81 {};

◆ setFields() [1/2]

void CGFields::StandardFieldsBinning::setFields ( const BaseInteraction c,
IntegralType  type 
)
inline
75 {};

◆ setFields() [2/2]

void CGFields::StandardFieldsBinning::setFields ( const BaseParticle p)
32  {
34 
35  Matrix3D sumContactStress;
36  Vec3D sumForces;
37 
38  // Using Eqs. 7, 11, and 15 from the following paper
39  // https://www2.msm.ctw.utwente.nl/sluding/PAPERS/cdm2004_luding.pdf
40  // or look here: https://doi.org/10.1016/j.ijsolstr.2004.05.048
41  for (auto i: p.getInteractions())
42  {
43  if (i->getP() == &p)
44  {
45  sumForces += i->getForce();
46  sumContactStress += Matrix3D::dyadic(i->getForce(), i->getCP());
47  }
48  else if (i->getI() == &p)
49  {
50  sumForces += -i->getForce();
51  sumContactStress += Matrix3D::dyadic(i->getForce(), i->getIC());
52  }
53  else
54  {
55  logger(ERROR, "Something went wrong in StandardFieldsBinning::setFields: handled particle is not part of its own interactions");
56  }
57  }
58 
59  setInteractionForceDensity(sumForces);
60  setContactStress(sumContactStress);
61  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
float * p
Definition: Tutorial_Map_using.cpp:9
void setFields(const BaseInteraction &c, IntegralType type)
Definition: StandardFields.cc:212
void setContactStress(Matrix3D contactStress)
Definition: StandardFields.h:201
void setInteractionForceDensity(Vec3D interactionForceDensity)
Definition: StandardFields.h:211
Implementation of a 3D matrix.
Definition: Kernel/Math/Matrix.h:17
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:302
Definition: Kernel/Math/Vector.h:30

References Matrix3D::dyadic(), ERROR, i, logger, p, CGFields::StandardFields::setContactStress(), CGFields::StandardFields::setFields(), and CGFields::StandardFields::setInteractionForceDensity().


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