From 275e912496ca21bd2cbc094ea57ac0ff2097c6d3 Mon Sep 17 00:00:00 2001 From: Peter German Date: Thu, 28 Sep 2023 13:20:04 -0600 Subject: [PATCH] Transform condition into assertion. (#25599) --- framework/src/fviks/FVInterfaceKernel.C | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/framework/src/fviks/FVInterfaceKernel.C b/framework/src/fviks/FVInterfaceKernel.C index 553f9235f687..0d9cc4e8e907 100644 --- a/framework/src/fviks/FVInterfaceKernel.C +++ b/framework/src/fviks/FVInterfaceKernel.C @@ -190,9 +190,10 @@ FVInterfaceKernel::computeResidual(const FaceInfo & fi) // If the two variables belong to two different nonlinear systems, we only contribute to the one // which is being assembled right now - if (_var1.sys().number() == _subproblem.currentNlSysNum()) - addResidual(_elem_is_one ? r : -r, _var1.number(), _elem_is_one ? false : true); - if (_var2.sys().number() == _subproblem.currentNlSysNum()) + mooseAssert(_var1.sys().number() == _subproblem.currentNlSysNum(), + "The interface kernel should contribute to the system which variable1 belongs to!"); + addResidual(_elem_is_one ? r : -r, _var1.number(), _elem_is_one ? false : true); + if (_var1.sys().number() == _var2.sys().number()) addResidual(_elem_is_one ? -r : r, _var2.number(), _elem_is_one ? true : false); } @@ -211,12 +212,13 @@ FVInterfaceKernel::computeJacobian(const FaceInfo & fi) // If the two variables belong to two different nonlinear systems, we only contribute to the one // which is being assembled right now - if (_var1.sys().number() == _subproblem.currentNlSysNum()) - addResidualsAndJacobian(_assembly, - std::array{{_elem_is_one ? r : -r}}, - _elem_is_one ? _var1.dofIndices() : _var1.dofIndicesNeighbor(), - _var1.scalingFactor()); - if (_var2.sys().number() == _subproblem.currentNlSysNum()) + mooseAssert(_var1.sys().number() == _subproblem.currentNlSysNum(), + "The interface kernel should contribute to the system which variable1 belongs to!"); + addResidualsAndJacobian(_assembly, + std::array{{_elem_is_one ? r : -r}}, + _elem_is_one ? _var1.dofIndices() : _var1.dofIndicesNeighbor(), + _var1.scalingFactor()); + if (_var1.sys().number() == _var2.sys().number()) addResidualsAndJacobian(_assembly, std::array{{_elem_is_one ? -r : r}}, _elem_is_one ? _var2.dofIndicesNeighbor() : _var2.dofIndices(),