ESyS-Particle  4.0.1
RotThermParticle.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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 #ifndef __ROTTHERMPARTICLE_H
14 #define __ROTTHERMPARTICLE_H
15 
16 // -- project includes --
17 #include "Foundation/vec3.h"
18 #include "Foundation/Matrix3.h"
19 #include "Model/ThermParticle.h"
20 #include "Foundation/Quaternion.h"
21 #include "Model/RotParticleVi.h"
22 
23 template <class T> class ParallelParticleArray;
24 class AMPISGBufferRoot;
25 class AMPIBuffer;
26 class AField;
27 
28 //--- MPIincludes ---
29 #include <mpi.h>
30 
31 //--- STL includes ---
32 #include <map>
33 #include <vector>
34 #include <utility>
35 #include <string>
36 
37 using std::map;
38 using std::vector;
39 using std::pair;
40 using std::string;
41 
42 namespace esys
43 {
44  namespace lsm
45  {
46  class SimpleParticleData;
47  }
48 }
49 
50 
55 {
56 
57  public: // types
58 
60  {
61  public:
62  exchangeType()
63  : m_pos(),
64  m_initPos(),
65  m_vel(),
66  m_angVel(),
67  m_angVel_t(),
68  m_quat(),
69  m_temperature(),
70  m_temperature_ini()
71  {
72  }
73 
75  const Vec3 &pos,
76  const Vec3 &initPos,
77  const Vec3 &vel,
78  const Vec3 &AngVel,
79  const Vec3 &currAngVel,
80  const Quaternion &quat,
81  const double temperature,
82  const double temperature_ini
83  )
84  : m_pos(pos),
85  m_initPos(initPos),
86  m_vel(vel),
87  m_angVel(AngVel),
88  m_angVel_t(currAngVel),
89  m_quat(quat),
90  m_temperature(temperature),
91  m_temperature_ini(temperature_ini)
92  {
93  }
94  public:
95  Vec3 m_pos;
96  Vec3 m_initPos;
97  Vec3 m_vel;
98  Vec3 m_angVel;
99  Vec3 m_angVel_t ;
100  Quaternion m_quat;
101  double m_temperature ;
102  double m_temperature_ini ;
103 
104  friend class TML_PackedMessageInterface;
105  };
106  typedef double (CRotThermParticle::* ScalarFieldFunction)() const;
107  typedef Vec3 (CRotThermParticle::* VectorFieldFunction)() const;
108 
109 
110 
111 
112 
113 protected:
114 
115 // double m_tempa ;
116 // double m_Cp ;
117 // double m_density ;
118 // double m_heat_frict ;
119 // double m_heat_trans ;
120 
121 
122 public:
123 // static const CBasicParticle INVALID;
124 
127 
129 
130  CRotThermParticle(const CParticle &p);
131 
133  double rad,
134  double mass,
135  const Vec3& pos,
136  const Vec3& vel,
137  const Vec3& force,
138  int id,
139  bool is_dyn
140  );
141 
143  double rad,
144  double mass,
145  const Vec3& pos,
146  const Vec3& vel,
147  const Vec3& force,
148  int id,
149  Quaternion& quat,
150  double inertRot,
151  const Vec3& moment,
152  const Vec3& angvel,
153  const Vec3& angvel_t,
154  double temperature,
155  double temperature_ini,
156  double Cp,
157  double heat_frict,
158  double heat_trans,
159  double therm_expansion0,
160  double therm_expansion1,
161  double therm_expansion2
162  );
164  double rad,
165  double mass,
166  const Vec3& pos,
167  const Vec3& oldpos,
168  const Vec3& initpos,
169  const Vec3& vel,
170  const Vec3& force,
171  int id,
172  const Quaternion& quat,
173  const Quaternion& initquat,
174  double inertRot,
175  const Vec3& moment,
176  const Vec3& angvel,
177  const Vec3& angvel_t,
178  double temperature,
179  double temperature_ini,
180  double Cp,
181  double heat_frict,
182  double heat_trans,
183  double therm_expansion0,
184  double therm_expansion1,
185  double therm_expansion2
186 
187  );
188 
189 
190  ~CRotThermParticle(){};
191 
192  void applyHeatTrans(const double);
193  void applyHeatFrict(const double);
194  void integrateTherm(double);
195  void zeroHeat();
196  void thermExpansion() ;
197 
198  void integrate(double);
199  inline void setTemperature(double t){m_temperature=t; m_temperature_ini=t;} ;
200 // inline void setTemperatureIni(double t){m_temperature_ini=t;} ;
201  inline double get_y() {return m_pos.Y(); } ;
202  inline void setCp(double t) {m_Cp=t; } ;
203  inline void setThermExpansion0(double t) { m_therm_expansion0=t;} ;
204  inline void setThermExpansion1(double t) { m_therm_expansion1=t;} ;
205  inline void setThermExpansion2(double t) { m_therm_expansion2=t;} ;
206 
207  void setCircular(const Vec3& cv);
208 
209  Vec3 getDisplacement() const {return CParticle::getDisplacement();};
210  void resetDisplacement() {CParticle::resetDisplacement();}
211 
212 
213 
214  static ScalarFieldFunction getScalarFieldFunction(const string&);
215  static VectorFieldFunction getVectorFieldFunction(const string&);
216 
217  static map<string,AField*> generateFields(ParallelParticleArray<CRotThermParticle>*);
218 
219  friend ostream& operator<<(ostream&, const CRotThermParticle&);
220  void print(){cout << *this << endl << flush;};
221 
222 // virtual void saveCheckPointData(std::ostream& oStream);
223 // virtual void loadCheckPointData(std::istream& iStream);
224 
227 
228 
229  static void get_type() {cout <<" CRotThermParticle" ;};
230  friend class TML_PackedMessageInterface;
231 
232  template <typename TmplVisitor>
233  void visit(TmplVisitor &visitor)
234  {
235  visitor.visitRotThermParticle(*this);
236  }
237 
238 };
239 
240 // ostream& operator<<(ostream&,const CRotThermParticle&);
241 
242 #endif //__ROTTHERMPARTICLE_H