CGFields::LiquidMigrationFields Class Reference

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

#include <LiquidMigrationFields.h>

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
 

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_
 

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.

35 {
36  setZero();
37 #ifdef DEBUG_CONSTRUCTOR
38  std::cerr << "LiquidMigrationFields::LiquidMigrationFields() finished" << std::endl;
39 #endif
40 }
void setZero()
Sets all fields to zero.
Definition: LiquidMigrationFields.cc:69

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
168 {
169 }

◆ 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
157 {
158  liquidBridgeVolume_ += currentInteraction.getLiquidBridgeVolume() * psi;
159 }
Mdouble liquidBridgeVolume_
Definition: LiquidMigrationFields.h:187

References getLiquidBridgeVolume(), and liquidBridgeVolume_.

◆ addParticleDifferentialStatistics()

void CGFields::LiquidMigrationFields::addParticleDifferentialStatistics ( Vec3D dphi,
const LiquidMigrationFields currentInteraction 
)
149 {
150 }

◆ 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
143 {
144  liquidFilmVolume_ += currentInteraction.getLiquidFilmVolume() * phi;
145 }
Mdouble liquidFilmVolume_
Definition: LiquidMigrationFields.h:195

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.

172 {
173  return true;
174 }

◆ evaluateFixedParticles()

static bool CGFields::LiquidMigrationFields::evaluateFixedParticles ( )
inlinestatic
166  {
167  return true;
168  }

◆ getLiquidBridgeVolume()

Mdouble CGFields::LiquidMigrationFields::getLiquidBridgeVolume ( ) const
inline
156  {
157  return liquidBridgeVolume_;
158  }

References liquidBridgeVolume_.

Referenced by addInteractionStatistics().

◆ getLiquidFilmVolume()

Mdouble CGFields::LiquidMigrationFields::getLiquidFilmVolume ( ) const
inline
161  {
162  return liquidFilmVolume_;
163  }

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
79 {
81  P.liquidBridgeVolume_ = mathsFunc::square(liquidBridgeVolume_);
82  P.liquidFilmVolume_ = mathsFunc::square(liquidFilmVolume_);
83  return P;
84 }
LiquidMigrationFields()
Default constructor, sets all field values to zero.
Definition: LiquidMigrationFields.cc:34
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
T square(const T val)
squares a number
Definition: ExtendedMath.h:106

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

175  {
176  return false;
177  }

◆ 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
120 {
122  p.liquidBridgeVolume_ = liquidBridgeVolume_ * a;
123  p.liquidFilmVolume_ = liquidFilmVolume_ * a;
124  return p;
125 }

References liquidBridgeVolume_, and liquidFilmVolume_.

◆ 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
98 {
99  liquidBridgeVolume_ += P.liquidBridgeVolume_;
100  liquidFilmVolume_ += P.liquidFilmVolume_;
101  return *this;
102 }

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
109 {
110  liquidBridgeVolume_ -= P.liquidBridgeVolume_;
111  liquidFilmVolume_ -= P.liquidFilmVolume_;
112  return *this;
113 }

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
132 {
133  liquidBridgeVolume_ /= a;
134  liquidFilmVolume_ /= a;
135  return *this;
136 }

References 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.
64 {
65  os << "liquidBridgeVolume " << liquidBridgeVolume_;
66  os << " liquidFilmVolume " << liquidFilmVolume_;
67 }

References liquidBridgeVolume_, and liquidFilmVolume_.

◆ setCylindricalFields() [1/2]

void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
212 {
213  setFields(c, type);
214 }
void setFields(const BaseInteraction &c, IntegralType type)
Definition: LiquidMigrationFields.cc:176

References setFields().

◆ setCylindricalFields() [2/2]

void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseParticle p)
217 {
218  setFields(p);
219 }

References setFields().

◆ setFields() [1/2]

void CGFields::LiquidMigrationFields::setFields ( const BaseInteraction c,
IntegralType  type 
)
177 {
178  auto l = dynamic_cast<const LiquidMigrationWilletInteraction*>(&c);
179  logger.assert_debug(l != nullptr,
180  "LiquidMigrationFields::addParticleStatistics: "
181  "interaction type should be LiquidMigrationWilletInteraction");
182  liquidBridgeVolume_ = l->getLiquidBridgeVolume();
183 }
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:45

References liquidBridgeVolume_, and logger.

Referenced by setCylindricalFields().

◆ setFields() [2/2]

void CGFields::LiquidMigrationFields::setFields ( const BaseParticle p)
204 {
205  auto l = dynamic_cast<const LiquidFilmParticle*>(&p);
206  logger.assert_debug(l != nullptr,
207  "LiquidMigrationFields::addParticleStatistics: particle type should be LiquidFilmParticle");
208  liquidFilmVolume_ = l->getLiquidVolume();
209 }
Definition: LiquidFilmParticle.h:36

References liquidFilmVolume_, and logger.

◆ setZero()

void CGFields::LiquidMigrationFields::setZero ( )

Sets all fields to zero.

70 {
71  liquidBridgeVolume_ = 0.0;
72  liquidFilmVolume_ = 0.0;
73 }

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.
55 {
56  os << liquidBridgeVolume_;
57  os << " " << liquidFilmVolume_;
58 }

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.
46 {
47  os << countVariables + 1 << ":liquidBridgeVolume ";
48  os << countVariables + 2 << ":liquidFilmVolume ";
49 }

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: