Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only error when invalid maps are passed to base physics methods #1302

Merged
merged 8 commits into from
Dec 31, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void L2_scalar_valued_test(std::string meshfile)
interior_faces);

double t = 0.0;
check_gradient(residual, t, U0, U1);
check_gradient(residual, t, U0, U1, 2e-4);
}

TEST(basic, L2_mixed_scalar_test_tris_and_quads_linear)
Expand Down
20 changes: 15 additions & 5 deletions src/serac/physics/base_physics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class BasePhysics {
*/
virtual const std::unordered_map<std::string, const serac::FiniteElementDual&> computeInitialConditionSensitivity()
{
SLIC_ERROR_ROOT(axom::fmt::format("Initial condition sensitivities not enabled in physics module {}", name_));
SLIC_WARNING_ROOT(axom::fmt::format("Initial condition sensitivities not enabled in physics module {}", name_));
return {};
}

Expand All @@ -363,19 +363,29 @@ class BasePhysics {

/**
* @brief Set the loads for the adjoint reverse timestep solve
* @param string_to_dual An unorder map from the state field name string to the finite element adjoint/dual load
* The adjoint load is d(qoi)/d(state)
*/
virtual void setAdjointLoad(std::unordered_map<std::string, const serac::FiniteElementDual&>)
virtual void setAdjointLoad(std::unordered_map<std::string, const serac::FiniteElementDual&> string_to_dual)
{
SLIC_ERROR_ROOT(axom::fmt::format("Adjoint analysis not defined for physics module {}", name_));
if (!string_to_dual.empty()) {
SLIC_ERROR_ROOT(
axom::fmt::format("Failed to setAdjointLoad. Adjoint analysis not defined for physics module {}", name_));
}
}

/**
* @brief Set the dual loads (dirichlet values) for the adjoint reverse timestep solve
* This must be called after setAdjointLoad
* @param string_to_bc An unorder map from dual name string to finite element adjoint/state boundary condition
* The adjoint bc is d(qoi)/d(dual)
*/
virtual void setDualAdjointBcs(std::unordered_map<std::string, const serac::FiniteElementState&>)
virtual void setDualAdjointBcs(std::unordered_map<std::string, const serac::FiniteElementState&> string_to_bc)
{
SLIC_ERROR_ROOT(axom::fmt::format("Adjoint analysis not defined for physics module {}", name_));
if (!string_to_bc.empty()) {
SLIC_ERROR_ROOT(
axom::fmt::format("Failed to setDualAdjointBCs. Adjoint analysis not defined for physics module {}", name_));
}
}

/**
Expand Down