Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute pressure from microphysics eos #335

Merged
merged 57 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f8094cb
compute pressure from microphysics eos
psharda Jul 26, 2023
289e160
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 26, 2023
8e50b6d
Merge branch 'quokka-astro:development' into eos-pressure
psharda Jul 26, 2023
343429c
call EOS to compute pressure
psharda Jul 26, 2023
642b3af
add function to compute pressure
psharda Jul 26, 2023
3db466e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 26, 2023
aa5a3f6
return pressure times density
psharda Jul 26, 2023
9e28e43
updated microp
psharda Jul 26, 2023
75baed9
change mean mol weight from NAN to arbitrary +ve value to get finite …
psharda Jul 26, 2023
580f3e5
use gamma_law to compute pressure
psharda Jul 26, 2023
c4a36f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 26, 2023
380fec7
define a finite mean molecular weight
psharda Jul 26, 2023
fb67ff5
more EOS calls
psharda Jul 26, 2023
e94edec
dont need microp headers
psharda Jul 26, 2023
a70fe90
removed unused var
psharda Jul 26, 2023
6cea067
remove unused vars
psharda Jul 26, 2023
c9ffd1c
remove unused var; assert P
psharda Jul 26, 2023
95db069
fixed warnings
psharda Jul 27, 2023
dac7af8
use EOS compute pressure directly
psharda Jul 27, 2023
483d3b7
updated microp
psharda Jul 27, 2023
7db199b
updated microp
psharda Jul 27, 2023
906b4d9
added ComputeSoundSpeed
psharda Jul 27, 2023
235c18d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
abf95f9
updated microp
psharda Jul 27, 2023
1112f9f
spell check
psharda Jul 27, 2023
ebbfe81
pass quokka gamma to microphysics eos
psharda Jul 27, 2023
27ee213
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
a7648ca
add function ComputeEintFromPres
psharda Jul 27, 2023
e62a6ed
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
1c64f8e
use EOS to find pres and cs
psharda Jul 27, 2023
6d31572
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
cdd18da
replace K_S with sound spped calc
psharda Jul 27, 2023
54723a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
c7ca8a0
avoid re-declaaration
psharda Jul 27, 2023
8c56cfc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
6ec3096
fix warning
psharda Jul 27, 2023
a5d2714
use microp EOS
psharda Jul 27, 2023
8146b4e
remove ASSERT
psharda Jul 27, 2023
1fcab92
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 27, 2023
9dfb12c
remove unused var
psharda Jul 27, 2023
49c46c4
fix bug in EintFromPres
psharda Jul 28, 2023
f3b6ea0
declaring P_L as const double
psharda Jul 28, 2023
0bfb82e
remove unused var
psharda Jul 28, 2023
a50ea5a
remove declaration of P_L
psharda Jul 28, 2023
13c623e
updated microp: ensure exact cancellation
psharda Jul 28, 2023
e07c5e4
remove unused var
psharda Jul 28, 2023
dc4cb27
use finite mean_molecular_weight
psharda Jul 28, 2023
7356796
use finite mol wt and use microphysics for EOS
psharda Jul 28, 2023
04c26d7
use finite mean mol wt
psharda Jul 28, 2023
9dcf491
use microphysics eos
psharda Jul 28, 2023
bed26e3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 28, 2023
16f441a
remove unused var
psharda Jul 28, 2023
b7c3da0
if rho = 0, pres is 0
psharda Jul 29, 2023
6dd9326
return finite pressure for isothermal gamma
psharda Jul 29, 2023
50631c5
@psharda
psharda Jul 29, 2023
deac5f3
use finite mol wt
psharda Jul 30, 2023
77c35b1
minor style changes
psharda Jul 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
[submodule "extern/Microphysics"]
path = extern/Microphysics
url = https://github.com/psharda/Microphysics
branch = development
branch = compute-cs
138 changes: 133 additions & 5 deletions src/EOS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ template <typename problem_t> class EOS
[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeEintFromTgas(amrex::Real rho, amrex::Real Tgas, const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars = {}) -> amrex::Real;
[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure, const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars = {})
-> amrex::Real;
[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeEintTempDerivative(amrex::Real rho, amrex::Real Tgas, const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars = {})
-> amrex::Real;
[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputePressure(amrex::Real rho, amrex::Real Eint, const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars = {}) -> amrex::Real;
[[nodiscard]] AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE static auto
ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure, const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars = {}) -> amrex::Real;

private:
static constexpr amrex::Real gamma_ = EOS_Traits<problem_t>::gamma;
Expand All @@ -60,11 +67,11 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeTgasFromEin
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars)
-> amrex::Real
{
// return temperature for an ideal gas
// return temperature for an ideal gas given density and internal energy
amrex::Real Tgas = NAN;

#ifdef PRIMORDIAL_CHEM
burn_t chemstate;
eos_t chemstate;
chemstate.rho = rho;
chemstate.e = Eint / rho;
// initialize array of number densities
Expand Down Expand Up @@ -100,11 +107,11 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromTga
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars)
-> amrex::Real
{
// return internal energy density for a gamma-law ideal gas
// return internal energy density given density and temperature
amrex::Real Eint = NAN;

#ifdef PRIMORDIAL_CHEM
burn_t chemstate;
eos_t chemstate;
chemstate.rho = rho;
// Define and initialize Tgas here
amrex::Real const Tgas_value = Tgas;
Expand Down Expand Up @@ -136,6 +143,45 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromTga
return Eint;
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromPres(amrex::Real rho, amrex::Real Pressure,
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars)
-> amrex::Real
{
// return internal energy density given density and pressure
amrex::Real Eint = NAN;

#ifdef PRIMORDIAL_CHEM
eos_t chemstate;
chemstate.rho = rho;
chemstate.p = Pressure;
// initialize array of number densities
for (int ii = 0; ii < NumSpec; ++ii) {
chemstate.xn[ii] = -1.0;
}

if (massScalars) {
const auto &massArray = *massScalars;
for (int nn = 0; nn < nmscalars_; ++nn) {
chemstate.xn[nn] = massArray[nn] / spmasses[nn]; // massScalars are partial densities (massFractions * rho)
}
}

eos(eos_input_rp, chemstate);
Eint = chemstate.e * chemstate.rho;
#else
if constexpr (gamma_ != 1.0) {
chem_eos_t estate;
estate.rho = rho;
estate.p = Pressure;
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_rp, estate);
Eint = estate.e * rho;
}
#endif
return Eint;
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto
EOS<problem_t>::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Real Tgas,
Expand All @@ -145,7 +191,7 @@ EOS<problem_t>::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Re
amrex::Real dEint_dT = NAN;

#ifdef PRIMORDIAL_CHEM
burn_t chemstate;
eos_t chemstate;
chemstate.rho = rho;
// we don't need Tgas to find chemstate.dedT, but we still need to initialize chemstate.T because we are using the 'rt' EOS mode
chemstate.T = NAN;
Expand Down Expand Up @@ -176,6 +222,88 @@ EOS<problem_t>::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Re
return dEint_dT;
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputePressure(amrex::Real rho, amrex::Real Eint,
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars)
-> amrex::Real
{
// return pressure for an ideal gas
amrex::Real P = NAN;
#ifdef PRIMORDIAL_CHEM
eos_t chemstate;
chemstate.rho = rho;
chemstate.e = Eint / rho;
// initialize array of number densities
for (int ii = 0; ii < NumSpec; ++ii) {
chemstate.xn[ii] = -1.0;
}

if (massScalars) {
const auto &massArray = *massScalars;
for (int nn = 0; nn < nmscalars_; ++nn) {
chemstate.xn[nn] = massArray[nn] / spmasses[nn]; // massScalars are partial densities (massFractions * rho)
}
}

eos(eos_input_re, chemstate);
P = chemstate.p;
#else
if constexpr (gamma_ != 1.0) {
chem_eos_t estate;
estate.rho = rho;
// if rho is 0, pass 0 to state.e
if (rho == 0.0) {
estate.e = 0;
} else {
estate.e = Eint / rho;
}
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_re, estate);
P = estate.p;
}
#endif
return P;
}

template <typename problem_t>
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeSoundSpeed(amrex::Real rho, amrex::Real Pressure,
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars)
-> amrex::Real
{
// return sound speed for an ideal gas
amrex::Real cs = NAN;

#ifdef PRIMORDIAL_CHEM
eos_t chemstate;
chemstate.rho = rho;
chemstate.p = Pressure;
// initialize array of number densities
for (int ii = 0; ii < NumSpec; ++ii) {
chemstate.xn[ii] = -1.0;
}

if (massScalars) {
const auto &massArray = *massScalars;
for (int nn = 0; nn < nmscalars_; ++nn) {
chemstate.xn[nn] = massArray[nn] / spmasses[nn]; // massScalars are partial densities (massFractions * rho)
}
}

eos(eos_input_rp, chemstate);
cs = chemstate.cs;
#else
if constexpr (gamma_ != 1.0) {
chem_eos_t estate;
estate.rho = rho;
estate.p = Pressure;
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_rp, estate);
cs = estate.cs;
}
#endif
return cs;
}

} // namespace quokka

