From 63ed9d553c5c3462f6c3cf646aa901df34c38149 Mon Sep 17 00:00:00 2001 From: psharda Date: Mon, 24 Jul 2023 23:51:05 +0200 Subject: [PATCH] changed EOS functions to use microphysics --- src/EOS.hpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/EOS.hpp b/src/EOS.hpp index acc045f10..f3318e559 100644 --- a/src/EOS.hpp +++ b/src/EOS.hpp @@ -129,8 +129,14 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::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; + // 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_ / mass_code_units_; + eos(eos_input_rt, estate); + Eint = estate.e * rho * boltzmann_constant_ / C::k_B; } #endif return Eint; @@ -138,7 +144,7 @@ AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto EOS::ComputeEintFromTga template AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE auto -EOS::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Real /*Tgas*/, +EOS::ComputeEintTempDerivative(const amrex::Real rho, const amrex::Real Tgas, const std::optional> massScalars) -> amrex::Real { // compute derivative of internal energy w/r/t temperature @@ -165,8 +171,14 @@ EOS::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; + // 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_ / mass_code_units_; + eos(eos_input_rt, estate); + dEint_dT = estate.dedT * rho; } #endif return dEint_dT;