CGFields::LiquidMigrationFields Class Reference

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

#include <LiquidMigrationFields.h>

+ Inheritance diagram for CGFields::LiquidMigrationFields:

Public Member Functions

 LiquidMigrationFields ()
 Default constructor, sets all field values to zero. More...
 
 LiquidMigrationFields (const LiquidMigrationFields &P)=default
 Default copy constructor, copies the values of all fields. More...
 
 ~LiquidMigrationFields ()=default
 Destructor, it simply destructs the LiquidMigrationFields 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...
 
LiquidMigrationFields getSquared () const
 Returns the square of all field values (to calculate standard deviation). More...
 
LiquidMigrationFieldsoperator= (const LiquidMigrationFields &P)
 Copies all field values. More...
 
LiquidMigrationFieldsoperator+= (const LiquidMigrationFields &P)
 Adds the field values on the RHS to the LHS of the equation. More...
 
LiquidMigrationFieldsoperator-= (const LiquidMigrationFields &P)
 Subtracts the field values on the RHS from the LHS of the equation. More...
 
LiquidMigrationFieldsoperator/= (Mdouble a)
 Divides the field values on the LHS by the RHS of the equation. More...
 
LiquidMigrationFields 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 LiquidMigrationFields &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 LiquidMigrationFields &currentInteraction)
 
