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

Use microphysics EOS in Quokka's EOS.hpp for all quokka tests + use amu instead of hydrogen mass throughout Quokka #324

Merged
merged 74 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
20f630e
track branch from max
psharda Jun 6, 2023
360e567
Merge branch 'quokka-astro:development' into micro-max
psharda Jun 13, 2023
bfe6e05
enable two-EOS compilation
psharda Jun 13, 2023
2040e58
use ifdefs for primordial chem
psharda Jun 13, 2023
9c3c5c2
include actual eos data header
psharda Jun 13, 2023
ba1dadb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 13, 2023
de5ef24
updated microp
psharda Jun 13, 2023
4b8ba3c
updated microp
psharda Jun 13, 2023
ca15bbe
update microp
psharda Jun 14, 2023
d8f9120
updated microphysics
psharda Jun 14, 2023
6b1786c
use BEFORE keyword to set right priority of include dirs
psharda Jun 14, 2023
ad854ab
updated microp: remove gammalaw eos params from primordial chem eos
psharda Jun 14, 2023
8a33278
Merge branch 'quokka-astro:development' into micro-max
psharda Jun 15, 2023
e855760
Merge branch 'quokka-astro:development' into micro-max
psharda Jun 21, 2023
c988c19
updated microp
psharda Jun 21, 2023
da60ddc
include QuokkaObjSources
psharda Jun 21, 2023
9b5169b
updated microp
psharda Jun 21, 2023
8c50e09
remove de-linking quokkaobj lib
psharda Jun 21, 2023
8b18029
only build some tests
psharda Jun 21, 2023
358e2cd
reattached microp
psharda Jun 21, 2023
2135136
add QuokkaObjSources
psharda Jun 21, 2023
95e1744
build all tests
psharda Jun 21, 2023
df02fdb
Merge branch 'development' into micro-max
psharda Jun 21, 2023
8d20b48
Merge branch 'quokka-astro:development' into micro-max
psharda Jun 22, 2023
03f4f6f
use microp EOS for all tests
psharda Jun 22, 2023
811a077
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 22, 2023
b03c827
add gamma_law_sources to all tests
psharda Jun 22, 2023
7a5d80b
initializes Microphysics EOS
psharda Jun 22, 2023
7ce9928
initialize extern_params
psharda Jun 22, 2023
71233f4
use the new chem_eos_t struct
psharda Jun 22, 2023
b4439e2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 22, 2023
44e6300
updated microp
psharda Jun 27, 2023
7a872aa
updated microp
psharda Jun 27, 2023
6402f4e
added hydrogen_mass_code_units as an EOS_Trait
psharda Jun 27, 2023
7480a3c
removed EOS_traits
psharda Jun 27, 2023
4a6b40a
defined hydrogen_mass_code_units in EOS traits
psharda Jun 27, 2023
a544989
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
7d027d3
specify code units in EOS class
psharda Jun 27, 2023
a68c1cf
add code units
psharda Jun 27, 2023
40983b1
initialize EOS
psharda Jun 27, 2023
b110065
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
f7cbb25
corrected the name for mean_molecular_weight
psharda Jun 27, 2023
3ceb89e
Merge branch 'micro-max' of github.com:psharda/quokka into micro-max
psharda Jun 27, 2023
6c94d94
corrected code units
psharda Jun 27, 2023
4631866
corrected code units
psharda Jun 27, 2023
96d9d86
scale Tgas by k_B
psharda Jun 27, 2023
bee8c9c
use microphysics k_B
psharda Jun 27, 2023
b309e4c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
7b6e6b0
corrected code units
psharda Jun 27, 2023
52eb94c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
ddeb814
code unit changed to 1/n_A
psharda Jun 27, 2023
dc6bceb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 27, 2023
1a54ffa
Merge branch 'quokka-astro:development' into micro-max
psharda Jul 23, 2023
9c63d01
updated microp
psharda Jul 23, 2023
379f970
use microp constant for hydrogen mass
psharda Jul 23, 2023
b13a540
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 23, 2023
dfef3f1
changed mass units
psharda Jul 23, 2023
607d203
use amu and k_B from microphysics instead of m_H and k_B in quokka
psharda Jul 24, 2023
e65dcaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2023
1cdc0d8
revert to hydrogen mass
psharda Jul 24, 2023
2335402
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2023
7a5749f
revert to hydrogen mass
psharda Jul 24, 2023
ff5fb51
use amu
psharda Jul 24, 2023
c928b73
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 24, 2023
5b70e51
use amu
psharda Jul 24, 2023
f520195
Merge branch 'micro-max' of github.com:psharda/quokka into micro-max
psharda Jul 24, 2023
2012264
revert to hydrogen mass
psharda Jul 24, 2023
63ed9d5
changed EOS functions to use microphysics
psharda Jul 24, 2023
58d27e7
scaled dedT by kB
psharda Jul 25, 2023
9f60a17
fixed bug
psharda Jul 25, 2023
99ec5f7
fixed bugs
psharda Jul 25, 2023
9ce8fb7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 25, 2023
852ee12
remove mass_code_units
psharda Jul 25, 2023
66d017c
remove mass_code_units
psharda Jul 26, 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 = del-eos-comp
branch = development
2 changes: 1 addition & 1 deletion extern/Microphysics
Submodule Microphysics updated 134 files
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ link_libraries(hdf5::hdf5)
include(CTest)

