Skip to content

Commit

Permalink
Add information to FVFluxBC error on faces it should not be triggered on
Browse files Browse the repository at this point in the history
Add test for FVFluxBCs to capture this error
Add test for FVNeumannBC for regular use
refs idaholab#16882
  • Loading branch information
GiudGiud committed Feb 10, 2021
1 parent e48c34b commit eabebef
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 3 deletions.
14 changes: 12 additions & 2 deletions framework/src/fvbcs/FVFluxBC.C
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ FVFluxBC::computeResidual(const FaceInfo & fi)
prepareVectorTag(_assembly, _var.number());
else if (ft == FaceInfo::VarFaceNeighbors::NEIGHBOR)
prepareVectorTagNeighbor(_assembly, _var.number());
else if (ft == FaceInfo::VarFaceNeighbors::BOTH)
mooseError("A FVFluxBC is being triggered on an internal face with centroid: ",
fi.faceCentroid());
else
mooseError("should never get here");
mooseError("A FVFluxBC is being triggered on a face which does not connect to a block ",
"with the relevant finite volume variable. Its centroid: ",
fi.faceCentroid());

_local_re(0) = r;
accumulateTaggedLocalResidual();
Expand Down Expand Up @@ -160,8 +165,13 @@ FVFluxBC::computeJacobian(const FaceInfo & fi)
computeJacobian(Moose::ElementElement, residual);
else if (ft == FaceInfo::VarFaceNeighbors::NEIGHBOR)
computeJacobian(Moose::NeighborNeighbor, residual);
else if (ft == FaceInfo::VarFaceNeighbors::BOTH)
mooseError("A FVFluxBC is being triggered on an internal face with centroid: ",
fi.faceCentroid());
else
mooseError("should never get here");
mooseError("A FVFluxBC is being triggered on a face which does not connect to a block ",
"with the relevant finite volume variable. Its centroid: ",
fi.faceCentroid());
};

_assembly.processDerivatives(r, _var.dofIndices()[0], _matrix_tags, local_functor);
Expand Down
73 changes: 73 additions & 0 deletions test/tests/fvbcs/fv_neumannbc/fv_neumannbc.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[Mesh]
[mesh]
type = CartesianMeshGenerator
dim = 2
dx = '1 1'
dy = '1'
ix = '5 5'
iy = '5'
subdomain_id = '1 1'
[]
[internal_sideset]
type = ParsedGenerateSideset
combinatorial_geometry = 'x<1.01 & x>0.99'
included_subdomain_ids = 1
new_sideset_name = 'center'
input = 'mesh'
[]
[]

[Variables]
[u]
family = MONOMIAL
order = CONSTANT
fv = true
block = 1
[]
[]

[FVKernels]
[diff]
type = FVDiffusion
variable = u
coeff = 1
[]
[]

[FVBCs]
inactive = 'center'
[left]
type = FVDirichletBC
variable = u
boundary = left
value = 1
[]
[right]
type = FVNeumannBC
variable = u
boundary = right
value = 4
[]
# Internal center sideset, should cause erroring out
[center]
type = FVNeumannBC
variable = u
boundary = center
value = 0
[]
[]

[Problem]
kernel_coverage_check = off
[]

[Executioner]
type = Steady
solve_type = 'Newton'
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]

[Outputs]
exodus = true
[]
Binary file not shown.
28 changes: 28 additions & 0 deletions test/tests/fvbcs/fv_neumannbc/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[Tests]
[fv_neumann]
design = 'FVNeumannBC.md'
issues = '#16477'
type = 'Exodiff'
input = 'fv_neumannbc.i'
exodiff = 'fv_neumannbc_out.e'
requirement = 'The system shall run a simple 1D diffusion problem with a Neumann BC value.'
[]
[fvbcs_internal]
design = 'FVNeumannBC.md'
issues = '#16882'
type = RunException
input = 'fv_neumannbc.i'
cli_args = "FVBCs/inactive=''"
expect_err = 'A FVFluxBC is being triggered on an internal face with centroid'
requirement = 'The system shall error out if FVFluxBC, in this case a FVNeumannBC, are used internally.'
[]
[fvbcs_disconnected_from_variable]
design = 'FVNeumannBC.md'
issues = '#16882'
type = RunException
input = 'fv_neumannbc.i'
expect_err = 'A FVFluxBC is being triggered on a face which does not connect to a block with the relevant finite volume variable.'
cli_args = "Mesh/mesh/subdomain_id='1 2'"
requirement = 'The system shall error out if FVFluxBC are used on a mesh face that is not connected to an element with the corresponding finite volume variable.'
[]
[]
2 changes: 1 addition & 1 deletion test/tests/transfers/multiapp_userobject_transfer/tests
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
input = 'restricted_elem_master.i'
exodiff = 'restricted_elem_master_out.e restricted_elem_master_out_ch00.e restricted_elem_master_out_ch10.e'

requirement = "The system shall transfer user-defined spatial data into block and boundary restricted elemntal variables."
requirement = "The system shall transfer user-defined spatial data into block and boundary restricted elemental variables."
design = "MultiAppUserObjectTransfer.md"
issues = '#16241'
[]
Expand Down

0 comments on commit eabebef

Please sign in to comment.