ESyS-Particle  4.0.1
RotThermFricInteraction.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __ROTTHERMFRICTIONINTERACTION_H
14 #define __ROTTHERMFRICTIONINTERACTION_H
15 
16 // -- project includes --
17 #include "Model/RotThermPairInteraction.h"
18 #include "Model/RotThermParticle.h"
19 #include "Model/InteractionParam.h"
20 #include "Foundation/vec3.h"
21 #include "Model/IGParam.h"
22 
23 // -- I/O includes --
24 #include <iostream>
25 using std::ostream;
26 
27 
28 //double calc_angle( double , double ) ;
29 
30 
35 {
37 
39  const std::string &name,
40  double k,
41  double mu_d,
42  double mu_s,
43  double k_s,
44  double diffusivity,
45  double dt
46  );
47 
48  double k;
49  double mu_d; // sliding frictional coefficient
50  double mu_s; // max static frictional coefficient
51  double k_s;
52  double dt;
53  double diffusivity ;
54 
55  virtual std::string getTypeString() const
56  {
57  return "RotThermFriction";
58  }
59 
60  inline void setTimeStepSize(double deltaT)
61  {
62  dt = deltaT;
63  }
64 };
65 
70 {
71  public: // types
73 
74  typedef double (CRotThermFrictionInteraction::* ScalarFieldFunction)() const;
75  typedef pair<bool,double> (CRotThermFrictionInteraction::* CheckedScalarFieldFunction)() const;
76  typedef Vec3 (CRotThermFrictionInteraction::* VectorFieldFunction)() const;
77 
78  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
79  static ScalarFieldFunction getScalarFieldFunction(const string&);
80  static VectorFieldFunction getVectorFieldFunction(const string&);
81 
82  inline void setTimeStepSize(double deltaT)
83  {
84  m_dt = deltaT;
85  }
86 // protected:
87  private:
88 
89  double m_k;
90  double m_r0;
91  double m_mu_d;
92  double m_mu_s;
93  double m_ks;
94  double m_dt;
95  Vec3 m_Ffric;
96  Vec3 m_force_deficit;
97  Vec3 m_cpos;
98  Vec3 m_normal_force;
99  bool m_is_slipping;
100  bool m_is_touching;
101  double m_E_diss;
102  double m_diffusivity;
103  Vec3 m_ds;
104  //Quaternion m_init_q1, m_init_q2;
105  //Vec3 m_init_pos1 , m_init_pos2;
106 
107  public:
110  virtual ~CRotThermFrictionInteraction();
111 
112  static string getType() {return "RotThermFriction";};
113 
114  virtual void calcForces();
115  void calcHeatFrict();
116  void calcHeatTrans();
117  virtual bool isPersistent();
118 
119  void calcNormalForce();
120  double getAbsForceDeficit()const;
121  double getPotentialEnergy()const;
122  double getSlipping()const;
123  double getTouching()const;
124  double getSticking()const;
125  double getDissipatedEnergy() const;
126  inline Vec3 getDs() {return m_ds;}
127  virtual Vec3 getPos() const {return m_cpos;}
128  Vec3 getForce() const;
129  Vec3 getNormalForce() const;
130 
131  friend ostream& operator<<(ostream&,const CRotThermFrictionInteraction&);
132  friend class TML_PackedMessageInterface;
133 
134  // checkpointing
135  virtual void saveRestartData(std::ostream &oStream);
136  virtual void loadRestartData(std::istream &iStream);
137 };
138 
139 #endif //__ROTFRICTIONINTERACTION_H