~esys-p-dev/esys-particle/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/////////////////////////////////////////////////////////////
//                                                         //
// Copyright (c) 2003-2014 by The University of Queensland //
// Centre for Geoscience Computing                         //
// http://earth.uq.edu.au/centre-geoscience-computing      //
//                                                         //
// Primary Business: Brisbane, Queensland, Australia       //
// Licensed under the Open Software License version 3.0    //
// http://www.opensource.org/licenses/osl-3.0.php          //
//                                                         //
/////////////////////////////////////////////////////////////

#ifndef MODEL_ABCDAMPING_HPP
#define MODEL_ABCDAMPING_HPP

#include<cmath>
using std::fabs;
using std::exp;



/*!
 Construct a damping "interaction" for a particle

  \param P the particle
  \param param the parameters
*/
template <class ParticleType>
ABCDamping<ParticleType>::ABCDamping(ParticleType* P, ABCDampingIGP* param) 
: CDamping<ParticleType>(P,param)
{
  // calc local viscosity
  Vec3 pos=param->getPos();
  Vec3 normal=param->getNormal();
  double c1=param->getC1();
  double v_0=this->m_visc;
  double dist=fabs((this->m_p->getInitPos()-pos)*normal);
  double v_new=v_0/exp(dist*c1);
  this->m_visc=v_new;
}

template <class ParticleType>
ABCDamping<ParticleType>::~ABCDamping()
{}


/*  Get the particle member function which returns a scalar field of a given name.
 
  \param name the name of the field
*/
template <class T>
typename ABCDamping<T>::ScalarFieldFunction ABCDamping<T>::getScalarFieldFunction(const string& name)
{
  typename ABCDamping<T>::ScalarFieldFunction sf;
  
  sf=NULL;
  cerr << "ERROR - invalid name for interaction scalar  access function" << endl;
  
  return sf;
}


/*!
  Get the particle member function which returns a checked scalar field of a given name.

  \param name the name of the field
*/
template <class T>
typename ABCDamping<T>::CheckedScalarFieldFunction ABCDamping<T>::getCheckedScalarFieldFunction(const string& name)
{
  typename ABCDamping<T>::CheckedScalarFieldFunction sf;

  sf=NULL;
  cerr << "ERROR - invalid name for interaction scalar  access function" << endl;
  
  return sf;
}


/*!
  Get the particle member function which returns a vector field of a given name.
 
  \param name the name of the field
*/
template <class T>
typename ABCDamping<T>::VectorFieldFunction ABCDamping<T>::getVectorFieldFunction(const string& name)
{
  typename ABCDamping<T>::VectorFieldFunction vf;

  vf=NULL;
  cerr << "ERROR - invalid name for interaction vector access function" << endl;
  
  return vf;
}

#endif //MODEL_ABCDAMPING_HPP