void addInteractionStatistics (Mdouble psi, const LiquidMigrationFields &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 LiquidMigrationFields &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 getLiquidBridgeVolume () const
 
Mdouble getLiquidFilmVolume () 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 ()
 

Private Attributes

Mdouble liquidBridgeVolume_
 
Mdouble liquidFilmVolume_
 

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

◆ LiquidMigrationFields() [1/2]

CGFields::LiquidMigrationFields::LiquidMigrationFields ( )

Default constructor, sets all field values to zero.

14 {
15  setZero();
16 #ifdef DEBUG_CONSTRUCTOR
17  std::cerr << "LiquidMigrationFields::LiquidMigrationFields() finished" << std::endl;
18 #endif
19 }
void setZero()
Sets all fields to zero.
Definition: LiquidMigrationFields.cc:48

References setZero().

◆ LiquidMigrationFields() [2/2]

CGFields::LiquidMigrationFields::LiquidMigrationFields ( const LiquidMigrationFields P)
default

Default copy constructor, copies the values of all fields.

◆ ~LiquidMigrationFields()

CGFields::LiquidMigrationFields::~LiquidMigrationFields ( )
default

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

Member Function Documentation

◆ addContactPointStatistics()

void CGFields::LiquidMigrationFields::addContactPointStatistics ( Mdouble phi  ,
const LiquidMigrationFields 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
147 {
148 }

◆ addInteractionStatistics()

void CGFields::LiquidMigrationFields::addInteractionStatistics ( Mdouble  psi,
const LiquidMigrationFields 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
136 {
137  liquidBridgeVolume_ += currentInteraction.getLiquidBridgeVolume() * psi;
138 }
Mdouble liquidBridgeVolume_
Definition: LiquidMigrationFields.h:169

References getLiquidBridgeVolume(), and liquidBridgeVolume_.

◆ addParticleDifferentialStatistics()

void CGFields::LiquidMigrationFields::addParticleDifferentialStatistics ( Vec3D dphi,
const LiquidMigrationFields currentInteraction 
)
128 {
129 }

◆ addParticleStatistics()

void CGFields::LiquidMigrationFields::addParticleStatistics ( Mdouble  phi,
const LiquidMigrationFields 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]pthe particle which is used in the cg function
122 {
123  liquidFilmVolume_ += currentInteraction.getLiquidFilmVolume() * phi;
124 }
Mdouble liquidFilmVolume_
Definition: LiquidMigrationFields.h:177

References getLiquidFilmVolume(), and liquidFilmVolume_.

◆ doInteractionStatistics()

bool CGFields::LiquidMigrationFields::doInteractionStatistics ( )
static

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

151 {
152  return true;
153 }

◆ evaluateFixedParticles()

static bool CGFields::LiquidMigrationFields::evaluateFixedParticles ( )
inlinestatic
148  {
149  return true;
150  }

◆ getLiquidBridgeVolume()

Mdouble CGFields::LiquidMigrationFields::getLiquidBridgeVolume ( ) const
inline
138  {
139  return liquidBridgeVolume_;
140  }

References liquidBridgeVolume_.

Referenced by addInteractionStatistics().

◆ getLiquidFilmVolume()

Mdouble CGFields::LiquidMigrationFields::getLiquidFilmVolume ( ) const
inline
143  {
144  return liquidFilmVolume_;
145  }

References liquidFilmVolume_.

Referenced by addParticleStatistics().

◆ getSquared()

LiquidMigrationFields CGFields::LiquidMigrationFields::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
58 {
60  P.liquidBridgeVolume_ = mathsFunc::square(liquidBridgeVolume_);
61  P.liquidFilmVolume_ = mathsFunc::square(liquidFilmVolume_);
62  return P;
63 }
LiquidMigrationFields()
Default constructor, sets all field values to zero.
Definition: LiquidMigrationFields.cc:13
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:77
T square(const T val)
squares a number
Definition: ExtendedMath.h:86

References liquidBridgeVolume_, liquidFilmVolume_, Global_Physical_Variables::P, and mathsFunc::square().

◆ isDifferentialField()

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

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

157  {
158  return false;
159  }

◆ operator*()

LiquidMigrationFields CGFields::LiquidMigrationFields::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
99 {
101  p.liquidBridgeVolume_ = liquidBridgeVolume_ * a;
102  p.liquidFilmVolume_ = liquidFilmVolume_ * a;
103  return p;
104 }
float * p
Definition: Tutorial_Map_using.cpp:9
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, liquidBridgeVolume_, liquidFilmVolume_, and p.

◆ operator+=()

LiquidMigrationFields & CGFields::LiquidMigrationFields::operator+= ( const LiquidMigrationFields 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
77 {
78  liquidBridgeVolume_ += P.liquidBridgeVolume_;
79  liquidFilmVolume_ += P.liquidFilmVolume_;
80  return *this;
81 }

References liquidBridgeVolume_, liquidFilmVolume_, and Global_Physical_Variables::P.

◆ operator-=()

LiquidMigrationFields & CGFields::LiquidMigrationFields::operator-= ( const LiquidMigrationFields 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
88 {
89  liquidBridgeVolume_ -= P.liquidBridgeVolume_;
90  liquidFilmVolume_ -= P.liquidFilmVolume_;
91  return *this;
92 }

References liquidBridgeVolume_, liquidFilmVolume_, and Global_Physical_Variables::P.

◆ operator/=()

LiquidMigrationFields & CGFields::LiquidMigrationFields::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
111 {
113  liquidFilmVolume_ /= a;
114  return *this;
115 }

References a, liquidBridgeVolume_, and liquidFilmVolume_.

◆ operator=()

LiquidMigrationFields & CGFields::LiquidMigrationFields::operator= ( const LiquidMigrationFields 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::LiquidMigrationFields::output ( std::ostream &  os) const

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

Parameters
[out]osthe ostream into which the data is written.
43 {
44  os << "liquidBridgeVolume " << liquidBridgeVolume_;
45  os << " liquidFilmVolume " << liquidFilmVolume_;
46 }

References liquidBridgeVolume_, and liquidFilmVolume_.

◆ setCylindricalFields() [1/2]

void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
191 {
192  setFields(c, type);
193 }
void setFields(const BaseInteraction &c, IntegralType type)
Definition: LiquidMigrationFields.cc:155
int c
Definition: calibrate.py:100
type
Definition: compute_granudrum_aor.py:141

References calibrate::c, setFields(), and compute_granudrum_aor::type.

◆ setCylindricalFields() [2/2]

void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseParticle p)
196 {
197  setFields(p);
198 }

References p, and setFields().

◆ setFields() [1/2]

void CGFields::LiquidMigrationFields::setFields ( const BaseInteraction c,
IntegralType  type 
)
156 {
157  auto l = dynamic_cast<const LiquidMigrationWilletInteraction*>(&c);
158  logger.assert_debug(l != nullptr,
159  "LiquidMigrationFields::addParticleStatistics: "
160  "interaction type should be LiquidMigrationWilletInteraction");
161  liquidBridgeVolume_ = l->getLiquidBridgeVolume();
162 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Defines the liquid bridge willet interaction between two particles or walls.
Definition: LiquidMigrationWilletInteraction.h:30

References calibrate::c, liquidBridgeVolume_, and logger.

Referenced by setCylindricalFields().

◆ setFields() [2/2]

void CGFields::LiquidMigrationFields::setFields ( const BaseParticle p)
183 {
184  auto l = dynamic_cast<const LiquidFilmParticle*>(&p);
185  logger.assert_debug(l != nullptr,
186  "LiquidMigrationFields::addParticleStatistics: particle type should be LiquidFilmParticle");
187  liquidFilmVolume_ = l->getLiquidVolume();
188 }
Definition: LiquidFilmParticle.h:15

References liquidFilmVolume_, logger, and p.

◆ setZero()

void CGFields::LiquidMigrationFields::setZero ( )

Sets all fields to zero.

49 {
50  liquidBridgeVolume_ = 0.0;
51  liquidFilmVolume_ = 0.0;
52 }

References liquidBridgeVolume_, and liquidFilmVolume_.

Referenced by LiquidMigrationFields().

◆ write()

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

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

Parameters
[out]osthe ostream into which the data is written.
34 {
35  os << liquidBridgeVolume_;
36  os << " " << liquidFilmVolume_;
37 }

References liquidBridgeVolume_, and liquidFilmVolume_.

◆ writeNames()

void CGFields::LiquidMigrationFields::writeNames ( std::ostream &  os,
unsigned  countVariables 
)
static
Parameters
[out]osthe ostream into which the data is written.
25 {
26  os << countVariables + 1 << ":liquidBridgeVolume ";
27  os << countVariables + 2 << ":liquidFilmVolume ";
28 }

Member Data Documentation

◆ liquidBridgeVolume_

Mdouble CGFields::LiquidMigrationFields::liquidBridgeVolume_
private

liquid bridge volume density, computed as the sum over all particles i

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

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

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

◆ liquidFilmVolume_

Mdouble CGFields::LiquidMigrationFields::liquidFilmVolume_
private

liquid bridge volume density, computed as the sum over all particles i

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

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

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


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