MercuryDPM  Trunk

#include <GradVelocityField.h>

## Public Member Functions

Default constructor, sets all field values to zero. More...

Default copy constructor, copies the values of all fields. More...

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

Returns the square of all field values (to calculate standard deviation). More...

Copies all field values. More...

Adds the field values on the RHS to the LHS of the equation. More...

Subtracts the field values on the RHS from the LHS of the equation. More...

Divides the field values on the LHS by the RHS of the equation. More...

Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer. More...

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

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

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_

## Detailed Description

Definition at line 39 of file GradVelocityField.h.

## Constructor & Destructor Documentation

Default constructor, sets all field values to zero.

Definition at line 32 of file GradVelocityField.cc.

References setZero().

33 {
34  setZero();
35 #ifdef DEBUG_CONSTRUCTOR
37 #endif
38 }
void setZero()
Sets all fields to zero.
default

Default copy constructor, copies the values of all fields.

default

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

## Member Function Documentation

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] phi the value of the cg function for the contact point of c and the current CGPoint [in] c the interaction which is used in the cg function

Definition at line 177 of file GradVelocityField.cc.

178 {
179 }

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] psi the value of the line integral from C to P at the current CGPoint [in] c the contact which is used in the line integral

Definition at line 168 of file GradVelocityField.cc.

169 {
170 }

Definition at line 181 of file GradVelocityField.cc.

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

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

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] phi the value of the cg function at the current CGPoint [in] p the particle which is used in the cg function

Definition at line 158 of file GradVelocityField.cc.

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

159 {
160  density_ += currentInteraction.getDensity() * phi;
161  momentum_ += currentInteraction.getMomentum() * phi;
162 }
static

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

Returns
True if the class contains fields that are defined as a sum over all Interactions, else false.

Definition at line 193 of file GradVelocityField.cc.

194 {
195  return false;
196 }
inlinestatic

Definition at line 165 of file GradVelocityField.h.

166  {
167  return false;
168  }
inline

Definition at line 155 of file GradVelocityField.h.

References ddensity_.

156  {
157  return ddensity_;
158  }
inline

Definition at line 145 of file GradVelocityField.h.

References density_.

146  {
147  return density_;
148  }
inline

Definition at line 160 of file GradVelocityField.h.

References dmomentum_.

161  {
162  return dmomentum_;
163  }
inline

Definition at line 150 of file GradVelocityField.h.

References momentum_.

151  {
152  return momentum_;
153  }

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 84 of file GradVelocityField.cc.

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 }
static Vec3D square(const Vec3D &a)
Calculates the pointwise square of a Vec3D.
Definition: Vector.cc:114
Default constructor, sets all field values to zero.
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
static Matrix3D square(const Matrix3D &A)
Calculates the pointwise square.
Definition: Matrix.cc:298
inlinestatic

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

Definition at line 174 of file GradVelocityField.h.

175  {
176  return true;
177  }

Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and returns the answer.

Parameters
 [in] a the scalar that we multiply with
Returns
the CGField to which the multiplied values are written

Definition at line 131 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

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 }
Default constructor, sets all field values to zero.

Adds the field values on the RHS to the LHS of the equation.

Parameters
 [in] P the CGField that has to be added
Returns
the CGField to which the values are added

Definition at line 105 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

106 {
107  density_ += P.density_;
108  momentum_ += P.momentum_;
109  ddensity_ += P.ddensity_;
110  dmomentum_ += P.dmomentum_;
111  return *this;
112 }

Subtracts the field values on the RHS from the LHS of the equation.

Parameters
 [in] P the CGField that has to be subtracted
Returns
the CGField from which the values are subtracted

Definition at line 118 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

119 {
120  density_ -= P.density_;
121  momentum_ -= P.momentum_;
122  ddensity_ -= P.ddensity_;
123  dmomentum_ -= P.dmomentum_;
124  return *this;
125 }

Divides the field values on the LHS by the RHS of the equation.

Parameters
 [in] a the scalar that we divide by
Returns
the CGField to which the divided values are written

Definition at line 145 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

146 {
147  density_ /= a;
148  momentum_ /= a;
149  ddensity_ /= a;
150  dmomentum_ /= a;
151  return *this;
152 }
default

Copies all field values.

Parameters
 [in] P the CGField that has to be copied
Returns
the CGField into which the values are copied
 void CGFields::GradVelocityField::output ( std::ostream & os ) const

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

Parameters
 [out] os the ostream into which the data is written.

Definition at line 65 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

66 {
67  os << "density " << density_;
68  os << " momentum " << momentum_;
69  os << " ddensity " << ddensity_;
70  os << " dmomentum " << dmomentum_;
71 }
 void CGFields::GradVelocityField::setCylindricalFields ( const BaseInteraction & c, IntegralType type )

Definition at line 208 of file GradVelocityField.cc.

209 {
210 }
 void CGFields::GradVelocityField::setCylindricalFields ( const BaseParticle & p )

Definition at line 212 of file GradVelocityField.cc.

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

Definition at line 198 of file GradVelocityField.cc.

Referenced by setCylindricalFields().

199 {
200 }
 void CGFields::GradVelocityField::setFields ( const BaseParticle & p )

Definition at line 202 of file GradVelocityField.cc.

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

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

Sets all fields to zero.

Definition at line 73 of file GradVelocityField.cc.

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

74 {
75  density_ = 0.0;
79 }
void setZero()
Sets all elements to zero.
Definition: Vector.cc:43
void setZero()
Sets all elements to zero.
Definition: Matrix.cc:75
 void CGFields::GradVelocityField::write ( std::ostream & os ) const

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

Parameters
 [out] os the ostream into which the data is written.

Definition at line 54 of file GradVelocityField.cc.

References ddensity_, density_, dmomentum_, and momentum_.

55 {
56  os << density_;
57  os << " " << momentum_;
58  os << " " << ddensity_;
59  os << " " << dmomentum_;
60 }
 void CGFields::GradVelocityField::writeNames ( std::ostream & os, unsigned countVariables )
static
Parameters
 [out] os the ostream into which the data is written.

Definition at line 43 of file GradVelocityField.cc.

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

private

Definition at line 183 of file GradVelocityField.h.

private

Definition at line 181 of file GradVelocityField.h.