Skip to content

Commit

Permalink
Merge branch 'main' into jmm/pt-space-pte-solver
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Jan 9, 2025
2 parents 9002ac4 + 3f78b83 commit 47445a4
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 47 deletions.
17 changes: 6 additions & 11 deletions doc/sphinx/src/using-eos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1178,11 +1178,11 @@ temperature. The function
provides the minimum pressure an equation of state supports, which may
be the most negative tension state. The function

.. cpp:function:: Real MaximumPressureFromTemperature() const;
.. cpp:function:: Real MaximumPressureAtTemperature(const Real temp) const;

provides a maximum possible pressure an equation of state
supports. (Most models are unbounded in pressure.) This is again
useful for root finds.
provides a maximum possible pressure an equation of state supports at
a given temperature. (Most models are unbounded in pressure.) This is
again useful for root finds.

The function

Expand All @@ -1194,13 +1194,8 @@ The function
is designed for working in Pressure-Temperature space. Given a
pressure ``press`` and temperature ``temp``, it sets a density ``rho``
and specific internal energy ``sie``.

.. note::

Note that ``lambda`` must be passed in, whether or not a given
equation of state requires one. You may pass in ``nullptr`` safely,
however.
and specific internal energy ``sie``. The ``lambda`` is optional and
defaults to a ``nullptr``.

