ConditionalSampleReporter

Evaluates parsed function to determine if sample needs to be evaluated, otherwise data is set to a default value.

Description

This object is a type of StochasticReporter, so it can be used in to transfer reporters into using SamplerReporterTransfer. This object is mainly meant for demonstration for eventual active learning algorithms, but could prove useful. Basically, it enables a inputted function to determine if a multiapp solve is "possible" based on sampler values. The parsed function inputted with the parameter "function" should evaluate to 0 or false if multiapp run is not possible/necessary. The variables within the function should be associated with a sampler column, which is defined by the pair of parameters "sampler_vars" and "sampler_var_indices". If the inputted function evaluates to 0 or false, the quantity being transferred to this object using SamplerReporterTransfer with be replaced with "default_value".

Example Input Syntax

An example usage of this reporter is to ensure that the sampler values are positive. For demonstration, the following makes sure that the sampler value is greater-than or equal to the current simulation time. If it isn't, the multiapp is not run and the transferred quantity is replaced with a value of 1.0.

[MultiApps]
  [runner]
    type = SamplerFullSolveMultiApp
    sampler = cart
    input_files = 'sub.i'
    mode = batch-reset
    should_run_reporter = conditional/need_sample
  []
[]

[Transfers]
  [data]
    type = SamplerReporterTransfer
    from_multi_app = runner
    sampler = cart
    from_reporter = 'average/value'
    stochastic_reporter = conditional
  []
[]

[Reporters]
  [conditional]
    type = ConditionalSampleReporter
    sampler = cart
    default_value = 999
    function = 'val1 * val2 >= t'
    sampler_vars = 'val1 val2'
    sampler_var_indices = '0 1'
    parallel_type = ROOT
    execute_on = 'initial timestep_begin'
  []
[]
(modules/stochastic_tools/test/tests/multiapps/conditional_run/conditional_main.i)

Input Parameters

  • default_valueValue to replace in data when sample is not evaluated.

    C++ Type:double

    Controllable:No

    Description:Value to replace in data when sample is not evaluated.

  • functionfunction expression that should evaluate to 0 if sample should NOT be evaluated.

    C++ Type:FunctionExpression

    Controllable:No

    Description:function expression that should evaluate to 0 if sample should NOT be evaluated.

  • samplerThe sampler used to produce data.

    C++ Type:SamplerName

    Controllable:No

    Description:The sampler used to produce data.

Required Parameters

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

    Default:TIMESTEP_END

    C++ Type:ExecFlagEnum

    Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM

    Controllable:No

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

  • parallel_typeDISTRIBUTEDThis parameter will determine how the stochastic data is gathered. It is common for outputting purposes that this parameter be set to ROOT, otherwise, many files will be produced showing the values on each processor. However, if there are lot of samples, gathering on root may be memory restrictive.

    Default:DISTRIBUTED

    C++ Type:MooseEnum

    Options:DISTRIBUTED, ROOT

    Controllable:No

    Description:This parameter will determine how the stochastic data is gathered. It is common for outputting purposes that this parameter be set to ROOT, otherwise, many files will be produced showing the values on each processor. However, if there are lot of samples, gathering on root may be memory restrictive.

  • 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

    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.

  • sampler_var_indicesVector of indices defining the sampler column index associated with the variables in 'sampler_vars'.

    C++ Type:std::vector<unsigned int>

    Controllable:No

    Description:Vector of indices defining the sampler column index associated with the variables in 'sampler_vars'.

  • sampler_varsVector of variables defined by sampler values.

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

    Controllable:No

    Description:Vector of variables defined by sampler values.

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

  • use_timeTrueMake time (t) variable available in the function expression.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Make time (t) variable available in the function expression.

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

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

  • disable_fpoptimizerFalseDisable the function parser algebraic optimizer

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Disable the function parser algebraic optimizer

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:Yes

    Description:Set the enabled status of the MooseObject.

  • enable_ad_cacheTrueEnable caching of function derivatives for faster startup time

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable caching of function derivatives for faster startup time

  • enable_auto_optimizeTrueEnable automatic immediate optimization of derivatives

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable automatic immediate optimization of derivatives

  • enable_jitTrueEnable just-in-time compilation of function expressions for faster evaluation

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Enable just-in-time compilation of function expressions for faster evaluation

  • evalerror_behaviornanWhat to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

    Default:nan

    C++ Type:MooseEnum

    Options:nan, nan_warning, error, exception

    Controllable:No

    Description:What to do if evaluation error occurs. Options are to pass a nan, pass a nan with a warning, throw a error, or throw an exception

  • 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

  • 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

Input Files