CGFields::GradVelocityField Class Reference

#include <GradVelocityField.h>

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
 

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_
 

Constructor & Destructor Documentation

◆ GradVelocityField() [1/2]

CGFields::GradVelocityField::GradVelocityField ( )

Default constructor, sets all field values to zero.

33 {
34  setZero();
35 #ifdef DEBUG_CONSTRUCTOR
36  std::cerr << "GradVelocityField::GradVelocityField() finished" << std::endl;
37 #endif
38 }
void setZero()
Sets all fields to zero.
Definition: GradVelocityField.cc:73

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
178 {
179 }

◆ 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
169 {
170 }

◆ addParticleDifferentialStatistics()

void CGFields::GradVelocityField::addParticleDifferentialStatistics ( Vec3D dphi,
const GradVelocityField currentInteraction 
)
182 {
183  ddensity_ += currentInteraction.getDensity() * dphi;
184  dmomentum_ += Matrix3D::dyadic(currentInteraction.getMomentum(), dphi);
185 }
Matrix3D dmomentum_
Definition: GradVelocityField.h:184
Vec3D ddensity_
Definition: GradVelocityField.h:183
static Matrix3D dyadic(const Vec3D &a, const Vec3D &b)
Calculates the dyadic product of a two Vec3D: .
Definition: Matrix.cc:323

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
159 {
160  density_ += currentInteraction.getDensity() * phi;
161  momentum_ += currentInteraction.getMomentum() * phi;
162 }
Mdouble density_
Definition: GradVelocityField.h:181
Vec3D momentum_
Definition: GradVelocityField.h:182

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.
194 {
195  return false;
196 }

◆ evaluateFixedParticles()

static bool CGFields::GradVelocityField::evaluateFixedParticles ( )
inlinestatic
166  {
167  return false;
168  }

◆ getDDensity()

Vec3D CGFields::GradVelocityField::getDDensity ( ) const
inline
156  {
157  return ddensity_;
158  }

References ddensity_.

◆ getDensity()

Mdouble CGFields::GradVelocityField::getDensity ( ) const
inline
146  {
147  return density_;
148  }

References density_.

Referenced by addParticleDifferentialStatistics(), and addParticleStatistics().

◆ getDMomentum()

Matrix3D CGFields::GradVelocityField::getDMomentum ( ) const
inline
161  {
162  return dmomentum_;
163  }

References dmomentum_.

◆ getMomentum()

Vec3D CGFields::GradVelocityField::getMomentum ( ) const
inline
151  {
152  return momentum_;
153  }

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
85 {
87  P.density_ = mathsFunc::square(density_);
88  P.momentum_ = Vec3D::square(momentum_);
89  P.ddensity_ = Vec3D::square(ddensity_);
90  P.dmomentum_ = Matrix3D::square(dmomentum_);
91  return P;
92 }
GradVelocityField()
Default constructor, sets all field values to zero.
Definition: GradVelocityField.cc:32
static Matrix3D square(const Matrix3D &A)
Calculates the pointwise square.
Definition: Matrix.cc:298
static Vec3D square(const Vec3D &a)
Calculates the pointwise square of a Vec3D.
Definition: Vector.cc:114
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73
T square(const T val)
squares a number
Definition: ExtendedMath.h:106

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

175  {
176  return true;
177  }

◆ 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
132 {
134  p.density_ = density_ * a;
135  p.momentum_ = momentum_ * a;
136  p.ddensity_ = ddensity_ * a;
137  p.dmomentum_ = dmomentum_ * a;
138  return p;
139 }

References ddensity_, density_, dmomentum_, and momentum_.

◆ 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
106 {
107  density_ += P.density_;
108  momentum_ += P.momentum_;
109  ddensity_ += P.ddensity_;
110  dmomentum_ += P.dmomentum_;
111  return *this;
112 }

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
119 {
120  density_ -= P.density_;
121  momentum_ -= P.momentum_;
122  ddensity_ -= P.ddensity_;
123  dmomentum_ -= P.dmomentum_;
124  return *this;
125 }

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
146 {
147  density_ /= a;
148  momentum_ /= a;
149  ddensity_ /= a;
150  dmomentum_ /= a;
151  return *this;
152 }

References 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.
66 {
67  os << "density " << density_;
68  os << " momentum " << momentum_;
69  os << " ddensity " << ddensity_;
70  os << " dmomentum " << dmomentum_;
71 }

References ddensity_, density_, dmomentum_, and momentum_.

◆ setCylindricalFields() [1/2]

void CGFields::GradVelocityField::setCylindricalFields ( const BaseInteraction c,
IntegralType  type 
)
209 {
210 }

◆ setCylindricalFields() [2/2]

void CGFields::GradVelocityField::setCylindricalFields ( const BaseParticle p)
213 {
214  setFields(p);
216 }
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Definition: BaseInteractable.h:218
void setFields(const BaseInteraction &c, IntegralType type)
Definition: GradVelocityField.cc:198
Vec3D getCylindricalTensorField(const Vec3D &position) const
Returns this vector field at point p to cylindrical coordinates.
Definition: Vector.cc:261

References Vec3D::getCylindricalTensorField(), BaseInteractable::getPosition(), momentum_, and setFields().

◆ setFields() [1/2]

void CGFields::GradVelocityField::setFields ( const BaseInteraction c,
IntegralType  type 
)
199 {
200 }

Referenced by setCylindricalFields().

◆ setFields() [2/2]

void CGFields::GradVelocityField::setFields ( const BaseParticle p)
203 {
204  density_ = p.getMass();
205  momentum_ = p.getVelocity() * p.getMass();
206 }
virtual const Vec3D & getVelocity() const
Returns the velocity of this interactable.
Definition: BaseInteractable.cc:329
Mdouble getMass() const
Returns the particle's mass.
Definition: BaseParticle.h:322

References density_, BaseParticle::getMass(), BaseInteractable::getVelocity(), and momentum_.

◆ setZero()

void CGFields::GradVelocityField::setZero ( )

Sets all fields to zero.

74 {
75  density_ = 0.0;
79 }
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:75
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43

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.
55 {
56  os << density_;
57  os << " " << momentum_;
58  os << " " << ddensity_;
59  os << " " << dmomentum_;
60 }

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.
44 {
45  os << countVariables + 1 << ":Density ";
46  os << countVariables + 2 << "-" << countVariables + 4 << ":momentum ";
47  os << countVariables + 5 << "-" << countVariables + 7 << ":ddensity ";
48  os << countVariables + 8 << "-" << countVariables + 16 << ":dmomentum ";
49 }

Member Data Documentation

◆ ddensity_

◆ density_

◆ dmomentum_

◆ momentum_


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