FVDiffusion

Computes residual for diffusion operator for finite volume method.

The steady-state diffusion equation on a domain is defined as

with the diffusion coefficient or diffusivity. has to be supplied as material property to this kernel.

The diffusion term is integrated using the divergence theorem, turning it from a volumetric second order derivative term into a first order derivative integrated over a surface.

where is the surface normal on each side of the element considered.

The diffusion coefficient can be interpolated to the surface using two approaches:

  • Simple arithmetic average: (with , being the diffusion coefficient in the neighboring cells respectively)

  • Simple harmonic average: , which yields better results if the diffusion coefficients are positive and discontinuous. This is due to the fact that this scheme preserves flux continuity in the face-normal direction on orthogonal grids.

The interpolation method can be set using the "coeff_interp_method" parameter, and is defaulted to harmonic due to its superior accuracy for discontinuous diffusion coefficients. Simple tests cases with discontinuous diffusion coefficients (see below) indicate that using harmonic interpolation yields a second-order accurate scheme for orthogonal and 1D meshes and close to second-order accurate scheme for slightly non-orthogonal meshes. At the same time, using a simple arithmetic average for the interpolation of discontinuous diffusion coefficients yields a first order scheme.

commentnote

This kernel leverages the automatic differentiation system, so the Jacobian is computed at the same time as the residual and need not be defined separately.

Example input syntax

This example shows a simple 1D diffusion problem with two variables defined on two subdomains. Because of the limits of the legacy material system, the two material properties have to have different names, otherwise it is not clear what the boundary value of the diffusion coefficient should be.

[Mesh]
  [gen]
    type = GeneratedMeshGenerator
    dim = 1
    nx = 20
    xmax = 2
  []
  [subdomain1]
    input = gen
    type = SubdomainBoundingBoxGenerator
    bottom_left = '1.0 0 0'
    block_id = 1
    top_right = '2.0 1.0 0'
  []
  [left_right]
    input = subdomain1
    type = SideSetsBetweenSubdomainsGenerator
    primary_block = '0'
    paired_block = '1'
    new_boundary = 'left_right'
  []
  [right_left]
    input = left_right
    type = SideSetsBetweenSubdomainsGenerator
    primary_block = '1'
    paired_block = '0'
    new_boundary = 'right_left'
  []
[]

[Variables]
  [left]
    family = MONOMIAL
    order = CONSTANT
    fv = true
    block = 0
  []
  [right]
    family = MONOMIAL
    order = CONSTANT
    fv = true
    block = 1
  []
[]

[FVKernels]
  [left]
    type = FVDiffusion
    variable = left
    coeff = coeff_left
    block = 0
    coeff_interp_method = average
  []
  [right]
    type = FVDiffusion
    variable = right
    coeff = coeff_right
    block = 1
    coeff_interp_method = average
  []
[]

[FVBCs]
  [left]
    type = FVDirichletBC
    variable = left
    boundary = left
    value = 0
  []
  [left_right]
    type = FVDirichletBC
    variable = left
    boundary = left_right
    value = 1
  []
  [right_left]
    type = FVDirichletBC
    variable = right
    boundary = right_left
    value = 0
  []
  [right]
    type = FVDirichletBC
    variable = right
    boundary = right
    value = 1
  []
[]

[Materials]
  [left]
    type = ADGenericFunctorMaterial
    prop_names = 'coeff_left'
    prop_values = '1'
    block = 0
  []
  [right]
    type = ADGenericFunctorMaterial
    prop_names = 'coeff_right'
    prop_values = '1'
    block = 1
  []
[]

[Executioner]
  type = Steady
  solve_type = 'NEWTON'
  petsc_options_iname = '-pc_type -pc_hypre_type'
  petsc_options_value = 'hypre boomeramg'
  line_search = 'none'
[]

[Outputs]
  exodus = true
[]
(moose/test/tests/fvkernels/block-restriction/1d.i)