#endif // EOS_HPP_
2 changes: 1 addition & 1 deletion src/HydroBlast2D/test_hydro2d_blast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct BlastProblem {

template <> struct quokka::EOS_Traits<BlastProblem> {
static constexpr double gamma = 5. / 3.;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
2 changes: 1 addition & 1 deletion src/HydroBlast3D/test_hydro3d_blast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool test_passes = false; // if one of the energy checks fails, set to false

template <> struct quokka::EOS_Traits<SedovProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
11 changes: 5 additions & 6 deletions src/HydroContact/test_hydro_contact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ template <> void RadhydroSimulation<ContactProblem>::setInitialConditionsOnGrid(
AMREX_ASSERT(!std::isnan(rho));
AMREX_ASSERT(!std::isnan(P));

const auto gamma = quokka::EOS_Traits<ContactProblem>::gamma;
for (int n = 0; n < ncomp_cc; ++n) {
state_cc(i, j, k, n) = 0.;
}
state_cc(i, j, k, HydroSystem<ContactProblem>::density_index) = rho;
state_cc(i, j, k, HydroSystem<ContactProblem>::x1Momentum_index) = rho * vx;
state_cc(i, j, k, HydroSystem<ContactProblem>::x2Momentum_index) = 0.;
state_cc(i, j, k, HydroSystem<ContactProblem>::x3Momentum_index) = 0.;
state_cc(i, j, k, HydroSystem<ContactProblem>::energy_index) = P / (gamma - 1.) + 0.5 * rho * (vx * vx);
state_cc(i, j, k, HydroSystem<ContactProblem>::internalEnergy_index) = P / (gamma - 1.);
state_cc(i, j, k, HydroSystem<ContactProblem>::energy_index) = quokka::EOS<ContactProblem>::ComputeEintFromPres(rho, P) + 0.5 * rho * (vx * vx);
state_cc(i, j, k, HydroSystem<ContactProblem>::internalEnergy_index) = quokka::EOS<ContactProblem>::ComputeEintFromPres(rho, P);
});
}

