hydrodynamics_2d.cpp
1 #include "hydrodynamics_2d.hpp"
2 #include "../../tessellation/calc_face_vertex_velocity.hpp"
3 #include "../../tessellation/HilbertOrder.hpp"
4 
5 using std::max;
6 
7 int get_other_index(const Edge& edge, const int index)
8 {
9  if (edge.neighbors.first == index && edge.neighbors.second != index)
10  return edge.neighbors.second;
11  else if (edge.neighbors.second == index && edge.neighbors.first != index)
12  return edge.neighbors.first;
13  else
14  throw UniversalError("Something went wrong in Hydrodynamics2D::get_other_index");
15 }
16 
17 namespace
18 {
19  Vector2D calc_representing_point(Tessellation const& tess,
20  int index,
21  bool cm_flag)
22  {
23  if (cm_flag)
24  return tess.GetCellCM(index);
25  else
26  return tess.GetMeshPoint(index);
27  }
28 
29  Primitive initialize_single_cell(Tessellation const& tess,
30  int index,
31  bool cm_flag,
32  SpatialDistribution const& density,
33  SpatialDistribution const& pressure,
34  SpatialDistribution const& xvelocity,
35  SpatialDistribution const& yvelocity,
36  EquationOfState const& eos)
37  {
38  const Vector2D r = calc_representing_point(tess, index, cm_flag);
39  return CalcPrimitive(density(r),
40  pressure(r),
41  Vector2D(xvelocity(r),
42  yvelocity(r)),
43  eos);
44  }
45 
46  class CellInitializer : public LazyList<Primitive>
47  {
48  public:
49 
50  CellInitializer(Tessellation const& tess,
51  bool cm_flag,
52  SpatialDistribution const& density,
53  SpatialDistribution const& pressure,
54  SpatialDistribution const& xvelocity,
55  SpatialDistribution const& yvelocity,
56  EquationOfState const& eos) :
57  tess_(tess), cm_flag_(cm_flag),
58  density_(density),
59  pressure_(pressure),
60  xvelocity_(xvelocity),
61  yvelocity_(yvelocity),
62  eos_(eos) {}
63 
64  Primitive operator[](size_t n) const
65  {
66  return initialize_single_cell(tess_,
67  static_cast<int>(n),
68  cm_flag_,
69  density_,
70  pressure_,
71  xvelocity_,
72  yvelocity_,
73  eos_);
74  }
75 
76  size_t size(void) const
77  {
78  return static_cast<size_t>(tess_.GetPointNo());
79  }
80 
81  ~CellInitializer(void) {}
82 
83  private:
84  Tessellation const& tess_;
85  const bool cm_flag_;
86  SpatialDistribution const& density_;
87  SpatialDistribution const& pressure_;
88  SpatialDistribution const& xvelocity_;
89  SpatialDistribution const& yvelocity_;
90  EquationOfState const& eos_;
91  };
92 }
93 
94 vector<Primitive> InitialiseCells
95 (SpatialDistribution const& density,
96  SpatialDistribution const& pressure,
97  SpatialDistribution const& xvelocity,
98  SpatialDistribution const& yvelocity,
99  EquationOfState const& eos,
100  Tessellation const& tess,
101  bool cm_value)
102 {
103  return serial_generate
104  (CellInitializer
105  (tess, cm_value, density,
106  pressure, xvelocity, yvelocity, eos));
107 }
108 
109 namespace {
110  class IntensiveInitializer : public LazyList<Conserved>
111  {
112  public:
113 
114  explicit IntensiveInitializer(vector<Primitive> const& cells) :
115  cells_(cells) {}
116 
117  Conserved operator[](size_t n) const
118  {
119  return Primitive2Conserved(cells_[n]);
120  }
121 
122  size_t size(void) const
123  {
124  return cells_.size();
125  }
126 
127  private:
128  vector<Primitive> const& cells_;
129  };
130 }
131 
132 vector<Conserved> CalcConservedIntensive
133 (vector<Primitive> const& cells)
134 {
135  return serial_generate(IntensiveInitializer(cells));
136 }
137 
138 namespace {
139 
140  class CellEdgesGetter : public LazyList<Edge>
141  {
142  public:
143 
144  CellEdgesGetter(const Tessellation& tess, int n) :
145  tess_(tess), edge_indices_(tess.GetCellEdges(n)) {}
146 
147  size_t size(void) const
148  {
149  return edge_indices_.size();
150  }
151 
152  Edge operator[](size_t i) const
153  {
154  return tess_.GetEdge(edge_indices_[i]);
155  }
156 
157  private:
158  const Tessellation& tess_;
159  const vector<int> edge_indices_;
160  };
161 
162  class ExtensiveInitializer : public LazyList<Conserved>
163  {
164  public:
165 
166  ExtensiveInitializer(const vector<Conserved>& intensive,
167  const Tessellation& tess,
168  const PhysicalGeometry& pg) :
169  intensive_(intensive), tess_(tess), pg_(pg) {}
170 
171  Conserved operator[](size_t n) const
172  {
173  return pg_.calcVolume(serial_generate(CellEdgesGetter(tess_, static_cast<int>(n))))*
174  intensive_[n];
175  }
176 
177  size_t size(void) const
178  {
179  return static_cast<size_t>(tess_.GetPointNo());
180  }
181 
182  private:
183  const vector<Conserved>& intensive_;
184  const Tessellation& tess_;
185  const PhysicalGeometry& pg_;
186  };
187 }
188 
189 vector<Conserved> CalcConservedExtensive
190 (const vector<Conserved>& cons_int,
191  const Tessellation& tess,
192  const PhysicalGeometry& pg)
193 {
194  return serial_generate(ExtensiveInitializer(cons_int, tess, pg));
195 }
196 
197 double TimeStepForCell(Primitive const& cell, double width,
198  vector<Vector2D> const& face_velocites)
199 {
200  double max_fv = 0;
201  for (size_t i = 0; i < face_velocites.size(); ++i)
202  max_fv = max(max_fv, abs(face_velocites[i] - cell.Velocity));
203  return width / (cell.SoundSpeed + max_fv);
204 }
205 
206 namespace {
207  class NewPointPosition : public LazyList<Vector2D>
208  {
209  public:
210 
211  NewPointPosition(Tessellation const& tess,
212  vector<Vector2D> const& point_velocity,
213  double dt) :
214  tess_(tess),
215  point_velocity_(point_velocity),
216  dt_(dt) {}
217 
218  Vector2D operator[](size_t n) const
219  {
220  return tess_.GetMeshPoint(static_cast<int>(n)) + dt_*point_velocity_[n];
221  }
222 
223  size_t size(void) const
224  {
225  return static_cast<size_t>(tess_.GetPointNo());
226  }
227 
228  private:
229  Tessellation const& tess_;
230  vector<Vector2D> const& point_velocity_;
231  const double dt_;
232  };
233 }
234 
235 vector<int> MoveMeshPoints(vector<Vector2D> const& pointvelocity,
236  double dt, Tessellation& tessellation, bool reorder, vector<Vector2D> oldpoints)
237 {
238  if (oldpoints.empty())
239  oldpoints = serial_generate(NewPointPosition(tessellation, pointvelocity, dt));
240  else
241  {
242  for (size_t i = 0; i < oldpoints.size(); ++i)
243  oldpoints[i] += pointvelocity[i] * dt;
244  }
245  vector<int> indeces = tessellation.Update(oldpoints, reorder);
246  return indeces;
247 }
248 
249 #ifdef RICH_MPI
250 vector<int> MoveMeshPoints(vector<Vector2D> const& pointvelocity,
251  double dt, Tessellation& tessellation,
252  Tessellation const& vproc, bool reorder,
253  vector<Vector2D> oldpoints)
254 {
255  if (oldpoints.empty())
256  oldpoints = serial_generate(NewPointPosition(tessellation, pointvelocity, dt));
257  else
258  {
259  for (size_t i = 0; i < oldpoints.size(); ++i)
260  oldpoints[i] += pointvelocity[i] * dt;
261  }
262  vector<int> indeces = tessellation.Update(oldpoints, vproc, reorder);
263  return indeces;
264 }
265 #endif // RICH_MPI
266 
267 namespace {
268  class IntensiveCalculator : public LazyList<Conserved>
269  {
270  public:
271 
272  IntensiveCalculator(const Tessellation& tess,
273  const vector<Conserved>& extensive,
274  const PhysicalGeometry& pg) :
275  tess_(tess), extensive_(extensive), pg_(pg) {}
276 
277  size_t size(void) const
278  {
279  return extensive_.size();
280  }
281 
282  Conserved operator[](size_t i) const
283  {
284  return extensive_[i] /
285  pg_.calcVolume(serial_generate(CellEdgesGetter(tess_, static_cast<int>(i))));
286  }
287 
288  private:
289  const Tessellation& tess_;
290  const vector<Conserved>& extensive_;
291  const PhysicalGeometry& pg_;
292  };
293 }
294 
295 vector<Conserved> calc_conserved_intensive
296 (const Tessellation& tess,
297  const vector<Conserved>& extensive,
298  const PhysicalGeometry& pg)
299 {
300  return serial_generate(IntensiveCalculator(tess, extensive, pg));
301 }
302 
303 void UpdateConservedIntensive(Tessellation const& tessellation,
304  vector<Conserved> const& conservedextensive,
305  vector<Conserved>& conservedintensive)
306 {
307  conservedintensive.resize(conservedextensive.size());
308  for (int i = 0; i < tessellation.GetPointNo(); i++) {
309  conservedintensive[static_cast<size_t>(i)] = conservedextensive[static_cast<size_t>(i)] /
310  tessellation.GetVolume(i);
311  }
312 }
313 
315  const Vector2D& paraldir,
316  const Primitive& p)
317 {
318  Primitive res = p;
319  res.Velocity.Set(Projection(p.Velocity, normaldir),
320  Projection(p.Velocity, paraldir));
321  return res;
322 }
323 
325  Vector2D const& normaldir,
326  Vector2D const& paraldir)
327 {
328  Conserved res = c;
329  res.Momentum = c.Momentum.x*normaldir / abs(normaldir) +
330  c.Momentum.y*paraldir / abs(paraldir);
331  return res;
332 }
333 
334 Conserved FluxInBulk(Vector2D const& normaldir,
335  Vector2D const& paraldir,
336  Primitive const& left,
337  Primitive const& right,
338  Vector2D const& edge_velocity,
339  RiemannSolver const& rs)
340 {
341  const Primitive rotated_left = RotatePrimitive(normaldir, paraldir, left);
342  const Primitive rotated_right = RotatePrimitive(normaldir, paraldir, right);
343  const double normal_speed = Projection(edge_velocity, normaldir);
344  const Conserved res = rs(rotated_left, rotated_right, normal_speed);
345  return RotateFluxBack(res, normaldir, paraldir);
346 }
347 
349 (const Tessellation& tess,
350  const PhysicalGeometry& pg,
351  const CacheData& cd,
352  const vector<ComputationalCell>& cells,
353  const vector<Extensive>& fluxes,
354  const vector<Vector2D>& point_velocities,
355  const SourceTerm& force,
356  double t,
357  double dt,
358  vector<Extensive>& extensives,
359  TracerStickerNames const& tracerstickernames)
360 {
361  const vector<Extensive> diff = force(tess, pg, cd, cells, fluxes, point_velocities, t,tracerstickernames);
362  for (size_t i = 0; i < static_cast<size_t>(tess.GetPointNo()); ++i)
363  {
364  extensives[i].mass += dt*diff[i].mass;
365  extensives[i].momentum += dt*diff[i].momentum;
366  extensives[i].energy += dt*diff[i].energy;
367  assert(extensives[i].tracers.size()==diff[i].tracers.size());
368  size_t N = diff[i].tracers.size();
369  for (size_t j = 0; j < N; ++j)
370  extensives[i].tracers[j] += dt*diff[i].tracers[j];
371  }
372 }
373 
374 vector<Vector2D> get_all_mesh_points
375 (Tessellation const& tess)
376 {
377  vector<Vector2D> res(static_cast<size_t>(tess.GetPointNo()));
378  for (int i = 0; i < static_cast<int>(tess.GetPointNo()); ++i)
379  res[static_cast<size_t>(i)] = tess.GetMeshPoint(i);
380  return res;
381 }
382 
383 vector<Primitive> make_eos_consistent
384 (vector<Primitive> const& vp,
385  EquationOfState const& eos)
386 {
387  vector<Primitive> res = vp;
388  for (int i = 0; i < static_cast<int>(vp.size()); ++i)
389  res[static_cast<size_t>(i)] = make_eos_consistent(vp[static_cast<size_t>(i)], eos);
390  return res;
391 }
392 
393 vector<double> GetForceEnergy(Tessellation const& tess,
394  vector<double> const& g)
395 {
396  vector<double> res;
397  int n = int(g.size());
398  res.resize(static_cast<size_t>(n));
399  for (int i = 0; i < n; ++i)
400  res[static_cast<size_t>(i)] = g[static_cast<size_t>(i)] * tess.GetWidth(i);
401  return res;
402 }
403 
404 namespace {
405  vector<double> scalar_mult(const vector<double>& v,
406  double s)
407  {
408  if (v.empty())
409  return vector<double>();
410  vector<double> res(v.size());
411  for (size_t i = 0; i < v.size(); ++i)
412  res[i] = s*v[i];
413  return res;
414  }
415 }
416 
417 namespace {
418  class ExtensiveTracerCalculator : public LazyList<vector<double> >
419  {
420  public:
421 
422  ExtensiveTracerCalculator(const vector<vector<double> >& tracers,
423  const Tessellation& tess,
424  const vector<Primitive>& cells,
425  const PhysicalGeometry& pg) :
426  tracers_(tracers), tess_(tess), cells_(cells), pg_(pg) {}
427 
428  size_t size(void) const
429  {
430  if (tracers_.empty())
431  return 0;
432  else
433  return static_cast<size_t>(tess_.GetPointNo());
434  }
435 
436  vector<double> operator[](size_t i) const
437  {
438  return scalar_mult
439  (tracers_[i],
440  pg_.calcVolume(serial_generate(CellEdgesGetter(tess_, static_cast<int>(i))))*
441  cells_[i].Density);
442  }
443 
444  private:
445  const vector<vector<double> >& tracers_;
446  const Tessellation& tess_;
447  const vector<Primitive>& cells_;
448  const PhysicalGeometry& pg_;
449  };
450 }
451 
452 vector<vector<double> > calc_extensive_tracer
453 (const vector<vector<double> >& intensive_tracer,
454  const Tessellation& tess,
455  const vector<Primitive>& cells,
456  const PhysicalGeometry& pg)
457 {
458  return serial_generate(ExtensiveTracerCalculator(intensive_tracer,
459  tess,
460  cells,
461  pg));
462 }
463 
464 void MakeTracerExtensive(vector<vector<double> > const &tracer,
465  Tessellation const& tess,
466  vector<Primitive> const& cells,
467  vector<vector<double> > &result)
468 {
469  const size_t n = static_cast<size_t>(tess.GetPointNo());
470  result.resize(n);
471  for (size_t i = 0; i < n; ++i)
472  result[i] = scalar_mult(tracer[i],
473  tess.GetVolume(static_cast<int>(i))*cells[i].Density);
474 }
475 
476 void GetPointToRemove(Tessellation const& tess, Vector2D const& point,
477  double R, vector<int> & PointToRemove, int Inner)
478 {
479  int n = tess.GetPointNo();
480  PointToRemove.clear();
481  for (int i = Inner; i < n; ++i)
482  {
483  // Check if point is completly engulfed
484  bool test = true;
485  vector<int> neigh = tess.GetNeighbors(i);
486  for (int j = 0; j < static_cast<int>(neigh.size()); ++j)
487  if (neigh[static_cast<size_t>(j)] >= Inner)
488  test = false;
489  // Is point inside a radius?
490  if (abs(point - tess.GetMeshPoint(i)) < R || test)
491  PointToRemove.push_back(i);
492  }
493  return;
494 }
495 
496 void FixAdvection(vector<Conserved>& extensive,
497  vector<Conserved> const& intensive, Tessellation const& tessold,
498  Tessellation const& tessnew, vector<Vector2D> const& facevelocity,
499  double dt, vector<Vector2D> const& /*pointvelocity*/)
500 {
501  int n = tessold.GetTotalSidesNumber();
502  int npoints = tessold.GetPointNo();
503  vector<double> Rold(static_cast<size_t>(npoints)), Rnew(static_cast<size_t>(npoints));
504  vector<vector<Vector2D> > pold(static_cast<size_t>(npoints)), pnew(static_cast<size_t>(npoints));
505  for (int i = 0; i < npoints; ++i)
506  {
507  Rold[static_cast<size_t>(i)] = tessold.GetWidth(i);
508  Rnew[static_cast<size_t>(i)] = tessnew.GetWidth(i);
509  ConvexHull(pold[static_cast<size_t>(i)], tessold, i);
510  ConvexHull(pnew[static_cast<size_t>(i)], tessnew, i);
511  }
512 
513  PolygonOverlap polyoverlap;
514  double eps = 1e-7;
515  for (int i = 0; i < n; ++i)
516  {
517  Edge const& edge = tessold.GetEdge(i);
518  int n0 = edge.neighbors.first;
519  int n1 = edge.neighbors.second;
520  if (n0 < 0 || n1 < 0)
521  continue;
522  Vector2D norm(tessold.GetMeshPoint(n1) - tessold.GetMeshPoint(n0));
523  norm = norm / abs(norm);
524  norm = norm*edge.GetLength();
525  double dv_dt = ScalarProd(facevelocity[static_cast<size_t>(i)], norm)*dt;
526  double real_dv1 = polyoverlap.polygon_overlap_area
527  (pold[static_cast<size_t>(tessold.GetOriginalIndex(n0))],
528  pnew[static_cast<size_t>(tessold.GetOriginalIndex(n1))],
529  Rold[static_cast<size_t>(tessold.GetOriginalIndex(n0))] * eps,
530  Rnew[static_cast<size_t>(tessold.GetOriginalIndex(n1))] * eps);
531  double real_dv0 = polyoverlap.polygon_overlap_area
532  (pnew[static_cast<size_t>(tessold.GetOriginalIndex(n0))],
533  pold[static_cast<size_t>(tessold.GetOriginalIndex(n1))],
534  Rnew[static_cast<size_t>(tessold.GetOriginalIndex(n0))] * eps,
535  Rold[static_cast<size_t>(tessold.GetOriginalIndex(n1))] * eps);
536 
537  if (dv_dt > 0)
538  {
539  if (n0 < npoints)
540  {
541  extensive[static_cast<size_t>(n0)] += (real_dv0 - dv_dt)*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n1))];
542  extensive[static_cast<size_t>(n0)] -= real_dv1*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n0))];
543  }
544  if (n1 < npoints)
545  {
546  extensive[static_cast<size_t>(n1)] += (dv_dt - real_dv0)*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n1))];
547  extensive[static_cast<size_t>(n1)] += real_dv1*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n0))];
548  }
549  }
550  else
551  {
552  if (n0 < npoints)
553  {
554  extensive[static_cast<size_t>(n0)] -= (real_dv1 + dv_dt)*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n0))];
555  extensive[static_cast<size_t>(n0)] += real_dv0*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n1))];
556  }
557  if (n1 < npoints)
558  {
559  extensive[static_cast<size_t>(n1)] -= (-dv_dt - real_dv1)*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n0))];
560  extensive[static_cast<size_t>(n1)] -= real_dv0*intensive[static_cast<size_t>(tessold.GetOriginalIndex(n1))];
561  }
562  }
563  }
564 }
565 
566 double determine_time_step(double hydro_time_step,
567  double external_dt,
568  double current_time,
569  double end_time)
570 {
571  double dt = hydro_time_step;
572  if (external_dt > 0)
573  dt = std::min(external_dt, dt);
574  if (end_time > 0)
575  dt = std::min(end_time - current_time, dt);
576 
577  return dt;
578 }
Set of conserved variables (extensive)
Vector2D Momentum
Momentum.
virtual vector< int > Update(const vector< Vector2D > &points, bool HilbertOrder=false)=0
Update the tessellation.
double SoundSpeed
Speed of sound.
double TimeStepForCell(Primitive const &cell, double width, vector< Vector2D > const &face_velocites)
Calculates the time step for a cell.
double determine_time_step(double hydro_time_step, double external_dt, double current_time, double end_time)
Determines the time step.
Abstract class for tessellation.
void GetPointToRemove(Tessellation const &tess, Vector2D const &point, double R, vector< int > &PointToRemove, int Inner)
Makes a list of points to remove.
vector< Conserved > CalcConservedIntensive(vector< Primitive > const &cells)
Calculates the intensive conserved variables.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
virtual Vector2D const & GetCellCM(int index) const =0
Returns Position of Cell&#39;s CM.
virtual int GetOriginalIndex(int point) const
Returns the original index of the duplicated point.
Definition: tessellation.cpp:5
Container for error reports.
Primitive CalcPrimitive(double density, double pressure, Vector2D const &velocity, EquationOfState const &eos)
Calculates the primitive variables.
double Projection(Vector3D const &v1, Vector3D const &v2)
Calculates the projection of one vector in the direction of the second.
Definition: Vector3D.cpp:193
vector< T > serial_generate(const LazyList< T > &ll)
Creates a vector from an LazyList.
Definition: lazy_list.hpp:49
vector< vector< double > > calc_extensive_tracer(const vector< vector< double > > &intensive_tracer, const Tessellation &tess, const vector< Primitive > &cells, const PhysicalGeometry &pg)
Calculates extensive tracers.
Vector2D Velocity
Velocity.
Interface between two cells.
Definition: Edge.hpp:13
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
void FixAdvection(vector< Conserved > &extensive, vector< Conserved > const &intensive, Tessellation const &tessold, Tessellation const &tessnew, vector< Vector2D > const &facevelocity, double dt, vector< Vector2D > const &pointvelocity)
Applies a correction to the extensive variables due to the change in volume during time step...
vector< Primitive > InitialiseCells(SpatialDistribution const &density, SpatialDistribution const &pressure, SpatialDistribution const &xvelocity, SpatialDistribution const &yvelocity, EquationOfState const &eos, Tessellation const &tess, bool CMvalue=true)
Initialize computational cells.
vector< Conserved > calc_conserved_intensive(const Tessellation &tess, const vector< Conserved > &extensive, const PhysicalGeometry &pg)
Calculates the intensive conserved variables.
double max(vector< double > const &v)
returns the maximal term in a vector
Definition: utils.cpp:52
double y
Component in the y direction.
Definition: geometry.hpp:48
Ordered list whose terms are evaluated lazily.
Definition: lazy_list.hpp:17
Spatial distribution for initial conditions.
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
Abstract class for external forces.
Definition: SourceTerm.hpp:17
Overlap of two polygons.
Base class for Riemann solver.
virtual T operator[](const size_t i) const =0
Returns a single member of the list.
Conserved Primitive2Conserved(Primitive const &p)
Converts primitive variables to conserved intensive.
Primitive make_eos_consistent(Primitive const &p, EquationOfState const &eos)
Takes a set of primitive variables that do not necessarily satisfy the equation of state...
void ConvexHull(vector< Vector2D > &result, Tessellation const &tess, int index)
Returns the ConvexHull for a set of points.
Definition: ConvexHull.cpp:31
int get_other_index(const Edge &edge, const int index)
Given an edge and an index of one neighbor, returns the index of another neighbor.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Definition: Vector3D.cpp:185
vector< Vector2D > get_all_mesh_points(Tessellation const &tess)
Returns the position of all mesh generating points.
vector< double > GetForceEnergy(Tessellation const &tess, vector< double > const &g)
Returns the energies due to external potentials.
Base class for equation of state.
void ExternalForceContribution(const Tessellation &tess, const PhysicalGeometry &pg, const CacheData &cd, const vector< ComputationalCell > &cells, const vector< Extensive > &fluxes, const vector< Vector2D > &point_velocities, const SourceTerm &source, double t, double dt, vector< Extensive > &extensives, TracerStickerNames const &tracerstickernames)
Adds force contribution to the extensive conserved variables.
Container for cache data.
Definition: cache_data.hpp:14
virtual double GetWidth(int index) const =0
Returns the effective width of a cell.
void reorder(vector< T > &v, vector< size_t > const &order)
Reorder a vector according to an index vector (obtained from the &#39;ordered&#39; function) ...
double min(vector< double > const &v)
Returns the minimal term in a vector.
Definition: utils.cpp:44
virtual double GetVolume(int index) const =0
Returns the volume of a cell.
Class for keeping the names of the tracers and stickers.
void Set(double ix, double iy)
Set vector components.
Definition: geometry.cpp:39
vector< Conserved > CalcConservedExtensive(const vector< Conserved > &cons_int, const Tessellation &tess, const PhysicalGeometry &pg)
Calculates the extensive conserved variables.
virtual int GetTotalSidesNumber(void) const =0
Returns the total number of faces.
std::pair< int, int > neighbors
Neighboring cells.
Definition: Edge.hpp:21
Conserved RotateFluxBack(const Conserved &c, const Vector2D &n, const Vector2D &p)
Rotates flux from the edge frame back to the lab frame.
Various manipulations of hydrodynamic variables.
Conserved FluxInBulk(Vector2D const &normaldir, Vector2D const &paraldir, Primitive const &left, Primitive const &right, Vector2D const &edge_velocity, RiemannSolver const &rs)
Calculates the flux in the bulk of the fluid.
double abs(Vector3D const &v)
Norm of a vector.
Definition: Vector3D.cpp:44
virtual vector< int > const & GetCellEdges(int index) const =0
Returns the indexes of a cell&#39;s edges.
Primitive hydrodynamic variables.
void UpdateConservedIntensive(Tessellation const &tessellation, vector< Conserved > const &conservedextensive, vector< Conserved > &conservedintensive)
Updates the intensive conserved variables.
2D Mathematical vector
Definition: geometry.hpp:15
double GetLength(void) const
Returns the length of the edge.
Definition: Edge.cpp:26
vector< int > MoveMeshPoints(vector< Vector2D > const &pointvelocity, double dt, Tessellation &tessellation, bool reorder, vector< Vector2D > oldpoints=vector< Vector2D >())
Move mesh points.
virtual vector< int > GetNeighbors(int index) const =0
Returns the indeces of the neighbors.
Base class for physical geometry.
virtual size_t size(void) const =0
Returns the length of the list.
double x
Component in the x direction.
Definition: geometry.hpp:45
double polygon_overlap_area(vector< Vector2D > const &ch1, vector< Vector2D > const &ch2, double R0, double R1)
Calculates the area overlaped between two convex polygons.
void MakeTracerExtensive(vector< vector< double > > const &tracer, Tessellation const &tess, vector< Primitive > const &cells, vector< vector< double > > &result)
Calculates the extensive tracer.
Primitive RotatePrimitive(const Vector2D &normaldir, const Vector2D &paraldir, const Primitive &p)
Rotates primitive variables to align with edge.