9 #include <athena/athena.hpp>
10 #include <athena/eos/eos.hpp>
11 #include <athena/field/field.hpp>
12 #include <athena/hydro/hydro.hpp>
13 #include <athena/mesh/mesh.hpp>
14 #include <athena/parameter_input.hpp>
18 EquationOfState::EquationOfState(MeshBlock *pmb, ParameterInput *pin)
21 pin->GetOrAddReal(
"hydro",
"dfloor", std::sqrt(1024 * float_min))},
23 pin->GetOrAddReal(
"hydro",
"pfloor", std::sqrt(1024 * float_min))} {}
32 void EquationOfState::ConservedToPrimitive(
35 Coordinates *pco,
int il,
int iu,
int jl,
int ju,
int kl,
int ku) {
36 for (
int k = kl; k <= ku; ++k)
37 for (
int j = jl;
j <= ju; ++
j)
38 for (
int i = il; i <= iu; ++i) {
39 Real &ud = cons(IDN, k,
j, i);
40 Real &wd = prim(IDN, k,
j, i);
43 ud = (ud > density_floor_) ? ud : density_floor_;
47 prim(IVX, k,
j, i) = cons(IM1, k,
j, i) * di;
48 prim(IVY, k,
j, i) = cons(IM2, k,
j, i) * di;
49 prim(IVZ, k,
j, i) = 0.;
64 int jl,
int ju,
int kl,
int ku) {
65 for (
int k = kl; k <= ku; ++k)
66 for (
int j = jl;
j <= ju; ++
j)
67 for (
int i = il; i <= iu; ++i) {
68 const Real &wd = prim(IDN, k,
j, i);
69 cons(IDN, k,
j, i) = wd;
70 cons(IM1, k,
j, i) = prim(IVX, k,
j, i) * wd;
71 cons(IM2, k,
j, i) = prim(IVY, k,
j, i) * wd;
72 cons(IM3, k,
j, i) = 0.;
81 Real EquationOfState::SoundSpeed(
const Real prim[NHYDRO]) {
82 return std::sqrt(prim[IDN]);
93 Real &w_d = prim(IDN, i);
96 w_d = (w_d > density_floor_) ? w_d : density_floor_;
104 int k,
int j,
int i) {
105 Real &w_d = prim(IDN, k,
j, i);
106 Real &u_d = cons(IDN, k,
j, i);
109 w_d = (w_d > density_floor_) ? w_d : density_floor_;