ESyS-Particle  2.3.2
BodyForceGroup.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 
14 #ifndef ESYS_LSMBODYFORCEGROUP_H
15 #define ESYS_LSMBODYFORCEGROUP_H
16 
17 #include "Model/InteractionGroup.h"
18 #include "Foundation/vec3.h"
19 
20 template <class TmplParticle> class ParallelParticleArray;
21 
22 namespace esys
23 {
24  namespace lsm
25  {
26  class BodyForceIGP : public AIGParam
27  {
28  public:
29 
30  BodyForceIGP();
31 
32  BodyForceIGP(const std::string &name, const Vec3 &acceleration);
33 
34  virtual ~BodyForceIGP();
35 
36  const Vec3 &getAcceleration() const;
37 
38  const std::string &getName() const;
39 
40  virtual void packInto(CVarMPIBuffer *pBuffer) const;
41 
42  static BodyForceIGP extract(CVarMPIBuffer *pBuffer);
43 
44  virtual std::string getTypeString() const {return "BodyForce";}
45 
46  protected:
48  };
49 
50  class GravityIGP : public BodyForceIGP
51  {
52  public:
53 
55  {
56  }
57 
58  GravityIGP(const std::string &name, const Vec3 &acceleration) : BodyForceIGP(name, acceleration)
59  {
60  }
61 
62  virtual std::string getTypeString() const {return "Gravity";}
63 
64  private:
65  };
66 
67  class BuoyancyIGP : public AIGParam
68  {
69  public:
70 
72  {
73  }
74 
75  BuoyancyIGP(const std::string &name, const Vec3 &acceleration, const double &fluidDensity, const double &fluidHeight);
76 
77  virtual std::string getTypeString() const {return "Buoyancy";}
78 
79  virtual void packInto(CVarMPIBuffer *pBuffer) const;
80 
81  static BuoyancyIGP extract(CVarMPIBuffer *pBuffer);
82 
83  const double &getFluidDensity () const;
84 
85  const double &getFluidHeight () const;
86 
87  const Vec3 &getAcceleration() const;
88 
89  private:
92  };
93 
98  template <class TmplParticle>
99  class BodyForceGroup : public AInteractionGroup<TmplParticle>
100  {
101  public:
104 
105  BodyForceGroup(const BodyForceIGP &prms, ParticleArray &particleArray);
106 
107  ~BodyForceGroup();
108 
116  Vec3 getForce(double mass) const;
117 
124  void applyForce(TmplParticle &particle) const;
125 
126  virtual void Update(ParallelParticleArray<TmplParticle> *particleArray);
127 
131  virtual void setTimeStepSize(double dt)
132  {
133  }
134 
135  virtual void calcForces();
136 
137  private:
140  };
141 
142  template <class TmplParticle>
143  class BuoyancyForceGroup : public AInteractionGroup<TmplParticle>
144  {
145  public:
148 
149  BuoyancyForceGroup(const BuoyancyIGP &prms, ParticleArray &particleArray);
150 
152 
160  Vec3 getForce(double volume) const;
161 
168  void applyForce(TmplParticle &particle) const;
169 
170  virtual void Update(ParallelParticleArray<TmplParticle> *particleArray);
171 
175  virtual void setTimeStepSize(double dt)
176  {
177  }
178 
179  virtual void calcForces();
180 
181  private:
185  };
186  }
187 }
188 
189 #include "Model/BodyForceGroup.hpp"
190 
191 #endif