ESyS-Particle
4.0.1
|
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 __ROTTHERMBONDEDINTERACTION_H 00014 #define __ROTTHERMBONDEDINTERACTION_H 00015 00016 // -- project includes -- 00017 #include "Model/RotThermPairInteraction.h" 00018 #include "Model/RotThermParticle.h" 00019 #include "Model/InteractionParam.h" 00020 #include "Model/BondedInteractionCpData.h" 00021 #include "Foundation/vec3.h" 00022 #include "Model/IGParam.h" 00023 00024 // -- I/O includes -- 00025 #include <iostream> 00026 using std::ostream; 00027 00032 double calc_angle( double , double ) ; 00033 00034 struct CRotThermBondedIGP : public AIGParam 00035 { 00036 CRotThermBondedIGP(); 00037 CRotThermBondedIGP( 00038 const std::string &name, 00039 double kr, 00040 double ks, 00041 double kt, 00042 double kb, 00043 double max_nForce, 00044 double max_shForce, 00045 double max_tMoment, 00046 double max_bMoment, 00047 double diffusivity, 00048 int tag 00049 ); 00050 00051 double kr,ks,kt,kb ; 00052 double max_nForce, max_shForce,max_tMoment, max_bMoment; 00053 double diffusivity ; 00054 int tag; 00055 00056 virtual std::string getTypeString() const 00057 { 00058 return "RotThermBonded"; 00059 } 00060 }; 00061 00066 class CRotThermBondedInteraction : public ARotThermPairInteraction 00067 { 00068 public: // types 00069 typedef CRotThermBondedIGP ParameterType; 00070 00074 typedef BondedInteractionCpData CheckPointable; 00075 00076 typedef double (CRotThermBondedInteraction::* ScalarFieldFunction)() const; 00077 typedef pair<bool,double> (CRotThermBondedInteraction::* CheckedScalarFieldFunction)() const; 00078 typedef Vec3 (CRotThermBondedInteraction::* VectorFieldFunction)() const; 00079 00080 private: 00081 00082 // protected: 00083 double m_dist; 00084 double m_min_r; 00085 double m_kr ; 00086 double m_ks ; 00087 double m_kb ; 00088 double m_kt ; 00089 00090 double m_diffusivity ; 00091 00092 00093 double m_max_nForce; // always >0 00094 double m_max_shForce ; 00095 double m_max_tMoment ; 00096 double m_max_bMoment ; 00097 00098 double m_nForce; // >0, pulling; <0 , compressing 00099 double m_shForce ; // always >0 00100 double m_tMoment ; 00101 double m_bMoment ; 00102 00103 Vec3 m_force; 00104 Vec3 m_moment ; 00105 00106 Vec3 m_cpos; // ? 00107 int m_tag; 00108 00109 public: 00110 00111 CRotThermBondedInteraction(); 00112 CRotThermBondedInteraction(CRotThermParticle*,CRotThermParticle*,const CRotThermBondedIGP&); 00113 virtual ~CRotThermBondedInteraction(); 00114 00115 static ScalarFieldFunction getScalarFieldFunction(const string&); 00116 static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&); 00117 static VectorFieldFunction getVectorFieldFunction(const string&); 00118 00119 static string getType(){return "RotThermBonded";}; 00120 00121 int getTag() const; 00122 void setTag(int tag); 00123 00124 void calcForces(); 00125 void calcHeatTrans() ; 00126 //void setBreak(double); 00127 bool broken(); 00128 00129 //26/Mar added ! 00130 Vec3 getBondedVector1() const; 00131 Vec3 getBondedVector2() const; 00132 00133 double getPotentialEnergy() const; 00134 double getNormalPotentialEnergy() const; 00135 double getShearPotentialEnergy() const; 00136 double getTwistPotentialEnergy() const; 00137 double getBendPotentialEnergy() const; 00138 double getCriterion() const; 00139 Vec3 getForce() const; 00140 virtual Vec3 getPos() const {return m_cpos;}; 00141 00142 Vec3 getCentrePtDiff() const; 00143 Vec3 getInitialCentrePtDiff() const; 00144 Vec3 getInitialMidPoint() const; 00145 00146 Vec3 getShearDiff() const; 00147 00148 friend ostream& operator<<(ostream&,const CRotThermBondedInteraction&); 00149 friend class TML_PackedMessageInterface; 00150 00151 virtual void saveCheckPointData(std::ostream &oStream); 00152 00153 virtual void loadCheckPointData(std::istream &iStream); 00154 00155 // save/load of restart parameters 00156 virtual void saveRestartData(std::ostream &oStream); 00157 virtual void loadRestartData(std::istream &iStream); 00158 }; 00159 00160 #endif //__BONDEDINTERACTION_H