MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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).

Definition at line 50 of file LiquidMigrationFields.h.

Constructor & Destructor Documentation

CGFields::LiquidMigrationFields::LiquidMigrationFields ( )

Default constructor, sets all field values to zero.

Definition at line 34 of file LiquidMigrationFields.cc.

References setZero().

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.
CGFields::LiquidMigrationFields::LiquidMigrationFields ( const LiquidMigrationFields P)
default

Default copy constructor, copies the values of all fields.

CGFields::LiquidMigrationFields::~LiquidMigrationFields ( )
default

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

Member Function Documentation

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

Definition at line 166 of file LiquidMigrationFields.cc.

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

Definition at line 156 of file LiquidMigrationFields.cc.

References getLiquidBridgeVolume(), and liquidBridgeVolume_.

157 {
158  liquidBridgeVolume_ += currentInteraction.getLiquidBridgeVolume() * psi;
159 }
void CGFields::LiquidMigrationFields::addParticleDifferentialStatistics ( Vec3D dphi,
const LiquidMigrationFields currentInteraction 
)

Definition at line 147 of file LiquidMigrationFields.cc.

149 {
150 }
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

Definition at line 142 of file LiquidMigrationFields.cc.

References getLiquidFilmVolume(), and liquidFilmVolume_.

143 {
144  liquidFilmVolume_ += currentInteraction.getLiquidFilmVolume() * phi;
145 }
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.

Definition at line 171 of file LiquidMigrationFields.cc.

172 {
173  return true;
174 }
static bool CGFields::LiquidMigrationFields::evaluateFixedParticles ( )
inlinestatic

Definition at line 165 of file LiquidMigrationFields.h.

166  {
167  return true;
168  }
Mdouble CGFields::LiquidMigrationFields::getLiquidBridgeVolume ( ) const
inline

Definition at line 155 of file LiquidMigrationFields.h.

References liquidBridgeVolume_.

Referenced by addInteractionStatistics().

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

Definition at line 160 of file LiquidMigrationFields.h.

References liquidFilmVolume_.

Referenced by addParticleStatistics().

161  {
162  return liquidFilmVolume_;
163  }
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

Definition at line 78 of file LiquidMigrationFields.cc.

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

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.
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
static bool CGFields::LiquidMigrationFields::isDifferentialField ( )
inlinestatic

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

Definition at line 174 of file LiquidMigrationFields.h.

175  {
176  return false;
177  }
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

Definition at line 119 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

120 {
122  p.liquidBridgeVolume_ = liquidBridgeVolume_ * a;
123  p.liquidFilmVolume_ = liquidFilmVolume_ * a;
124  return p;
125 }
LiquidMigrationFields()
Default constructor, sets all field values to zero.
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

Definition at line 97 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

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

Definition at line 108 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

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

Definition at line 131 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

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

Definition at line 63 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

64 {
65  os << "liquidBridgeVolume " << liquidBridgeVolume_;
66  os << " liquidFilmVolume " << liquidFilmVolume_;
67 }
void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)

Definition at line 211 of file LiquidMigrationFields.cc.

References setFields().

212 {
213  setFields(c, type);
214 }
void setFields(const BaseInteraction &c, IntegralType type)
void CGFields::LiquidMigrationFields::setCylindricalFields ( const BaseParticle p)

Definition at line 216 of file LiquidMigrationFields.cc.

References setFields().

217 {
218  setFields(p);
219 }
void setFields(const BaseInteraction &c, IntegralType type)
void CGFields::LiquidMigrationFields::setFields ( const BaseInteraction c,
IntegralType  type 
)

Definition at line 176 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and logger.

Referenced by setCylindricalFields().

177 {
178  auto l = dynamic_cast<const LiquidMigrationWilletInteraction*>(&c);
179  logger.assert(l != nullptr,
180  "LiquidMigrationFields::addParticleStatistics: "
181  "interaction type should be LiquidMigrationWilletInteraction");
182  liquidBridgeVolume_ = l->getLiquidBridgeVolume();
183 }
Defines the liquid bridge willet interaction between two particles or walls.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void CGFields::LiquidMigrationFields::setFields ( const BaseParticle p)

Definition at line 203 of file LiquidMigrationFields.cc.

References liquidFilmVolume_, and logger.

204 {
205  auto l = dynamic_cast<const LiquidFilmParticle*>(&p);
206  logger.assert(l != nullptr,
207  "LiquidMigrationFields::addParticleStatistics: particle type should be LiquidFilmParticle");
208  liquidFilmVolume_ = l->getLiquidVolume();
209 }
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void CGFields::LiquidMigrationFields::setZero ( )

Sets all fields to zero.

Definition at line 69 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

Referenced by LiquidMigrationFields().

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.

Definition at line 54 of file LiquidMigrationFields.cc.

References liquidBridgeVolume_, and liquidFilmVolume_.

void CGFields::LiquidMigrationFields::writeNames ( std::ostream &  os,
unsigned  countVariables 
)
static
Parameters
[out]osthe ostream into which the data is written.

Definition at line 45 of file LiquidMigrationFields.cc.

46 {
47  os << countVariables + 1 << ":liquidBridgeVolume ";
48  os << countVariables + 2 << ":liquidFilmVolume ";
49 }

Member Data Documentation

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.

Definition at line 187 of file LiquidMigrationFields.h.

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

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.

Definition at line 195 of file LiquidMigrationFields.h.

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: