ESyS-Particle  4.0.1
HertzianViscoElasticFrictionInteraction.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 __HERTZIANVISCOELASTICFRICTIONINTERACTION_H
00014 #define __HERTZIANVISCOELASTICFRICTIONINTERACTION_H
00015 
00016 #include "Model/IGParam.h"
00017 #include "Model/Interaction.h"
00018 #include "Model/Particle.h"
00019 #include "Foundation/vec3.h"
00020 
00021 #include <iostream>
00022 #include <utility>
00023 
00027 class CHertzianViscoElasticFrictionIGP : public AIGParam
00028 {
00029 public:
00030   CHertzianViscoElasticFrictionIGP();
00031 
00032   CHertzianViscoElasticFrictionIGP(
00033     const std::string &name,
00034     double A,
00035     double E,
00036     double nu,
00037     double fricCoef,
00038     double shearK,
00039     double dT
00040   );
00041 
00042   virtual std::string getTypeString() const
00043   {
00044     return "HertzianViscoElasticFriction";
00045   }
00046 
00047   void setTimeStepSize(double dt);
00048   
00049   double m_A;  // Dissipative constant
00050   double m_E;  // Young's modulus
00051   double m_nu; // Poisson ratio
00052   double mu;   // Friction coefficient
00053   double k_s;  // Shear coefficient
00054   double dt;
00055 };
00056 
00063 class CHertzianViscoElasticFrictionInteraction : public APairInteraction
00064 {
00065  public: // types
00066   typedef CHertzianViscoElasticFrictionIGP ParameterType;
00067 
00068   typedef
00069     double (CHertzianViscoElasticFrictionInteraction::* ScalarFieldFunction)(
00070     ) const;
00071   typedef
00072     std::pair<bool,double>
00073     (CHertzianViscoElasticFrictionInteraction::* CheckedScalarFieldFunction)(
00074     ) const;
00075   typedef
00076     Vec3 (CHertzianViscoElasticFrictionInteraction::* VectorFieldFunction)(
00077     ) const;
00078 
00079   static ScalarFieldFunction getScalarFieldFunction(const string&);
00080   static CheckedScalarFieldFunction getCheckedScalarFieldFunction(
00081     const string&
00082   );
00083   static VectorFieldFunction getVectorFieldFunction(const string&);
00084 
00085  protected:
00086   double m_A;     
00087   double m_E;     
00088   double m_nu;    
00089   double m_r0;    
00090   double m_mu;    
00091   double m_ks;    
00092   double m_dt;    
00093   Vec3 m_Ffric;   
00094   Vec3 m_force_deficit; 
00095   Vec3 m_cpos; 
00096   Vec3 m_normal_force; 
00097   double m_dn; 
00098   bool m_is_slipping; 
00099   bool m_is_touching; 
00100   double m_E_diss; 
00101 
00102  public:
00103   CHertzianViscoElasticFrictionInteraction();
00104   CHertzianViscoElasticFrictionInteraction(CParticle*,CParticle*);
00105   CHertzianViscoElasticFrictionInteraction(
00106     CParticle*,
00107     CParticle*,
00108     const CHertzianViscoElasticFrictionIGP&
00109   );
00110   virtual ~CHertzianViscoElasticFrictionInteraction();
00111 
00112   static string getType() {return "HertzianViscoElasticFriction";};
00113   
00114   virtual void calcForces();
00115   virtual bool isPersistent();
00116 
00117   void setTimeStepSize(double dt);
00118 
00119   std::pair<bool,double> getAbsFrictionalForce() const;
00120   std::pair<bool,double> getAbsFN() const;
00121   std::pair<bool,double> getAbsMuFN() const;
00122   std::pair<bool,double> getSlipVelocity() const;
00123   std::pair<bool,double> getNormalStress() const;
00124   std::pair<bool,double> getMaxFricStress() const;
00125   std::pair<bool,double> getAbsFrictionalStress() const;
00126 
00127   double getAbsForceDeficit() const;
00128   double getPotentialEnergy() const;
00129   double getSlipping()const;
00130   double getSticking()const;
00131   double getDissipatedEnergy() const;
00132   double Count() const;
00133   Vec3 getForce() const;
00134   Vec3 getNormalForce() const;
00135   virtual Vec3 getPos() const {return m_cpos;};
00136 
00137   std::pair<bool,double> getMuEff(const Vec3&,const Vec3&) const;
00138   std::pair<bool,double> getMuEffXY() const
00139   {
00140     return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,1.0,0.0));
00141   };
00142   std::pair<bool,double> getMuEffXZ() const
00143   {
00144     return getMuEff(Vec3(1.0,0.0,0.0),Vec3(0.0,0.0,1.0));
00145   };
00146 
00147   friend std::ostream& operator<<(
00148     std::ostream&,
00149     const CHertzianViscoElasticFrictionInteraction&
00150   );
00151   friend class TML_PackedMessageInterface;
00152 };
00153 
00154 #endif //__HERTZIANVISCOELASTICFRICTIONINTERACTION_H