feat(libmeanfield): variadic refactor
also added normaliztion operator
This commit is contained in:
@@ -44,20 +44,11 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
TEST_CASE(
|
||||
"Central Density Bordered Root Preserves The Physical Operator Prefix",
|
||||
"Central Density Contribution Composes Through The Variadic Root",
|
||||
tags::central_density_phase_integration
|
||||
) {
|
||||
using namespace mean_field;
|
||||
|
||||
STATIC_CHECK_FALSE(
|
||||
std::same_as<
|
||||
operators::PreparedStellarEquilibriumOperator, operators::PreparedCentralDensityStellarEquilibriumOperator>
|
||||
);
|
||||
STATIC_CHECK(
|
||||
operators::CentralDensityStellarEquilibriumSpecificationModel::compilationClass ==
|
||||
models::ModelCompilationClass::isolated_root
|
||||
);
|
||||
|
||||
utils::Args args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
REQUIRE(f.okay());
|
||||
@@ -80,7 +71,8 @@ TEST_CASE(
|
||||
STATIC_CHECK(
|
||||
std::same_as<
|
||||
typename std::remove_cvref_t<decltype(equilibriumProblem)>::PreparedOperatorType,
|
||||
operators::PreparedCentralDensityStellarEquilibriumOperator>
|
||||
operators::PreparedVariadicStellarEquilibriumOperator<
|
||||
typename std::remove_cvref_t<decltype(equilibriumProblem)>::ModelType>>
|
||||
);
|
||||
CHECK(
|
||||
equilibriumProblem.GetStellarModel().specification<constraint::FixedCentralDensity>().targetDensity() ==
|
||||
@@ -95,19 +87,21 @@ TEST_CASE(
|
||||
CHECK(borderedOperator.GetRootManifest().constraints().size() == 3);
|
||||
CHECK(borderedOperator.GetRootManifest().specificationDescriptors().size() == 4);
|
||||
|
||||
const auto constraints = borderedOperator.GetRootManifest().constraints();
|
||||
CHECK(constraints[2].stableId == "FixedCentralDensity");
|
||||
CHECK(constraints[2].role == models::SpecificationRole::phase_condition);
|
||||
CHECK(constraints[2].columnPolicy == operators::RootColumnPolicy::solver_border);
|
||||
CHECK(constraints[2].target == 1.0);
|
||||
REQUIRE(constraints[2].carrierTarget.has_value());
|
||||
CHECK(*constraints[2].carrierTarget == 1.0);
|
||||
CHECK(constraints[2].targetUnits == "density");
|
||||
CHECK(constraints[2].residualUnits == "specific_enthalpy");
|
||||
const auto ¢ralDescriptor =
|
||||
borderedOperator.GetRootManifest().specification<constraint::FixedCentralDensity>();
|
||||
CHECK(centralDescriptor.stableId == "FixedCentralDensity");
|
||||
CHECK(centralDescriptor.role == models::SpecificationRole::phase_condition);
|
||||
CHECK(centralDescriptor.columnPolicy == operators::RootColumnPolicy::solver_border);
|
||||
CHECK(centralDescriptor.target == 1.0);
|
||||
REQUIRE(centralDescriptor.carrierTarget.has_value());
|
||||
CHECK(*centralDescriptor.carrierTarget == 1.0);
|
||||
CHECK(centralDescriptor.targetUnits == "density");
|
||||
CHECK(centralDescriptor.residualUnits == "specific_enthalpy");
|
||||
|
||||
mfem::Vector physicalState(physicalOperator.Width());
|
||||
physicalState = 0.0;
|
||||
const auto physicalStateView = physicalOperator.GetRootStateView(physicalState);
|
||||
const auto physicalStateView =
|
||||
physicalOperator.GetRootManifest().stateView(physicalState);
|
||||
physicalStateView.block(utils::blocks::density_field.mass_term) = 1.0;
|
||||
physicalStateView.block(utils::blocks::enthalpy_field.specific_term) = 1.0;
|
||||
|
||||
@@ -118,10 +112,9 @@ TEST_CASE(
|
||||
const operators::StellarEquilibriumDependencies dependencies = make_dependencies();
|
||||
const physics::RigidRotation rotation = make_zero_rotation();
|
||||
physicalOperator.Prepare(physicalState, dependencies, rotation);
|
||||
const operators::PreparedCentralDensityStellarEquilibriumReport initialReport =
|
||||
equilibriumProblem.Prepare(borderedState, dependencies, rotation);
|
||||
const auto initialReport = equilibriumProblem.Prepare(borderedState, dependencies, rotation);
|
||||
CHECK(initialReport.physical.assembledResidual);
|
||||
CHECK(initialReport.phase.assembledResidual);
|
||||
CHECK(initialReport.specification<constraint::FixedCentralDensity>().constraint.assembledResidual);
|
||||
CHECK(initialReport.assembledResidual);
|
||||
|
||||
mfem::Vector physicalResidual;
|
||||
@@ -164,13 +157,13 @@ TEST_CASE(
|
||||
|
||||
const auto repeatedReport = borderedOperator.Prepare(borderedState, dependencies, rotation);
|
||||
CHECK_FALSE(repeatedReport.physical.DidAnyWork());
|
||||
CHECK_FALSE(repeatedReport.phase.DidAnyWork());
|
||||
CHECK_FALSE(repeatedReport.assembledResidual);
|
||||
CHECK_FALSE(repeatedReport.specification<constraint::FixedCentralDensity>().DidAnyWork());
|
||||
CHECK(repeatedReport.assembledResidual);
|
||||
|
||||
borderedState(borderedState.Size() - 1) = 0.375;
|
||||
const auto borderReport = borderedOperator.Prepare(borderedState, dependencies, rotation);
|
||||
CHECK_FALSE(borderReport.physical.DidAnyWork());
|
||||
CHECK(borderReport.phase.refreshedBorder);
|
||||
CHECK(borderReport.specification<constraint::FixedCentralDensity>().constraint.refreshedBorder);
|
||||
CHECK(borderReport.assembledResidual);
|
||||
|
||||
mfem::Vector borderOnlyDirection(borderedOperator.Width());
|
||||
|
||||
Reference in New Issue
Block a user