3 #include "../newtonian/common/hydrodynamic_variables.hpp" 4 #include "../misc/universal_error.hpp" 5 #include "../misc/utils.hpp" 19 WaveSpeeds(
double left_i,
34 WaveSpeeds estimate_wave_speeds(
Primitive const& left,
Primitive const& right,
double &pstar)
38 const double lamda_minus_left = (left.
Velocity.
x - disct) / (1 + sig_left);
39 const double lamda_plus_left = (left.
Velocity.
x + disct) / (1 + sig_left);
42 const double lamda_minus_right = (right.
Velocity.
x - disct) / (1 + sig_right);
43 const double lamda_plus_right = (right.
Velocity.
x + disct) / (1 + sig_right);
44 const double sl =
std::min(lamda_minus_right, lamda_minus_left);
45 const double sr =
std::max(lamda_plus_left, lamda_plus_right);
51 const double E_hll = (sr*Er - sl * El + mxl - mxr) / (sr - sl);
53 const double F_E = (sr * mxl - sl * mxr + sr * sl*(Er - El)) / (sr - sl);
55 const double b = -(E_hll + F_mx);
56 const double ss = (
std::abs(F_E) <
std::max(1e-7*E_hll, 1e-30)) ? -mx_hll / b : (-b - std::sqrt(b*b - 4 * mx_hll*F_E)) / (2 * F_E);
58 pstar = -F_E * ss + F_mx;
62 return WaveSpeeds(sl, ss, sr);
71 double left_wave_speed,
72 double center_wave_speed,
73 double right_wave_speed)
88 res.
AddEntry(
"interface velocity", velocity);
89 res.
AddEntry(
"left wave speed", left_wave_speed);
90 res.
AddEntry(
"center wave speed", center_wave_speed);
91 res.
AddEntry(
"right wave speed", right_wave_speed);
101 double gamma =std::sqrt(g_2);
107 Conserved starred_flux(
Primitive const& state,
double lambda_star,
double lambda,
double edge_vel,
double pstar)
110 const double dlambda_1 = 1.0 / (lambda - lambda_star);
111 const double d = state.
Density*(lambda-state.
Velocity.
x)*dlambda_1*std::sqrt(g_2);
115 Conserved res(d*(lambda_star - edge_vel),
Vector2D(mx*(lambda_star - edge_vel) + pstar,
116 my*(lambda_star - edge_vel)), (lambda_star - edge_vel)*(E - d) + pstar * lambda_star);
137 WaveSpeeds ws = estimate_wave_speeds(left,right,pstar);
140 if (ws.left > velocity)
141 f_gr = SR_Primitive2Flux(left, velocity);
142 else if (ws.left <= velocity && ws.center >= velocity)
143 f_gr = starred_flux(left, ws.center, ws.left, velocity,pstar);
145 else if (ws.center < velocity &&ws.right >= velocity)
146 f_gr = starred_flux(right, ws.center, ws.right, velocity,pstar);
148 else if (ws.right < velocity)
149 f_gr = SR_Primitive2Flux(right, velocity);
151 throw invalid_wave_speeds(left,
Set of conserved variables (extensive)
Hllc_SR()
Class constructor.
double SoundSpeed
Speed of sound.
Container for error reports.
Vector2D Velocity
Velocity.
double max(vector< double > const &v)
returns the maximal term in a vector
double y
Component in the y direction.
double ScalarProd(Vector3D const &v1, Vector3D const &v2)
Scalar product of two vectors.
double min(vector< double > const &v)
Returns the minimal term in a vector.
Conserved operator()(Primitive const &left, Primitive const &right, double velocity) const
Solve Riemann porblme.
HLLC riemann solver for special relativity based on Mignone & Bodo 2005.
double Energy
Thermal energy per unit mass, entahalpy in relativistic case.
bool is_nan(double x)
Checks whether a number is a nan.
double abs(Vector3D const &v)
Norm of a vector.
void AddEntry(std::string const &field, double value)
Adds an entry to the list.
Primitive hydrodynamic variables.
double x
Component in the x direction.