8 double eta,
bool cold,
double cold_speed) : pm_(pm), eos_(eos), pouter_(-1, 1, 1, -1), outer_(outer), chi_(chi), eta_(eta), cold_(cold), cold_speed_(cold_speed) {}
11 double eta,
bool cold,
double cold_speed) : pm_(pm), eos_(eos), pouter_(-1, 1, 1, -1), outer_(pouter_), chi_(chi), eta_(eta),cold_(cold), cold_speed_(cold_speed) {}
21 size_t n =
static_cast<size_t>(tess.
GetPointNo());
22 const double inv_dt = 1.0 / dt;
23 for (
size_t i = 0; i < n; ++i)
26 double R = tess.
GetWidth(static_cast<int>(i));
63 Vector2D RoundCells::calc_dw(
size_t i,
const Tessellation& tess,
const vector<ComputationalCell>& cells,
68 const double d =
abs(s - r);
69 const double R = tess.
GetWidth(static_cast<int>(i));
72 const double c =
std::max(eos_.
dp2c(cells[i].density, cells[i].pressure,
73 cells[i].tracers,tracerstickernames.
tracer_names),
abs(cells[i].velocity));
74 return chi_*c*(s - r) / R;
77 Vector2D RoundCells::calc_dw(
size_t i,
const Tessellation& tess,
double dt,vector<ComputationalCell>
const& cells,
82 const double d =
abs(s - r);
83 const double R = tess.
GetWidth(static_cast<int>(i));
86 vector<int> neigh = tess.
GetNeighbors(static_cast<int>(i));
87 size_t N = neigh.size();
88 double cs = eos_.
dp2c(cells[i].density, cells[i].pressure, cells[i].tracers,tracerstickernames.
tracer_names);
89 for (
size_t j = 0; j < N; ++j)
91 if (tess.
GetOriginalIndex(neigh[j]) ==
static_cast<int>(i) || neigh[j]>static_cast<int>(N))
93 cs =
std::max(cs, eos_.
dp2c(cells[static_cast<size_t>(neigh[j])].density, cells[static_cast<size_t>(neigh[j])].pressure,
94 cells[static_cast<size_t>(neigh[j])].tracers));
95 cs =
std::max(cs,
abs(cells[static_cast<size_t>(neigh[j])].velocity - cells[i].velocity));
97 const double c_dt = cold_speed_ * d / dt;
98 return chi_*
std::max(c_dt, cs)*(s - r) / R;
104 vector<Vector2D> res = pm_(tess, cells, time,tracerstickernames);
105 res.resize(static_cast<size_t>(tess.
GetPointNo()));
106 size_t N =
static_cast<size_t>(tess.
GetPointNo());
109 for (
size_t i = 0; i < N; ++i)
111 res[i] += calc_dw(i, tess, cells,tracerstickernames);
118 double dt, vector<Vector2D>
const & velocities,
TracerStickerNames const& tracerstickernames)
const 120 vector<Vector2D> res = pm_.
ApplyFix(tess, cells, time, dt, velocities,tracerstickernames);
121 res.resize(static_cast<size_t>(tess.
GetPointNo()));
124 const size_t n = res.size();
125 for (
size_t i = 0; i < n; ++i)
127 res.at(i) += calc_dw(i, tess, dt,cells,tracerstickernames);
131 CorrectPointsOverShoot(res, dt, tess,outer_);
Abstract class for tessellation.
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's CM.
virtual int GetOriginalIndex(int point) const
Returns the original index of the duplicated point.
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
Correction to point velocities that keeps cells round.
virtual double dp2c(double d, double p, tvector const &tracers=tvector(), vector< string > const &tracernames=vector< string >()) const =0
Calculates the speed of sound.
double max(vector< double > const &v)
returns the maximal term in a vector
Abstract class for motion of mesh generating points.
vector< Vector2D > operator()(const Tessellation &tess, const vector< ComputationalCell > &cells, double time, TracerStickerNames const &tracerstickernames) const
Calculates the velocity of all mesh points.
virtual BoundaryType GetBoundaryType(void) const =0
Returns the boundary type.
Base class for equation of state.
virtual double GetWidth(int index) const =0
Returns the effective width of a cell.
std::vector< std::string > tracer_names
The names of the tracers.
Class for keeping the names of the tracers and stickers.
vector< Vector2D > ApplyFix(Tessellation const &tess, vector< ComputationalCell > const &cells, double time, double dt, vector< Vector2D > const &velocities, TracerStickerNames const &tracerstickernames) const
Applies a small fix to the velocity of all mesh points once the time step is known.
virtual vector< Vector2D > ApplyFix(Tessellation const &tess, vector< ComputationalCell > const &cells, double time, double dt, vector< Vector2D > const &velocities, TracerStickerNames const &tracerstickernames) const
Applies a small fix to the velocity of all mesh points once the time step is known.
double abs(Vector3D const &v)
Norm of a vector.
Abstract class for geometric boundary conditions for the tessellation.
virtual vector< int > GetNeighbors(int index) const =0
Returns the indeces of the neighbors.
virtual double GetGridBoundary(Directions dir) const =0
Returns the boundary coordinate.
RoundCells(const PointMotion &pm, const EquationOfState &eos, OuterBoundary const &outer, double chi=0.15, double eta=0.02, bool cold=false, double cold_speed=0.15)
Class constructor.