Typically this operation requires a root find. You may pass in an
initial guess for the density ``rho`` in-place and most EOS models
Expand Down
12 changes: 9 additions & 3 deletions singularity-eos/eos/eos_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,9 +799,7 @@ class EosBase {
Real MinimumPressure() const { return 0; }
// Gruneisen EOS's often have a maximum density, which implies a maximum pressure.
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature([[maybe_unused]] const Real T) const {
return 1e100;
}
Real MaximumPressureAtTemperature([[maybe_unused]] const Real T) const { return 1e100; }

PORTABLE_INLINE_FUNCTION
Real RhoPmin(const Real temp) const { return 0.0; }
Expand Down Expand Up @@ -901,6 +899,14 @@ class EosBase {
sie = copy.InternalEnergyFromDensityTemperature(rho, temp, lambda);
return;
}
PORTABLE_INLINE_FUNCTION void DensityEnergyFromPressureTemperature(const Real press,
const Real temp,
Real &rho,
Real &sie) const {
CRTP copy = *(static_cast<CRTP const *>(this));
copy.DensityEnergyFromPressureTemperature(press, temp, static_cast<Real *>(nullptr),
rho, sie);
}

// Serialization
/*
Expand Down
2 changes: 1 addition & 1 deletion singularity-eos/eos/eos_gruneisen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Gruneisen : public EosBase<Gruneisen> {
PORTABLE_FORCEINLINE_FUNCTION
Real MinimumPressure() const { return PressureFromDensityInternalEnergy(0, 0); }
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature(const Real T) const {
Real MaximumPressureAtTemperature(const Real T) const {
return MaxStableDensityAtTemperature(T);
}

Expand Down
4 changes: 1 addition & 3 deletions singularity-eos/eos/eos_mgusup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ class MGUsup : public EosBase<MGUsup> {
PORTABLE_FORCEINLINE_FUNCTION
Real MinimumPressure() const { return -1e100; }
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature([[maybe_unused]] const Real T) const {
return 1e100;
}
Real MaximumPressureAtTemperature([[maybe_unused]] const Real T) const { return 1e100; }

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION void
Expand Down
4 changes: 1 addition & 3 deletions singularity-eos/eos/eos_powermg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ class PowerMG : public EosBase<PowerMG> {
PORTABLE_FORCEINLINE_FUNCTION
Real MinimumPressure() const { return -1e100; }
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature([[maybe_unused]] const Real T) const {
return 1e100;
}
Real MaximumPressureAtTemperature([[maybe_unused]] const Real T) const { return 1e100; }

inline void Finalize() {}
static std::string EosType() { return std::string("PowerMG"); }
Expand Down
4 changes: 1 addition & 3 deletions singularity-eos/eos/eos_sap_polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ class SAP_Polynomial : public EosBase<SAP_Polynomial> {
PORTABLE_FORCEINLINE_FUNCTION
Real MinimumPressure() const { return -1e100; }
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature([[maybe_unused]] const Real T) const {
return 1e100;
}
Real MaximumPressureAtTemperature([[maybe_unused]] const Real T) const { return 1e100; }

template <typename Indexer_t = Real *>
PORTABLE_INLINE_FUNCTION void
Expand Down
14 changes: 12 additions & 2 deletions singularity-eos/eos/eos_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ class Variant {
},
eos_);
}
PORTABLE_INLINE_FUNCTION void DensityEnergyFromPressureTemperature(const Real press,
const Real temp,
Real &rho,
Real &sie) const {
return mpark::visit(
[&press, &temp, &rho, &sie](const auto &eos) {
return eos.DensityEnergyFromPressureTemperature(press, temp, rho, sie);
},
eos_);
}

PORTABLE_INLINE_FUNCTION
Real RhoPmin(const Real temp) const {
Expand Down Expand Up @@ -344,9 +354,9 @@ class Variant {
}

PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature(const Real temp) const {
Real MaximumPressureAtTemperature(const Real temp) const {
return mpark::visit(
[&temp](const auto &eos) { return eos.MaximumPressureFromTemperature(temp); },
[&temp](const auto &eos) { return eos.MaximumPressureAtTemperature(temp); },
eos_);
}

Expand Down
4 changes: 1 addition & 3 deletions singularity-eos/eos/eos_vinet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ class Vinet : public EosBase<Vinet> {
PORTABLE_FORCEINLINE_FUNCTION
Real MinimumPressure() const { return -1e100; }
PORTABLE_FORCEINLINE_FUNCTION
Real MaximumPressureFromTemperature([[maybe_unused]] const Real T) const {
return 1e100;
}
Real MaximumPressureAtTemperature([[maybe_unused]] const Real T) const { return 1e100; }

// Generic functions provided by the base class. These contain e.g. the vector
// overloads that use the scalar versions declared here
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/eos_unitsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,8 @@ class UnitSystem : public EosBase<UnitSystem<T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return inv_press_unit_ * t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return inv_press_unit_ * t_.MaximumPressureFromTemperature(temp_unit_ * temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return inv_press_unit_ * t_.MaximumPressureAtTemperature(temp_unit_ * temp);
}

template <typename Indexer_t = Real *>
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/ramps_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,8 @@ class BilinearRampEOS : public EosBase<BilinearRampEOS<T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return t_.MaximumPressureFromTemperature(temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return t_.MaximumPressureAtTemperature(temp);
}

template <typename Indexer_t = Real *>
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/relativistic_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ class RelativisticEOS : public EosBase<RelativisticEOS<T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return t_.MaximumPressureFromTemperature(temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return t_.MaximumPressureAtTemperature(temp);
}

static constexpr unsigned long PreferredInput() { return T::PreferredInput(); }
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/scaled_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,8 @@ class ScaledEOS : public EosBase<ScaledEOS<T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return t_.MaximumPressureFromTemperature(temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return t_.MaximumPressureAtTemperature(temp);
}

PORTABLE_INLINE_FUNCTION
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/shifted_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,8 @@ class ShiftedEOS : public EosBase<ShiftedEOS<T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return t_.MaximumPressureFromTemperature(temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return t_.MaximumPressureAtTemperature(temp);
}

template <typename Indexer_t = Real *>
Expand Down
5 changes: 2 additions & 3 deletions singularity-eos/eos/modifiers/zsplit_eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,8 @@ class ZSplit : public EosBase<ZSplit<ztype, T>> {
PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const {
return t_.MinimumPressure();
}
PORTABLE_FORCEINLINE_FUNCTION Real
MaximumPressureFromTemperature(const Real temp) const {
return t_.MaximumPressureFromTemperature(temp);
PORTABLE_FORCEINLINE_FUNCTION Real MaximumPressureAtTemperature(const Real temp) const {
return t_.MaximumPressureAtTemperature(temp);
}

template <typename Indexer_t = Real *>
Expand Down

0 comments on commit 47445a4

Please sign in to comment.