ESyS-Particle  4.0.1
RotThermElasticInteraction.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 __ROTTHERMELASTICINTERACTION_H
00014 #define __ROTTHERMELASTICINTERACTION_H
00015 
00016 #include "Model/RotThermPairInteraction.h"
00017 #include "Model/RotThermParticle.h"
00018 #include "Model/IGParam.h"
00019 
00023 class CRotThermElasticIGP : public AIGParam
00024 {
00025  protected:
00026  public:
00027   CRotThermElasticIGP();
00028 
00029   CRotThermElasticIGP(
00030     const std::string &name,
00031     double normalK,
00032     double diffusivity
00033   );
00034   
00035   double m_kr;
00036   double diffusivity ;
00037 
00038   virtual void  packInto(CVarMPIBuffer*) const;
00039   void setSpringConst(double k){m_kr=k;};
00040   double getSpringConst() const{return m_kr;};
00041 
00042 
00043   void setDiffusivity(double d){diffusivity = d;};
00044   double getDiffusivity() const{return diffusivity ; };
00045 
00046 
00047   friend ostream& operator<<(ostream&,const CRotThermElasticIGP&);
00048 
00049   virtual std::string getTypeString() const
00050   {
00051     return "RotThermElastic";
00052   }
00053 };
00054 
00055 CRotThermElasticIGP* extractRotThermElasticIGP(AMPIBuffer*);
00056 CRotThermElasticIGP* extractRotThermElasticIGP_p(AMPIBuffer*);
00057 
00061 class CRotThermElasticInteraction : public  ARotThermPairInteraction
00062 {
00063 public:
00064   typedef double (CRotThermElasticInteraction::* ScalarFieldFunction)() const;
00065   typedef pair<bool,double> (CRotThermElasticInteraction::* CheckedScalarFieldFunction)() const;
00066   typedef Vec3 (CRotThermElasticInteraction::* VectorFieldFunction)() const;
00067 
00068   static ScalarFieldFunction getScalarFieldFunction(const string&);
00069   static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
00070   static VectorFieldFunction getVectorFieldFunction(const string&);
00071 
00072 private:
00073   double m_kr; 
00074   Vec3   m_force; 
00075   double m_nForce; 
00076   Vec3   m_cpos;  
00077   Vec3   m_D; 
00078   double m_diffusivity; 
00079 
00080 public:
00081   typedef CRotThermElasticIGP ParameterType;
00082 
00083   CRotThermElasticInteraction();
00084   CRotThermElasticInteraction(CRotThermParticle*,CRotThermParticle*,const CRotThermElasticIGP&);
00085   virtual ~CRotThermElasticInteraction(){};
00086 
00087   virtual Vec3 getPos() const {return m_cpos;};
00088 
00089   static string getType(){return "RotThermElastic";}
00090 
00091   virtual void calcForces();
00092   void calcHeatTrans() ;
00093 //  void calcHeatFrict(){} ;
00094      
00095   Vec3 getForce() const;
00096   double getPotentialEnergy() const;
00097 //26/Mar added
00098   Vec3 getBondedVector() const ;
00099 
00100   friend ostream& operator<<(ostream&,const CRotThermElasticInteraction&);
00101   
00102   // save/load of restart parameters
00103   virtual void saveRestartData(std::ostream &oStream);
00104   virtual void loadRestartData(std::istream &iStream);
00105 };
00106 #endif //__ELASTICINTERACTION_H