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:
@@ -66,26 +66,24 @@ namespace prepared_displacement_residual_test_utils {
|
||||
}
|
||||
|
||||
[[nodiscard]] mean_field::operators::DisplacementResidualLayout make_layout(const mean_field::fem::FEM &f) {
|
||||
using DomainSchema = gravity_prepared_test_utils::DomainSchema;
|
||||
|
||||
const auto densityMap = gravity_prepared_test_utils::make_field_map<mean_field::field::Density>(f);
|
||||
const auto displacementMap = gravity_prepared_test_utils::make_field_map<mean_field::field::Displacement>(f);
|
||||
const auto gravityFluxMap =
|
||||
mean_field::field::make_field_dof_map<mean_field::field::Gravity, DomainSchema>(*f.gravityFluxFes);
|
||||
const auto gravityPotentialMap =
|
||||
mean_field::field::make_field_dof_map<mean_field::field::Gravity, DomainSchema>(*f.gravityPotentialFes);
|
||||
const auto enthalpyMap = make_enthalpy_map(f);
|
||||
|
||||
/*
|
||||
* Transitional displacement-composer layout.
|
||||
*
|
||||
* Pressure has now migrated its h column to supported FieldDof
|
||||
* coordinates, while the density-consuming mechanical children are
|
||||
* intentionally still full-space until the next migration slice.
|
||||
*
|
||||
* The adapter only writes R_d. The unrelated residual-row sizes remain
|
||||
* at their current full-space values in this standalone adapter test.
|
||||
*/
|
||||
const std::array<int, CoupledForm::value_block_count> valueSizes{
|
||||
f.densityFes->GetTrueVSize(), f.displacementFes->GetTrueVSize(), f.gravityFluxFes->GetTrueVSize(),
|
||||
f.gravityPotentialFes->GetTrueVSize(), enthalpyMap.reduced_size(), 1
|
||||
densityMap.reduced_size(), displacementMap.reduced_size(), gravityFluxMap.reduced_size(),
|
||||
gravityPotentialMap.reduced_size(), enthalpyMap.reduced_size(), 1
|
||||
};
|
||||
|
||||
const std::array<int, CoupledForm::residual_block_count> residualSizes{
|
||||
f.gravityFluxFes->GetTrueVSize(), f.gravityPotentialFes->GetTrueVSize(), f.densityFes->GetTrueVSize(),
|
||||
f.displacementFes->GetTrueVSize(), f.enthalpyFes->GetTrueVSize(), 1
|
||||
gravityFluxMap.reduced_size(), gravityPotentialMap.reduced_size(), densityMap.reduced_size(),
|
||||
displacementMap.reduced_size(), enthalpyMap.reduced_size(), 1
|
||||
};
|
||||
|
||||
return {valueSizes, residualSizes};
|
||||
@@ -273,10 +271,10 @@ namespace prepared_displacement_residual_test_utils {
|
||||
const std::uint64_t potentialRevision
|
||||
) {
|
||||
context.Prepare(
|
||||
{.density = density,
|
||||
.displacement = displacement,
|
||||
.gravity_gradient = gravityGradient,
|
||||
.gravity_potential = gravityPotential},
|
||||
{.density = context.GetDensityMap().gather(density),
|
||||
.displacement = context.GetDisplacementMap().gather(displacement),
|
||||
.gravity_gradient = context.GetGravityGradientMap().gather(gravityGradient),
|
||||
.gravity_potential = context.GetGravityPotentialMap().gather(gravityPotential)},
|
||||
make_gravity_revisions(dependencies, potentialRevision)
|
||||
);
|
||||
}
|
||||
@@ -334,7 +332,7 @@ namespace prepared_displacement_residual_test_utils {
|
||||
|
||||
TEST_CASE(
|
||||
"Prepared Displacement Residual Equals The Three Prepared Contributors",
|
||||
tags::barotrope &tags::prepared &tags::integration &tags::residuals
|
||||
tags::barotrope_prepared
|
||||
) {
|
||||
using Operator = mean_field::operators::PreparedDisplacementResidualOperator;
|
||||
|
||||
@@ -419,7 +417,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Prepared Displacement Residual Selectively Orchestrates Its Children",
|
||||
tags::barotrope &tags::prepared &tags::contexts &tags::integration
|
||||
tags::barotrope_context_integration
|
||||
) {
|
||||
mean_field::utils::Args args = test_utils::setup_args();
|
||||
|
||||
@@ -537,7 +535,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Prepared Displacement Residual Jacobian Equals The Contributor Sums",
|
||||
tags::barotrope &tags::prepared &tags::jacobian &tags::accuracy
|
||||
tags::barotrope_prepared_jacobian_accuracy
|
||||
) {
|
||||
mean_field::utils::Args args = test_utils::setup_args();
|
||||
|
||||
@@ -585,30 +583,37 @@ TEST_CASE(
|
||||
|
||||
preparedOperator.Prepare({.enthalpy = enthalpy}, dependencies, rotation);
|
||||
|
||||
const mfem::Vector densityDirectionReduced = gravityContext.GetDensityMap().gather(densityDirection);
|
||||
const mfem::Vector displacementDirectionReduced = gravityContext.GetDisplacementMap().gather(displacementDirection);
|
||||
const mfem::Vector gravityDirectionReduced = gravityContext.GetGravityGradientMap().gather(gravityDirection);
|
||||
|
||||
mfem::Vector densityAction;
|
||||
mfem::Vector displacementAction;
|
||||
mfem::Vector gravityAction;
|
||||
mfem::Vector enthalpyAction;
|
||||
mfem::Vector completeAction;
|
||||
|
||||
preparedOperator.ApplyDensityJacobianAction(densityDirection, densityAction);
|
||||
preparedOperator.ApplyDensityJacobianAction(densityDirectionReduced, densityAction);
|
||||
|
||||
preparedOperator.ApplyDisplacementJacobianAction(displacementDirection, displacementAction);
|
||||
preparedOperator.ApplyDisplacementJacobianAction(displacementDirectionReduced, displacementAction);
|
||||
|
||||
preparedOperator.ApplyGravityGradientJacobianAction(gravityDirection, gravityAction);
|
||||
preparedOperator.ApplyGravityGradientJacobianAction(gravityDirectionReduced, gravityAction);
|
||||
|
||||
preparedOperator.ApplyEnthalpyJacobianAction(enthalpyDirection, enthalpyAction);
|
||||
|
||||
preparedOperator.ApplyCompleteJacobianAction(
|
||||
densityDirection, displacementDirection, gravityDirection, enthalpyDirection, completeAction
|
||||
densityDirectionReduced, displacementDirectionReduced, gravityDirectionReduced, enthalpyDirection,
|
||||
completeAction
|
||||
);
|
||||
|
||||
mfem::Vector expectedDensity;
|
||||
mfem::Vector expectedRotationDensity;
|
||||
|
||||
preparedOperator.GetGravityOperator().ApplyDensityJacobianAction(densityDirection, expectedDensity);
|
||||
preparedOperator.GetGravityOperator().ApplyDensityJacobianAction(densityDirectionReduced, expectedDensity);
|
||||
|
||||
preparedOperator.GetRotationalOperator().ApplyDensityJacobianAction(densityDirection, expectedRotationDensity);
|
||||
preparedOperator.GetRotationalOperator().ApplyDensityJacobianAction(
|
||||
densityDirectionReduced, expectedRotationDensity
|
||||
);
|
||||
|
||||
expectedDensity += expectedRotationDensity;
|
||||
|
||||
@@ -616,21 +621,23 @@ TEST_CASE(
|
||||
mfem::Vector expectedGravityDisplacement;
|
||||
mfem::Vector expectedRotationDisplacement;
|
||||
|
||||
preparedOperator.GetPressureOperator().ApplyDisplacementJacobianAction(displacementDirection, expectedDisplacement);
|
||||
preparedOperator.GetPressureOperator().ApplyDisplacementJacobianAction(
|
||||
displacementDirectionReduced, expectedDisplacement
|
||||
);
|
||||
|
||||
preparedOperator.GetGravityOperator().ApplyDisplacementJacobianAction(
|
||||
displacementDirection, expectedGravityDisplacement
|
||||
displacementDirectionReduced, expectedGravityDisplacement
|
||||
);
|
||||
|
||||
preparedOperator.GetRotationalOperator().ApplyDisplacementJacobianAction(
|
||||
displacementDirection, expectedRotationDisplacement
|
||||
displacementDirectionReduced, expectedRotationDisplacement
|
||||
);
|
||||
|
||||
expectedDisplacement += expectedGravityDisplacement;
|
||||
expectedDisplacement += expectedRotationDisplacement;
|
||||
|
||||
mfem::Vector expectedGravity;
|
||||
preparedOperator.GetGravityOperator().ApplyGravityGradientJacobianAction(gravityDirection, expectedGravity);
|
||||
preparedOperator.GetGravityOperator().ApplyGravityGradientJacobianAction(gravityDirectionReduced, expectedGravity);
|
||||
|
||||
mfem::Vector expectedEnthalpy;
|
||||
preparedOperator.GetPressureOperator().ApplyEnthalpyJacobianAction(enthalpyDirection, expectedEnthalpy);
|
||||
@@ -672,7 +679,7 @@ TEST_CASE(
|
||||
TEST_CASE(
|
||||
"Prepared Displacement Residual Jacobian Matches A Simultaneous "
|
||||
"Centered Difference On Deformed Geometry",
|
||||
tags::barotrope &tags::prepared &tags::jacobian &tags::accuracy &tags::geometry
|
||||
tags::barotrope_prepared_jacobian_accuracy &tags::geometry
|
||||
) {
|
||||
mean_field::utils::Args args = test_utils::setup_args();
|
||||
|
||||
@@ -720,10 +727,15 @@ TEST_CASE(
|
||||
|
||||
preparedOperator.Prepare({.enthalpy = baseEnthalpy}, dependencies, rotation);
|
||||
|
||||
const mfem::Vector densityDirectionReduced = gravityContext.GetDensityMap().gather(densityDirection);
|
||||
const mfem::Vector displacementDirectionReduced = gravityContext.GetDisplacementMap().gather(displacementDirection);
|
||||
const mfem::Vector gravityDirectionReduced = gravityContext.GetGravityGradientMap().gather(gravityDirection);
|
||||
|
||||
mfem::Vector jacobianAction;
|
||||
|
||||
preparedOperator.ApplyCompleteJacobianAction(
|
||||
densityDirection, displacementDirection, gravityDirection, enthalpyDirection, jacobianAction
|
||||
densityDirectionReduced, displacementDirectionReduced, gravityDirectionReduced, enthalpyDirection,
|
||||
jacobianAction
|
||||
);
|
||||
|
||||
constexpr double step = 1.0e-5;
|
||||
@@ -793,7 +805,7 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Prepared Displacement Residual MFEM Adapter Routes Only R-d",
|
||||
tags::barotrope &tags::prepared &tags::jacobian &tags::mfem_operators &tags::unit
|
||||
tags::barotrope_prepared_jacobian_unit
|
||||
) {
|
||||
using JacobianForm = mean_field::utils::blocks::barotropic_equilibrium_jacobian_form;
|
||||
|
||||
@@ -876,6 +888,10 @@ TEST_CASE(
|
||||
|
||||
preparedOperator.Prepare({.enthalpy = enthalpy}, dependencies, rotation);
|
||||
|
||||
const mfem::Vector densityDirectionReduced = gravityContext.GetDensityMap().gather(densityDirection);
|
||||
const mfem::Vector displacementDirectionReduced = gravityContext.GetDisplacementMap().gather(displacementDirection);
|
||||
const mfem::Vector gravityDirectionReduced = gravityContext.GetGravityGradientMap().gather(gravityDirection);
|
||||
|
||||
const mean_field::operators::DisplacementResidualLayout layout =
|
||||
prepared_displacement_residual_test_utils::make_layout(f);
|
||||
|
||||
@@ -889,24 +905,25 @@ TEST_CASE(
|
||||
);
|
||||
|
||||
mfem::BlockVector direction(layout.value_offsets());
|
||||
direction = 0.0;
|
||||
direction = 0.0;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::densityValue) = densityDirection;
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::densityValue) = densityDirectionReduced;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::displacementValue) = displacementDirection;
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::displacementValue) = displacementDirectionReduced;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::gravityGradientValue) = gravityDirection;
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::gravityGradientValue) = gravityDirectionReduced;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::enthalpyValue) = enthalpyDirection;
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::enthalpyValue) = enthalpyDirection;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::gravityPotentialValue) = 0.59;
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::gravityPotentialValue) = 0.59;
|
||||
|
||||
direction.GetBlock(prepared_displacement_residual_test_utils::barotropicConstantValue) = -0.73;
|
||||
|
||||
mfem::Vector expectedDisplacementAction;
|
||||
|
||||
preparedOperator.ApplyCompleteJacobianAction(
|
||||
densityDirection, displacementDirection, gravityDirection, enthalpyDirection, expectedDisplacementAction
|
||||
densityDirectionReduced, displacementDirectionReduced, gravityDirectionReduced, enthalpyDirection,
|
||||
expectedDisplacementAction
|
||||
);
|
||||
|
||||
mfem::Vector action;
|
||||
|
||||
Reference in New Issue
Block a user