Skip to content

Commit

Permalink
Implement FaceArg evaluation for finite element variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Oct 18, 2023
1 parent dfa2799 commit c8de23f
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 4 deletions.
5 changes: 1 addition & 4 deletions framework/include/variables/MooseVariableFE.h
Expand Up @@ -704,10 +704,7 @@ class MooseVariableFE : public MooseVariableField<OutputType>
ValueType evaluate(const ElemArg &, const StateArg &) const override final;
ValueType evaluate(const ElemPointArg &, const StateArg &) const override final;
ValueType evaluate(const NodeArg & node_arg, const StateArg & state) const override final;
ValueType evaluate(const FaceArg &, const StateArg &) const override final
{
mooseError("Face info functor overload not yet implemented for finite element variables");
}
ValueType evaluate(const FaceArg &, const StateArg &) const override final;

GradientType evaluateGradient(const ElemQpArg & elem_qp, const StateArg & state) const override;
GradientType evaluateGradient(const ElemSideQpArg & elem_side_qp,
Expand Down
12 changes: 12 additions & 0 deletions framework/src/variables/MooseVariableFE.C
Expand Up @@ -1031,6 +1031,18 @@ MooseVariableFE<OutputType>::evaluate(const ElemArg & elem_arg, const StateArg &
return _current_elem_qp_functor_sln[0];
}

template <typename OutputType>
typename MooseVariableFE<OutputType>::ValueType
MooseVariableFE<OutputType>::evaluate(const FaceArg & face_arg, const StateArg & state) const
{
const QMonomial qrule(face_arg.fi->elem().dim() - 1, CONSTANT);
// We can use whatever we want for the point argument since it won't be used
const ElemSideQpArg elem_side_qp_arg{
face_arg.fi->elemPtr(), face_arg.fi->elemSideID(), /*qp=*/0, &qrule, Point(0, 0, 0)};
evaluateOnElementSide(elem_side_qp_arg, state, /*cache_eligible=*/false);
return _current_elem_side_qp_functor_sln[0];
}

template <typename OutputType>
typename MooseVariableFE<OutputType>::ValueType
MooseVariableFE<OutputType>::evaluate(const ElemPointArg & elem_point_arg,
Expand Down
Binary file not shown.
68 changes: 68 additions & 0 deletions test/tests/functors/fe-var-for-fv-neumann/test.i
@@ -0,0 +1,68 @@
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 1
nx = 20
[]
[]

[Variables]
[fe][]
[fv]
type = MooseVariableFVReal
[]
[]

[Kernels]
[diff]
type = Diffusion
variable = fe
[]
[]

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

[BCs]
[left]
type = DirichletBC
variable = fe
value = 0
boundary = left
[]
[right]
type = DirichletBC
variable = fe
value = 1
boundary = right
[]
[]

[FVBCs]
[left]
type = FVDirichletBC
variable = fv
value = 0
boundary = left
[]
[right]
type = FVFunctorNeumannBC
variable = fv
functor = fe
boundary = right
[]
[]

[Executioner]
type = Steady
solve_type = NEWTON
[]

[Outputs]
exodus = true
[]
17 changes: 17 additions & 0 deletions test/tests/functors/fe-var-for-fv-neumann/tests
@@ -0,0 +1,17 @@
[Tests]
design = 'Functors/index.md'
issues = '#19420'
[exo]
type = Exodiff
input = test.i
exodiff = test_out.e
requirement = 'The system shall be able to accurately evaluate a finite element variable through the functor system in a finite volume Dirichlet boundary condition.'
[]
[jac]
type = PetscJacobianTester
ratio_tol = 1e-7
difference_tol = 1e-5
input = test.i
run_sim = True
[]
[]

0 comments on commit c8de23f

Please sign in to comment.