collela.cpp
1 #include <cmath>
2 #include "collela.hpp"
3 
4 using namespace std;
5 
6 Collela::Collela(double ref, double a, double l, double offset):
7  ref_(ref), a_(a), l_(l), offset_(offset) {}
8 
9 double Collela::operator()(double x) const
10 {
11  const double xc = x - offset_;
12  if(abs(l_)<abs(xc))
13  return ref_;
14  else
15  return ref_*(1+a_*pow((pow(xc/l_,2)-1),4));
16 }
double operator()(double x) const
Calculates initial conditions.
Definition: collela.cpp:9
Collela(double ref, double a, double l, double offset)
Class constructor.
Definition: collela.cpp:6
Smooth spatial distribution.
double abs(Vector3D const &v)
Norm of a vector.
Definition: Vector3D.cpp:44