feat(dimensions): added second partial type and new dimensions

This commit is contained in:
2026-11-02 10:06:47 -05:00
parent 9a7e4a7112
commit 48bc7d5472
3 changed files with 52 additions and 3 deletions

View File

@@ -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";
};
}
}

View File

@@ -27,6 +27,22 @@ namespace serif::dimensions {
template <ThermodynamicQuantityType Quantity>
struct WithRespectTo final {};
/** @brief
* A second EOS partial retains both differentiation quantities in its type.
*/
template <ThermodynamicQuantityType OutputQuantity, ThermodynamicQuantityType FirstInput, ThermodynamicQuantityType SecondInput>
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.
};
}
}

View File

@@ -30,6 +30,7 @@ namespace serif::dimensions {
using SpecificEnergyValue = QuantityValue<SpecificEnergy>; ///< A quantity representing specific energy.
using SpecificInternalEnergyValue = QuantityValue<SpecificInternalEnergy>; ///< A quantity representing specific internal energy.
using SpecificEnthalpyValue = QuantityValue<SpecificEnthalpy>; ///< A quantity representing specific enthalpy.
using BarotropicPressurePotentialValue = QuantityValue<BarotropicPressurePotential>; ///< A barotropic pressure primitive with specific energy units.
using EnergyDensityValue = QuantityValue<EnergyDensity>; ///< A quantity representing energy density.
using GravitationalPotentialValue = QuantityValue<GravitationalPotential>; ///< A quantity representing gravitational potential.
using VelocityValue = QuantityValue<Velocity>; ///< A quantity representing velocity.
@@ -48,4 +49,4 @@ namespace serif::dimensions {
using DynamicViscosityValue = QuantityValue<DynamicViscosity>; ///< A quantity representing dynamic viscosity.
using KinematicViscosityValue = QuantityValue<KinematicViscosity>; ///< A quantity representing kinematic viscosity.
using MagneticFluxDensityValue = QuantityValue<MagneticFluxDensity>; ///< A quantity representing magnetic flux density.
}
}