Input Parameters

  • coeffdiffusion coefficient. A functor is any of the following: a variable, a functor material property, a function, a post-processor, or a number.

    C++ Type:MooseFunctorName

    Controllable:No

    Description:diffusion coefficient. A functor is any of the following: a variable, a functor material property, a function, a post-processor, or a number.

  • variableThe name of the variable that this residual object operates on

    C++ Type:NonlinearVariableName

    Controllable:No

    Description:The name of the variable that this residual object operates on

Required Parameters

  • blockThe list of blocks (ids or names) that this object will be applied

    C++ Type:std::vector<SubdomainName>

    Controllable:No

    Description:The list of blocks (ids or names) that this object will be applied

  • coeff_interp_methodharmonicSwitch that can select face interpolation method for diffusion coefficients.

    Default:harmonic

    C++ Type:MooseEnum

    Options:average, harmonic

    Controllable:No

    Description:Switch that can select face interpolation method for diffusion coefficients.

  • prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

    C++ Type:MaterialPropertyName

    Controllable:No

    Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.

  • use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.

Optional Parameters

  • absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution

    C++ Type:std::vector<TagName>

    Controllable:No

    Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution

  • extra_matrix_tagsThe extra tags for the matrices this Kernel should fill

    C++ Type:std::vector<TagName>

    Controllable:No

    Description:The extra tags for the matrices this Kernel should fill

  • extra_vector_tagsThe extra tags for the vectors this Kernel should fill

    C++ Type:std::vector<TagName>

    Controllable:No

    Description:The extra tags for the vectors this Kernel should fill

  • matrix_tagssystemThe tag for the matrices this Kernel should fill

    Default:system

    C++ Type:MultiMooseEnum

    Options:nontime, system

    Controllable:No

    Description:The tag for the matrices this Kernel should fill

  • vector_tagsnontimeThe tag for the vectors this Kernel should fill

    Default:nontime

    C++ Type:MultiMooseEnum

    Options:nontime, time

    Controllable:No

    Description:The tag for the vectors this Kernel should fill

Tagging Parameters

  • boundaries_to_avoidThe set of sidesets to not execute this FVFluxKernel on. This takes precedence over force_boundary_execution to restrict to less external boundaries. By default flux kernels are executed on all internal boundaries and Dirichlet boundary conditions.

    C++ Type:std::vector<BoundaryName>

    Controllable:No

    Description:The set of sidesets to not execute this FVFluxKernel on. This takes precedence over force_boundary_execution to restrict to less external boundaries. By default flux kernels are executed on all internal boundaries and Dirichlet boundary conditions.

  • boundaries_to_forceThe set of sidesets to force execution of this FVFluxKernel on. Setting force_boundary_execution to true is equivalent to listing all external mesh boundaries in this parameter.

    C++ Type:std::vector<BoundaryName>

    Controllable:No

    Description:The set of sidesets to force execution of this FVFluxKernel on. Setting force_boundary_execution to true is equivalent to listing all external mesh boundaries in this parameter.

  • force_boundary_executionFalseWhether to force execution of this object on all external boundaries.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether to force execution of this object on all external boundaries.

Boundary Execution Modification Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • implicitTrueDetermines whether this object is calculated using an implicit or explicit form

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Determines whether this object is calculated using an implicit or explicit form

  • seed0The seed for the master random number generator

    Default:0

    C++ Type:unsigned int

    Controllable:No

    Description:The seed for the master random number generator

  • use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.

Advanced Parameters

  • ghost_layers2The number of layers of elements to ghost.

    Default:2

    C++ Type:unsigned short

    Controllable:No

    Description:The number of layers of elements to ghost.

  • use_point_neighborsFalseWhether to use point neighbors, which introduces additional ghosting to that used for simple face neighbors.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether to use point neighbors, which introduces additional ghosting to that used for simple face neighbors.

Parallel Ghosting Parameters