#create an object library for files that should be compiled with all test problems
set (QuokkaObjSources "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/CloudyCooling.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/GrackleDataReader.cpp")
set (QuokkaObjSources "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/CloudyCooling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GrackleDataReader.cpp"
"${gamma_law_sources}")
#we don't use it anymore because it gives issues on Cray systems
#add_library(QuokkaObj OBJECT ${QuokkaObjSources} ${gamma_law_sources})
#if(AMReX_GPU_BACKEND MATCHES "CUDA")
Expand Down
14 changes: 7 additions & 7 deletions src/CloudyCooling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto cloudy_cooling_function(Real const
{
// interpolate cooling rates from Cloudy tables
const Real rhoH = rho * cloudy_H_mass_fraction; // mass density of H species
const Real nH = rhoH / quokka::hydrogen_mass_cgs;
const Real nH = rhoH / (C::m_p + C::m_e);
psharda marked this conversation as resolved.
Show resolved Hide resolved
const Real log_nH = std::log10(nH);
const Real log_T = std::log10(T);

Expand All @@ -102,7 +102,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto cloudy_cooling_function(Real const

// compute electron density
// N.B. it is absolutely critical to include the metal contribution here!
double n_e = (rho / quokka::hydrogen_mass_cgs) * (1.0 - mu * (X + Y / 4. + Z / mean_metals_A)) / (mu - (electron_mass_cgs / quokka::hydrogen_mass_cgs));
double n_e = (rho / (C::m_p + C::m_e)) * (1.0 - mu * (X + Y / 4. + Z / mean_metals_A)) / (mu - (electron_mass_cgs / (C::m_p + C::m_e)));
// the approximation for the metals contribution to e- fails at high densities (~1e3 or higher)
n_e = std::max(n_e, 1.0e-4 * nH);

Expand All @@ -118,7 +118,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto cloudy_cooling_function(Real const
// Compton term (CMB photons)
// [e.g., Hirata 2018: doi:10.1093/mnras/stx2854]
constexpr double Gamma_C = (8. * sigma_T * E_cmb) / (3. * electron_mass_cgs * c_light_cgs_);
constexpr double C_n = Gamma_C * quokka::boltzmann_constant_cgs / (5. / 3. - 1.0);
constexpr double C_n = Gamma_C * C::k_B / (5. / 3. - 1.0);
const double compton_CMB = -C_n * (T - T_cmb) * n_e;
Edot += compton_CMB;

Expand All @@ -129,13 +129,13 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto ComputeEgasFromTgas(double rho, do
{
// convert Egas (internal gas energy) to temperature
const Real rhoH = rho * cloudy_H_mass_fraction;
const Real nH = rhoH / quokka::hydrogen_mass_cgs;
const Real nH = rhoH / (C::m_p + C::m_e);

// compute mu from mu(T) table
const Real mu = interpolate2d(std::log10(nH), std::log10(Tgas), tables.log_nH, tables.log_Tgas, tables.meanMolWeight);

// compute thermal gas energy
const Real Egas = (rho / (quokka::hydrogen_mass_cgs * mu)) * quokka::boltzmann_constant_cgs * Tgas / (gamma - 1.);
const Real Egas = (rho / ((C::m_p + C::m_e) * mu)) * C::k_B * Tgas / (gamma - 1.);
return Egas;
}

Expand All @@ -157,12 +157,12 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto ComputeTgasFromEgas(double rho, do

// solve for temperature given Eint (with fixed adiabatic index gamma)
const Real rhoH = rho * cloudy_H_mass_fraction;
const Real nH = rhoH / quokka::hydrogen_mass_cgs;
const Real nH = rhoH / (C::m_p + C::m_e);
const Real log_nH = std::log10(nH);

// mean molecular weight (in Grackle tables) is defined w/r/t
// hydrogen_mass_cgs_
const Real C = (gamma - 1.) * Egas / (quokka::boltzmann_constant_cgs * (rho / quokka::hydrogen_mass_cgs));
const Real C = (gamma - 1.) * Egas / (C::k_B * (rho / (C::m_p + C::m_e)));

// solve for mu(T)*C == T.
// (Grackle does this with a fixed-point iteration. We use a more robust
Expand Down
8 changes: 4 additions & 4 deletions src/Cooling/test_cooling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ using amrex::Real;
struct CoolingTest {
}; // dummy type to allow compile-type polymorphism via template specialization

constexpr double m_H = quokka::hydrogen_mass_cgs;
constexpr double m_H = C::m_u;
constexpr double seconds_in_year = 3.154e7;

template <> struct quokka::EOS_Traits<CoolingTest> {
static constexpr double gamma = 5. / 3.; // default value
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<CoolingTest> {
Expand Down Expand Up @@ -131,7 +131,7 @@ template <> void RadhydroSimulation<CoolingTest>::setInitialConditionsOnGrid(quo
Real xmom = 0;
Real ymom = 0;
Real zmom = 0;
Real const P = 4.0e4 * quokka::boltzmann_constant_cgs; // erg cm^-3
Real const P = 4.0e4 * C::k_B; // erg cm^-3
Real Eint = (quokka::EOS_Traits<CoolingTest>::gamma - 1.) * P;

Real const Egas = RadSystem<CoolingTest>::ComputeEgasFromEint(rho, xmom, ymom, zmom, Eint);
Expand Down
32 changes: 22 additions & 10 deletions src/EOS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "AMReX_GpuQualifiers.H"
#include "AMReX_REAL.H"
#include "physics_info.hpp"
#include <AMReX_Print.H>

#include "burn_type.H"
#include "eos.H"
Expand All @@ -25,16 +26,14 @@

namespace quokka
{
static constexpr double boltzmann_constant_cgs = 1.380658e-16; // cgs
static constexpr double hydrogen_mass_cgs = 1.6726231e-24; // cgs

// specify default values for ideal gamma-law EOS
//
template <typename problem_t> struct EOS_Traits {
static constexpr double gamma = 5. / 3.; // default value
static constexpr double cs_isothermal = NAN; // only used when gamma = 1
static constexpr double mean_molecular_weight = NAN;
static constexpr double boltzmann_constant = boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <typename problem_t> class EOS
Expand Down Expand Up @@ -84,8 +83,13 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeTgasFromEin
Tgas = chemstate.T;
#else
if constexpr (gamma_ != 1.0) {
const amrex::Real c_v = boltzmann_constant_ / (mean_molecular_weight_ * (gamma_ - 1.0));
Tgas = Eint / (rho * c_v);
chem_eos_t estate;
estate.rho = rho;
estate.e = Eint / rho;
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_re, estate);
// scale returned temperature in case boltzmann constant is dimensionless
Tgas = estate.T * C::k_B / boltzmann_constant_;
}
#endif
return Tgas;
Expand Down Expand Up @@ -121,16 +125,20 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS<problem_t>::ComputeEintFromTga
Eint = chemstate.e * chemstate.rho;
#else
if constexpr (gamma_ != 1.0) {
const amrex::Real c_v = boltzmann_constant_ / (mean_molecular_weight_ * (gamma_ - 1.0));
Eint = rho * c_v * Tgas;
chem_eos_t estate;
estate.rho = rho;
estate.T = Tgas;
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_rt, estate);
Eint = estate.e * rho * boltzmann_constant_ / C::k_B;
}
#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*/,
EOS<problem_t>::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Real Tgas,
const std::optional<amrex::GpuArray<amrex::Real, nmscalars_>> massScalars) -> amrex::Real
{
// compute derivative of internal energy w/r/t temperature
Expand All @@ -157,8 +165,12 @@ EOS<problem_t>::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Re
dEint_dT = chemstate.dedT * chemstate.rho;
#else
if constexpr (gamma_ != 1.0) {
const amrex::Real c_v = boltzmann_constant_ / (mean_molecular_weight_ * (gamma_ - 1.0));
dEint_dT = rho * c_v;
chem_eos_t estate;
estate.rho = rho;
estate.T = Tgas;
estate.mu = mean_molecular_weight_ / C::m_u;
eos(eos_input_rt, estate);
dEint_dT = estate.dedT * rho * boltzmann_constant_ / C::k_B;
}
#endif
return dEint_dT;
Expand Down
4 changes: 2 additions & 2 deletions src/FCQuantities/test_fc_quantities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ struct FCQuantities {

template <> struct quokka::EOS_Traits<FCQuantities> {
static constexpr double gamma = 5. / 3.;
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<FCQuantities> {
Expand Down
2 changes: 1 addition & 1 deletion src/HydroBlast2D/test_hydro2d_blast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<BlastProblem> {
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 @@ -35,7 +35,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct HydroSystem_Traits<SedovProblem> {
Expand Down
4 changes: 2 additions & 2 deletions src/HydroContact/test_hydro_contact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct ContactProblem {

template <> struct quokka::EOS_Traits<ContactProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ContactProblem> {
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 @@ -31,7 +31,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<HighMachProblem> {
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 @@ -25,7 +25,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct HydroSystem_Traits<KelvinHelmholzProblem> {
Expand Down
4 changes: 2 additions & 2 deletions src/HydroLeblanc/test_hydro_leblanc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct ShocktubeProblem {

template <> struct quokka::EOS_Traits<ShocktubeProblem> {
static constexpr double gamma = (5. / 3.);
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ShocktubeProblem> {
Expand Down
2 changes: 1 addition & 1 deletion src/HydroQuirk/test_quirk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct HydroSystem_Traits<QuirkProblem> {
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 @@ -24,7 +24,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct HydroSystem_Traits<RichtmeyerMeshkovProblem> {
Expand Down
4 changes: 2 additions & 2 deletions src/HydroSMS/test_hydro_sms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct ShocktubeProblem {

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

template <> struct Physics_Traits<ShocktubeProblem> {
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 @@ -29,7 +29,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ShocktubeProblem> {
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 @@ -34,7 +34,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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ShocktubeProblem> {
Expand Down
4 changes: 2 additions & 2 deletions src/HydroShuOsher/test_hydro_shuosher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct ShocktubeProblem {

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

template <> struct Physics_Traits<ShocktubeProblem> {
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 @@ -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 boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ShocktubeProblem> {
Expand Down
4 changes: 2 additions & 2 deletions src/HydroWave/test_hydro_wave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct WaveProblem {

template <> struct quokka::EOS_Traits<WaveProblem> {
static constexpr double gamma = 5. / 3.;
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<WaveProblem> {
Expand Down
18 changes: 13 additions & 5 deletions src/ODEIntegration/test_ode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
///

#include "test_ode.hpp"
#include "eos.H"
#include "extern_parameters.H"
#include "radiation_system.hpp"

using amrex::Real;

constexpr double Tgas0 = 6000.; // K
constexpr double rho0 = 0.01 * quokka::hydrogen_mass_cgs; // g cm^-3
constexpr double Tgas0 = 6000.; // K
constexpr double rho0 = 0.01 * (C::m_p + C::m_e); // g cm^-3

template <> struct quokka::EOS_Traits<ODETest> {
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
static constexpr double gamma = 5. / 3.;
};

Expand All @@ -30,7 +32,7 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto cooling_function(Real const rho, R
// use fitting function from Koyama & Inutsuka (2002)
Real gamma_heat = 2.0e-26;
Real lambda_cool = gamma_heat * (1.0e7 * std::exp(-114800. / (T + 1000.)) + 14. * std::sqrt(T) * std::exp(-92. / T));
Real rho_over_mh = rho / quokka::hydrogen_mass_cgs;
Real rho_over_mh = rho / (C::m_p + C::m_e);
Real cooling_source_term = rho_over_mh * gamma_heat - (rho_over_mh * rho_over_mh) * lambda_cool;
return cooling_source_term;
}
Expand All @@ -52,6 +54,12 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto user_rhs(Real /*t*/, quokka::valar

auto problem_main() -> int
{
// initialize EOS
init_extern_parameters();
Real small_temp = 1e-10;
Real small_dens = 1e-100;
eos_init(small_temp, small_dens);

// set up initial conditions
const Real Eint0 = quokka::EOS<ODETest>::ComputeEintFromTgas(rho0, Tgas0);
const Real Edot0 = cooling_function(rho0, Tgas0);
Expand Down
4 changes: 2 additions & 2 deletions src/PassiveScalar/test_scalars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct ScalarProblem {

template <> struct quokka::EOS_Traits<ScalarProblem> {
static constexpr double gamma = 1.4;
static constexpr double mean_molecular_weight = quokka::hydrogen_mass_cgs;
static constexpr double boltzmann_constant = quokka::boltzmann_constant_cgs;
static constexpr double mean_molecular_weight = C::m_u;
static constexpr double boltzmann_constant = C::k_B;
};

template <> struct Physics_Traits<ScalarProblem> {
Expand Down
Loading