Grad-div Problem

Summary

Solves a diffusion problem for a vector field on a cuboid domain, discretized using conforming Raviart-Thomas elements. This example is based on MFEM Example 4 and is relevant for solving Maxwell's equations using potentials without the Coulomb gauge.

Description

This problem solves a grad-div equation with strong form:

where

In this example, we solve this using the weak form

where

Example File

# Grad-div problem using method of manufactured solutions,
# based on MFEM Example 4.

[Mesh<<<{"href": "../Mesh/index.html"}>>>]
  type = MFEMFileMesh
  file = ../mesh/beam-tet.mesh
  uniform_refine<<<{"description": "Specify the level of uniform refinement applied to the initial mesh"}>>> = 1
[]

[Problem<<<{"href": "../Problem/index.html"}>>>]
  type = MFEMProblem
[]

[FESpaces]
  [HDivFESpace]
    type = MFEMVectorFESpace
    fec_type = RT
    fec_order = CONSTANT
    ordering = "vdim"
  []
  [L2FESpace]
    type = MFEMScalarFESpace
    fec_type = L2
    fec_order = CONSTANT
    basis = GaussLegendre
  []
[]

[Variables<<<{"href": "../Variables/index.html"}>>>]
  [F]
    type = MFEMVariable
    fespace = HDivFESpace
  []
[]

[AuxVariables<<<{"href": "../AuxVariables/index.html"}>>>]
  [divF]
    type = MFEMVariable
    fespace = L2FESpace
  []
[]

[AuxKernels<<<{"href": "../AuxKernels/index.html"}>>>]
  [div]
    type = MFEMDivAux
    variable = divF
    source = F
    execute_on = TIMESTEP_END
  []
[]

[Functions<<<{"href": "../Functions/index.html"}>>>]
  [f]
    type = ParsedVectorFunction<<<{"description": "Returns a vector function based on string descriptions for each component.", "href": "../../source/functions/MooseParsedVectorFunction.html"}>>>
    expression_x<<<{"description": "x-component of function."}>>> = '(1. + 2*kappa * kappa) * cos(kappa * x) * sin(kappa * y)'
    expression_y<<<{"description": "y-component of function."}>>> = '(1. + 2*kappa * kappa) * cos(kappa * y) * sin(kappa * x)'
    expression_z<<<{"description": "z-component of function."}>>> = '0'

    symbol_names<<<{"description": "Symbols (excluding t,x,y,z) that are bound to the values provided by the corresponding items in the symbol_values vector."}>>> = kappa
    symbol_values<<<{"description": "Constant numeric values, postprocessor names, function names, and scalar variables corresponding to the symbols in symbol_names."}>>> = 3.1415926535
  []
  [F_exact]
    type = ParsedVectorFunction<<<{"description": "Returns a vector function based on string descriptions for each component.", "href": "../../source/functions/MooseParsedVectorFunction.html"}>>>
    expression_x<<<{"description": "x-component of function."}>>> = 'cos(kappa * x) * sin(kappa * y)'
    expression_y<<<{"description": "y-component of function."}>>> = 'cos(kappa * y) * sin(kappa * x)'
    expression_z<<<{"description": "z-component of function."}>>> = '0'

    symbol_names<<<{"description": "Symbols (excluding t,x,y,z) that are bound to the values provided by the corresponding items in the symbol_values vector."}>>> = kappa
    symbol_values<<<{"description": "Constant numeric values, postprocessor names, function names, and scalar variables corresponding to the symbols in symbol_names."}>>> = 3.1415926535
  []
[]

[BCs<<<{"href": "../BCs/index.html"}>>>]
  [dirichlet]
    type = MFEMVectorNormalDirichletBC
    variable = F
    boundary = '1 2 3'
    vector_coefficient = F_exact
  []
[]

[Kernels<<<{"href": "../Kernels/index.html"}>>>]
  [divdiv]
    type = MFEMDivDivKernel
    variable = F
  []
  [mass]
    type = MFEMVectorFEMassKernel
    variable = F
  []
  [source]
    type = MFEMVectorFEDomainLFKernel
    variable = F
    vector_coefficient = f
  []
[]

[Solvers]
  [ADS]
    type = MFEMHypreADS
    fespace = HDivFESpace
  []
  [main]
    type = MFEMCGSolver
    preconditioner = ADS
    l_tol = 1e-16
    l_max_its = 1000
    print_level = 2
  []
[]

[Executioner<<<{"href": "../Executioner/index.html"}>>>]
  type = MFEMSteady
  device = "cpu"
[]

[VectorPostprocessors<<<{"href": "../VectorPostprocessors/index.html"}>>>]
  [F_line_sample]
    type = MFEMVariableLineValueSampler
    variable = 'F'
    start_point = '0.01 0.013 0.014'
    end_point = '7.98 0.99 0.97'
    num_points = 114
  []
  [divF_line_sample]
    type = MFEMVariableLineValueSampler
    variable = 'divF'
    start_point = '0.01 0.013 0.014'
    end_point = '7.98 0.99 0.97'
    num_points = 114
  []
[]

[Outputs<<<{"href": "../Outputs/index.html"}>>>]
  [CSV]
    type = CSV<<<{"description": "Output for postprocessors, vector postprocessors, and scalar variables using comma seperated values (CSV).", "href": "../../source/outputs/CSV.html"}>>>
    execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = 'timestep_end'
    file_base<<<{"description": "The desired solution output name without an extension. If not provided, MOOSE sets it with Outputs/file_base when available. Otherwise, MOOSE uses input file name and this object name for a master input or uses master file_base, the subapp name and this object name for a subapp input to set it."}>>> = OutputData/GradDiv/graddiv
  []
[]
(moose/test/tests/mfem/kernels/graddiv.i)