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 __ROTFRICTIONINTERACTION_H 00014 #define __ROTFRICTIONINTERACTION_H 00015 00016 // -- project includes -- 00017 #include "Model/RotPairInteraction.h" 00018 #include "Model/RotParticle.h" 00019 #include "Model/IGParam.h" 00020 #include "Foundation/vec3.h" 00021 00022 // -- I/O includes -- 00023 #include <iostream> 00024 using std::ostream; 00025 00026 00027 //double calc_angle( double , double ) ; 00028 00029 00037 class CRotFrictionIGP : public AIGParam 00038 { 00039 public: 00040 CRotFrictionIGP(); 00041 00042 CRotFrictionIGP( 00043 const std::string &name, 00044 double k, 00045 double mu_d, 00046 double mu_s, 00047 double k_s, 00048 double dt, 00049 bool scaling, 00050 bool rigid 00051 ); 00052 00053 CRotFrictionIGP( 00054 const std::string &name, 00055 double youngsModulus, 00056 double poissonsRatio, 00057 double mu_d, 00058 double mu_s, 00059 double dt, 00060 bool rigid 00061 ); 00062 00063 virtual std::string getTypeString() const 00064 { 00065 return "RotFriction"; 00066 } 00067 00068 void setTimeStepSize(double dt); 00069 00070 double k; 00071 double mu_d; // sliding frictional coefficient 00072 double mu_s; // max static frictional coefficient 00073 double k_s; 00074 double dt; 00075 bool scaling; 00076 bool rigid; 00077 }; 00078 00086 class CRotFrictionInteraction : public ARotPairInteraction 00087 { 00088 public: // types 00089 typedef CRotFrictionIGP ParameterType; 00090 00091 typedef double (CRotFrictionInteraction::* ScalarFieldFunction)() const; 00092 typedef pair<bool,double> (CRotFrictionInteraction::* CheckedScalarFieldFunction)() const; 00093 typedef Vec3 (CRotFrictionInteraction::* VectorFieldFunction)() const; 00094 00095 static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&); 00096 static ScalarFieldFunction getScalarFieldFunction(const string&); 00097 static VectorFieldFunction getVectorFieldFunction(const string&); 00098 00099 // protected: 00100 private: 00101 00102 double m_k; 00103 double m_r0; 00104 double m_mu_d; 00105 double m_mu_s; 00106 double m_ks; 00107 double m_dt; 00108 Vec3 m_Ffric; 00109 Vec3 m_force_deficit; 00110 Vec3 m_cpos; 00111 Vec3 m_normal_force; 00112 bool m_is_slipping; 00113 bool m_is_touching; 00114 double m_E_diss; 00115 bool m_scaling; 00116 bool m_rigid; 00117 00118 //Quaternion m_init_q1, m_init_q2; 00119 //Vec3 m_init_pos1 , m_init_pos2; 00120 00121 public: 00122 CRotFrictionInteraction(); 00123 CRotFrictionInteraction(CRotParticle*,CRotParticle*,const CRotFrictionIGP&); 00124 virtual ~CRotFrictionInteraction(); 00125 00126 static string getType() {return "RotFriction";}; 00127 00128 virtual void calcForces(); 00129 virtual void calcSimpleForces(); 00130 virtual void calcRigidBodyForces(); 00131 virtual bool isPersistent(); 00132 00133 void setTimeStepSize(double dt); 00134 00135 void calcNormalForce(); 00136 double getAbsForceDeficit()const; 00137 double getPotentialEnergy()const; 00138 double getSlipping()const; 00139 double getSticking()const; 00140 double getDissipatedEnergy() const; 00141 virtual double Count() const; 00142 virtual Vec3 getPos() const {return m_cpos;}; 00143 Vec3 getForce() const; 00144 Vec3 getNormalForce() const; 00145 00146 friend ostream& operator<<(ostream&,const CRotFrictionInteraction&); 00147 friend class TML_PackedMessageInterface; 00148 00149 // checkpointing 00150 virtual void saveRestartData(std::ostream &oStream); 00151 virtual void loadRestartData(std::istream &iStream); 00152 }; 00153 00154 #endif //__ROTFRICTIONINTERACTION_H