From 48bc7d54726cd3772f8ab5fec23deff66adcc25e Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 2 Nov 2026 10:06:47 -0500 Subject: [PATCH] feat(dimensions): added second partial type and new dimensions --- src/include/serif/dimensions/dimensions.hpp | 34 ++++++++++++++++++++- src/include/serif/dimensions/partial.hpp | 18 ++++++++++- src/include/serif/dimensions/type_alias.hpp | 3 +- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/include/serif/dimensions/dimensions.hpp b/src/include/serif/dimensions/dimensions.hpp index 060251a1..ccb804b5 100644 --- a/src/include/serif/dimensions/dimensions.hpp +++ b/src/include/serif/dimensions/dimensions.hpp @@ -64,6 +64,28 @@ namespace serif::dimensions { static constexpr std::string_view identifier = "inverse_time_squared"; }; + /** + * @brief Mass density divided by time, + */ + struct MassDensityRate final : PhysicalQuantity { + static constexpr std::string_view identifier = "mass_density_rate"; + }; + + /** + * @brief Force per unit volume + */ + struct ForceDensity final : PhysicalQuantity { + static constexpr std::string_view identifier = "force_density"; + }; + + /** + * @brief Pressure divided by length squared + */ + struct PressureLaplacian final : PhysicalQuantity + { + static constexpr std::string_view identifier = "pressure_laplacian"; + }; + /** * @struct GravitationalConstant * @@ -200,6 +222,11 @@ namespace serif::dimensions { static constexpr std::string_view identifier = "specific_enthalpy"; }; + /** @brief The barotropic pressure primitive A with dA/density = (dP/density)/density. */ + struct BarotropicPressurePotential final : ThermodynamicQuantity { + static constexpr std::string_view identifier = "barotropic_pressure_potential"; + }; + /** * @struct EnergyDensity * @@ -254,6 +281,11 @@ namespace serif::dimensions { static constexpr std::string_view identifier = "angular_velocity"; }; + /** @brief Angular acceleration, distinct from angular velocity despite sharing its chosen axis. */ + struct AngularAcceleration final : PhysicalQuantity { + static constexpr std::string_view identifier = "angular_acceleration"; + }; + /** * @struct Momentum * @@ -364,4 +396,4 @@ namespace serif::dimensions { struct MagneticFluxDensity final : PhysicalQuantity { static constexpr std::string_view identifier = "magnetic_flux_density"; }; -} \ No newline at end of file +} diff --git a/src/include/serif/dimensions/partial.hpp b/src/include/serif/dimensions/partial.hpp index ffff99b6..5acf9bce 100644 --- a/src/include/serif/dimensions/partial.hpp +++ b/src/include/serif/dimensions/partial.hpp @@ -27,6 +27,22 @@ namespace serif::dimensions { template struct WithRespectTo final {}; + /** @brief + * A second EOS partial retains both differentiation quantities in its type. + */ + template + class SecondPartialDerivative final { + public: + /** @brief Store an explicitly evaluated second partial; this type does not differentiate. */ + explicit constexpr SecondPartialDerivative(double value) noexcept : m_value(value) {} + + /** @brief Return the numeric partial in the caller's physical units. */ + [[nodiscard]] constexpr double value() const noexcept { return m_value; } + + private: + double m_value; + }; + /** * @class PartialDerivative * @@ -188,4 +204,4 @@ namespace serif::dimensions { private: double m_value; ///< Numeric value associated with the partial. If this is known at compile time then the compiler can optimize operations with partial.value() to be equivalent to compile time double operations. }; -} \ No newline at end of file +} diff --git a/src/include/serif/dimensions/type_alias.hpp b/src/include/serif/dimensions/type_alias.hpp index 6e588b41..caa6ef83 100644 --- a/src/include/serif/dimensions/type_alias.hpp +++ b/src/include/serif/dimensions/type_alias.hpp @@ -30,6 +30,7 @@ namespace serif::dimensions { using SpecificEnergyValue = QuantityValue; ///< A quantity representing specific energy. using SpecificInternalEnergyValue = QuantityValue; ///< A quantity representing specific internal energy. using SpecificEnthalpyValue = QuantityValue; ///< A quantity representing specific enthalpy. + using BarotropicPressurePotentialValue = QuantityValue; ///< A barotropic pressure primitive with specific energy units. using EnergyDensityValue = QuantityValue; ///< A quantity representing energy density. using GravitationalPotentialValue = QuantityValue; ///< A quantity representing gravitational potential. using VelocityValue = QuantityValue; ///< A quantity representing velocity. @@ -48,4 +49,4 @@ namespace serif::dimensions { using DynamicViscosityValue = QuantityValue; ///< A quantity representing dynamic viscosity. using KinematicViscosityValue = QuantityValue; ///< A quantity representing kinematic viscosity. using MagneticFluxDensityValue = QuantityValue; ///< A quantity representing magnetic flux density. -} \ No newline at end of file +}