feat(surface): surface deformation prescriptions
restricted the unknown state vector to surface deformation and implemented one prescription, NodalRadialSurface, while the full volumetric displacment field is reconstructed analytically from that. This reduced the number of degrees of freedom in the system by a factor of 80 while also removing many null vectors from the system.
This commit is contained in:
@@ -5,8 +5,11 @@ module;
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <mfem.hpp>
|
||||
|
||||
export module mean_field:model.stellar;
|
||||
|
||||
export import :deformation.domain_deformation;
|
||||
export import :eos.runtime;
|
||||
export import :model.structure.base;
|
||||
export import :surface.compiler;
|
||||
@@ -35,38 +38,85 @@ export namespace mean_field::models {
|
||||
std::remove_cvref_t<decltype(std::declval<const std::remove_cvref_t<Candidate> &>().equationOfState())>;
|
||||
|
||||
template <typename Candidate, typename EquationOfState>
|
||||
concept SurfacePrescription =
|
||||
concept SurfaceCondition =
|
||||
surface::ConstantPressureSurfaceType<Candidate> &&
|
||||
surface::PressureSurfaceCompilable<surface::BarotropicSurfaceFormulation, std::remove_cvref_t<EquationOfState>>;
|
||||
|
||||
template <StructurePrescription Structure>
|
||||
requires SurfacePrescription<surface::ConstantPressureSurface, StructureEquationOfStateT<Structure>>
|
||||
template <
|
||||
StructurePrescription Structure,
|
||||
deformation::SurfaceDeformationPrescription SurfaceDeformation = deformation::NodalRadialSurface,
|
||||
deformation::InteriorDeformationExtension StellarInteriorDeformation =
|
||||
deformation::PowerLawRadialInteriorExtension,
|
||||
deformation::VacuumDeformationExtension VacuumDeformation = deformation::FixedInfinityRadialVacuumExtension>
|
||||
requires SurfaceCondition<surface::ConstantPressureSurface, StructureEquationOfStateT<Structure>>
|
||||
class StellarModel final {
|
||||
public:
|
||||
using StructurePrescriptionType = Structure;
|
||||
using SurfacePrescriptionType = surface::ConstantPressureSurface;
|
||||
using EquationOfStateType = StructureEquationOfStateT<Structure>;
|
||||
using StructurePrescriptionType = Structure;
|
||||
using SurfaceConditionType = surface::ConstantPressureSurface;
|
||||
using SurfaceDeformationPrescriptionType = SurfaceDeformation;
|
||||
using StellarInteriorDeformationExtensionType = StellarInteriorDeformation;
|
||||
using VacuumDeformationExtensionType = VacuumDeformation;
|
||||
using EquationOfStateType = StructureEquationOfStateT<Structure>;
|
||||
using SurfaceConstraintType =
|
||||
surface::CompiledPressureSurfaceConstraintT<surface::BarotropicSurfaceFormulation, EquationOfStateType>;
|
||||
|
||||
template <typename StructureArgument>
|
||||
requires std::same_as<
|
||||
std::remove_cvref_t<StructureArgument>,
|
||||
Structure>
|
||||
std::remove_cvref_t<StructureArgument>,
|
||||
Structure>
|
||||
explicit StellarModel(
|
||||
StructureArgument &&structurePrescription,
|
||||
const surface::ConstantPressureSurface surfacePrescription
|
||||
const surface::ConstantPressureSurface surfaceCondition
|
||||
)
|
||||
: StellarModel(
|
||||
std::forward<StructureArgument>(structurePrescription),
|
||||
surfaceCondition,
|
||||
deformation::NodalRadialSurface{defaultReferenceCenter()},
|
||||
deformation::PowerLawRadialInteriorExtension{},
|
||||
deformation::FixedInfinityRadialVacuumExtension{}
|
||||
) {
|
||||
}
|
||||
|
||||
template <
|
||||
typename StructureArgument,
|
||||
typename SurfaceDeformationArgument,
|
||||
typename StellarInteriorDeformationArgument,
|
||||
typename VacuumDeformationArgument>
|
||||
requires std::same_as<
|
||||
std::remove_cvref_t<StructureArgument>,
|
||||
Structure> &&
|
||||
std::same_as<
|
||||
std::remove_cvref_t<SurfaceDeformationArgument>,
|
||||
SurfaceDeformation> &&
|
||||
std::same_as<
|
||||
std::remove_cvref_t<StellarInteriorDeformationArgument>,
|
||||
StellarInteriorDeformation> &&
|
||||
std::same_as<
|
||||
std::remove_cvref_t<VacuumDeformationArgument>,
|
||||
VacuumDeformation>
|
||||
explicit StellarModel(
|
||||
StructureArgument &&structurePrescription,
|
||||
const surface::ConstantPressureSurface surfaceCondition,
|
||||
SurfaceDeformationArgument &&surfaceDeformation,
|
||||
StellarInteriorDeformationArgument &&stellarInteriorDeformation,
|
||||
VacuumDeformationArgument &&vacuumDeformation
|
||||
)
|
||||
: m_structurePrescription(
|
||||
std::make_unique<Structure>(std::forward<StructureArgument>(structurePrescription))
|
||||
),
|
||||
m_surfacePrescription(std::make_unique<surface::ConstantPressureSurface>(surfacePrescription)),
|
||||
m_compiledSurfaceConstraint(
|
||||
std::make_unique<SurfaceConstraintType>(validateAndCompileSurface(
|
||||
*m_structurePrescription,
|
||||
*m_surfacePrescription
|
||||
))
|
||||
) {
|
||||
m_surfaceCondition(std::make_unique<surface::ConstantPressureSurface>(surfaceCondition)),
|
||||
m_surfaceDeformation(
|
||||
std::make_unique<SurfaceDeformation>(std::forward<SurfaceDeformationArgument>(surfaceDeformation))
|
||||
),
|
||||
m_stellarInteriorDeformation(
|
||||
std::make_unique<StellarInteriorDeformation>(
|
||||
std::forward<StellarInteriorDeformationArgument>(stellarInteriorDeformation)
|
||||
)
|
||||
),
|
||||
m_vacuumDeformation(
|
||||
std::make_unique<VacuumDeformation>(std::forward<VacuumDeformationArgument>(vacuumDeformation))
|
||||
),
|
||||
m_compiledSurfaceConstraint(std::make_unique<SurfaceConstraintType>(validateAndCompileConfiguration())) {
|
||||
}
|
||||
|
||||
~StellarModel() = default;
|
||||
@@ -80,8 +130,20 @@ export namespace mean_field::models {
|
||||
return *m_structurePrescription;
|
||||
}
|
||||
|
||||
[[nodiscard]] const surface::ConstantPressureSurface &surfacePrescription() const noexcept {
|
||||
return *m_surfacePrescription;
|
||||
[[nodiscard]] const surface::ConstantPressureSurface &surfaceCondition() const noexcept {
|
||||
return *m_surfaceCondition;
|
||||
}
|
||||
|
||||
[[nodiscard]] const SurfaceDeformation &surfaceDeformationPrescription() const noexcept {
|
||||
return *m_surfaceDeformation;
|
||||
}
|
||||
|
||||
[[nodiscard]] const StellarInteriorDeformation &stellarInteriorDeformationExtension() const noexcept {
|
||||
return *m_stellarInteriorDeformation;
|
||||
}
|
||||
|
||||
[[nodiscard]] const VacuumDeformation &vacuumDeformationExtension() const noexcept {
|
||||
return *m_vacuumDeformation;
|
||||
}
|
||||
|
||||
[[nodiscard]] const EquationOfStateType &equationOfState() const noexcept {
|
||||
@@ -100,20 +162,36 @@ export namespace mean_field::models {
|
||||
return *m_compiledSurfaceConstraint;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto compileDomainDeformation(fem::FEM &finiteElementModel) const {
|
||||
return deformation::compileDomainDeformation(
|
||||
surfaceDeformationPrescription(), stellarInteriorDeformationExtension(), vacuumDeformationExtension(),
|
||||
finiteElementModel
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
[[nodiscard]] static SurfaceConstraintType validateAndCompileSurface(
|
||||
const Structure &structurePrescription,
|
||||
const surface::ConstantPressureSurface &surfacePrescription
|
||||
) {
|
||||
structurePrescription.validate();
|
||||
[[nodiscard]] static mfem::Vector defaultReferenceCenter() {
|
||||
mfem::Vector center(3);
|
||||
center = 0.0;
|
||||
return center;
|
||||
}
|
||||
|
||||
[[nodiscard]] SurfaceConstraintType validateAndCompileConfiguration() const {
|
||||
m_structurePrescription->validate();
|
||||
m_surfaceDeformation->validate();
|
||||
m_stellarInteriorDeformation->validate();
|
||||
m_vacuumDeformation->validate();
|
||||
|
||||
return surface::compilePressureSurfaceConstraint<surface::BarotropicSurfaceFormulation>(
|
||||
surfacePrescription, structurePrescription.equationOfState()
|
||||
*m_surfaceCondition, m_structurePrescription->equationOfState()
|
||||
);
|
||||
}
|
||||
|
||||
std::unique_ptr<Structure> m_structurePrescription;
|
||||
std::unique_ptr<surface::ConstantPressureSurface> m_surfacePrescription;
|
||||
std::unique_ptr<surface::ConstantPressureSurface> m_surfaceCondition;
|
||||
std::unique_ptr<SurfaceDeformation> m_surfaceDeformation;
|
||||
std::unique_ptr<StellarInteriorDeformation> m_stellarInteriorDeformation;
|
||||
std::unique_ptr<VacuumDeformation> m_vacuumDeformation;
|
||||
std::unique_ptr<SurfaceConstraintType> m_compiledSurfaceConstraint;
|
||||
};
|
||||
|
||||
@@ -121,12 +199,42 @@ export namespace mean_field::models {
|
||||
StellarModel(
|
||||
Structure &&,
|
||||
surface::ConstantPressureSurface
|
||||
) -> StellarModel<std::remove_cvref_t<Structure>>;
|
||||
)
|
||||
-> StellarModel<
|
||||
std::remove_cvref_t<Structure>,
|
||||
deformation::NodalRadialSurface,
|
||||
deformation::PowerLawRadialInteriorExtension,
|
||||
deformation::FixedInfinityRadialVacuumExtension>;
|
||||
|
||||
template <
|
||||
typename Structure,
|
||||
typename SurfaceDeformation,
|
||||
typename StellarInteriorDeformation,
|
||||
typename VacuumDeformation>
|
||||
StellarModel(
|
||||
Structure &&,
|
||||
surface::ConstantPressureSurface,
|
||||
SurfaceDeformation &&,
|
||||
StellarInteriorDeformation &&,
|
||||
VacuumDeformation &&
|
||||
)
|
||||
-> StellarModel<
|
||||
std::remove_cvref_t<Structure>,
|
||||
std::remove_cvref_t<SurfaceDeformation>,
|
||||
std::remove_cvref_t<StellarInteriorDeformation>,
|
||||
std::remove_cvref_t<VacuumDeformation>>;
|
||||
|
||||
namespace detail {
|
||||
template <typename Candidate> struct IsStellarModel : std::false_type { };
|
||||
|
||||
template <typename Structure> struct IsStellarModel<StellarModel<Structure>> : std::true_type { };
|
||||
template <
|
||||
typename Structure,
|
||||
typename SurfaceDeformation,
|
||||
typename StellarInteriorDeformation,
|
||||
typename VacuumDeformation>
|
||||
struct IsStellarModel<
|
||||
StellarModel<Structure, SurfaceDeformation, StellarInteriorDeformation, VacuumDeformation>>
|
||||
: std::true_type { };
|
||||
} // namespace detail
|
||||
|
||||
template <typename Candidate>
|
||||
@@ -143,7 +251,10 @@ export namespace mean_field::models {
|
||||
m_makeInitialSeed(&makeInitialSeedFor<typename std::remove_cvref_t<Model>::StructurePrescriptionType>),
|
||||
m_targetMass(model.targetMass()),
|
||||
m_surfaceCondition(model.compiledSurfaceConstraint().descriptor()),
|
||||
m_surfaceDependencies(model.compiledSurfaceConstraint().runtimeDependencies()) {
|
||||
m_surfaceDependencies(model.compiledSurfaceConstraint().runtimeDependencies()),
|
||||
m_surfaceDeformation(model.surfaceDeformationPrescription().descriptor()),
|
||||
m_stellarInteriorDeformation(model.stellarInteriorDeformationExtension().descriptor()),
|
||||
m_vacuumDeformation(model.vacuumDeformationExtension().descriptor()) {
|
||||
}
|
||||
|
||||
[[nodiscard]] eos::EquationOfStateView equationOfState() const noexcept {
|
||||
@@ -166,6 +277,18 @@ export namespace mean_field::models {
|
||||
return m_surfaceDependencies;
|
||||
}
|
||||
|
||||
[[nodiscard]] deformation::SurfaceDeformationDescriptor surfaceDeformation() const noexcept {
|
||||
return m_surfaceDeformation;
|
||||
}
|
||||
|
||||
[[nodiscard]] deformation::InteriorDeformationExtensionDescriptor stellarInteriorDeformation() const noexcept {
|
||||
return m_stellarInteriorDeformation;
|
||||
}
|
||||
|
||||
[[nodiscard]] deformation::VacuumDeformationExtensionDescriptor vacuumDeformation() const noexcept {
|
||||
return m_vacuumDeformation;
|
||||
}
|
||||
|
||||
private:
|
||||
using MakeInitialSeedFunction = structure::StructureSeed (*)(
|
||||
const void *,
|
||||
@@ -186,5 +309,8 @@ export namespace mean_field::models {
|
||||
double m_targetMass;
|
||||
surface::PressureSurfaceDescriptor m_surfaceCondition;
|
||||
surface::RuntimeSurfaceConstraintDependencies m_surfaceDependencies;
|
||||
deformation::SurfaceDeformationDescriptor m_surfaceDeformation;
|
||||
deformation::InteriorDeformationExtensionDescriptor m_stellarInteriorDeformation;
|
||||
deformation::VacuumDeformationExtensionDescriptor m_vacuumDeformation;
|
||||
};
|
||||
} // namespace mean_field::models
|
||||
|
||||
Reference in New Issue
Block a user