62 lines
2.6 KiB
C++
62 lines
2.6 KiB
C++
module;
|
|
|
|
#include <array>
|
|
#include <utility>
|
|
|
|
export module mean_field_extension_example.rotating_stellar_model;
|
|
|
|
export import mean_field_extension_example.ideal_gas_radiation;
|
|
import mean_field;
|
|
|
|
/*
|
|
* This file is the physics-facing composition layer. It contains no block
|
|
* matrices, generated residual types, Jacobian indices, or preconditioner
|
|
* plumbing. StellarModel infers those structural types from the four
|
|
* physical specifications passed to it.
|
|
*/
|
|
export namespace mean_field::extension_example {
|
|
struct RotatingStellarModelParameters final {
|
|
IdealGasRadiation::Parameters equationOfState;
|
|
mean_field::dimensions::PressureValue surfacePressure;
|
|
mean_field::dimensions::MassValue totalMass;
|
|
mean_field::dimensions::AngularMomentumValue totalAngularMomentum;
|
|
std::array<double, 3> rotationAxis{0.0, 0.0, 1.0};
|
|
std::array<double, 3> rotationCenter{0.0, 0.0, 0.0};
|
|
};
|
|
|
|
[[nodiscard]] auto makeRotatingStellarModel(const RotatingStellarModelParameters ¶meters) {
|
|
return mean_field::model::StellarModel(
|
|
IdealGasRadiation(parameters.equationOfState),
|
|
mean_field::surface::Isobaric({.Psurf = parameters.surfacePressure}),
|
|
mean_field::integral::FixedTotalMass({.Mtotal = parameters.totalMass}),
|
|
mean_field::integral::FixedAngularMomentum({
|
|
.Jtotal = parameters.totalAngularMomentum,
|
|
.axis = parameters.rotationAxis,
|
|
.center = parameters.rotationCenter
|
|
})
|
|
);
|
|
}
|
|
|
|
using RotatingStellarModel = decltype(
|
|
makeRotatingStellarModel(std::declval<const RotatingStellarModelParameters &>())
|
|
);
|
|
|
|
static_assert(mean_field::model::StellarModelType<RotatingStellarModel>);
|
|
static_assert(RotatingStellarModel::symbolicallySquare);
|
|
|
|
/*
|
|
* Deliberate capability boundary:
|
|
*
|
|
* The specification above is a valid, strongly typed stellar model. The
|
|
* current numerical equilibrium core, however, closes density through a
|
|
* barotropic relation rho(h). This EOS instead needs an independent
|
|
* temperature or entropy field and its governing equation. Keeping this
|
|
* assertion false prevents an example from suggesting that discretize()
|
|
* already implements thermal equilibrium when it does not.
|
|
*/
|
|
inline constexpr bool currentEquilibriumBackendSupportsIdealGasRadiation =
|
|
mean_field::equilibrium::StellarEquilibriumModel<RotatingStellarModel>;
|
|
|
|
static_assert(!currentEquilibriumBackendSupportsIdealGasRadiation);
|
|
} // namespace mean_field::extension_example
|