ESyS-Particle  4.0.1
ABCDamping.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 #ifndef MODEL_ABCDAMPING_HPP
00014 #define MODEL_ABCDAMPING_HPP
00015 
00016 #include<cmath>
00017 using std::fabs;
00018 using std::exp;
00019 
00020 
00021 
00028 template <class ParticleType>
00029 ABCDamping<ParticleType>::ABCDamping(ParticleType* P, ABCDampingIGP* param) 
00030 : CDamping<ParticleType>(P,param)
00031 {
00032   // calc local viscosity
00033   Vec3 pos=param->getPos();
00034   Vec3 normal=param->getNormal();
00035   double c1=param->getC1();
00036   double v_0=this->m_visc;
00037   double dist=fabs((this->m_p->getInitPos()-pos)*normal);
00038   double v_new=v_0/exp(dist*c1);
00039   this->m_visc=v_new;
00040 }
00041 
00042 template <class ParticleType>
00043 ABCDamping<ParticleType>::~ABCDamping()
00044 {}
00045 
00046 
00047 /*  Get the particle member function which returns a scalar field of a given name.
00048  
00049   \param name the name of the field
00050 */
00051 template <class T>
00052 typename ABCDamping<T>::ScalarFieldFunction ABCDamping<T>::getScalarFieldFunction(const string& name)
00053 {
00054   typename ABCDamping<T>::ScalarFieldFunction sf;
00055   
00056   sf=NULL;
00057   cerr << "ERROR - invalid name for interaction scalar  access function" << endl;
00058   
00059   return sf;
00060 }
00061 
00062 
00068 template <class T>
00069 typename ABCDamping<T>::CheckedScalarFieldFunction ABCDamping<T>::getCheckedScalarFieldFunction(const string& name)
00070 {
00071   typename ABCDamping<T>::CheckedScalarFieldFunction sf;
00072 
00073   sf=NULL;
00074   cerr << "ERROR - invalid name for interaction scalar  access function" << endl;
00075   
00076   return sf;
00077 }
00078 
00079 
00085 template <class T>
00086 typename ABCDamping<T>::VectorFieldFunction ABCDamping<T>::getVectorFieldFunction(const string& name)
00087 {
00088   typename ABCDamping<T>::VectorFieldFunction vf;
00089 
00090   vf=NULL;
00091   cerr << "ERROR - invalid name for interaction vector access function" << endl;
00092   
00093   return vf;
00094 }
00095 
00096 #endif //MODEL_ABCDAMPING_HPP