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 MODEL_BWALLINTERACTION_HPP 00014 #define MODEL_BWALLINTERACTION_HPP 00015 00016 template <class T> 00017 CBondedWallInteraction<T>::CBondedWallInteraction(T* p,CWall* w,double k,bool iflag): 00018 AWallInteraction<T>(p,w,iflag) 00019 { 00020 // scale stiffness to particle cross section 00021 double scale; 00022 if(CParticle::getDo2dCalculations()){ // 2D 00023 // scale=2.0*this->m_p->getRad(); 00024 scale=1.0; 00025 } else { // 3D 00026 // scale=3.1415926536*this->m_p->getRad()*this->m_p->getRad(); 00027 scale=3.1415926536*this->m_p->getRad(); 00028 } 00029 00030 m_k=k*scale; 00031 } 00032 00037 template <class T> 00038 void CBondedWallInteraction<T>::calcForces() 00039 { 00040 Vec3 D=(this->m_p->getTotalDisplacement()-this->m_wall->getTotalDisplacement()); 00041 //double dist=sqrt(D*D); 00042 00043 Vec3 force=D*m_k; 00044 Vec3 pos=this->m_p->getPos(); 00045 00046 this->m_p->applyForce(-1.0*force,pos); 00047 if(this->m_inner_flag) this->m_wall->addForce(force); 00048 } 00049 00053 template <class T> 00054 Vec3 CBondedWallInteraction<T>::getForce() 00055 { 00056 Vec3 D=(this->m_p->getTotalDisplacement()-this->m_wall->getTotalDisplacement()); 00057 //const double dist=sqrt(D*D); 00058 00059 return D*m_k; 00060 } 00061 00062 #endif