feat(support): continued migration to new field dof support system

mass normaliztion, gravity, displacement, and hydrostatic equilibrium are now migrated
This commit is contained in:
2026-08-24 15:44:24 -04:00
parent 0f3ca8050b
commit 177ae8b38a
48 changed files with 1738 additions and 935 deletions

View File

@@ -144,8 +144,7 @@ namespace prepared_hydrostatic_analytic_solve_test_utils {
TEST_CASE(
"Prepared Hydrostatic Operator Solves Analytic Bernoulli Equilibria",
tags::barotrope &tags::hydro &tags::prepared &tags::integration &tags::solver &tags::convergence &tags::accuracy
&tags::analytic_comparison
tags::barotrope_hydrostatic_prepared_analytic &tags::convergence &tags::accuracy
) {
using prepared_hydrostatic_analytic_solve_test_utils::AnalyticCase;
@@ -181,6 +180,15 @@ TEST_CASE(
const MPI_Comm communicator = f.mesh->GetComm();
const mean_field::field::FieldDofMap enthalpyMap =
field_dof_test_utils::make_map<mean_field::field::Enthalpy>(*f.enthalpyFes);
const mean_field::field::FieldDofMap gravityPotentialMap =
field_dof_test_utils::make_map<mean_field::field::Gravity>(*f.gravityPotentialFes);
const mean_field::field::FieldDofMap displacementMap =
field_dof_test_utils::make_map<mean_field::field::Displacement>(*f.displacementFes);
const mfem::Array<int> stellarElementMarker =
prepared_hydrostatic_analytic_solve_test_utils::make_stellar_element_marker(f);
@@ -234,11 +242,14 @@ TEST_CASE(
potentialField.ProjectCoefficient(potentialCoefficient);
mfem::Vector displacement;
mfem::Vector gravityPotential;
mfem::Vector displacementTrue;
mfem::Vector gravityPotentialTrue;
displacementField.GetTrueDofs(displacement);
potentialField.GetTrueDofs(gravityPotential);
displacementField.GetTrueDofs(displacementTrue);
potentialField.GetTrueDofs(gravityPotentialTrue);
const mfem::Vector displacement = displacementMap.gather(displacementTrue);
const mfem::Vector gravityPotential = gravityPotentialMap.gather(gravityPotentialTrue);
/*
* This projection is not used as the solution. It gives
@@ -266,7 +277,7 @@ TEST_CASE(
/*
* Begin deliberately far from equilibrium.
*/
mfem::Vector enthalpy(f.enthalpyFes->GetTrueVSize());
mfem::Vector enthalpy(enthalpyMap.reduced_size());
enthalpy = 0.0;
@@ -301,21 +312,20 @@ TEST_CASE(
* enthalpy solve.
*/
prepared_hydrostatic_analytic_solve_test_utils::EnthalpyJacobianOperator enthalpyJacobian(
f.enthalpyFes->GetTrueVSize(), preparedOperator
enthalpyMap.reduced_size(), preparedOperator
);
mfem::Vector rightHandSide(initialResidual);
rightHandSide *= -1.0;
mfem::Vector enthalpyCorrection(f.enthalpyFes->GetTrueVSize());
mfem::Vector enthalpyCorrection(enthalpyMap.reduced_size());
enthalpyCorrection = 0.0;
/*
* The operator is positive definite on stellar-supported
* enthalpy DOFs and semidefinite on exterior-only DOFs.
* The RHS is in its range, so MINRES is appropriate for
* the compatible system.
* The reduced operator contains only stellar-supported
* enthalpy DOFs and is positive definite. MINRES remains
* appropriate for this symmetric system.
*/
mfem::MINRESSolver linearSolver(communicator);
@@ -375,7 +385,9 @@ TEST_CASE(
*/
mfem::ParGridFunction solvedEnthalpyField(f.enthalpyFes.get());
solvedEnthalpyField.SetFromTrueDofs(enthalpy);
mfem::Vector enthalpyTrue(enthalpyMap.full_size());
enthalpyMap.scatter(enthalpy, enthalpyTrue);
solvedEnthalpyField.SetFromTrueDofs(enthalpyTrue);
const double solvedAnalyticError =
solvedEnthalpyField.ComputeL2Error(exactEnthalpyCoefficient, nullptr, &stellarElementMarker);
@@ -416,4 +428,4 @@ TEST_CASE(
CHECK(relativeSolvedAnalyticError / relativeProjectionError < 5.0);
}
}
}
}