GradVelocityField.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #ifndef GradVelocityField_H
26 #define GradVelocityField_H
27 
28 #include <Math/Matrix.h>
29 #include <Math/MatrixSymmetric.h>
31 
32 class BaseParticle;
33 
34 class BaseInteraction;
35 
36 namespace CGFields
37 {
38 
40 {
41 public:
42 
47 
52 
57  ~GradVelocityField() = default;
58 
59  static void writeNames(std::ostream& os, unsigned countVariables);
60 
64  void write(std::ostream& os) const;
65 
69  void output(std::ostream& os) const;
70 
74  void setZero();
75 
80 
85 
90 
95 
100 
106 
112  void addParticleStatistics(Mdouble phi, const GradVelocityField& currentInteraction);
113 
114  void addParticleDifferentialStatistics(Vec3D& dphi, const GradVelocityField& currentInteraction);
115 
121  void addInteractionStatistics(Mdouble psi, const GradVelocityField& currentInteraction);
122 
128  void addContactPointStatistics(Mdouble phi, const GradVelocityField& currentInteraction);
129 
130  void setFields(const BaseInteraction& c, IntegralType type);
131 
133 
134  void setFields(const BaseParticle& p);
135 
136  void setCylindricalFields(const BaseParticle& p);
137 
138 
143  static bool doInteractionStatistics();
144 
146  {
147  return density_;
148  }
149 
151  {
152  return momentum_;
153  }
154 
156  {
157  return ddensity_;
158  }
159 
161  {
162  return dmomentum_;
163  }
164 
166  {
167  return false;
168  }
169 
174  static bool isDifferentialField()
175  {
176  return true;
177  }
178 
179 private:
180 
185 };
186 
187 }
188 #endif
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:34
Stores information about interactions between two interactable objects; often particles but could be ...
Definition: BaseInteraction.h:60
Definition: BaseParticle.h:54
Definition: GradVelocityField.h:40
void write(std::ostream &os) const
Writes class content into an output stream, typically a stat file.
Definition: GradVelocityField.cc:54
GradVelocityField & operator+=(const GradVelocityField &P)
Adds the field values on the RHS to the LHS of the equation.
Definition: GradVelocityField.cc:105
void output(std::ostream &os) const
Writes human-readable class content into an output stream, typically a stat file.
Definition: GradVelocityField.cc:65
GradVelocityField & operator/=(Mdouble a)
Divides the field values on the LHS by the RHS of the equation.
Definition: GradVelocityField.cc:145
void setZero()
Sets all fields to zero.
Definition: GradVelocityField.cc:73
Matrix3D dmomentum_
Definition: GradVelocityField.h:184
void setFields(const BaseInteraction &c, IntegralType type)
Definition: GradVelocityField.cc:198
void addContactPointStatistics(Mdouble phi, const GradVelocityField &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
Definition: GradVelocityField.cc:177
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 a...
Definition: GradVelocityField.cc:158
~GradVelocityField()=default
Destructor, it simply destructs the GradVelocityField and all the objects it contains.
void setCylindricalFields(const BaseInteraction &c, IntegralType type)
Definition: GradVelocityField.cc:208
static bool evaluateFixedParticles()
Definition: GradVelocityField.h:165
void addParticleDifferentialStatistics(Vec3D &dphi, const GradVelocityField &currentInteraction)
Definition: GradVelocityField.cc:181
GradVelocityField & operator=(const GradVelocityField &P)
Copies all field values.
Mdouble density_
Definition: GradVelocityField.h:181
GradVelocityField getSquared() const
Returns the square of all field values (to calculate standard deviation).
Definition: GradVelocityField.cc:84
static bool isDifferentialField()
Definition: GradVelocityField.h:174
GradVelocityField()
Default constructor, sets all field values to zero.
Definition: GradVelocityField.cc:32
GradVelocityField operator*(Mdouble a) const
Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and re...
Definition: GradVelocityField.cc:131
GradVelocityField(const GradVelocityField &P)=default
Default copy constructor, copies the values of all fields.
Matrix3D getDMomentum() const
Definition: GradVelocityField.h:160
GradVelocityField & operator-=(const GradVelocityField &P)
Subtracts the field values on the RHS from the LHS of the equation.
Definition: GradVelocityField.cc:118
Vec3D ddensity_
Definition: GradVelocityField.h:183
static void writeNames(std::ostream &os, unsigned countVariables)
Definition: GradVelocityField.cc:43
Vec3D getDDensity() const
Definition: GradVelocityField.h:155
void addInteractionStatistics(Mdouble psi, const GradVelocityField &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
Definition: GradVelocityField.cc:168
Vec3D getMomentum() const
Definition: GradVelocityField.h:150
Vec3D momentum_
Definition: GradVelocityField.h:182
Mdouble getDensity() const
Definition: GradVelocityField.h:145
static bool doInteractionStatistics()
Returns true if the class contains fields that are defined as a sum over all Interactions (e....
Definition: GradVelocityField.cc:193
Implementation of a 3D matrix.
Definition: Matrix.h:38
Definition: Vector.h:51
Definition: GradVelocityField.cc:30
double P
Uniform pressure.
Definition: TwenteMeshGluing.cpp:73