ESyS-Particle  4.0.1
ViscWallInteraction.hpp
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 
00014 #ifndef MODEL_VISCWALLINTERACTION_HPP
00015 #define MODEL_VISCWALLINTERACTION_HPP
00016 
00017 #include "Model/ViscWallInteraction.h"
00018 
00028 template <class T>
00029 CViscWallInteraction<T>::CViscWallInteraction(T* p,CWall* w,double nu,bool iflag):
00030   AWallInteraction<T>(p,w,iflag)
00031 {
00032   m_nu=nu;
00033 }
00034 
00041 template <class T>
00042 void CViscWallInteraction<T>::calcForces()
00043 {
00044   Vec3 vp=this->m_p->getVel();
00045   Vec3 vw=this->m_wall->getVel();
00046 
00047   Vec3 force=m_nu*this->m_p->getMass()*(vp-vw);
00048   Vec3 pos=this->m_p->getPos();
00049 
00050   this->m_p->applyForce(force,pos);
00051   if(this->m_inner_flag) this->m_wall->addForce(force);
00052 }
00053 
00057 template <class T>
00058 Vec3 CViscWallInteraction<T>::getForce()
00059 {
00060   Vec3 vp=this->m_p->getVel();
00061   Vec3 vw=this->m_wall->getVel();
00062 
00063   Vec3 force=m_nu*this->m_p->getMass()*(vw-vp);
00064 
00065   return force;
00066 }
00067 
00068 #endif