CumulativeTimeAverageFunctorAux

Running time-weighted mean of a functor, starting at a given simulation time.

Description

The CumulativeTimeAverageFunctorAux computes the running time-weighted mean of a functor, which may be a finite element or finite volume variable, a function, or a functor material property, selected with "functor". It can be used, for example, to compute the mean field of a turbulent or otherwise unsteady simulation.

Averaging starts at the first time step with "start_time". With the later of "start_time" and the beginning of that first time step, the average is updated at each time step as

where is the value of the functor at the current time and is the part of the time step after , so that no time before is included. This is equivalent to the time-weighted mean of all values since averaging started. Up to and including , the variable holds the current value of the functor.

By default, the functor is integrated over each time step with the rectangle rule using its current value , the same quadrature as the implicit Euler time integrator. This is first order accurate in , but for statistically stationary signals averaged over many time steps the quadrature error is generally considered much smaller than the sampling error of the average. For more accuracy, setting "time_integration_scheme" to trapezoidal-rule replaces with the trapezoidal rule over the time step, , which is second order accurate. This only improves the accuracy if the functor is itself computed with a second order (or higher) time integrator, for example CrankNicolson or BDF2. On the first averaged time step, the value at is linearly interpolated between and . The trapezoidal rule requires the functor to support evaluation at the previous time step.

The update only depends on the average from the previous time step, so executing the auxiliary kernel several times in a time step gives the same result.

commentnote

The functor is evaluated once per element, so the auxiliary "variable" must be elemental and should be of CONSTANT MONOMIAL type. Nodal variables are rejected.

Example Input Syntax

In this example, the function u equals and the simulation time advances by 1 each time step. The CumulativeTimeAverageFunctorAux stores the time average of u in the CONSTANT MONOMIAL variable u_avg, starting at . In each element, the average is the element centroid coordinate times the time-weighted mean of the times sampled since averaging started.

[AuxKernels<<<{"href": "../../syntax/AuxKernels/index.html"}>>>]
  [u_avg]
    type = CumulativeTimeAverageFunctorAux<<<{"description": "Running time-weighted mean of a functor, starting at a given simulation time.", "href": "CumulativeTimeAverageFunctorAux.html"}>>>
    variable<<<{"description": "The name of the variable that this object applies to"}>>> = u_avg
    functor<<<{"description": "The variable or functor to time-average. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number."}>>> = u
    start_time<<<{"description": "Simulation time at which averaging starts."}>>> = 2.5
  []
[]
(test/tests/auxkernels/cumulative_time_average_functor_aux/time_averaged.i)

Input Parameters

  • functorThe variable or functor to time-average. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number.

    C++ Type:MooseFunctorName

    Unit:(no unit assumed)

    Controllable:No

    Description:The variable or functor to time-average. A functor is any of the following: a variable, a functor material property, a function, a postprocessor or a number.

  • start_timeSimulation time at which averaging starts.

    C++ Type:Real

    Unit:(no unit assumed)

    Controllable:No

    Description:Simulation time at which averaging starts.

  • variableThe name of the variable that this object applies to

    C++ Type:AuxVariableName

    Unit:(no unit assumed)

    Controllable:No

    Description:The name of the variable that this object applies to

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

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

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

    Controllable:No

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

  • check_boundary_restrictedTrueWhether to check for multiple element sides on the boundary in the case of a boundary restricted, element aux variable. Setting this to false will allow contribution to a single element's elemental value(s) from multiple boundary sides on the same element (example: when the restricted boundary exists on two or more sides of an element, such as at a corner of a mesh

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Whether to check for multiple element sides on the boundary in the case of a boundary restricted, element aux variable. Setting this to false will allow contribution to a single element's elemental value(s) from multiple boundary sides on the same element (example: when the restricted boundary exists on two or more sides of an element, such as at a corner of a mesh

  • execute_onLINEAR TIMESTEP_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:LINEAR TIMESTEP_END

    C++ Type:ExecFlagEnum

    Options:XFEM_MARK, FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, LINEAR_CONVERGENCE, NONLINEAR, NONLINEAR_CONVERGENCE, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, MULTIAPP_FIXED_POINT_CONVERGENCE, MULTISYSTEM_FIXED_POINT_ITERATION_END, FINAL, CUSTOM, PRE_DISPLACE

    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.

  • time_integration_schemeimplicit-eulerQuadrature of the time integral of the functor. 'implicit-euler' uses the current value over each time step, 'trapezoidal-rule' the mean of the current and old values.

    Default:implicit-euler

    C++ Type:MooseEnum

    Options:implicit-euler, trapezoidal-rule

    Controllable:No

    Description:Quadrature of the time integral of the functor. 'implicit-euler' uses the current value over each time step, 'trapezoidal-rule' the mean of the current and old values.

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

  • search_methodnearest_node_connected_sidesChoice of search algorithm. All options begin by finding the nearest node in the primary boundary to a query point in the secondary boundary. In the default nearest_node_connected_sides algorithm, primary boundary elements are searched iff that nearest node is one of their nodes. This is fast to determine via a pregenerated node-to-elem map and is robust on conforming meshes. In the optional all_proximate_sides algorithm, primary boundary elements are searched iff they touch that nearest node, even if they are not topologically connected to it. This is more CPU-intensive but is necessary for robustness on any boundary surfaces which has disconnections (such as Flex IGA meshes) or non-conformity (such as hanging nodes in adaptively h-refined meshes).

    Default:nearest_node_connected_sides

    C++ Type:MooseEnum

    Options:nearest_node_connected_sides, all_proximate_sides

    Controllable:No

    Description:Choice of search algorithm. All options begin by finding the nearest node in the primary boundary to a query point in the secondary boundary. In the default nearest_node_connected_sides algorithm, primary boundary elements are searched iff that nearest node is one of their nodes. This is fast to determine via a pregenerated node-to-elem map and is robust on conforming meshes. In the optional all_proximate_sides algorithm, primary boundary elements are searched iff they touch that nearest node, even if they are not topologically connected to it. This is more CPU-intensive but is necessary for robustness on any boundary surfaces which has disconnections (such as Flex IGA meshes) or non-conformity (such as hanging nodes in adaptively h-refined meshes).

  • 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

  • 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