feat(field-support): added field support system, mid migration

currently the barotope and the pressure force operator are migrated to the new support system
This commit is contained in:
2026-08-23 10:13:53 -04:00
parent dc912fd15e
commit 0f3ca8050b
137 changed files with 29975 additions and 16389 deletions

View File

@@ -0,0 +1,68 @@
module;
#include <vector>
#include <mfem.hpp>
export module mean_field:model.structure.polytropic;
export import :eos.polytrope;
export import :model.structure.base;
import :utils.misc;
export namespace mean_field::models::structure {
class PolytropicStructure final : public StructureBase {
public:
explicit PolytropicStructure(
eos::Polytrope equationOfState,
double targetMass
);
[[nodiscard]] const eos::EquationOfState &equationOfState() const noexcept override;
[[nodiscard]] double targetMass() const noexcept override;
[[nodiscard]] StructureSeed makeInitialSeed(const StructureSeedRequest &request) const override;
void validate() const override;
private:
struct LaneEmdenPoint {
double coordinate{0.0};
double value{0.0};
double derivative{0.0};
};
struct LaneEmdenDerivative {
double value{0.0};
double derivative{0.0};
};
static void validateSeedRequest(const StructureSeedRequest &request);
[[nodiscard]] static LaneEmdenDerivative evaluateLaneEmdenRhs(
double coordinate,
double value,
double derivative,
double polytropicIndex
);
[[nodiscard]] static LaneEmdenPoint takeLaneEmdenStep(
const LaneEmdenPoint &point,
double step,
double polytropicIndex
);
[[nodiscard]] static std::vector<LaneEmdenPoint> solveLaneEmden(double polytropicIndex);
[[nodiscard]] static double interpolateLaneEmdenValue(
const std::vector<LaneEmdenPoint> &solution,
double coordinate,
std::size_t &lowerIndex
);
eos::Polytrope m_equationOfState;
double m_targetMass;
};
} // namespace mean_field::models::structure