feat(field-support): added field support system, mid migration
currently the barotope and the pressure force operator are migrated to the new support system
This commit is contained in:
@@ -34,8 +34,7 @@ namespace hydrostatic_kernel_test_utils {
|
||||
|
||||
mfem::Vector make_enthalpy(const mean_field::fem::FEM &f) {
|
||||
mfem::FunctionCoefficient coefficient([](const mfem::Vector &position) {
|
||||
return 1.10 + 0.035 * position(0) - 0.021 * position(1) +
|
||||
0.014 * position(2);
|
||||
return 1.10 + 0.035 * position(0) - 0.021 * position(1) + 0.014 * position(2);
|
||||
});
|
||||
|
||||
return project_scalar(*f.enthalpyFes, coefficient);
|
||||
@@ -43,8 +42,7 @@ namespace hydrostatic_kernel_test_utils {
|
||||
|
||||
mfem::Vector make_potential(const mean_field::fem::FEM &f) {
|
||||
mfem::FunctionCoefficient coefficient([](const mfem::Vector &position) {
|
||||
return -0.72 + 0.018 * position(0) + 0.011 * position(1) -
|
||||
0.025 * position(2);
|
||||
return -0.72 + 0.018 * position(0) + 0.011 * position(1) - 0.025 * position(2);
|
||||
});
|
||||
|
||||
return project_scalar(*f.gravityPotentialFes, coefficient);
|
||||
@@ -98,23 +96,18 @@ namespace hydrostatic_kernel_test_utils {
|
||||
mfem::Vector difference(computed);
|
||||
difference -= reference;
|
||||
|
||||
return gravity_prepared_test_utils::global_norm(
|
||||
difference, communicator
|
||||
) /
|
||||
return gravity_prepared_test_utils::global_norm(difference, communicator) /
|
||||
std::max(normalization, std::numeric_limits<double>::epsilon());
|
||||
}
|
||||
|
||||
mfem::Vector
|
||||
make_vacuum_supported_potential(const mean_field::fem::FEM &f) {
|
||||
mfem::Vector make_vacuum_supported_potential(const mean_field::fem::FEM &f) {
|
||||
mfem::Vector attributeValues(f.mesh->attributes.Max());
|
||||
|
||||
attributeValues = 0.0;
|
||||
attributeValues = 0.0;
|
||||
|
||||
const int vacuumAttribute =
|
||||
f.domainMapperStateless->GetVacuumElementAttribute();
|
||||
const int vacuumAttribute = f.domainMapperStateless->GetVacuumElementAttribute();
|
||||
|
||||
for (int attributeIndex = 0; attributeIndex < f.mesh->attributes.Size();
|
||||
++attributeIndex) {
|
||||
for (int attributeIndex = 0; attributeIndex < f.mesh->attributes.Size(); ++attributeIndex) {
|
||||
const int attribute = f.mesh->attributes[attributeIndex];
|
||||
|
||||
if (attribute == vacuumAttribute) {
|
||||
@@ -144,10 +137,9 @@ namespace hydrostatic_kernel_test_utils {
|
||||
const mfem::Vector &input,
|
||||
mfem::Vector &output
|
||||
) const override {
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_enthalpy_action(
|
||||
f_, domainMapper_, input, displacementTrue_, output
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_enthalpy_action(
|
||||
f_, domainMapper_, input, displacementTrue_, output
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -161,10 +153,9 @@ namespace hydrostatic_kernel_test_utils {
|
||||
|
||||
TEST_CASE(
|
||||
"Rigid Rotation Potential Derivative Matches Centered Differences",
|
||||
tags::barotrope &tags::hydro &tags::jacobian &tags::physics &tags::unit
|
||||
tags::barotrope &tags::hydro &tags::jacobian &tags::physics &tags::unit &tags::kernels
|
||||
) {
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_rotation();
|
||||
|
||||
mfem::Vector position(3);
|
||||
mfem::Vector direction(3);
|
||||
@@ -186,17 +177,12 @@ TEST_CASE(
|
||||
minusPosition.Add(-epsilon, direction);
|
||||
|
||||
const double centeredDerivative =
|
||||
(rotation.potential(plusPosition) - rotation.potential(minusPosition)) /
|
||||
(2.0 * epsilon);
|
||||
(rotation.potential(plusPosition) - rotation.potential(minusPosition)) / (2.0 * epsilon);
|
||||
|
||||
const double analyticDerivative =
|
||||
rotation.potential_directional_derivative(position, direction);
|
||||
const double analyticDerivative = rotation.potential_directional_derivative(position, direction);
|
||||
|
||||
const double relativeError =
|
||||
std::abs(centeredDerivative - analyticDerivative) /
|
||||
std::max(
|
||||
std::abs(analyticDerivative), std::numeric_limits<double>::epsilon()
|
||||
);
|
||||
const double relativeError = std::abs(centeredDerivative - analyticDerivative) /
|
||||
std::max(std::abs(analyticDerivative), std::numeric_limits<double>::epsilon());
|
||||
|
||||
INFO("Rigid-rotation derivative error = " << relativeError);
|
||||
|
||||
@@ -205,42 +191,31 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Hydrostatic Residual Vanishes For A Manufactured Rotating State",
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::kernels
|
||||
&tags::physics &tags::residuals
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::kernels &tags::physics &tags::residuals
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_rotation();
|
||||
|
||||
constexpr double bernoulliConstant = 0.73;
|
||||
constexpr double potentialValue = -0.21;
|
||||
constexpr double constantOffset = 0.40;
|
||||
constexpr double bernoulliConstant = 0.73;
|
||||
constexpr double potentialValue = -0.21;
|
||||
constexpr double constantOffset = 0.40;
|
||||
|
||||
mfem::FunctionCoefficient enthalpyCoefficient(
|
||||
[&rotation](const mfem::Vector &position) {
|
||||
return bernoulliConstant - potentialValue +
|
||||
rotation.potential(position);
|
||||
}
|
||||
);
|
||||
mfem::FunctionCoefficient enthalpyCoefficient([&rotation](const mfem::Vector &position) {
|
||||
return bernoulliConstant - potentialValue + rotation.potential(position);
|
||||
});
|
||||
|
||||
const mfem::Vector interpolatedEnthalpy =
|
||||
hydrostatic_kernel_test_utils::project_scalar(
|
||||
*f.enthalpyFes, enthalpyCoefficient
|
||||
);
|
||||
hydrostatic_kernel_test_utils::project_scalar(*f.enthalpyFes, enthalpyCoefficient);
|
||||
|
||||
const mfem::Vector potential =
|
||||
hydrostatic_kernel_test_utils::make_constant_field(
|
||||
*f.gravityPotentialFes, potentialValue
|
||||
);
|
||||
hydrostatic_kernel_test_utils::make_constant_field(*f.gravityPotentialFes, potentialValue);
|
||||
|
||||
const mfem::Vector displacement =
|
||||
gravity_prepared_test_utils::make_displacement(f, 0.0);
|
||||
const mfem::Vector displacement = gravity_prepared_test_utils::make_displacement(f, 0.0);
|
||||
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
|
||||
/*
|
||||
* First measure the residual of the nodally interpolated
|
||||
@@ -253,35 +228,26 @@ TEST_CASE(
|
||||
mfem::Vector interpolatedReferenceResidual;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, interpolatedEnthalpy, potential,
|
||||
displacement, bernoulliConstant, interpolatedResidual
|
||||
f, *f.domainMapperStateless, rotation, interpolatedEnthalpy, potential, displacement, bernoulliConstant,
|
||||
interpolatedResidual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, interpolatedEnthalpy, potential,
|
||||
displacement, bernoulliConstant + constantOffset,
|
||||
interpolatedReferenceResidual
|
||||
f, *f.domainMapperStateless, rotation, interpolatedEnthalpy, potential, displacement,
|
||||
bernoulliConstant + constantOffset, interpolatedReferenceResidual
|
||||
);
|
||||
|
||||
const double interpolatedResidualNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
interpolatedResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(interpolatedResidual, communicator);
|
||||
|
||||
const double interpolatedReferenceNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
interpolatedReferenceResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(interpolatedReferenceResidual, communicator);
|
||||
|
||||
REQUIRE(interpolatedReferenceNorm > 1.0e-12);
|
||||
|
||||
const double representationFloor =
|
||||
interpolatedResidualNorm / interpolatedReferenceNorm;
|
||||
const double representationFloor = interpolatedResidualNorm / interpolatedReferenceNorm;
|
||||
|
||||
INFO(
|
||||
"Interpolated rotating-state residual norm = "
|
||||
<< interpolatedResidualNorm
|
||||
);
|
||||
INFO("Interpolated rotating-state residual norm = " << interpolatedResidualNorm);
|
||||
|
||||
INFO(
|
||||
"Interpolated rotating-state relative "
|
||||
@@ -310,8 +276,9 @@ TEST_CASE(
|
||||
* side is in the range of M_h. Starting CG from zero keeps the
|
||||
* iteration in the active stellar subspace.
|
||||
*/
|
||||
hydrostatic_kernel_test_utils::HydrostaticEnthalpyMassOperator
|
||||
enthalpyMassOperator(f, *f.domainMapperStateless, displacement);
|
||||
hydrostatic_kernel_test_utils::HydrostaticEnthalpyMassOperator enthalpyMassOperator(
|
||||
f, *f.domainMapperStateless, displacement
|
||||
);
|
||||
|
||||
mfem::Vector correctionRightHandSide(interpolatedResidual);
|
||||
|
||||
@@ -332,20 +299,11 @@ TEST_CASE(
|
||||
|
||||
projectionSolver.Mult(correctionRightHandSide, enthalpyCorrection);
|
||||
|
||||
INFO(
|
||||
"Discrete-equilibrium projection converged = "
|
||||
<< projectionSolver.GetConverged()
|
||||
);
|
||||
INFO("Discrete-equilibrium projection converged = " << projectionSolver.GetConverged());
|
||||
|
||||
INFO(
|
||||
"Discrete-equilibrium projection iterations = "
|
||||
<< projectionSolver.GetNumIterations()
|
||||
);
|
||||
INFO("Discrete-equilibrium projection iterations = " << projectionSolver.GetNumIterations());
|
||||
|
||||
INFO(
|
||||
"Discrete-equilibrium projection final norm = "
|
||||
<< projectionSolver.GetFinalNorm()
|
||||
);
|
||||
INFO("Discrete-equilibrium projection final norm = " << projectionSolver.GetFinalNorm());
|
||||
|
||||
REQUIRE(projectionSolver.GetConverged());
|
||||
|
||||
@@ -356,9 +314,7 @@ TEST_CASE(
|
||||
correctionEquationResidual -= correctionRightHandSide;
|
||||
|
||||
const double correctionEquationNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
correctionEquationResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(correctionEquationResidual, communicator);
|
||||
|
||||
INFO(
|
||||
"Discrete-equilibrium correction-equation "
|
||||
@@ -366,10 +322,7 @@ TEST_CASE(
|
||||
<< correctionEquationNorm
|
||||
);
|
||||
|
||||
CHECK(
|
||||
correctionEquationNorm <=
|
||||
std::max(5.0e-12 * interpolatedResidualNorm, 5.0e-15)
|
||||
);
|
||||
CHECK(correctionEquationNorm <= std::max(5.0e-12 * interpolatedResidualNorm, 5.0e-15));
|
||||
|
||||
mfem::Vector discreteEnthalpy(interpolatedEnthalpy);
|
||||
|
||||
@@ -379,25 +332,20 @@ TEST_CASE(
|
||||
mfem::Vector referenceResidual;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, discreteEnthalpy, potential,
|
||||
displacement, bernoulliConstant, exactResidual
|
||||
f, *f.domainMapperStateless, rotation, discreteEnthalpy, potential, displacement, bernoulliConstant,
|
||||
exactResidual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, discreteEnthalpy, potential,
|
||||
displacement, bernoulliConstant + constantOffset, referenceResidual
|
||||
f, *f.domainMapperStateless, rotation, discreteEnthalpy, potential, displacement,
|
||||
bernoulliConstant + constantOffset, referenceResidual
|
||||
);
|
||||
|
||||
const double exactNorm =
|
||||
gravity_prepared_test_utils::global_norm(exactResidual, communicator);
|
||||
const double exactNorm = gravity_prepared_test_utils::global_norm(exactResidual, communicator);
|
||||
|
||||
const double referenceNorm = gravity_prepared_test_utils::global_norm(
|
||||
referenceResidual, communicator
|
||||
);
|
||||
const double referenceNorm = gravity_prepared_test_utils::global_norm(referenceResidual, communicator);
|
||||
|
||||
const double correctionNorm = gravity_prepared_test_utils::global_norm(
|
||||
enthalpyCorrection, communicator
|
||||
);
|
||||
const double correctionNorm = gravity_prepared_test_utils::global_norm(enthalpyCorrection, communicator);
|
||||
|
||||
INFO("Enthalpy representation correction norm = " << correctionNorm);
|
||||
|
||||
@@ -412,43 +360,31 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Exact Constant Hydrostatic Equilibrium Remains Zero Under Deformation",
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian
|
||||
&tags::kernels &tags::mapping &tags::physics
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian &tags::kernels &tags::mapping &tags::physics
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_zero_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_zero_rotation();
|
||||
|
||||
constexpr double enthalpyValue = 1.20;
|
||||
constexpr double potentialValue = -0.35;
|
||||
constexpr double enthalpyValue = 1.20;
|
||||
constexpr double potentialValue = -0.35;
|
||||
|
||||
constexpr double bernoulliConstant = enthalpyValue + potentialValue;
|
||||
constexpr double bernoulliConstant = enthalpyValue + potentialValue;
|
||||
|
||||
const mfem::Vector enthalpy =
|
||||
hydrostatic_kernel_test_utils::make_constant_field(
|
||||
*f.enthalpyFes, enthalpyValue
|
||||
);
|
||||
const mfem::Vector enthalpy = hydrostatic_kernel_test_utils::make_constant_field(*f.enthalpyFes, enthalpyValue);
|
||||
|
||||
const mfem::Vector potential =
|
||||
hydrostatic_kernel_test_utils::make_constant_field(
|
||||
*f.gravityPotentialFes, potentialValue
|
||||
);
|
||||
hydrostatic_kernel_test_utils::make_constant_field(*f.gravityPotentialFes, potentialValue);
|
||||
|
||||
const mfem::Vector displacementVariation =
|
||||
gravity_prepared_test_utils::make_displacement(f, 0.67);
|
||||
const mfem::Vector displacementVariation = gravity_prepared_test_utils::make_displacement(f, 0.67);
|
||||
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
|
||||
for (const double deformationScale : {0.0, 0.5, 1.0}) {
|
||||
DYNAMIC_SECTION("Deformation scale = " << deformationScale) {
|
||||
const mfem::Vector displacement =
|
||||
gravity_prepared_test_utils::make_displacement(
|
||||
f, deformationScale
|
||||
);
|
||||
const mfem::Vector displacement = gravity_prepared_test_utils::make_displacement(f, deformationScale);
|
||||
|
||||
mfem::Vector exactResidual;
|
||||
mfem::Vector referenceResidual;
|
||||
@@ -456,48 +392,35 @@ TEST_CASE(
|
||||
mfem::Vector referenceGeometryAction;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, exactResidual
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant,
|
||||
exactResidual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant + 0.50, referenceResidual
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant + 0.50,
|
||||
referenceResidual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, displacementVariation,
|
||||
exactGeometryAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant,
|
||||
displacementVariation, exactGeometryAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant + 0.50,
|
||||
displacementVariation, referenceGeometryAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant + 0.50,
|
||||
displacementVariation, referenceGeometryAction
|
||||
);
|
||||
|
||||
const double exactResidualNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
exactResidual, communicator
|
||||
);
|
||||
const double exactResidualNorm = gravity_prepared_test_utils::global_norm(exactResidual, communicator);
|
||||
|
||||
const double referenceResidualNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
referenceResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(referenceResidual, communicator);
|
||||
|
||||
const double exactGeometryNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
exactGeometryAction, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(exactGeometryAction, communicator);
|
||||
|
||||
const double referenceGeometryNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
referenceGeometryAction, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::global_norm(referenceGeometryAction, communicator);
|
||||
|
||||
REQUIRE(referenceResidualNorm > 1.0e-12);
|
||||
|
||||
@@ -512,64 +435,49 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Hydrostatic Equilibrium Excludes Vacuum Elements",
|
||||
tags::barotrope &tags::hydro &tags::kernels &tags::mapping &tags::physics
|
||||
&tags::unit
|
||||
tags::barotrope &tags::hydro &tags::kernels &tags::mapping &tags::physics &tags::unit
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_zero_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_zero_rotation();
|
||||
|
||||
const mfem::Vector zeroEnthalpy(f.enthalpyFes->GetTrueVSize());
|
||||
|
||||
mfem::Vector enthalpy(zeroEnthalpy);
|
||||
enthalpy = 0.0;
|
||||
enthalpy = 0.0;
|
||||
|
||||
const mfem::Vector vacuumPotential =
|
||||
hydrostatic_kernel_test_utils::make_vacuum_supported_potential(f);
|
||||
const mfem::Vector vacuumPotential = hydrostatic_kernel_test_utils::make_vacuum_supported_potential(f);
|
||||
|
||||
const mfem::Vector stellarPotential =
|
||||
hydrostatic_kernel_test_utils::make_constant_field(
|
||||
*f.gravityPotentialFes, 1.0
|
||||
);
|
||||
hydrostatic_kernel_test_utils::make_constant_field(*f.gravityPotentialFes, 1.0);
|
||||
|
||||
const mfem::Vector displacement =
|
||||
gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
const mfem::Vector displacement = gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
|
||||
mfem::Vector residual;
|
||||
mfem::Vector vacuumAction;
|
||||
mfem::Vector stellarAction;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, vacuumPotential,
|
||||
displacement, 0.0, residual
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, vacuumPotential, displacement, 0.0, residual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, vacuumPotential, displacement,
|
||||
vacuumAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, vacuumPotential, displacement, vacuumAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, stellarPotential, displacement,
|
||||
stellarAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, stellarPotential, displacement, stellarAction
|
||||
);
|
||||
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
|
||||
const double residualNorm =
|
||||
gravity_prepared_test_utils::global_norm(residual, communicator);
|
||||
const double residualNorm = gravity_prepared_test_utils::global_norm(residual, communicator);
|
||||
|
||||
const double vacuumActionNorm =
|
||||
gravity_prepared_test_utils::global_norm(vacuumAction, communicator);
|
||||
const double vacuumActionNorm = gravity_prepared_test_utils::global_norm(vacuumAction, communicator);
|
||||
|
||||
const double stellarActionNorm =
|
||||
gravity_prepared_test_utils::global_norm(stellarAction, communicator);
|
||||
const double stellarActionNorm = gravity_prepared_test_utils::global_norm(stellarAction, communicator);
|
||||
|
||||
REQUIRE(stellarActionNorm > 1.0e-12);
|
||||
|
||||
@@ -580,40 +488,28 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Hydrostatic Jacobian Matches Blocks And Centered Differences",
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian
|
||||
&tags::kernels &tags::mapping &tags::physics
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian &tags::kernels &tags::mapping &tags::physics
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_rotation();
|
||||
|
||||
const mfem::Vector enthalpy =
|
||||
hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
const mfem::Vector enthalpy = hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
|
||||
const mfem::Vector potential =
|
||||
hydrostatic_kernel_test_utils::make_potential(f);
|
||||
const mfem::Vector potential = hydrostatic_kernel_test_utils::make_potential(f);
|
||||
|
||||
const mfem::Vector displacement =
|
||||
gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
const mfem::Vector displacement = gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
|
||||
const mfem::Vector enthalpyVariation =
|
||||
gravity_prepared_test_utils::make_deterministic_vector(
|
||||
f.enthalpyFes->GetTrueVSize(), 0.23
|
||||
);
|
||||
gravity_prepared_test_utils::make_deterministic_vector(f.enthalpyFes->GetTrueVSize(), 0.23);
|
||||
|
||||
const mfem::Vector potentialVariation =
|
||||
gravity_prepared_test_utils::make_deterministic_vector(
|
||||
f.gravityPotentialFes->GetTrueVSize(), 0.47
|
||||
);
|
||||
gravity_prepared_test_utils::make_deterministic_vector(f.gravityPotentialFes->GetTrueVSize(), 0.47);
|
||||
|
||||
const mfem::Vector displacementVariation =
|
||||
gravity_prepared_test_utils::make_deterministic_vector(
|
||||
f.displacementFes->GetTrueVSize(), 0.71
|
||||
);
|
||||
gravity_prepared_test_utils::make_deterministic_vector(f.displacementFes->GetTrueVSize(), 0.71);
|
||||
|
||||
constexpr double bernoulliConstant = 0.41;
|
||||
constexpr double constantVariation = -0.37;
|
||||
@@ -625,35 +521,26 @@ TEST_CASE(
|
||||
mfem::Vector displacementAction;
|
||||
mfem::Vector completeAction;
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_enthalpy_action(
|
||||
f, *f.domainMapperStateless, enthalpyVariation, displacement,
|
||||
enthalpyAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_enthalpy_action(
|
||||
f, *f.domainMapperStateless, enthalpyVariation, displacement, enthalpyAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, potentialVariation, displacement,
|
||||
potentialAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_potential_action(
|
||||
f, *f.domainMapperStateless, potentialVariation, displacement, potentialAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_constant_action(
|
||||
f, *f.domainMapperStateless, constantVariation, displacement,
|
||||
constantAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_constant_action(
|
||||
f, *f.domainMapperStateless, constantVariation, displacement, constantAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, displacementVariation,
|
||||
displacementAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant,
|
||||
displacementVariation, displacementAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, enthalpyVariation, potentialVariation,
|
||||
constantVariation, displacementVariation, completeAction
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant, enthalpyVariation,
|
||||
potentialVariation, constantVariation, displacementVariation, completeAction
|
||||
);
|
||||
|
||||
mfem::Vector blockAction(enthalpyAction);
|
||||
@@ -663,25 +550,21 @@ TEST_CASE(
|
||||
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
|
||||
const double blockError = gravity_prepared_test_utils::relative_error(
|
||||
completeAction, blockAction, communicator
|
||||
);
|
||||
const double blockError = gravity_prepared_test_utils::relative_error(completeAction, blockAction, communicator);
|
||||
|
||||
INFO("Hydrostatic block reconstruction error = " << blockError);
|
||||
|
||||
CHECK(blockError < 5.0e-13);
|
||||
|
||||
auto evaluate_residual = [&f, &rotation](
|
||||
const mfem::Vector &trialEnthalpy,
|
||||
const mfem::Vector &trialPotential,
|
||||
const mfem::Vector &trialDisplacement,
|
||||
const double trialConstant
|
||||
const mfem::Vector &trialEnthalpy, const mfem::Vector &trialPotential,
|
||||
const mfem::Vector &trialDisplacement, const double trialConstant
|
||||
) {
|
||||
mfem::Vector residual;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, rotation, trialEnthalpy,
|
||||
trialPotential, trialDisplacement, trialConstant, residual
|
||||
f, *f.domainMapperStateless, rotation, trialEnthalpy, trialPotential, trialDisplacement, trialConstant,
|
||||
residual
|
||||
);
|
||||
|
||||
return residual;
|
||||
@@ -694,16 +577,10 @@ TEST_CASE(
|
||||
|
||||
minusEnthalpy.Add(-epsilon, enthalpyVariation);
|
||||
|
||||
const mfem::Vector enthalpyDifference =
|
||||
hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
plusEnthalpy, potential, displacement, bernoulliConstant
|
||||
),
|
||||
evaluate_residual(
|
||||
minusEnthalpy, potential, displacement, bernoulliConstant
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
const mfem::Vector enthalpyDifference = hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(plusEnthalpy, potential, displacement, bernoulliConstant),
|
||||
evaluate_residual(minusEnthalpy, potential, displacement, bernoulliConstant), epsilon
|
||||
);
|
||||
|
||||
mfem::Vector plusPotential(potential);
|
||||
mfem::Vector minusPotential(potential);
|
||||
@@ -712,29 +589,15 @@ TEST_CASE(
|
||||
|
||||
minusPotential.Add(-epsilon, potentialVariation);
|
||||
|
||||
const mfem::Vector potentialDifference =
|
||||
hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
enthalpy, plusPotential, displacement, bernoulliConstant
|
||||
),
|
||||
evaluate_residual(
|
||||
enthalpy, minusPotential, displacement, bernoulliConstant
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
const mfem::Vector potentialDifference = hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(enthalpy, plusPotential, displacement, bernoulliConstant),
|
||||
evaluate_residual(enthalpy, minusPotential, displacement, bernoulliConstant), epsilon
|
||||
);
|
||||
|
||||
const mfem::Vector constantDifference =
|
||||
hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
enthalpy, potential, displacement,
|
||||
bernoulliConstant + epsilon * constantVariation
|
||||
),
|
||||
evaluate_residual(
|
||||
enthalpy, potential, displacement,
|
||||
bernoulliConstant - epsilon * constantVariation
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
const mfem::Vector constantDifference = hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(enthalpy, potential, displacement, bernoulliConstant + epsilon * constantVariation),
|
||||
evaluate_residual(enthalpy, potential, displacement, bernoulliConstant - epsilon * constantVariation), epsilon
|
||||
);
|
||||
|
||||
mfem::Vector plusDisplacement(displacement);
|
||||
mfem::Vector minusDisplacement(displacement);
|
||||
@@ -743,33 +606,22 @@ TEST_CASE(
|
||||
|
||||
minusDisplacement.Add(-epsilon, displacementVariation);
|
||||
|
||||
const mfem::Vector displacementDifference =
|
||||
hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
enthalpy, potential, plusDisplacement, bernoulliConstant
|
||||
),
|
||||
evaluate_residual(
|
||||
enthalpy, potential, minusDisplacement, bernoulliConstant
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
|
||||
const double enthalpyError = gravity_prepared_test_utils::relative_error(
|
||||
enthalpyAction, enthalpyDifference, communicator
|
||||
const mfem::Vector displacementDifference = hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(enthalpy, potential, plusDisplacement, bernoulliConstant),
|
||||
evaluate_residual(enthalpy, potential, minusDisplacement, bernoulliConstant), epsilon
|
||||
);
|
||||
|
||||
const double potentialError = gravity_prepared_test_utils::relative_error(
|
||||
potentialAction, potentialDifference, communicator
|
||||
);
|
||||
const double enthalpyError =
|
||||
gravity_prepared_test_utils::relative_error(enthalpyAction, enthalpyDifference, communicator);
|
||||
|
||||
const double constantError = gravity_prepared_test_utils::relative_error(
|
||||
constantAction, constantDifference, communicator
|
||||
);
|
||||
const double potentialError =
|
||||
gravity_prepared_test_utils::relative_error(potentialAction, potentialDifference, communicator);
|
||||
|
||||
const double constantError =
|
||||
gravity_prepared_test_utils::relative_error(constantAction, constantDifference, communicator);
|
||||
|
||||
const double displacementError =
|
||||
gravity_prepared_test_utils::relative_error(
|
||||
displacementAction, displacementDifference, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::relative_error(displacementAction, displacementDifference, communicator);
|
||||
|
||||
INFO("Hydrostatic enthalpy-block error = " << enthalpyError);
|
||||
|
||||
@@ -803,35 +655,26 @@ TEST_CASE(
|
||||
|
||||
combinedMinusDisplacement.Add(-epsilon, displacementVariation);
|
||||
|
||||
const mfem::Vector combinedDifference =
|
||||
hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
combinedPlusEnthalpy, combinedPlusPotential,
|
||||
combinedPlusDisplacement,
|
||||
bernoulliConstant + epsilon * constantVariation
|
||||
),
|
||||
evaluate_residual(
|
||||
combinedMinusEnthalpy, combinedMinusPotential,
|
||||
combinedMinusDisplacement,
|
||||
bernoulliConstant - epsilon * constantVariation
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
const mfem::Vector combinedDifference = hydrostatic_kernel_test_utils::centered_difference(
|
||||
evaluate_residual(
|
||||
combinedPlusEnthalpy, combinedPlusPotential, combinedPlusDisplacement,
|
||||
bernoulliConstant + epsilon * constantVariation
|
||||
),
|
||||
evaluate_residual(
|
||||
combinedMinusEnthalpy, combinedMinusPotential, combinedMinusDisplacement,
|
||||
bernoulliConstant - epsilon * constantVariation
|
||||
),
|
||||
epsilon
|
||||
);
|
||||
|
||||
const double blockNormSum =
|
||||
gravity_prepared_test_utils::global_norm(enthalpyAction, communicator) +
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
potentialAction, communicator
|
||||
) +
|
||||
gravity_prepared_test_utils::global_norm(constantAction, communicator) +
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
displacementAction, communicator
|
||||
);
|
||||
const double blockNormSum = gravity_prepared_test_utils::global_norm(enthalpyAction, communicator) +
|
||||
gravity_prepared_test_utils::global_norm(potentialAction, communicator) +
|
||||
gravity_prepared_test_utils::global_norm(constantAction, communicator) +
|
||||
gravity_prepared_test_utils::global_norm(displacementAction, communicator);
|
||||
|
||||
const double simultaneousError =
|
||||
hydrostatic_kernel_test_utils::sum_normalized_error(
|
||||
completeAction, combinedDifference, blockNormSum, communicator
|
||||
);
|
||||
const double simultaneousError = hydrostatic_kernel_test_utils::sum_normalized_error(
|
||||
completeAction, combinedDifference, blockNormSum, communicator
|
||||
);
|
||||
|
||||
INFO("Hydrostatic simultaneous Jacobian error = " << simultaneousError);
|
||||
|
||||
@@ -840,75 +683,58 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Hydrostatic Displacement Action Is Linear In Its Direction",
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian
|
||||
&tags::mapping &tags::physics &tags::unit
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::jacobian &tags::mapping &tags::physics &tags::unit
|
||||
&tags::kernels
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
const mean_field::physics::RigidRotation rotation =
|
||||
hydrostatic_kernel_test_utils::make_rotation();
|
||||
const mean_field::physics::RigidRotation rotation = hydrostatic_kernel_test_utils::make_rotation();
|
||||
|
||||
const mfem::Vector enthalpy =
|
||||
hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
const mfem::Vector enthalpy = hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
|
||||
const mfem::Vector potential =
|
||||
hydrostatic_kernel_test_utils::make_potential(f);
|
||||
const mfem::Vector potential = hydrostatic_kernel_test_utils::make_potential(f);
|
||||
|
||||
const mfem::Vector displacement =
|
||||
gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
const mfem::Vector displacement = gravity_prepared_test_utils::make_displacement(f, 1.0);
|
||||
|
||||
const mfem::Vector firstDirection =
|
||||
gravity_prepared_test_utils::make_deterministic_vector(
|
||||
f.displacementFes->GetTrueVSize(), 0.31
|
||||
);
|
||||
gravity_prepared_test_utils::make_deterministic_vector(f.displacementFes->GetTrueVSize(), 0.31);
|
||||
|
||||
const mfem::Vector secondDirection =
|
||||
gravity_prepared_test_utils::make_deterministic_vector(
|
||||
f.displacementFes->GetTrueVSize(), 0.83
|
||||
);
|
||||
gravity_prepared_test_utils::make_deterministic_vector(f.displacementFes->GetTrueVSize(), 0.83);
|
||||
|
||||
constexpr double firstScale = 0.43;
|
||||
constexpr double secondScale = -0.29;
|
||||
constexpr double bernoulliConstant = 0.41;
|
||||
|
||||
const mfem::Vector combinedDirection =
|
||||
gravity_prepared_test_utils::linear_combination(
|
||||
firstDirection, firstScale, secondDirection, secondScale
|
||||
);
|
||||
gravity_prepared_test_utils::linear_combination(firstDirection, firstScale, secondDirection, secondScale);
|
||||
|
||||
mfem::Vector firstAction;
|
||||
mfem::Vector secondAction;
|
||||
mfem::Vector combinedAction;
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, firstDirection, firstAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant, firstDirection,
|
||||
firstAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, secondDirection, secondAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant, secondDirection,
|
||||
secondAction
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::
|
||||
apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential,
|
||||
displacement, bernoulliConstant, combinedDirection, combinedAction
|
||||
);
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium_displacement_action(
|
||||
f, *f.domainMapperStateless, rotation, enthalpy, potential, displacement, bernoulliConstant, combinedDirection,
|
||||
combinedAction
|
||||
);
|
||||
|
||||
const mfem::Vector expectedAction =
|
||||
gravity_prepared_test_utils::linear_combination(
|
||||
firstAction, firstScale, secondAction, secondScale
|
||||
);
|
||||
gravity_prepared_test_utils::linear_combination(firstAction, firstScale, secondAction, secondScale);
|
||||
|
||||
const double linearityError = gravity_prepared_test_utils::relative_error(
|
||||
combinedAction, expectedAction, f.mesh->GetComm()
|
||||
);
|
||||
const double linearityError =
|
||||
gravity_prepared_test_utils::relative_error(combinedAction, expectedAction, f.mesh->GetComm());
|
||||
|
||||
INFO("Hydrostatic displacement-linearity error = " << linearityError);
|
||||
|
||||
@@ -917,13 +743,11 @@ TEST_CASE(
|
||||
|
||||
TEST_CASE(
|
||||
"Hydrostatic Residual Is Translationally Invariant On Deformed Geometry",
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::kernels
|
||||
&tags::mapping &tags::physics &tags::residuals
|
||||
tags::barotrope &tags::hydro &tags::integration &tags::kernels &tags::mapping &tags::physics &tags::residuals
|
||||
) {
|
||||
auto args = test_utils::setup_args();
|
||||
auto args = test_utils::setup_args();
|
||||
|
||||
mean_field::fem::FEM f =
|
||||
mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
mean_field::fem::FEM f = mean_field::fem::setup_fem(args.mesh_file, args, 0);
|
||||
|
||||
mfem::Vector angularVelocity(3);
|
||||
|
||||
@@ -946,33 +770,25 @@ TEST_CASE(
|
||||
mfem::Vector translatedCenter(center);
|
||||
translatedCenter += translation;
|
||||
|
||||
const mean_field::physics::RigidRotation baseRotation(
|
||||
angularVelocity, center
|
||||
);
|
||||
const mean_field::physics::RigidRotation baseRotation(angularVelocity, center);
|
||||
|
||||
const mean_field::physics::RigidRotation translatedRotation(
|
||||
angularVelocity, translatedCenter
|
||||
);
|
||||
const mean_field::physics::RigidRotation translatedRotation(angularVelocity, translatedCenter);
|
||||
|
||||
const mfem::Vector enthalpy =
|
||||
hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
const mfem::Vector enthalpy = hydrostatic_kernel_test_utils::make_enthalpy(f);
|
||||
|
||||
const mfem::Vector potential =
|
||||
hydrostatic_kernel_test_utils::make_potential(f);
|
||||
const mfem::Vector potential = hydrostatic_kernel_test_utils::make_potential(f);
|
||||
|
||||
/*
|
||||
* Use a nontrivially deformed base state so this checks rotation
|
||||
* and mapped geometry simultaneously. The comparison state adds
|
||||
* an exactly representable rigid translation to that deformation.
|
||||
*/
|
||||
const mfem::Vector baseDisplacement =
|
||||
gravity_prepared_test_utils::make_displacement(f, 0.73);
|
||||
const mfem::Vector baseDisplacement = gravity_prepared_test_utils::make_displacement(f, 0.73);
|
||||
|
||||
mfem::ParGridFunction translationField(f.displacementFes.get());
|
||||
|
||||
mfem::VectorFunctionCoefficient translationCoefficient(
|
||||
f.mesh->Dimension(),
|
||||
[&translation](const mfem::Vector &, mfem::Vector &value) {
|
||||
f.mesh->Dimension(), [&translation](const mfem::Vector &, mfem::Vector &value) {
|
||||
value.SetSize(translation.Size());
|
||||
value = translation;
|
||||
}
|
||||
@@ -994,13 +810,13 @@ TEST_CASE(
|
||||
mfem::Vector untranslatedCenterResidual;
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, baseRotation, enthalpy, potential,
|
||||
baseDisplacement, bernoulliConstant, baseResidual
|
||||
f, *f.domainMapperStateless, baseRotation, enthalpy, potential, baseDisplacement, bernoulliConstant,
|
||||
baseResidual
|
||||
);
|
||||
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, translatedRotation, enthalpy, potential,
|
||||
translatedDisplacement, bernoulliConstant, translatedResidual
|
||||
f, *f.domainMapperStateless, translatedRotation, enthalpy, potential, translatedDisplacement, bernoulliConstant,
|
||||
translatedResidual
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -1008,43 +824,29 @@ TEST_CASE(
|
||||
* center fixed. This must not agree with the covariant result.
|
||||
*/
|
||||
mean_field::operators::kernels::apply_hydrostatic_equilibrium(
|
||||
f, *f.domainMapperStateless, baseRotation, enthalpy, potential,
|
||||
translatedDisplacement, bernoulliConstant, untranslatedCenterResidual
|
||||
f, *f.domainMapperStateless, baseRotation, enthalpy, potential, translatedDisplacement, bernoulliConstant,
|
||||
untranslatedCenterResidual
|
||||
);
|
||||
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
const MPI_Comm communicator = f.mesh->GetComm();
|
||||
|
||||
const double baseResidualNorm =
|
||||
gravity_prepared_test_utils::global_norm(baseResidual, communicator);
|
||||
const double baseResidualNorm = gravity_prepared_test_utils::global_norm(baseResidual, communicator);
|
||||
|
||||
const double translatedResidualNorm =
|
||||
gravity_prepared_test_utils::global_norm(
|
||||
translatedResidual, communicator
|
||||
);
|
||||
const double translatedResidualNorm = gravity_prepared_test_utils::global_norm(translatedResidual, communicator);
|
||||
|
||||
const double translationInvarianceError =
|
||||
gravity_prepared_test_utils::relative_error(
|
||||
translatedResidual, baseResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::relative_error(translatedResidual, baseResidual, communicator);
|
||||
|
||||
const double fixedCenterDifference =
|
||||
gravity_prepared_test_utils::relative_error(
|
||||
untranslatedCenterResidual, translatedResidual, communicator
|
||||
);
|
||||
gravity_prepared_test_utils::relative_error(untranslatedCenterResidual, translatedResidual, communicator);
|
||||
|
||||
INFO("Base deformed hydrostatic residual norm = " << baseResidualNorm);
|
||||
|
||||
INFO("Translated hydrostatic residual norm = " << translatedResidualNorm);
|
||||
|
||||
INFO(
|
||||
"Mapped-rotation translation invariance error = "
|
||||
<< translationInvarianceError
|
||||
);
|
||||
INFO("Mapped-rotation translation invariance error = " << translationInvarianceError);
|
||||
|
||||
INFO(
|
||||
"Relative change with untranslated rotation center = "
|
||||
<< fixedCenterDifference
|
||||
);
|
||||
INFO("Relative change with untranslated rotation center = " << fixedCenterDifference);
|
||||
|
||||
REQUIRE(baseResidualNorm > 1.0e-12);
|
||||
REQUIRE(translatedResidualNorm > 1.0e-12);
|
||||
|
||||
Reference in New Issue
Block a user