CGFields::GradVelocityField Class Reference

#include <GradVelocityField.h>

+ Inheritance diagram for CGFields::GradVelocityField:

Public Member Functions

 GradVelocityField ()
 Default constructor, sets all field values to zero. More...
 
 GradVelocityField (const GradVelocityField &P)=default
 Default copy constructor, copies the values of all fields. More...
 
 ~GradVelocityField ()=default
 Destructor, it simply destructs the GradVelocityField 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...
 
GradVelocityField getSquared () const
 Returns the square of all field values (to calculate standard deviation). More...
 
GradVelocityFieldoperator= (const GradVelocityField &P)
 Copies all field values. More...
 
GradVelocityFieldoperator+= (const GradVelocityField &P)
 Adds the field values on the RHS to the LHS of the equation. More...
 
GradVelocityFieldoperator-= (const GradVelocityField &P)
 Subtracts the field values on the RHS from the LHS of the equation. More...
 
GradVelocityFieldoperator/= (Mdouble a)
 Divides the field values on the LHS by the RHS of the equation. More...
 
GradVelocityField 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 GradVelocityField &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 GradVelocityField &currentInteraction)
 
void addInteractionStatistics (Mdouble psi, const GradVelocityField &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 GradVelocityField &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 getDensity () const
 
Vec3D getMomentum () const
 
Vec3D getDDensity () const
 
Matrix3D getDMomentum () 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 density_
 
Vec3D momentum_
 
Vec3D ddensity_
 
Matrix3D dmomentum_
 

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

Constructor & Destructor Documentation

◆ GradVelocityField() [1/2]

CGFields::GradVelocityField::GradVelocityField ( )

Default constructor, sets all field values to zero.

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

References setZero().

◆ GradVelocityField() [2/2]

CGFields::GradVelocityField::GradVelocityField ( const GradVelocityField P)
default

Default copy constructor, copies the values of all fields.

◆ ~GradVelocityField()

CGFields::GradVelocityField::~GradVelocityField ( )
default

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

Member Function Documentation

◆ addContactPointStatistics()

void CGFields::GradVelocityField::addContactPointStatistics ( Mdouble  phi,
const GradVelocityField 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
157 {
158 }

◆ addInteractionStatistics()

void CGFields::GradVelocityField::addInteractionStatistics ( Mdouble  psi,
const GradVelocityField 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
148 {
149 }

◆ addParticleDifferentialStatistics()

void CGFields::GradVelocityField::addParticleDifferentialStatistics ( Vec3D dphi,
const GradVelocityField currentInteraction 
)
161 {
162  ddensity_ += currentInteraction.getDensity() * dphi;
163  dmomentum_ += Matrix3D::dyadic(currentInteraction.getMomentum(), dphi);
164 }
Matrix3D dmomentum_
Definition: GradVelocityField.h:166
Vec3D ddensity_
Definition: GradVelocityField.h:165
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:302

References ddensity_, dmomentum_, Matrix3D::dyadic(), getDensity(), and getMomentum().

◆ addParticleStatistics()

void CGFields::GradVelocityField::addParticleStatistics ( Mdouble  phi,
const GradVelocityField 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
138 {
139  density_ += currentInteraction.getDensity() * phi;
140  momentum_ += currentInteraction.getMomentum() * phi;
141 }
Mdouble density_
Definition: GradVelocityField.h:163
Vec3D momentum_
Definition: GradVelocityField.h:164

References density_, getDensity(), getMomentum(), and momentum_.

◆ doInteractionStatistics()

bool CGFields::GradVelocityField::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.
173 {
174  return false;
175 }

◆ evaluateFixedParticles()

static bool CGFields::GradVelocityField::evaluateFixedParticles ( )
inlinestatic
148  {
149  return false;
150  }

◆ getDDensity()

Vec3D CGFields::GradVelocityField::getDDensity ( ) const
inline
138  {
139  return ddensity_;
140  }

References ddensity_.

◆ getDensity()

Mdouble CGFields::GradVelocityField::getDensity ( ) const
inline
128  {
129  return density_;
130  }

References density_.

Referenced by addParticleDifferentialStatistics(), and addParticleStatistics().

◆ getDMomentum()

Matrix3D CGFields::GradVelocityField::getDMomentum ( ) const
inline
143  {
144  return dmomentum_;
145  }

References dmomentum_.

◆ getMomentum()

Vec3D CGFields::GradVelocityField::getMomentum ( ) const
inline
133  {
134  return momentum_;
135  }

References momentum_.

Referenced by addParticleDifferentialStatistics(), and addParticleStatistics().

◆ getSquared()

GradVelocityField CGFields::GradVelocityField::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
64 {
66  P.density_ = mathsFunc::square(density_);
67  P.momentum_ = Vec3D::square(momentum_);
68  P.ddensity_ = Vec3D::square(ddensity_);
69  P.dmomentum_ = Matrix3D::square(dmomentum_);
70  return P;
71 }
GradVelocityField()
Default constructor, sets all field values to zero.
Definition: GradVelocityField.cc:11
static Matrix3D square(const Matrix3D &A)
Calculates the pointwise square.
Definition: Matrix.cc:277
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 ddensity_, density_, dmomentum_, momentum_, Global_Physical_Variables::P, Matrix3D::square(), mathsFunc::square(), and Vec3D::square().

◆ isDifferentialField()

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

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

157  {
158  return true;
159  }

◆ operator*()

GradVelocityField CGFields::GradVelocityField::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
111 {
113  p.density_ = density_ * a;
114  p.momentum_ = momentum_ * a;
115  p.ddensity_ = ddensity_ * a;
116  p.dmomentum_ = dmomentum_ * a;
117  return p;
118 }
float * p
Definition: Tutorial_Map_using.cpp:9
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, ddensity_, density_, dmomentum_, momentum_, and p.

◆ operator+=()

GradVelocityField & CGFields::GradVelocityField::operator+= ( const GradVelocityField 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
85 {
86  density_ += P.density_;
87  momentum_ += P.momentum_;
88  ddensity_ += P.ddensity_;
89  dmomentum_ += P.dmomentum_;
90  return *this;
91 }

References ddensity_, density_, dmomentum_, momentum_, and Global_Physical_Variables::P.

◆ operator-=()

GradVelocityField & CGFields::GradVelocityField::operator-= ( const GradVelocityField 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
98 {
99  density_ -= P.density_;
100  momentum_ -= P.momentum_;
101  ddensity_ -= P.ddensity_;
102  dmomentum_ -= P.dmomentum_;
103  return *this;
104 }

References ddensity_, density_, dmomentum_, momentum_, and Global_Physical_Variables::P.

◆ operator/=()

GradVelocityField & CGFields::GradVelocityField::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
125 {
126  density_ /= a;
127  momentum_ /= a;
128  ddensity_ /= a;
129  dmomentum_ /= a;
130  return *this;
131 }

References a, ddensity_, density_, dmomentum_, and momentum_.

◆ operator=()

GradVelocityField & CGFields::GradVelocityField::operator= ( const GradVelocityField 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::GradVelocityField::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.
45 {
46  os << "density " << density_;
47  os << " momentum " << momentum_;
48  os << " ddensity " << ddensity_;
49  os << " dmomentum " << dmomentum_;
50 }

References ddensity_, density_, dmomentum_, and momentum_.

◆ setCylindricalFields() [1/2]

void CGFields::GradVelocityField::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
188 {
189 }

◆ setCylindricalFields() [2/2]

void CGFields::GradVelocityField::setCylindricalFields ( const BaseParticle p)
192 {
193  setFields(p);
195 }
void setFields(const BaseInteraction &c, IntegralType type)
Definition: GradVelocityField.cc:177
Vec3D getCylindricalTensorField(const Vec3D &position) const
Returns this vector field at point p to cylindrical coordinates.
Definition: Vector.cc:280

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

◆ setFields() [1/2]

void CGFields::GradVelocityField::setFields ( const BaseInteraction c,
IntegralType  type 
)
178 {
179 }

Referenced by setCylindricalFields().

◆ setFields() [2/2]

void CGFields::GradVelocityField::setFields ( const BaseParticle p)
182 {
183  density_ = p.getMass();
184  momentum_ = p.getVelocity() * p.getMass();
185 }

References density_, momentum_, and p.

◆ setZero()

void CGFields::GradVelocityField::setZero ( )

Sets all fields to zero.

53 {
54  density_ = 0.0;
58 }
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:54
void setZero()
Sets all elements to zero.
Definition: Vector.cc:23

References ddensity_, density_, dmomentum_, momentum_, Matrix3D::setZero(), and Vec3D::setZero().

Referenced by GradVelocityField().

◆ write()

void CGFields::GradVelocityField::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 << density_;
36  os << " " << momentum_;
37  os << " " << ddensity_;
38  os << " " << dmomentum_;
39 }

References ddensity_, density_, dmomentum_, and momentum_.

◆ writeNames()

void CGFields::GradVelocityField::writeNames ( std::ostream &  os,
unsigned  countVariables 
)
static
Parameters
[out]osthe ostream into which the data is written.
23 {
24  os << countVariables + 1 << ":Density ";
25  os << countVariables + 2 << "-" << countVariables + 4 << ":momentum ";
26  os << countVariables + 5 << "-" << countVariables + 7 << ":ddensity ";
27  os << countVariables + 8 << "-" << countVariables + 16 << ":dmomentum ";
28 }

Member Data Documentation

◆ ddensity_

◆ density_

◆ dmomentum_

◆ momentum_


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