MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LiquidMigrationFields.cc
Go to the documentation of this file.
1 //Copyright (c) 2013-2020, 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 
26 #include "LiquidMigrationFields.h"
27 #include <Particles/BaseParticle.h>
30 
31 namespace CGFields
32 {
33 
35 {
36  setZero();
37 #ifdef DEBUG_CONSTRUCTOR
38  std::cerr << "LiquidMigrationFields::LiquidMigrationFields() finished" << std::endl;
39 #endif
40 }
41 
45 void LiquidMigrationFields::writeNames(std::ostream& os, const unsigned countVariables)
46 {
47  os << countVariables + 1 << ":liquidBridgeVolume ";
48  os << countVariables + 2 << ":liquidFilmVolume ";
49 }
50 
54 void LiquidMigrationFields::write(std::ostream& os) const
55 {
56  os << liquidBridgeVolume_;
57  os << " " << liquidFilmVolume_;
58 }
59 
63 void LiquidMigrationFields::output(std::ostream& os) const
64 {
65  os << "liquidBridgeVolume " << liquidBridgeVolume_;
66  os << " liquidFilmVolume " << liquidFilmVolume_;
67 }
68 
70 {
71  liquidBridgeVolume_ = 0.0;
72  liquidFilmVolume_ = 0.0;
73 }
74 
79 {
83  return P;
84 }
85 
91 = default;
92 
98 {
101  return *this;
102 }
103 
109 {
112  return *this;
113 }
114 
120 {
124  return p;
125 }
126 
132 {
133  liquidBridgeVolume_ /= a;
134  liquidFilmVolume_ /= a;
135  return *this;
136 }
137 
143 {
144  liquidFilmVolume_ += currentInteraction.getLiquidFilmVolume() * phi;
145 }
146 
148  const LiquidMigrationFields& currentInteraction)
149 {
150 }
151 
157 {
158  liquidBridgeVolume_ += currentInteraction.getLiquidBridgeVolume() * psi;
159 }
160 
167  const LiquidMigrationFields& currentInteraction UNUSED)
168 {
169 }
170 
172 {
173  return true;
174 }
175 
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 }
184 // if (type==IntegralType::CONTACT_TO_P)
185 // {
186 // auto p = dynamic_cast<const LiquidFilmParticle*>(c.getI());
187 // if (p!=nullptr) {
188 // liquidFilmVolume_ = p->getLiquidVolume();
189 // } else {
190 // liquidBridgeVolume_ = 0;
191 // }
192 // } else if (type==IntegralType::I_TO_CONTACT)
193 // {
194 // auto p = dynamic_cast<const LiquidFilmParticle*>(c.getP());
195 // if (p!=nullptr) {
196 // liquidFilmVolume_ = p->getLiquidVolume();
197 // } else {
198 // liquidBridgeVolume_ = 0;
199 // }
200 // }
201 
202 
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 }
210 
212 {
213  setFields(c, type);
214 }
215 
217 {
218  setFields(p);
219 }
220 
221 
222 }
Defines the liquid bridge willet interaction between two particles or walls.
LiquidMigrationFields getSquared() const
Returns the square of all field values (to calculate standard deviation).
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 a...
void output(std::ostream &os) const
Writes human-readable class content into an output stream, typically a stat file. ...
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
double Mdouble
Definition: GeneralDefine.h:34
static void writeNames(std::ostream &os, unsigned countVariables)
LiquidMigrationFields & operator=(const LiquidMigrationFields &P)
Copies all field values.
Stores information about interactions between two interactable objects; often particles but could be ...
LiquidMigrationFields operator*(Mdouble a) const
Multiplies the field values on the left of the '*' by the scalar value on the right of the '*' and re...
void setZero()
Sets all fields to zero.
LiquidMigrationFields()
Default constructor, sets all field values to zero.
LiquidMigrationFields & operator+=(const LiquidMigrationFields &P)
Adds the field values on the RHS to the LHS of the equation.
void addInteractionStatistics(Mdouble psi, const LiquidMigrationFields &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
IntegralType
Specifies the two points between which a line integral is computed.
Definition: IntegralType.h:33
LiquidMigrationFields & operator-=(const LiquidMigrationFields &P)
Subtracts the field values on the RHS from the LHS of the equation.
#define UNUSED
Definition: GeneralDefine.h:39
void addParticleDifferentialStatistics(Vec3D &dphi, const LiquidMigrationFields &currentInteraction)
void write(std::ostream &os) const
Writes class content into an output stream, typically a stat file.
void setFields(const BaseInteraction &c, IntegralType type)
Contains the computed field values, like density, momentum and stress.
LiquidMigrationFields & operator/=(Mdouble a)
Divides the field values on the LHS by the RHS of the equation.
static bool doInteractionStatistics()
Returns true if the class contains fields that are defined as a sum over all Interactions (e...
Definition: Vector.h:49
T square(const T val)
squares a number
Definition: ExtendedMath.h:104
void addContactPointStatistics(Mdouble phi, const LiquidMigrationFields &currentInteraction)
This function should be called from within a loop over all Interactions to compute all the fields tha...
void setCylindricalFields(const BaseInteraction &c, IntegralType type)