feat(equations): Loads of simple getters

The continuation and snapshotting systems needed more getters in order to reliably serialize a model. Added those getters
This commit is contained in:
2026-10-14 11:16:29 -04:00
parent f353deef57
commit 9a7e4a7112
8 changed files with 54 additions and 1 deletions

View File

@@ -201,6 +201,9 @@ namespace serif::equations
serif_ensure<SERiFErrorCode::INVALID_ARGUMENT, std::domain_error>(std::isfinite(axial_moment_of_inertia) && axial_moment_of_inertia >= 0.0, "The moment of inertia must be finite and nonnegative.");
}
/** @brief Inspect the physical rotation axis and origin. */
[[nodiscard]] const RigidRotation& rotation() const noexcept { return m_unit_rotation; }
private:
double m_target_axial_angular_momentum; ///< The prescribed total angular momentum along the rotation axis, \f$ J_{\text{target}} \geq 0 \f$.
RigidRotation m_unit_rotation; ///< The unit rotation, storing the normalized axis and its origin, used to compute \f$s^{2}\f$ and its gradient.

View File

@@ -7,7 +7,7 @@
* @brief File containing the EquationScale and EquationSum templates, which allow for scaling and summing equations.
*
* The astute observer will notice that none of the code in this file or indeed in in any part of the equations module actually implements summation or scaled
* addition more generally. Rather, the code to manage that is implemented in the operator/backend/mfem module. Effectively these
* addition more generally. Rather, the code to manage that is implemented in the backend/mfem/operators module. Effectively these
* templates are compile time tags telling that system how to combine weak contributions. The reason for this comes down to we dont really want to sum
* at the point wise level; rather, we generally want to sum already integrated contributions. Since equations, by design, do not know any details about
* the global system they are unable to manage this themselves.

View File

@@ -162,6 +162,12 @@ namespace serif::equations {
return 0;
}
/** @brief Inspect the immutable EOS defining this closure. */
[[nodiscard]] const EOST& equation_of_state() const noexcept { return m_eos; }
/** @brief Inspect the declared power used to choose quadrature. */
[[nodiscard]] double enthalpy_power() const noexcept { return m_enthalpy_power; }
private:
EOST m_eos; ///< The equation of state to use for the barotropic closure. (@todo should this be a reference?)
double m_enthalpy_power; ///< The power of the enthalpy to use for the quadrature. Must be positive and finite. This is only used if the ::additional_order method is called.

View File

@@ -123,6 +123,9 @@ namespace serif::equations {
return eos::evaluate<dimensions::MassDensity>(m_eos, enthalpy);
}
/** @brief Inspect the EOS defining the target central enthalpy. */
[[nodiscard]] const EOST& equation_of_state() const noexcept { return m_eos; }
private:
EOST m_eos; ///< The EOS model to use for evaluating the enthalpy from the prescribed density.
dimensions::DensityValue m_target_density; ///< The prescribed central density, which must be finite and strictly positive.

View File

@@ -0,0 +1,29 @@
#pragma once
/**
* @file equations.hpp
* @author Emily M. Boudreaux
*
* @brief File containing the equations module. This module contains the equations used in the SERiF framework.
*/
//TODO: Add a detailed worked example here
namespace serif::equations {}
#include "serif/equations/angular_momentum.hpp"
#include "serif/equations/arithmetic.hpp"
#include "serif/equations/barotropic_closure.hpp"
#include "serif/equations/centering.hpp"
#include "serif/equations/central_density.hpp"
#include "serif/equations/concepts.hpp"
#include "serif/equations/contributions.hpp"
#include "serif/equations/displacement_force.hpp"
#include "serif/equations/gravity_force.hpp"
#include "serif/equations/hydrostatic_equilibrium.hpp"
#include "serif/equations/mass_normalization.hpp"
#include "serif/equations/mixed_gravity.hpp"
#include "serif/equations/point.hpp"
#include "serif/equations/pressure_force.hpp"
#include "serif/equations/registry.hpp"
#include "serif/equations/rigid_rotation.hpp"
#include "serif/equations/rotational_force.hpp"

View File

@@ -184,6 +184,9 @@ namespace serif::equations {
}
}
/** @brief Inspect the physical rotation axis and origin. */
[[nodiscard]] const RigidRotation& rotation() const noexcept { return m_rotation; }
private:
RigidRotation m_rotation; ///< The rigid rotation object used to compute the centrifugal potential and its gradient. This is constructed from the axis and center of rotation provided to the constructor.
};

View File

@@ -147,6 +147,12 @@ namespace serif::equations {
return static_cast<int>(extra);
}
/** @brief Inspect the immutable EOS defining pressure. */
[[nodiscard]] const EOST& equation_of_state() const noexcept { return m_eos; }
/** @brief Inspect the declared power used to choose quadrature. */
[[nodiscard]] double enthalpy_power() const noexcept { return m_enthalpy_power; }
private:
EOST m_eos; ///< The EOS model to use for evaluating the pressure from the specific enthalpy.
double m_enthalpy_power; ///< The effective power of the pressure as a function of specific enthalpy, which must be positive and finite. This is used for quadrature selection.

View File

@@ -108,6 +108,9 @@ namespace serif::equations {
return Density::FunctionalSpace::order + position_order;
}
/** @brief Inspect the physical rotation axis and origin. */
[[nodiscard]] const RigidRotation& rotation() const noexcept { return m_rotation; }
private:
RigidRotation m_rotation; ///< The rigid rotation object used to compute the centrifugal potential and its derivatives, which is constructed from the axis and center of rotation provided to the constructor.
};