# RelativeDifferencePostprocessor

## Description

This post-processor computes the absolute value of the relative difference between 2 post-processor values: (1) where and are the 2 post-processor values. Note that is used as the base for the relative difference. If , then the absolute difference is used instead to prevent division by zero: (2)

## Example Syntax

The following example demonstrates how this post-processor is used:

# Tests the RelativeDifferencePostprocessor post-processor, which computes
# the relative difference between 2 post-processor values.

[Mesh]
type = GeneratedMesh
dim = 1
nx = 2
[]

[Problem]
solve = false
[]

[Executioner]
[]

[Postprocessors]
[./num_elems]
# number of elements, equal to 2
type = NumElems
[../]
[./num_nodes]
# number of nodes, equal to 3
type = NumNodes
[../]
[./zero]
# zero post-processor value
type = EmptyPostprocessor
[../]

# For the case in this input file, this will be computed as
#   y = abs((num_nodes - num_elems) / num_elems)
#   y = abs((3         - 2        ) / 2        ) = 0.5
# When the command-line modification "Postprocessors/relative_difference/value2=zero" is used,
#   y = abs(num_nodes - zero)
#   y = abs(3         - 0   ) = 3
[./relative_difference]
type = RelativeDifferencePostprocessor
value1 = num_nodes
value2 = num_elems
[../]
[]

[Outputs]
[./out]
type = CSV
show = relative_difference
[../]
[]

(test/tests/postprocessors/relative_difference/relative_difference.i)

## Input Parameters

• value2Second post-processor, base for relative difference

C++ Type:PostprocessorName

Options:

Description:Second post-processor, base for relative difference

• value1First post-processor

C++ Type:PostprocessorName

Options:

Description:First post-processor

### Required Parameters

• execute_onTIMESTEP_ENDThe list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM.

Default:TIMESTEP_END

C++ Type:ExecFlagEnum

Options:NONE INITIAL LINEAR NONLINEAR TIMESTEP_END TIMESTEP_BEGIN FINAL CUSTOM

Description:The list of flag(s) indicating when this object should be executed, the available options include NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, FINAL, CUSTOM.

### Optional Parameters

• enableTrueSet the enabled status of the MooseObject.

Default:True

C++ Type:bool

Options:

Description:Set the enabled status of the MooseObject.

• 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

Options:

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.

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

C++ Type:std::vector

Options:

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

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

C++ Type:std::vector

Options:

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

• 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

Options:

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

• force_preauxFalseForces the GeneralUserObject to be executed in PREAUX

Default:False

C++ Type:bool

Options:

Description:Forces the GeneralUserObject to be executed in PREAUX