ESyS-Particle  4.0.1
RotThermParticle.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __ROTTHERMPARTICLE_H
00014 #define __ROTTHERMPARTICLE_H
00015 
00016 // -- project includes --
00017 #include "Foundation/vec3.h"
00018 #include "Foundation/Matrix3.h"
00019 #include "Model/ThermParticle.h"
00020 #include "Foundation/Quaternion.h"
00021 #include "Model/RotParticleVi.h"
00022 
00023 template <class T> class ParallelParticleArray;
00024 class AMPISGBufferRoot;
00025 class AMPIBuffer;
00026 class AField;
00027 
00028 //--- MPIincludes ---
00029 #include <mpi.h>
00030 
00031 //--- STL includes ---
00032 #include <map>
00033 #include <vector>
00034 #include <utility>
00035 #include <string>
00036 
00037 using std::map;
00038 using std::vector;
00039 using std::pair;
00040 using std::string;
00041 
00042 namespace esys
00043 {
00044   namespace lsm
00045   {
00046     class SimpleParticleData;
00047   }
00048 }
00049 
00050 
00054 class CRotThermParticle : public CRotParticleVi, public CThermParticle
00055 {
00056 
00057  public: // types
00058 
00059   class exchangeType
00060   {
00061   public:
00062     exchangeType()
00063       : m_pos(),
00064         m_initPos(),
00065         m_vel(),
00066         m_angVel(),
00067         m_angVel_t(),
00068         m_quat(),
00069         m_temperature(),
00070         m_temperature_ini() 
00071     {
00072     }
00073 
00074     exchangeType(
00075       const Vec3 &pos,
00076       const Vec3 &initPos,
00077       const Vec3 &vel,
00078       const Vec3 &AngVel,
00079       const Vec3 &currAngVel,
00080       const Quaternion &quat,
00081       const double temperature,
00082       const double temperature_ini
00083     )
00084       : m_pos(pos),
00085         m_initPos(initPos),
00086         m_vel(vel),
00087         m_angVel(AngVel),
00088         m_angVel_t(currAngVel),
00089         m_quat(quat),
00090         m_temperature(temperature),
00091         m_temperature_ini(temperature_ini)
00092     {
00093     }
00094   public:
00095     Vec3       m_pos;
00096     Vec3       m_initPos;
00097     Vec3       m_vel;
00098     Vec3       m_angVel;
00099     Vec3       m_angVel_t ;
00100     Quaternion m_quat;
00101     double m_temperature ;
00102     double m_temperature_ini ;
00103 
00104     friend class TML_PackedMessageInterface;
00105   };
00106   typedef double (CRotThermParticle::* ScalarFieldFunction)() const;
00107   typedef Vec3 (CRotThermParticle::* VectorFieldFunction)() const;
00108 
00109 
00110 
00111 
00112 
00113 protected:
00114 
00115 //  double m_tempa ;
00116 //  double m_Cp    ;
00117 //  double m_density ;
00118 //  double m_heat_frict ;
00119 //  double m_heat_trans ;
00120   
00121 
00122 public:
00123 //  static const CBasicParticle INVALID;
00124 
00125   CRotThermParticle();
00126   CRotThermParticle(const esys::lsm::SimpleParticleData &data);
00127 
00128   CRotThermParticle(const CRotParticleVi &p);
00129 
00130   CRotThermParticle(const CParticle &p);
00131 
00132   CRotThermParticle(
00133     double      rad,
00134     double      mass,
00135     const Vec3& pos,
00136     const Vec3& vel,
00137     const Vec3& force,
00138     int         id,
00139     bool        is_dyn
00140   );
00141 
00142   CRotThermParticle(
00143     double      rad,
00144     double      mass,
00145     const Vec3& pos,
00146     const Vec3& vel,
00147     const Vec3& force,
00148     int         id,
00149     Quaternion& quat,
00150     double      inertRot,
00151     const Vec3& moment,
00152     const Vec3& angvel,
00153     const Vec3& angvel_t,
00154     double temperature,
00155     double temperature_ini,
00156     double Cp,
00157     double heat_frict,
00158     double heat_trans,
00159     double therm_expansion0,
00160     double therm_expansion1,
00161     double therm_expansion2 
00162   );
00163   CRotThermParticle(
00164     double            rad,
00165     double            mass,
00166     const Vec3&       pos,
00167     const Vec3&       oldpos,
00168     const Vec3&       initpos,
00169     const Vec3&       vel,
00170     const Vec3&       force,
00171     int               id,
00172     const Quaternion& quat,
00173     const Quaternion& initquat,
00174     double            inertRot,
00175     const Vec3&       moment,
00176     const Vec3&       angvel,
00177     const Vec3&       angvel_t,
00178     double temperature,
00179      double temperature_ini,
00180     double Cp,
00181     double heat_frict,
00182     double heat_trans,
00183     double therm_expansion0,
00184     double therm_expansion1,
00185     double therm_expansion2
00186 
00187   );
00188 
00189 
00190    ~CRotThermParticle(){};
00191 
00192   void applyHeatTrans(const double); 
00193   void applyHeatFrict(const double);
00194   void integrateTherm(double);
00195   void zeroHeat();
00196   void thermExpansion() ;
00197 
00198   void integrate(double);
00199   inline void setTemperature(double t){m_temperature=t; m_temperature_ini=t;} ;
00200 //  inline void setTemperatureIni(double t){m_temperature_ini=t;} ;
00201   inline double get_y() {return m_pos.Y(); } ;
00202   inline void setCp(double t) {m_Cp=t; } ; 
00203   inline void setThermExpansion0(double t) { m_therm_expansion0=t;} ;
00204   inline void setThermExpansion1(double t) { m_therm_expansion1=t;} ;
00205   inline void setThermExpansion2(double t) { m_therm_expansion2=t;} ;  
00206 
00207   void setCircular(const Vec3& cv);
00208 
00209   Vec3 getDisplacement() const {return CParticle::getDisplacement();};
00210   void resetDisplacement() {CParticle::resetDisplacement();}
00211 
00212 
00213 
00214   static ScalarFieldFunction getScalarFieldFunction(const string&);
00215   static VectorFieldFunction getVectorFieldFunction(const string&);
00216 
00217   static map<string,AField*> generateFields(ParallelParticleArray<CRotThermParticle>*);
00218 
00219   friend ostream& operator<<(ostream&, const CRotThermParticle&);
00220   void print(){cout << *this << endl << flush;};
00221 
00222 //  virtual void saveCheckPointData(std::ostream& oStream);
00223 //  virtual void loadCheckPointData(std::istream& iStream);
00224 
00225   CRotThermParticle::exchangeType getExchangeValues();
00226   void setExchangeValues(const CRotThermParticle::exchangeType &e);
00227 
00228 
00229   static void get_type() {cout <<" CRotThermParticle" ;};
00230   friend class TML_PackedMessageInterface;
00231 
00232   template <typename TmplVisitor>
00233   void visit(TmplVisitor &visitor)
00234   {
00235     visitor.visitRotThermParticle(*this);
00236   }
00237 
00238 };
00239 
00240 // ostream& operator<<(ostream&,const CRotThermParticle&);
00241 
00242 #endif //__ROTTHERMPARTICLE_H