Skip to content

Commit

Permalink
Transform condition into assertion. (#25599)
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed Sep 28, 2023
1 parent 7bf27f2 commit 275e912
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions framework/src/fviks/FVInterfaceKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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<ADReal, 1>{{_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<ADReal, 1>{{_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<ADReal, 1>{{_elem_is_one ? -r : r}},
_elem_is_one ? _var2.dofIndicesNeighbor() : _var2.dofIndices(),
Expand Down

0 comments on commit 275e912

Please sign in to comment.