From 5edeed40aef04d2e6701ddb0e472448e34a49dd7 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Mon, 2 Dec 2024 14:06:48 -0700 Subject: [PATCH] eos davis --- singularity-eos/eos/eos_davis.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/singularity-eos/eos/eos_davis.hpp b/singularity-eos/eos/eos_davis.hpp index 2bfd96ad76..a9a6ac228a 100644 --- a/singularity-eos/eos/eos_davis.hpp +++ b/singularity-eos/eos/eos_davis.hpp @@ -35,9 +35,10 @@ class DavisReactants : public EosBase { PORTABLE_INLINE_FUNCTION DavisReactants(const Real rho0, const Real e0, const Real P0, const Real T0, const Real A, const Real B, const Real C, const Real G0, const Real Z, - const Real alpha, const Real Cv0) + const Real alpha, const Real Cv0, + const MeanAtomicProperties &AZbar = MeanAtomicProperties()) : _rho0(rho0), _e0(e0), _P0(P0), _T0(T0), _A(A), _B(B), _C(C), _G0(G0), _Z(Z), - _alpha(alpha), _Cv0(Cv0) { + _alpha(alpha), _Cv0(Cv0), _AZbar(AZbar) { CheckParams(); } DavisReactants GetOnDevice() { return *this; } @@ -146,6 +147,10 @@ class DavisReactants : public EosBase { Indexer_t &&lambda = static_cast(nullptr)) const { return Gamma(rho); } + PORTABLE_INLINE_FUNCTION + Real MeanAtomicMass() const { return _AZbar.Abar; } + PORTABLE_INLINE_FUNCTION + Real MeanAtomicNumber() const { return _AZbar.Zbar; } template PORTABLE_INLINE_FUNCTION void FillEos(Real &rho, Real &temp, Real &energy, Real &press, Real &cv, Real &bmod, @@ -183,6 +188,7 @@ class DavisReactants : public EosBase { private: static constexpr Real onethird = 1.0 / 3.0; Real _rho0, _e0, _P0, _T0, _A, _B, _C, _G0, _Z, _alpha, _Cv0; + MeanAtomicProperties _AZbar; // static constexpr const char _eos_type[] = "DavisReactants"; static constexpr unsigned long _preferred_input = thermalqs::density | thermalqs::specific_internal_energy; @@ -198,8 +204,9 @@ class DavisProducts : public EosBase { DavisProducts() = default; PORTABLE_INLINE_FUNCTION DavisProducts(const Real a, const Real b, const Real k, const Real n, const Real vc, - const Real pc, const Real Cv) - : _a(a), _b(b), _k(k), _n(n), _vc(vc), _pc(pc), _Cv(Cv) {} + const Real pc, const Real Cv, + const MeanAtomicProperties &AZbar = MeanAtomicProperties()) + : _a(a), _b(b), _k(k), _n(n), _vc(vc), _pc(pc), _Cv(Cv), _AZbar(AZbar) {} PORTABLE_INLINE_FUNCTION void CheckParams() const { // TODO(JMM): Stub. @@ -285,6 +292,10 @@ class DavisProducts : public EosBase { Indexer_t &&lambda = static_cast(nullptr)) const { return Gamma(rho); } + PORTABLE_INLINE_FUNCTION + Real MeanAtomicMass() const { return _AZbar.Abar; } + PORTABLE_INLINE_FUNCTION + Real MeanAtomicNumber() const { return _AZbar.Zbar; } template PORTABLE_INLINE_FUNCTION void DensityEnergyFromPressureTemperature(const Real press, const Real temp, @@ -321,6 +332,7 @@ class DavisProducts : public EosBase { private: static constexpr Real onethird = 1.0 / 3.0; Real _a, _b, _k, _n, _vc, _pc, _Cv; + MeanAtomicProperties _AZbar; // static constexpr const char _eos_type[] = "DavisProducts"; static constexpr const unsigned long _preferred_input = thermalqs::density | thermalqs::specific_internal_energy;