ESyS-Particle  4.0.1
RotThermBondedInteraction.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 __ROTTHERMBONDEDINTERACTION_H
14 #define __ROTTHERMBONDEDINTERACTION_H
15 
16 // -- project includes --
17 #include "Model/RotThermPairInteraction.h"
18 #include "Model/RotThermParticle.h"
19 #include "Model/InteractionParam.h"
20 #include "Model/BondedInteractionCpData.h"
21 #include "Foundation/vec3.h"
22 #include "Model/IGParam.h"
23 
24 // -- I/O includes --
25 #include <iostream>
26 using std::ostream;
27 
32  double calc_angle( double , double ) ;
33 
35 {
38  const std::string &name,
39  double kr,
40  double ks,
41  double kt,
42  double kb,
43  double max_nForce,
44  double max_shForce,
45  double max_tMoment,
46  double max_bMoment,
47  double diffusivity,
48  int tag
49  );
50 
51  double kr,ks,kt,kb ;
52  double max_nForce, max_shForce,max_tMoment, max_bMoment;
53  double diffusivity ;
54  int tag;
55 
56  virtual std::string getTypeString() const
57  {
58  return "RotThermBonded";
59  }
60 };
61 
67 {
68  public: // types
70 
75 
76  typedef double (CRotThermBondedInteraction::* ScalarFieldFunction)() const;
77  typedef pair<bool,double> (CRotThermBondedInteraction::* CheckedScalarFieldFunction)() const;
78  typedef Vec3 (CRotThermBondedInteraction::* VectorFieldFunction)() const;
79 
80  private:
81 
82  // protected:
83  double m_dist;
84  double m_min_r;
85  double m_kr ;
86  double m_ks ;
87  double m_kb ;
88  double m_kt ;
89 
90  double m_diffusivity ;
91 
92 
93  double m_max_nForce; // always >0
94  double m_max_shForce ;
95  double m_max_tMoment ;
96  double m_max_bMoment ;
97 
98  double m_nForce; // >0, pulling; <0 , compressing
99  double m_shForce ; // always >0
100  double m_tMoment ;
101  double m_bMoment ;
102 
103  Vec3 m_force;
104  Vec3 m_moment ;
105 
106  Vec3 m_cpos; // ?
107  int m_tag;
108 
109  public:
110 
113  virtual ~CRotThermBondedInteraction();
114 
115  static ScalarFieldFunction getScalarFieldFunction(const string&);
116  static CheckedScalarFieldFunction getCheckedScalarFieldFunction(const string&);
117  static VectorFieldFunction getVectorFieldFunction(const string&);
118 
119  static string getType(){return "RotThermBonded";};
120 
121  int getTag() const;
122  void setTag(int tag);
123 
124  void calcForces();
125  void calcHeatTrans() ;
126  //void setBreak(double);
127  bool broken();
128 
129 //26/Mar added !
130  Vec3 getBondedVector1() const;
131  Vec3 getBondedVector2() const;
132 
133  double getPotentialEnergy() const;
134  double getNormalPotentialEnergy() const;
135  double getShearPotentialEnergy() const;
136  double getTwistPotentialEnergy() const;
137  double getBendPotentialEnergy() const;
138  double getCriterion() const;
139  Vec3 getForce() const;
140  virtual Vec3 getPos() const {return m_cpos;};
141 
142  Vec3 getCentrePtDiff() const;
143  Vec3 getInitialCentrePtDiff() const;
144  Vec3 getInitialMidPoint() const;
145 
146  Vec3 getShearDiff() const;
147 
148  friend ostream& operator<<(ostream&,const CRotThermBondedInteraction&);
149  friend class TML_PackedMessageInterface;
150 
151  virtual void saveCheckPointData(std::ostream &oStream);
152 
153  virtual void loadCheckPointData(std::istream &iStream);
154 
155  // save/load of restart parameters
156  virtual void saveRestartData(std::ostream &oStream);
157  virtual void loadRestartData(std::istream &iStream);
158 };
159 
160 #endif //__BONDEDINTERACTION_H