Expand Down Expand Up @@ -112,13 +111,13 @@ void RadhydroSimulation<ContactProblem>::computeReferenceSolution(amrex::MultiFa
stateExact(i, j, k, n) = 0.;
}

const auto gamma = quokka::EOS_Traits<ContactProblem>::gamma;
stateExact(i, j, k, HydroSystem<ContactProblem>::density_index) = rho;
stateExact(i, j, k, HydroSystem<ContactProblem>::x1Momentum_index) = rho * vx;
stateExact(i, j, k, HydroSystem<ContactProblem>::x2Momentum_index) = 0.;
stateExact(i, j, k, HydroSystem<ContactProblem>::x3Momentum_index) = 0.;
stateExact(i, j, k, HydroSystem<ContactProblem>::energy_index) = P / (gamma - 1.) + 0.5 * rho * (vx * vx);
stateExact(i, j, k, HydroSystem<ContactProblem>::internalEnergy_index) = P / (gamma - 1.);
stateExact(i, j, k, HydroSystem<ContactProblem>::energy_index) =
quokka::EOS<ContactProblem>::ComputeEintFromPres(rho, P) + 0.5 * rho * (vx * vx);
stateExact(i, j, k, HydroSystem<ContactProblem>::internalEnergy_index) = quokka::EOS<ContactProblem>::ComputeEintFromPres(rho, P);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/HydroHighMach/test_hydro_highmach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct HighMachProblem {

template <> struct quokka::EOS_Traits<HighMachProblem> {
static constexpr double gamma = 5. / 3.;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
2 changes: 1 addition & 1 deletion src/HydroKelvinHelmholz/test_hydro2d_kh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct KelvinHelmholzProblem {

template <> struct quokka::EOS_Traits<KelvinHelmholzProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
6 changes: 3 additions & 3 deletions src/HydroQuirk/test_quirk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct QuirkProblem {

template <> struct quokka::EOS_Traits<QuirkProblem> {
static constexpr double gamma = 5. / 3.;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down Expand Up @@ -125,8 +125,8 @@ template <> void RadhydroSimulation<QuirkProblem>::setInitialConditionsOnGrid(qu
state_cc(i, j, k, HydroSystem<QuirkProblem>::x1Momentum_index) = rho * vx;
state_cc(i, j, k, HydroSystem<QuirkProblem>::x2Momentum_index) = rho * vy;
state_cc(i, j, k, HydroSystem<QuirkProblem>::x3Momentum_index) = rho * vz;
state_cc(i, j, k, HydroSystem<QuirkProblem>::energy_index) = P / (gamma - 1.) + 0.5 * rho * v_sq;
state_cc(i, j, k, HydroSystem<QuirkProblem>::internalEnergy_index) = P / (gamma - 1.);
state_cc(i, j, k, HydroSystem<QuirkProblem>::energy_index) = quokka::EOS<QuirkProblem>::ComputeEintFromPres(rho, P) + 0.5 * rho * v_sq;
state_cc(i, j, k, HydroSystem<QuirkProblem>::internalEnergy_index) = quokka::EOS<QuirkProblem>::ComputeEintFromPres(rho, P);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/HydroRichtmeyerMeshkov/test_hydro2d_rm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct RichtmeyerMeshkovProblem {

template <> struct quokka::EOS_Traits<RichtmeyerMeshkovProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
2 changes: 1 addition & 1 deletion src/HydroShocktube/test_hydro_shocktube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ShocktubeProblem {

template <> struct quokka::EOS_Traits<ShocktubeProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
2 changes: 1 addition & 1 deletion src/HydroShocktubeCMA/test_hydro_shocktube_cma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ template <> struct SimulationData<ShocktubeProblem> {

template <> struct quokka::EOS_Traits<ShocktubeProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
2 changes: 1 addition & 1 deletion src/HydroVacuum/test_hydro_vacuum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct ShocktubeProblem {

template <> struct quokka::EOS_Traits<ShocktubeProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = NAN;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = C::k_B;
};

Expand Down
15 changes: 7 additions & 8 deletions src/PassiveScalar/test_scalars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,15 @@ template <> void RadhydroSimulation<ScalarProblem>::setInitialConditionsOnGrid(q
scalar = 0.0;
}

const auto gamma = quokka::EOS_Traits<ScalarProblem>::gamma;
for (int n = 0; n < state_cc.nComp(); ++n) {
state_cc(i, j, k, n) = 0.;
}
state_cc(i, j, k, HydroSystem<ScalarProblem>::density_index) = rho;
state_cc(i, j, k, HydroSystem<ScalarProblem>::x1Momentum_index) = rho * vx;
state_cc(i, j, k, HydroSystem<ScalarProblem>::x2Momentum_index) = 0.;
state_cc(i, j, k, HydroSystem<ScalarProblem>::x3Momentum_index) = 0.;
state_cc(i, j, k, HydroSystem<ScalarProblem>::energy_index) = P / (gamma - 1.) + 0.5 * rho * (vx * vx);
state_cc(i, j, k, HydroSystem<ScalarProblem>::internalEnergy_index) = P / (gamma - 1.);
state_cc(i, j, k, HydroSystem<ScalarProblem>::energy_index) = quokka::EOS<ScalarProblem>::ComputeEintFromPres(rho, P) + 0.5 * rho * (vx * vx);
state_cc(i, j, k, HydroSystem<ScalarProblem>::internalEnergy_index) = quokka::EOS<ScalarProblem>::ComputeEintFromPres(rho, P);
state_cc(i, j, k, HydroSystem<ScalarProblem>::scalar0_index) = scalar;
});
}
Expand Down Expand Up @@ -112,16 +111,16 @@ void RadhydroSimulation<ScalarProblem>::computeReferenceSolution(amrex::MultiFab
scalar = 0.0;
}

const auto gamma = quokka::EOS_Traits<ScalarProblem>::gamma;
for (int n = 0; n < ncomp; ++n) {
stateExact(i, j, k, n) = 0.;
}
stateExact(i, j, k, HydroSystem<ScalarProblem>::density_index) = rho;
stateExact(i, j, k, HydroSystem<ScalarProblem>::x1Momentum_index) = rho * vx;
stateExact(i, j, k, HydroSystem<ScalarProblem>::x2Momentum_index) = 0.;
stateExact(i, j, k, HydroSystem<ScalarProblem>::x3Momentum_index) = 0.;
stateExact(i, j, k, HydroSystem<ScalarProblem>::energy_index) = P / (gamma - 1.) + 0.5 * rho * (vx * vx);
stateExact(i, j, k, HydroSystem<ScalarProblem>::internalEnergy_index) = P / (gamma - 1.);
stateExact(i, j, k, HydroSystem<ScalarProblem>::energy_index) =
quokka::EOS<ScalarProblem>::ComputeEintFromPres(rho, P) + 0.5 * rho * (vx * vx);
stateExact(i, j, k, HydroSystem<ScalarProblem>::internalEnergy_index) = quokka::EOS<ScalarProblem>::ComputeEintFromPres(rho, P);
stateExact(i, j, k, HydroSystem<ScalarProblem>::scalar0_index) = scalar;
});
}
Expand Down Expand Up @@ -166,7 +165,7 @@ void RadhydroSimulation<ScalarProblem>::computeReferenceSolution(amrex::MultiFab
const auto s = val_exact.at(HydroSystem<ScalarProblem>::scalar0_index)[i];
const auto vx = xmom / rho;
const auto Eint = E - 0.5 * rho * (vx * vx);
const auto P = (quokka::EOS_Traits<ScalarProblem>::gamma - 1.) * Eint;
const auto P = quokka::EOS<ScalarProblem>::ComputePressure(rho, Eint);
d_exact.push_back(rho);
vx_exact.push_back(vx);
P_exact.push_back(P);
Expand All @@ -180,7 +179,7 @@ void RadhydroSimulation<ScalarProblem>::computeReferenceSolution(amrex::MultiFab
const auto fs = values.at(HydroSystem<ScalarProblem>::scalar0_index)[i];
const auto fvx = fxmom / frho;
const auto fEint = fE - 0.5 * frho * (fvx * fvx);
const auto fP = (quokka::EOS_Traits<ScalarProblem>::gamma - 1.) * fEint;
const auto fP = quokka::EOS<ScalarProblem>::ComputePressure(frho, fEint);
d_final.push_back(frho);
vx_final.push_back(fvx);
P_final.push_back(fP);
Expand Down
2 changes: 1 addition & 1 deletion src/RadMarshak/test_radiation_marshak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ constexpr double alpha_SuOlson = 4.0 * a_rad / eps_SuOlson;
constexpr double T_initial = 1.0e-2;

template <> struct quokka::EOS_Traits<SuOlsonProblem> {
static constexpr double mean_molecular_mass = 1.0;
static constexpr double mean_molecular_weight = 1.0;
static constexpr double boltzmann_constant = 1.0;
static constexpr double gamma = 5. / 3.;
};
Expand Down
2 changes: 1 addition & 1 deletion src/RadMarshakCGS/test_radiation_marshak_cgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ constexpr double alpha_SuOlson = 4.0 * a_rad / eps_SuOlson;
constexpr double T_initial = 1.0e4; // K

template <> struct quokka::EOS_Traits<SuOlsonProblemCgs> {
static constexpr double mean_molecular_mass = C::m_u;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
static constexpr double gamma = 5. / 3.;
};
Expand Down
Loading