cylindrical_complementary.cpp
1 #ifdef _MSC_VER
2 #define _USE_MATH_DEFINES
3 #endif
4 #include <cmath>
5 #include "cylindrical_complementary.hpp"
6 #include "../../../misc/lazy_list.hpp"
7 
8 namespace {
9  /*double distance_from_axis(const Vector2D& point,
10  const Axis& axis)
11  {
12  const double hypotenuse = abs(point - axis.origin);
13  const double side = std::abs(Projection(point - axis.origin,
14  axis.direction));
15  return sqrt(pow(hypotenuse, 2) - pow(side, 2));
16  }*/
17 
18  /*
19  Vector2D cross_z(const Vector2D& v)
20  {
21  return Vector2D(v.y,-v.x);
22  }
23  */
24 
26  const Vector2D& p)
27  {
28  return v - p*ScalarProd(v, p) / ScalarProd(p, p);
29  }
30 }
31 
33  axis_(axis) {}
34 
35 vector<Extensive> CylindricalComplementary::operator()
36 (const Tessellation& tess,
37  const PhysicalGeometry& /*pg*/,
38  const CacheData& /*cd*/,
39  const vector<ComputationalCell>& cells,
40  const vector<Extensive>& /*fluxes*/,
41  const vector<Vector2D>& /*point_velocities*/,
42  const double /*time*/,
43  TracerStickerNames const& /*tracerstickernames*/) const
44 {
45  vector<Extensive> res(static_cast<size_t>(tess.GetPointNo()));
46  const Vector2D r_hat = remove_parallel_component(tess.GetMeshPoint(0) - axis_.origin, axis_.direction);
47  for (size_t i = 0; i < res.size(); ++i)
48  {
49  const double p = cells[i].pressure;
50  /*const double rdist = distance_from_axis(tess.GetCellCM(static_cast<int>(i)), axis_);
51  const double R = tess.GetWidth(static_cast<int>(i);
52  rdist>15*R ? rdist :
53  const double r = std::max(distance_from_axis
54  (tess.GetCellCM(static_cast<int>(i)), axis_), tess.GetWidth(static_cast<int>(i)));*/
55  //const double r = distance_from_axis(tess.GetCellCM(static_cast<int>(i)), axis_);
56  //const double r = distance_from_axis(cd.CMs[i], axis_);
57  //const double volume = cd.volumes[i];
58  res[i].mass = 0;
59  // res[i].momentum = volume*(p / r)*r_hat / abs(r_hat);
60  res[i].momentum = 2*M_PI* tess.GetVolume(static_cast<int>(i))*p*r_hat / abs(r_hat);
61  res[i].energy = 0;
62  res[i].tracers.resize(cells[0].tracers.size(), 0);
63  }
64  return res;
65 }
Vector2D remove_parallel_component(const Vector2D &v, const Vector2D &p)
Remove parallel component of a vector.
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Definition: Vector3D.cpp:185
Axis of revolution.
const Vector2D direction
Positive direction of the axis.
CylindricalComplementary(const Axis &axis)
Class constructor.
Container for cache data.
Definition: cache_data.hpp:14
virtual double GetVolume(int index) const =0
Returns the volume of a cell.
Class for keeping the names of the tracers and stickers.
double abs(Vector3D const &v)
Norm of a vector.
Definition: Vector3D.cpp:44
const Vector2D origin
Origin of the axis.
2D Mathematical vector
Definition: geometry.hpp:15
Base class for physical geometry.