MFEML2Error

Summary

Computes L2 error for gridfucntions using H1 or L2 elements.

Overview

Postprocessor for calculating the L2 error of a scalar or conforming source variable compared to a scalar function.

where and is a scalar function.

Example Input File Syntax

# 2D irrotational vortex with Nedelec elements of the first kind.

centre_x = -0.75
centre_y = 0.1

[Mesh]
  type = MFEMMesh
  file = gold/vortex.msh
  dim = 2
[]

[Problem]
  type = MFEMProblem
[]

[FESpaces]
  [H1FESpace]
    type = MFEMScalarFESpace
    fec_type = H1
    fec_order = SEVENTH
  []
  [HCurlFESpace]
    type = MFEMVectorFESpace
    fec_type = ND
    fec_order = SEVENTH
  []
[]

[Variables]
  [velocity_potential]
    type = MFEMVariable
    fespace = H1FESpace
  []
[]

[AuxVariables]
  [velocity]
    type = MFEMVariable
    fespace = HCurlFESpace
  []
[]

[Functions]
  [speed]
    type = ParsedFunction
    expression = '1 / sqrt((x-x0)^2 + (y-y0)^2)'
    symbol_names = 'x0 y0'
  symbol_values = '${centre_x} ${centre_y}'
  []
  [theta]
    type = ParsedFunction
    expression = 'atan2(y-y0, x-x0)'
    symbol_names = 'x0 y0'
    symbol_values = '${centre_x} ${centre_y}'
  []  
  [exact_velocity]
    type = ParsedVectorFunction
    expression_x = '-v * sin(th)'
    expression_y = 'v * cos(th)'
    symbol_names = 'v th'
    symbol_values = 'speed theta'
  []
[]

[BCs]
  [potential_velocity_boundary]
    type = MFEMScalarFunctorDirichletBC
    variable = velocity_potential
    boundary = '1'
    coefficient = theta
  []
[]

[Materials]
  [Substance]
    type = MFEMGenericConstantMaterial
    prop_names = one
    prop_values = 1.0
  []
[]

[Kernels]
  [laplacian]
    type = MFEMDiffusionKernel
    variable = velocity_potential
    coefficient = one
  []
[]

[AuxKernels]
  [grad]
    type = MFEMGradAux
    variable = velocity
    source = velocity_potential
    execute_on = TIMESTEP_END
  []
[]

[Preconditioner]
  [boomeramg]
    type = MFEMHypreBoomerAMG
  []
[]

[Solver]
  type = MFEMHypreGMRES
  preconditioner = boomeramg
  l_tol = 1e-16
  l_max_its = 1000
[]

[Executioner]
  type = MFEMSteady
  device = cpu
[]

[Postprocessors]
  [potential_error]
    type = MFEML2Error
    variable = velocity_potential
    function = theta
    execution_order_group = 1
  []
  [velocity_error]
    type = MFEMVectorL2Error
    variable = velocity
    function = exact_velocity
    execution_order_group = 1
  []
[]

[Outputs]
  [ParaViewDataCollection]
    type = MFEMParaViewDataCollection
    file_base = OutputData/Irrotational
    vtk_format = ASCII
  []
  [L2CSV]
    type = CSV
    file_base = OutputData/Irrotational
  []
[]
(test/tests/kernels/irrotational.i)

Input Parameters

  • functionThe analytic solution to compare against.

    C++ Type:FunctionName

    Unit:(no unit assumed)

    Controllable:No

    Description:The analytic solution to compare against.

  • variableName of the variable of which to find the norm of the error.

    C++ Type:VariableName

    Unit:(no unit assumed)

    Controllable:No

    Description:Name of the variable of which to find the norm of the error.

Optional Parameters

  • allow_duplicate_execution_on_initialFalseIn the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

    Default:False

    C++ Type:bool

    Controllable:No

    Description:In the case where this UserObject is depended upon by an initial condition, allow it to be executed twice during the initial setup (once before the IC and again after mesh adaptivity (if applicable).

  • execute_onTIMESTEP_ENDThe 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.

    Default:TIMESTEP_END

    C++ Type:ExecFlagEnum

    Options:NONE, INITIAL, LINEAR, NONLINEAR_CONVERGENCE, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, TRANSFER

    Controllable:No

    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.

  • execution_order_group0Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

    Default:0

    C++ Type:int

    Controllable:No

    Description:Execution order groups are executed in increasing order (e.g., the lowest number is executed first). Note that negative group numbers may be used to execute groups before the default (0) group. Please refer to the user object documentation for ordering of user object execution within a group.

  • force_postauxFalseForces the UserObject to be executed in POSTAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in POSTAUX

  • force_preauxFalseForces the UserObject to be executed in PREAUX

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREAUX

  • force_preicFalseForces the UserObject to be executed in PREIC during initial setup

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Forces the UserObject to be executed in PREIC during initial setup

Execution Scheduling 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.

  • outputsVector of output names where you would like to restrict the output of variables(s) associated with this object

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

    Controllable:No

    Description:Vector of output names where you would like to restrict the output of variables(s) associated with this object

  • 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

  • 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

    Unit:(no unit assumed)

    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.

Material Property Retrieval Parameters

Input Files