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:
@@ -1077,7 +1077,7 @@ namespace {
|
||||
|
||||
TEST_CASE(
|
||||
"Uniform Potential Matches Analytic",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization
|
||||
tags::gravity_analytic_initialization
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
@@ -1161,7 +1161,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Parabolic Density Virial Self-Consistency",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization
|
||||
tags::gravity_analytic_initialization
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
@@ -1218,7 +1218,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Rational Density Virial Self-Consistency",
|
||||
tags::gravity &tags::self_consistency &tags::initialization
|
||||
tags::gravity_consistency_initialization
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
@@ -1278,7 +1278,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Homogeneous Ellipsoid Analytic Gravity",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization
|
||||
tags::gravity_analytic_initialization
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
@@ -1482,7 +1482,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Deformed Rational Density Virial Self-Consistency",
|
||||
tags::gravity &tags::self_consistency &tags::initialization
|
||||
tags::gravity_consistency_initialization
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
fem::FEM f = fem::setup_fem(args.mesh_file, args, 0);
|
||||
@@ -1565,7 +1565,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Matches Uniform Sphere Analytic",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration
|
||||
tags::gravity_analytic
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -1675,7 +1675,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Matches Legacy Solver On Homogeneous Ellipsoid",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration &tags::legacy_comparison
|
||||
tags::gravity_legacy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -1739,13 +1739,22 @@ TEST_CASE(
|
||||
constexpr auto gravity_poisson_residual_block =
|
||||
utils::blocks::get_residual_block<gravity_form>(utils::blocks::gravity_field.poisson_term);
|
||||
|
||||
using DomainSchema = utils::domain::CoreEnvelopeVacuumDomainSchema;
|
||||
const field::FieldDofMap density_map = field::make_field_dof_map<field::Density, DomainSchema>(*f.densityFes);
|
||||
const field::FieldDofMap displacement_map =
|
||||
field::make_field_dof_map<field::Displacement, DomainSchema>(*f.displacementFes);
|
||||
const field::FieldDofMap gravity_flux_map =
|
||||
field::make_field_dof_map<field::Gravity, DomainSchema>(*f.gravityFluxFes);
|
||||
const field::FieldDofMap gravity_potential_map =
|
||||
field::make_field_dof_map<field::Gravity, DomainSchema>(*f.gravityPotentialFes);
|
||||
|
||||
const std::array<int, gravity_form::value_block_count> value_sizes{
|
||||
f.densityFes->GetTrueVSize(), f.displacementFes->GetTrueVSize(), f.gravityFluxFes->GetTrueVSize(),
|
||||
f.gravityPotentialFes->GetTrueVSize()
|
||||
density_map.reduced_size(), displacement_map.reduced_size(), gravity_flux_map.reduced_size(),
|
||||
gravity_potential_map.reduced_size()
|
||||
};
|
||||
|
||||
const std::array<int, gravity_form::residual_block_count> residual_sizes{
|
||||
f.gravityFluxFes->GetTrueVSize(), f.gravityPotentialFes->GetTrueVSize()
|
||||
gravity_flux_map.reduced_size(), gravity_potential_map.reduced_size()
|
||||
};
|
||||
|
||||
const utils::blocks::form_layout<gravity_form> gravity_layout(value_sizes, residual_sizes);
|
||||
@@ -1760,6 +1769,8 @@ TEST_CASE(
|
||||
|
||||
REQUIRE(density_true.Size() == f.densityFes->GetTrueVSize());
|
||||
REQUIRE(displacement_true.Size() == f.displacementFes->GetTrueVSize());
|
||||
const mfem::Vector reduced_density = density_map.gather(density_true);
|
||||
const mfem::Vector reduced_displacement = displacement_map.gather(displacement_true);
|
||||
|
||||
operators::context::gravity_field::GravityFieldLinearizationContext residual_linearization_context(
|
||||
f, *f.domainMapperStateless
|
||||
@@ -1779,24 +1790,24 @@ TEST_CASE(
|
||||
);
|
||||
|
||||
operators::ReducedGravityFieldOperator new_reduced_operator(
|
||||
residual_gravity_operator, residual_geometry_context, displacement_true
|
||||
residual_gravity_operator, residual_geometry_context, reduced_displacement
|
||||
);
|
||||
|
||||
REQUIRE(new_reduced_operator.Width() == gravity_system_size);
|
||||
REQUIRE(new_reduced_operator.Height() == gravity_system_size);
|
||||
|
||||
mfem::Vector new_right_hand_side;
|
||||
new_reduced_operator.BuildRightHandSide(density_true, new_right_hand_side);
|
||||
new_reduced_operator.BuildRightHandSide(reduced_density, new_right_hand_side);
|
||||
|
||||
REQUIRE(new_right_hand_side.Size() == gravity_system_size);
|
||||
|
||||
REQUIRE(f.gravityContext.source_form->Width() == density_true.Size());
|
||||
REQUIRE(f.gravityContext.source_form->Width() == reduced_density.Size());
|
||||
REQUIRE(f.gravityContext.source_form->Height() == gravity_poisson_size);
|
||||
|
||||
mfem::Vector legacy_source_action(f.gravityContext.source_form->Height());
|
||||
legacy_source_action = 0.0;
|
||||
|
||||
f.gravityContext.source_form->Mult(density_true, legacy_source_action);
|
||||
f.gravityContext.source_form->Mult(reduced_density, legacy_source_action);
|
||||
|
||||
REQUIRE(legacy_source_action.Size() == gravity_poisson_size);
|
||||
|
||||
@@ -2057,7 +2068,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Deformed Rational Density Virial Self-Consistency",
|
||||
tags::gravity &tags::self_consistency &tags::initialization &tags::integration
|
||||
tags::gravity_consistency
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -2183,7 +2194,7 @@ TEST_CASE(
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Resolves Exterior Monopole By Compactification "
|
||||
"Shell",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration
|
||||
tags::gravity_analytic
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -2305,7 +2316,7 @@ TEST_CASE(
|
||||
TEST_CASE(
|
||||
"New Exterior Monopole Error Is Separated From Finite Element Projection "
|
||||
"Floor",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration &tags::accuracy
|
||||
tags::gravity_analytic_accuracy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -2466,7 +2477,7 @@ TEST_CASE(
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Matches Analytic Interior Potential For A Deformed "
|
||||
"Homogeneous Star",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration &tags::accuracy
|
||||
tags::gravity_analytic_accuracy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -2807,7 +2818,7 @@ static void evaluate_ferrers_n1_gradient(
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Potential Matches Analytic Ferrers Ellipsoid",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration &tags::accuracy
|
||||
tags::gravity_analytic_accuracy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
|
||||
@@ -458,9 +458,10 @@ namespace {
|
||||
const mfem::Vector projection_rhs = assemble_monopole_projection_rhs(f, displacement, mass, stellar_radius);
|
||||
|
||||
mean_field::operators::PreparedMappedHDivMassOperator mass_operator(f, *f.domainMapperStateless);
|
||||
mass_operator.Prepare(displacement_true);
|
||||
mass_operator.Prepare(mass_operator.GetDisplacementMap().gather(displacement_true));
|
||||
const mfem::Vector reduced_projection_rhs = mass_operator.GetFluxMap().gather(projection_rhs);
|
||||
|
||||
mfem::Vector projected_gradient(f.gravityFluxFes->GetTrueVSize());
|
||||
mfem::Vector projected_gradient(mass_operator.Width());
|
||||
projected_gradient = 0.0;
|
||||
|
||||
mfem::CGSolver solver(f.gravityFluxFes->GetComm());
|
||||
@@ -469,13 +470,13 @@ namespace {
|
||||
solver.SetAbsTol(1.0e-12);
|
||||
solver.SetMaxIter(2000);
|
||||
solver.SetPrintLevel(0);
|
||||
solver.Mult(projection_rhs, projected_gradient);
|
||||
solver.Mult(reduced_projection_rhs, projected_gradient);
|
||||
|
||||
mfem::Vector projection_residual;
|
||||
mass_operator.Mult(projected_gradient, projection_residual);
|
||||
projection_residual -= projection_rhs;
|
||||
projection_residual -= reduced_projection_rhs;
|
||||
|
||||
const double source_norm = global_norm(projection_rhs, f.gravityFluxFes->GetComm());
|
||||
const double source_norm = global_norm(reduced_projection_rhs, f.gravityFluxFes->GetComm());
|
||||
const double residual_norm = global_norm(projection_residual, f.gravityFluxFes->GetComm());
|
||||
const double relative_residual = residual_norm / std::max(source_norm, std::numeric_limits<double>::epsilon());
|
||||
|
||||
@@ -487,7 +488,7 @@ namespace {
|
||||
|
||||
REQUIRE(std::isfinite(relative_residual));
|
||||
REQUIRE(relative_residual < 1.0e-8);
|
||||
return projected_gradient;
|
||||
return mass_operator.GetFluxMap().scatter(projected_gradient);
|
||||
}
|
||||
|
||||
double mapped_hdiv_relative_error(
|
||||
@@ -502,7 +503,7 @@ namespace {
|
||||
displacement.GetTrueDofs(displacement_true);
|
||||
|
||||
mean_field::operators::PreparedMappedHDivMassOperator mass_operator(f, *f.domainMapperStateless);
|
||||
mass_operator.Prepare(displacement_true);
|
||||
mass_operator.Prepare(mass_operator.GetDisplacementMap().gather(displacement_true));
|
||||
|
||||
mfem::Vector difference(computed);
|
||||
difference -= reference;
|
||||
@@ -510,13 +511,15 @@ namespace {
|
||||
mfem::Vector difference_action;
|
||||
mfem::Vector reference_action;
|
||||
|
||||
mass_operator.Mult(difference, difference_action);
|
||||
mass_operator.Mult(reference, reference_action);
|
||||
const mfem::Vector reduced_difference = mass_operator.GetFluxMap().gather(difference);
|
||||
const mfem::Vector reduced_reference = mass_operator.GetFluxMap().gather(reference);
|
||||
mass_operator.Mult(reduced_difference, difference_action);
|
||||
mass_operator.Mult(reduced_reference, reference_action);
|
||||
|
||||
MPI_Comm communicator = f.gravityFluxFes->GetComm();
|
||||
|
||||
const double difference_energy = global_dot(difference, difference_action, communicator);
|
||||
const double reference_energy = global_dot(reference, reference_action, communicator);
|
||||
const double difference_energy = global_dot(reduced_difference, difference_action, communicator);
|
||||
const double reference_energy = global_dot(reduced_reference, reference_action, communicator);
|
||||
|
||||
REQUIRE(difference_energy >= -1.0e-12 * std::abs(reference_energy));
|
||||
REQUIRE(reference_energy > 0.0);
|
||||
@@ -853,7 +856,7 @@ namespace {
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Monopole Accuracy And Projection Floor",
|
||||
tags::gravity &tags::analytic_comparison &tags::initialization &tags::integration &tags::accuracy
|
||||
tags::gravity_analytic_accuracy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
@@ -1022,7 +1025,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"New Gravity Virial Consistency Across Volume Preserving Deformation",
|
||||
tags::gravity &tags::self_consistency &tags::initialization &tags::integration &tags::accuracy
|
||||
tags::gravity_consistency &tags::accuracy
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
args.p.rtol = 1.0e-13;
|
||||
|
||||
Reference in New Issue
Block a user