feat(libmeanfield): variadic refactor

also added normaliztion operator
This commit is contained in:
2026-09-06 10:15:00 -04:00
parent 71423d543f
commit 76818f2f82
63 changed files with 28794 additions and 1119 deletions

View File

@@ -0,0 +1,61 @@
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 &parameters) {
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