3 #include "../simple_flux_calculator.hpp" 4 #include "../../../misc/utils.hpp" 6 #include "../../../mpi/mpi_commands.hpp" 17 const double dr = right.
Density;
21 const double sl =
std::min(vl - cl, vr - cr);
22 const double sr =
std::max(vl + cl, vr + cr);
23 const double ss = (pr - pl + dl*vl*(sl - vl) - dr*vr*(sr - vr)) /
24 (dl*(sl - vl) - dr*(sr - vr));
34 size_t N =
static_cast<size_t>(tess.
GetPointNo());
35 vector<Vector2D> res(N,
Vector2D(0, 0));
36 for (
size_t i = 0; i < N; ++i)
37 res[i] = cells[i].velocity;
42 double dt, vector<Vector2D>
const& ,
TracerStickerNames const& tracerstickernames)
const 45 vector<Vector2D> res(static_cast<size_t>(N),
Vector2D(0, 0));
46 std::vector<double> TotalArea(static_cast<size_t>(N), 0);
47 vector<std::pair<ComputationalCell, ComputationalCell> > edge_values;
49 pair<ComputationalCell, ComputationalCell>(cells[0], cells[0]));
52 interp_(tess, cells, time, edge_values, tracerstickernames, cd);
53 size_t Nedges = edge_values.size();
54 vector<double> ws(Nedges, 0), edge_length(Nedges);
55 std::vector<Vector2D> normals(Nedges);
56 for (
size_t j = 0; j < Nedges; ++j)
58 Edge const& edge = tess.
GetEdge(static_cast<int>(j));
59 edge_length[j] = cd.
areas[j];
61 TotalArea[
static_cast<size_t>(edge.
neighbors.first)] += edge_length[j];
63 TotalArea[
static_cast<size_t>(edge.
neighbors.second)] += edge_length[j];
70 ws[j] = GetWs(left, right);
74 string(
"AreaX")) - tracerstickernames.
tracer_names.begin());
76 string(
"AreaY")) - tracerstickernames.
tracer_names.begin());
77 size_t Ntracers = tracerstickernames.
tracer_names.size();
78 for (
size_t i = 0; i < static_cast<size_t>(N); ++i)
83 for (
size_t j = 0; j < edges.size(); ++j)
85 double Atemp = edge_length[
static_cast<size_t>(edges[j])] *
86 dt*ws[static_cast<size_t>(edges[j])];
91 normals[
static_cast<size_t>(edges[j])]*dt;
92 CM += sign*Atemp*CMtemp;
96 double factor =
std::min(0.2*ratio*ratio,0.1);
97 res[i] = (CM / A - (tess.
GetMeshPoint(static_cast<int>(i))*factor+cd.
CMs[i]*(1-factor)))/dt;
98 if (indexX < Ntracers && indexY < Ntracers)
100 double m = 2.5*cells[i].density*cd.
volumes[i]/(dt*TotalArea[i]);
101 Vector2D toadd(m*cells[i].tracers[indexX], m*cells[i].tracers[indexY]);
102 double v =
abs(res[i]);
103 double t =
abs(toadd);
105 toadd = toadd*(0.05*v / t);
vector< Vector2D > operator()(const Tessellation &tess, const vector< ComputationalCell > &cells, double time, TracerStickerNames const &tracerstickernames) const
Calculates the velocity of all mesh points.
double SoundSpeed
Speed of sound.
Vector2D Parallel(Edge const &edge)
Calculates a unit vector parallel to an edge.
Spatial reconstruction of the primitive functions.
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
Primitive convert_to_primitive(const ComputationalCell &cell, const EquationOfState &eos, TracerStickerNames const &tracerstickernames)
Converts computational cell to primitive variables.
const CachedLazyList< Vector2D > CMs
List of center of masses of the cells.
Vector2D Velocity
Velocity.
Interface between two cells.
virtual Vector2D GetMeshPoint(int index) const =0
Returns Position of mesh generating point.
const CachedLazyList< double > areas
List of areas of interfaces.
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 max(vector< double > const &v)
returns the maximal term in a vector
LMotion(SpatialReconstruction const &interp, EquationOfState const &eos)
Class constructor.
virtual Edge const & GetEdge(int index) const =0
Returns edge (interface between cells)
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
Base class for equation of state.
std::pair< Vector2D, Vector2D > vertices
Points at the ends of the edge.
const CachedLazyList< double > volumes
List of cell volumes.
Container for cache data.
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.
double min(vector< double > const &v)
Returns the minimal term in a vector.
Vector2D normalize(const Vector2D &v)
Normalized a vector.
Class for keeping the names of the tracers and stickers.
virtual int GetTotalSidesNumber(void) const =0
Returns the total number of faces.
std::pair< int, int > neighbors
Neighboring cells.
double abs(Vector3D const &v)
Norm of a vector.
virtual vector< int > const & GetCellEdges(int index) const =0
Returns the indexes of a cell's edges.
Primitive hydrodynamic variables.
Iter binary_find(Iter begin, Iter end, T val)
Binary search that return iterator of found object or end if not found.
double fastabs(Vector2D const &v)
Norm of a vector, less accurate.
double x
Component in the x direction.