ESyS-Particle  4.0.1
RotThermFricInteraction.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 __ROTTHERMFRICTIONINTERACTION_H
00014 #define __ROTTHERMFRICTIONINTERACTION_H
00015 
00016 // -- project includes --
00017 #include "Model/RotThermPairInteraction.h"
00018 #include "Model/RotThermParticle.h"
00019 #include "Model/InteractionParam.h"
00020 #include "Foundation/vec3.h"
00021 #include "Model/IGParam.h"
00022 
00023 // -- I/O includes --
00024 #include <iostream>
00025 using std::ostream;
00026 
00027 
00028 //double calc_angle( double , double ) ;
00029 
00030 
00034 struct CRotThermFrictionIGP : public AIGParam
00035 {
00036   CRotThermFrictionIGP();
00037 
00038   CRotThermFrictionIGP(
00039     const std::string &name,
00040     double k,
00041     double mu_d,
00042     double mu_s,
00043     double k_s,
00044     double diffusivity,
00045     double dt
00046   );
00047 
00048   double k;
00049   double mu_d;    // sliding frictional coefficient
00050   double mu_s;     // max static frictional coefficient
00051   double k_s;
00052   double dt;
00053   double diffusivity ;
00054 
00055   virtual std::string getTypeString() const
00056   {
00057     return "RotThermFriction";
00058   }
00059 
00060   inline void setTimeStepSize(double deltaT)
00061   {
00062     dt = deltaT;
00063   }
00064 };
00065 
00069 class CRotThermFrictionInteraction : public ARotThermPairInteraction
00070 {
00071  public: // types
00072   typedef CRotThermFrictionIGP ParameterType;
00073 
00074   typedef double (CRotThermFrictionInteraction::* ScalarFieldFunction)() const;
00075   typedef pair<bool,double> (CRotThermFrictionInteraction::* CheckedScalarFieldFunction)() const;  
00076   typedef Vec3 (CRotThermFrictionInteraction::* VectorFieldFunction)() const;
00077 
00078   static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
00079   static ScalarFieldFunction getScalarFieldFunction(const string&);
00080   static VectorFieldFunction getVectorFieldFunction(const string&);
00081 
00082   inline void setTimeStepSize(double deltaT)
00083   {
00084     m_dt = deltaT;
00085   }
00086 // protected:
00087  private:
00088 
00089   double m_k;     
00090   double m_r0;    
00091   double m_mu_d;  
00092   double m_mu_s;  
00093   double m_ks;    
00094   double m_dt;    
00095   Vec3 m_Ffric;   
00096   Vec3 m_force_deficit; 
00097   Vec3 m_cpos; 
00098   Vec3 m_normal_force; 
00099   bool m_is_slipping; 
00100   bool m_is_touching; 
00101   double m_E_diss; 
00102   double m_diffusivity; 
00103   Vec3 m_ds; 
00104   //Quaternion m_init_q1, m_init_q2;
00105   //Vec3 m_init_pos1 , m_init_pos2;
00106 
00107  public:
00108   CRotThermFrictionInteraction();
00109   CRotThermFrictionInteraction(CRotThermParticle*,CRotThermParticle*,const CRotThermFrictionIGP&);
00110   virtual ~CRotThermFrictionInteraction();
00111 
00112   static string getType() {return "RotThermFriction";};
00113 
00114   virtual void calcForces();
00115   void calcHeatFrict();
00116   void calcHeatTrans();
00117   virtual bool isPersistent();
00118 
00119   void calcNormalForce();
00120   double getAbsForceDeficit()const;
00121   double getPotentialEnergy()const;
00122   double getSlipping()const;
00123   double getTouching()const;
00124   double getSticking()const;
00125   double getDissipatedEnergy() const;
00126   inline Vec3 getDs() {return m_ds;}
00127   virtual Vec3 getPos() const {return m_cpos;}
00128   Vec3 getForce() const;
00129   Vec3 getNormalForce() const;
00130 
00131   friend ostream& operator<<(ostream&,const CRotThermFrictionInteraction&);
00132   friend class TML_PackedMessageInterface;
00133 
00134   // checkpointing 
00135   virtual void saveRestartData(std::ostream &oStream);
00136   virtual void loadRestartData(std::istream &iStream);
00137 };
00138 
00139 #endif //__ROTFRICTIONINTERACTION_H