From 53798d849ef0065919182e2540716c34f654c531 Mon Sep 17 00:00:00 2001 From: Alex Lindsay Date: Sun, 10 Nov 2024 13:24:26 -0800 Subject: [PATCH] Error if bx norm postprocessor doesn't execute on linear --- framework/src/problems/EigenProblem.C | 11 +++++++++++ test/tests/problems/eigen_problem/jfnk_mo/tests | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/framework/src/problems/EigenProblem.C b/framework/src/problems/EigenProblem.C index d4b6073e3ef0..02c2e3c9793e 100644 --- a/framework/src/problems/EigenProblem.C +++ b/framework/src/problems/EigenProblem.C @@ -19,6 +19,7 @@ #include "OutputWarehouse.h" #include "Function.h" #include "MooseVariableScalar.h" +#include "UserObject.h" // libMesh includes #include "libmesh/system.h" @@ -493,6 +494,16 @@ EigenProblem::checkProblemIntegrity() { FEProblemBase::checkProblemIntegrity(); _nl_eigen->checkIntegrity(); + if (_bx_norm_name) + { + if (!isNonlinearEigenvalueSolver()) + paramWarning("bx_norm", "This parameter is only used for nonlinear solve types"); + else if (auto & pp = getUserObjectBase(_bx_norm_name.value()); + !pp.getExecuteOnEnum().contains(EXEC_LINEAR)) + pp.paramError("execute_on", + "If providing the Bx norm, this postprocessor must execute on linear e.g. " + "during residual evaluations"); + } } void diff --git a/test/tests/problems/eigen_problem/jfnk_mo/tests b/test/tests/problems/eigen_problem/jfnk_mo/tests index 1af1368a4875..66fccbf57158 100644 --- a/test/tests/problems/eigen_problem/jfnk_mo/tests +++ b/test/tests/problems/eigen_problem/jfnk_mo/tests @@ -72,14 +72,23 @@ slepc = true slepc_version = '>=3.11.0' detail = 'computed by a user provided postprocessor.' + prereq = 'ne_coupled_mo/l2_bx' [] [] + [missing_bx_norm_exec_linear] + type = RunException + issues = '#28993' + input = ne_coupled_mo.i + cli_args = "Problem/bx_norm=uint Postprocessors/uint/execute_on='initial nonlinear'" + requirement = 'The system shall error if the user wants the Bx norm provided by a postprocessor but the postprocessor is not executed during residual evaluations.' + expect_err = "If providing the Bx norm, this postprocessor must execute on linear" + [] [ne_coupled_mo_full] type = 'CSVDiff' input = 'ne_coupled_mo.i' csvdiff = 'ne_coupled_eigenvalues_0001.csv' - prereq = 'ne_coupled_mo' + prereq = 'ne_coupled_mo/custom_bx' cli_args = 'Preconditioning/active=''' slepc = true slepc_version = '>=3.11.0'