#include import mean_field; import test_helpers; namespace { namespace eos = mean_field::eos; class DensityClosureEquationOfState final { public: using Relations = eos::RelationCatalog; [[nodiscard]] constexpr eos::DensityValue evaluate( eos::DensityFromSpecificEnthalpy, const eos::SpecificEnthalpyValue specificEnthalpy ) const noexcept { return eos::DensityValue{specificEnthalpy.value()}; } [[nodiscard]] constexpr eos::PartialDerivative< eos::quantity::Density, eos::quantity::SpecificEnthalpy> partialDerivative( eos::DensityFromSpecificEnthalpy, eos::WithRespectTo, eos::SpecificEnthalpyValue ) const noexcept { return eos::PartialDerivative{1.0}; } }; class DensityClosureWithoutDerivative final { public: using Relations = eos::RelationCatalog; [[nodiscard]] constexpr eos::DensityValue evaluate( eos::DensityFromSpecificEnthalpy, const eos::SpecificEnthalpyValue specificEnthalpy ) const noexcept { return eos::DensityValue{specificEnthalpy.value()}; } }; class EnthalpyPressureEquationOfState final { public: using Relations = eos::RelationCatalog; [[nodiscard]] constexpr eos::PressureValue evaluate( eos::PressureFromSpecificEnthalpy, const eos::SpecificEnthalpyValue specificEnthalpy ) const noexcept { return eos::PressureValue{2.0 * specificEnthalpy.value()}; } [[nodiscard]] constexpr eos::PartialDerivative< eos::quantity::Pressure, eos::quantity::SpecificEnthalpy> partialDerivative( eos::PressureFromSpecificEnthalpy, eos::WithRespectTo, eos::SpecificEnthalpyValue ) const noexcept { return eos::PartialDerivative{2.0}; } }; class DensitySeedEquationOfState final { public: using Relations = eos::RelationCatalog; [[nodiscard]] constexpr eos::SpecificEnthalpyValue evaluate( eos::SpecificEnthalpyFromDensity, const eos::DensityValue density ) const noexcept { return eos::SpecificEnthalpyValue{3.0 * density.value()}; } }; class GeneralEquationOfStateWithoutCurrentConsumerRelations final { public: using Relations = eos::RelationCatalog; [[nodiscard]] constexpr eos::SpecificEnthalpyValue evaluate( eos::SpecificEnthalpyFromPressure, const eos::PressureValue pressure ) const noexcept { return eos::SpecificEnthalpyValue{pressure.value()}; } }; } // namespace TEST_CASE( "Barotropic Closure EOS Requires Density And Its Enthalpy Derivative", tags::barotropic_closure_equation_of_state_contract ) { STATIC_CHECK(eos::BarotropicClosureEquationOfState); STATIC_CHECK(eos::BarotropicClosureEquationOfState); STATIC_CHECK(eos::EquationOfStateModel); STATIC_CHECK_FALSE(eos::BarotropicClosureEquationOfState); STATIC_CHECK_FALSE(eos::BarotropicClosureEquationOfState); } TEST_CASE( "Pressure Force EOS Requires Pressure And Its Enthalpy Derivative", tags::pressure_force_equation_of_state_contract ) { STATIC_CHECK(eos::PressureForceEquationOfState); STATIC_CHECK(eos::PressureForceEquationOfState); STATIC_CHECK_FALSE(eos::PressureForceEquationOfState); STATIC_CHECK_FALSE(eos::PressureForceEquationOfState); } TEST_CASE( "Structure Seed EOS Requires Enthalpy From Density", tags::structure_seed_equation_of_state_contract ) { STATIC_CHECK(eos::StructureSeedEquationOfState); STATIC_CHECK(eos::StructureSeedEquationOfState); STATIC_CHECK_FALSE(eos::StructureSeedEquationOfState); STATIC_CHECK(eos::EquationOfStateModel); STATIC_CHECK_FALSE(eos::StructureSeedEquationOfState); STATIC_CHECK_FALSE(eos::BarotropicClosureEquationOfState); STATIC_CHECK_FALSE(eos::PressureForceEquationOfState); }