NodalL2Error

The L2-norm of the difference between a variable and a function computed at nodes.

This is typically used to compare a nodal variable to a known analytical solution. To compute the error with regards to a variable, instead of a function, you may use a ParsedAux to store the difference in an AuxVariable, then use the NodalL2Error or NodalL2Norm postprocessor to compute the norm.

Example input syntax

In this example, variable u is the solution of a diffusion-source problem. We know the analytical solution of this problem and use the NodalL2Error postprocessor to examine the quality of the numerical solution.

[Postprocessors]
  [./l2_error]
    type = NodalL2Error
    variable = u
    function = Soln
  [../]
[]

[Functions]
  [./dts]
    type = PiecewiseLinear
    x = '0.01 0.1'
    y = '0.005 0.05'
  [../]

  [./Soln]
    type = ParsedFunction
    expression = 't*(x*x+y*y)'
  [../]
  [./Source]
    type = ParsedFunction
    expression = '(x*x + y*y) - 4*t'
  [../]
  [./TopBC]
    type = ParsedFunction
    expression = 't*(x*x+1)'
  [../]
  [./BottomBC]
    type = ParsedFunction
    expression = 't*x*x'
  [../]
  [./RightBC]
    type = ParsedFunction
    expression = 't*(y*y+1)'
  [../]
  [./LeftBC]
    type = ParsedFunction
    expression = 't*y*y'
  [../]
[]
(moose/test/tests/auxkernels/time_integration/time_integration.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

  • variableThe name of the variable that this postprocessor operates on

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

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the variable that this postprocessor operates on

Required Parameters

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

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

    Unit:(no unit assumed)

    Controllable:No

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

  • boundaryThe list of boundaries (ids or names) from the mesh where this object applies

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

    Unit:(no unit assumed)

    Controllable:No

    Description:The list of boundaries (ids or names) from the mesh where this object applies

  • 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

    Unit:(no unit assumed)

    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.

  • unique_node_executeFalseWhen false (default), block restricted objects will have the execute method called multiple times on a single node if the node lies on a interface between two subdomains.

    Default:False

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:When false (default), block restricted objects will have the execute method called multiple times on a single node if the node lies on a interface between two subdomains.

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

    Unit:(no unit assumed)

    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).

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

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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • 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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    Controllable:No

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

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

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

    Unit:(no unit assumed)

    Controllable:No

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

  • seed0The seed for the master random number generator

    Default:0

    C++ Type:unsigned int

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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