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

Create minimum energy modifier #375

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
355cf71
Create default MinInternalEnergyFromDensity behavior
jhp-lanl May 11, 2024
2eda134
Add minimum energy modifier
jhp-lanl May 11, 2024
1c29d51
Add minimum energy modifier
jhp-lanl May 11, 2024
c6ed8dc
Rely on default minimum energy functionality in base class (if this w…
jhp-lanl May 11, 2024
4da0d99
Clang format
jhp-lanl May 11, 2024
21510e6
Merge branch 'main' of github.com:lanl/singularity-eos into jhp/MinEn…
jhp-lanl May 14, 2024
6a133af
Merge branch 'main' of github.com:lanl/singularity-eos into jhp/MinEn…
jhp-lanl Feb 20, 2025
eb85218
Reflect renamed file
jhp-lanl Feb 20, 2025
0a826a1
Add test for floored energy modifer
jhp-lanl Feb 27, 2025
27cd773
Clang format
jhp-lanl Feb 27, 2025
ad6d3cc
Use using macro
jhp-lanl Feb 27, 2025
692d1e1
Merge branch 'main' of github.com:lanl/singularity-eos into jhp/MinEn…
jhp-lanl Feb 27, 2025
06afb52
Rename file without typo
jhp-lanl Feb 27, 2025
aacebac
copy_eos_arr_to_device needs template argument since EOS type can change
jhp-lanl Feb 27, 2025
f5ff947
Whoops... forgot the constructor
jhp-lanl Feb 28, 2025
0411b1c
Whoops... forgot 'typename'
jhp-lanl Feb 28, 2025
f0edfca
Whoops... needs second template argument
jhp-lanl Feb 28, 2025
587466e
Fix a lot of silly mistakes
jhp-lanl Feb 28, 2025
c053d29
Clang format
jhp-lanl Feb 28, 2025
0e58fda
Remove spiner temporarily
jhp-lanl Feb 28, 2025
69d28fa
Enable MinInternalEnergyFromDensity for spiner rho T
jhp-lanl Feb 28, 2025
5841d42
Remove extraneous const
jhp-lanl Feb 28, 2025
cf5ebd3
Move variables inside ifdef to avoid unused warning
jhp-lanl Feb 28, 2025
7ea79ef
Change test stage slightly
jhp-lanl Feb 28, 2025
f131b32
Add FlooredEnergy modifer
jhp-lanl Feb 28, 2025
a3dcdea
Add FlooredEnergy documentation
jhp-lanl Feb 28, 2025
b01e9bd
Update copyright
jhp-lanl Feb 28, 2025
c01e51e
One last doc change
jhp-lanl Feb 28, 2025
ebd11bd
Small change to documentation
jhp-lanl Feb 28, 2025
e2b269c
Merge branch 'main' of github.com:lanl/singularity-eos into jhp/MinEn…
jhp-lanl Mar 3, 2025
01c59d8
Add newer methods to floored_energy modifier
jhp-lanl Mar 3, 2025
c667d49
__host__ __device__ apparently can't handle an return type
jhp-lanl Mar 3, 2025
c6fa446
Actually... the problem was a mis-placed PORTABLE function decorator
jhp-lanl Mar 3, 2025
e97890a
diff_pressures can't have an auto return type
jhp-lanl Mar 4, 2025
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
1 change: 1 addition & 0 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ register_headers(
eos/modifiers/ramps_eos.hpp
eos/modifiers/shifted_eos.hpp
eos/modifiers/eos_unitsystem.hpp
eos/modifiers/floored_energy.hpp
eos/modifiers/zsplit_eos.hpp
eos/eos_base.hpp
eos/eos_eospac.hpp
Expand Down
13 changes: 12 additions & 1 deletion singularity-eos/eos/eos_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,18 @@ class EosBase {
PORTABLE_ALWAYS_THROW_OR_ABORT(msg);
}

// Default MinInternalEnergyFromDensity behavior is to cause an error
// Default MinInternalEnergyFromDensity behavior is to just return the zero-K isotherm.
// This should be fine for all thermodynamically consistent EOS, but could cause issues
// with EOS that aren't thermodynamically consistent.
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const {
CRTP copy = *(static_cast<CRTP const *>(this));
return copy.InternalEnergyFromDensityTemperature(rho, 0.);
}

// This error is useful for EOS where the zero-K approximation is invalid for whatever
// reason
PORTABLE_FORCEINLINE_FUNCTION
void MinInternalEnergyIsNotEnabled(const char *eosname) const {
// Construct the error message using char* so it works on device
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/eos_gruneisen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,8 @@ PORTABLE_INLINE_FUNCTION Real Gruneisen::PressureFromDensityInternalEnergy(
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
Gruneisen::MinInternalEnergyFromDensity(const Real rho_in, Indexer_t &&lambda) const {
// const Real rho = std::min(rho_in, _rho_max);
MinInternalEnergyIsNotEnabled("Gruneisen");
return 0.0;
const Real rho = std::min(rho_in, _rho_max);
return EosBase<Gruneisen>::MinInternalEnergyFromDensity(rho);
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real Gruneisen::EntropyFromDensityInternalEnergy(
Expand Down
6 changes: 0 additions & 6 deletions singularity-eos/eos/eos_helmholtz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,6 @@ class Helmholtz : public EosBase<Helmholtz> {
thermalqs::pressure | thermalqs::temperature, lambda);
return p;
}
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const {
MinInternalEnergyIsNotEnabled("Helmholtz");
return 0.0;
}

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
Expand Down
9 changes: 0 additions & 9 deletions singularity-eos/eos/eos_jwl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class JWL : public EosBase<JWL> {
const Real rho, const Real sie,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temperature,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
Expand Down Expand Up @@ -171,12 +168,6 @@ PORTABLE_INLINE_FUNCTION Real JWL::PressureFromDensityInternalEnergy(
return ReferencePressure(rho) + _w * rho * (sie - ReferenceEnergy(rho));
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
JWL::MinInternalEnergyFromDensity(const Real rho, Indexer_t &&lambda) const {
MinInternalEnergyIsNotEnabled("JWL");
return 0.0;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real JWL::EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Indexer_t &&lambda) const {
EntropyIsNotEnabled("JWL");
Expand Down
9 changes: 0 additions & 9 deletions singularity-eos/eos/eos_mgusup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class MGUsup : public EosBase<MGUsup> {
const Real rho, const Real sie,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temp,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
Expand Down Expand Up @@ -336,12 +333,6 @@ PORTABLE_INLINE_FUNCTION Real MGUsup::PressureFromDensityInternalEnergy(
return value;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
MGUsup::MinInternalEnergyFromDensity(const Real rho, Indexer_t &&lambda) const {
MinInternalEnergyIsNotEnabled("MGUsup");
return 0.0;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real MGUsup::EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Indexer_t &&lambda) const {
Real eta = 1.0 - robust::ratio(_rho0, rho);
Expand Down
1 change: 0 additions & 1 deletion singularity-eos/eos/eos_noble_abel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class NobleAbel : public EosBase<NobleAbel> {
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const {
return _qq;
}

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temperature,
Expand Down
9 changes: 0 additions & 9 deletions singularity-eos/eos/eos_powermg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ class PowerMG : public EosBase<PowerMG> {
const Real rho, const Real sie,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temp,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
Expand Down Expand Up @@ -428,12 +425,6 @@ PORTABLE_INLINE_FUNCTION Real PowerMG::PressureFromDensityInternalEnergy(
return value;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
PowerMG::MinInternalEnergyFromDensity(const Real rho, Indexer_t &&lambda) const {
MinInternalEnergyIsNotEnabled("PowerMG");
return 0.0;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real PowerMG::EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Indexer_t &&lambda) const {
const Real eta = 1.0 - robust::ratio(_rho0, rho);
Expand Down
7 changes: 0 additions & 7 deletions singularity-eos/eos/eos_sap_polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ class SAP_Polynomial : public EosBase<SAP_Polynomial> {
sie * (_b0 + _b1 * mu + _b2e * mu * mu + _b3 * mu * mu * mu);
}

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const {
MinInternalEnergyIsNotEnabled("SAP Polynomial");
return 0.0;
};

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temperature,
Expand Down
7 changes: 0 additions & 7 deletions singularity-eos/eos/eos_stiff.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ class StiffGas : public EosBase<StiffGas> {
return std::max(-_Pinf, _gm1 * rho * (sie - _qq) - (_gm1 + 1.0) * _Pinf);
}

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const {
MinInternalEnergyIsNotEnabled("StiffGas");
return 0.0;
};

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
EntropyFromDensityTemperature(const Real rho, const Real temperature,
Expand Down
9 changes: 0 additions & 9 deletions singularity-eos/eos/eos_vinet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ class Vinet : public EosBase<Vinet> {
PORTABLE_INLINE_FUNCTION Real PressureFromDensityInternalEnergy(
const Real rho, const Real sie,
Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real MinInternalEnergyFromDensity(
const Real rho, Indexer_t &&lambda = static_cast<Real *>(nullptr)) const;
// Entropy added AEM Dec. 2022
template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION Real
Expand Down Expand Up @@ -359,12 +356,6 @@ PORTABLE_INLINE_FUNCTION Real Vinet::PressureFromDensityInternalEnergy(
return output[1];
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real
Vinet::MinInternalEnergyFromDensity(const Real rho, Indexer_t &&lambda) const {
MinInternalEnergyIsNotEnabled("Vinet");
return 0.0;
}
template <typename Indexer_t>
PORTABLE_INLINE_FUNCTION Real Vinet::EntropyFromDensityInternalEnergy(
const Real rho, const Real sie, Indexer_t &&lambda) const {
Real temp;
Expand Down
Loading