#include #include #include import mean_field; import mean_field_extension_example.rotating_stellar_model; TEST_CASE("The example EOS composes with existing stellar specifications", "[extension-example][model][type]") { using namespace mean_field; namespace example = mean_field::extension_example; const auto stellarModel = example::makeRotatingStellarModel({ .equationOfState = { .meanMolecularWeight = 0.62, .boltzmannConstant = 1.380649e-16, .atomicMassUnit = 1.66053906660e-24, .radiationConstant = 7.5657e-15 }, .surfacePressure = dimensions::PressureValue{0.0}, .totalMass = dimensions::MassValue{1.75}, .totalAngularMomentum = dimensions::AngularMomentumValue{0.3}, .rotationAxis = {0.0, 0.0, 4.0}, .rotationCenter = {0.1, -0.2, 0.3} }); using Model = std::remove_cvref_t; STATIC_CHECK(std::same_as); STATIC_CHECK(model::StellarModelType); STATIC_CHECK(Model::symbolicallySquare); STATIC_CHECK(Model::specificationCount == 4); STATIC_CHECK(std::same_as, example::IdealGasRadiation>); STATIC_CHECK(Model::template containsSpecification); STATIC_CHECK(Model::template containsSpecification); STATIC_CHECK(Model::template specificationRoleCount == 1); STATIC_CHECK(Model::template specificationRoleCount == 1); STATIC_CHECK(Model::template specificationRoleCount == 2); CHECK(stellarModel.equationOfState().parameters().meanMolecularWeight == 0.62); CHECK(stellarModel.surfaceCondition().targetPressure() == dimensions::PressureValue{0.0}); CHECK(stellarModel.specification().targetMass() == dimensions::MassValue{1.75}); const auto &angularMomentum = stellarModel.specification(); CHECK(angularMomentum.targetAngularMomentum() == dimensions::AngularMomentumValue{0.3}); CHECK(angularMomentum.axis()[0] == 0.0); CHECK(angularMomentum.axis()[1] == 0.0); CHECK(angularMomentum.axis()[2] == 1.0); CHECK(angularMomentum.center()[0] == 0.1); CHECK(angularMomentum.center()[1] == -0.2); CHECK(angularMomentum.center()[2] == 0.3); CHECK(stellarModel.runtimeSpecificationDescriptors().size() == 4); } TEST_CASE("The example states the current thermal-runtime boundary explicitly", "[extension-example][model][capability]") { using Model = mean_field::extension_example::RotatingStellarModel; /* * This is not a failure of model composition. It is the intended * compile-time rejection of a thermal EOS by a currently barotropic * numerical core. See the manual section 'What compiles today'. */ STATIC_CHECK(mean_field::model::StellarModelType); STATIC_CHECK_FALSE(mean_field::extension_example::currentEquilibriumBackendSupportsIdealGasRadiation); STATIC_CHECK_FALSE(mean_field::equilibrium::StellarEquilibriumModel); }