ParsedScalarReporter

Applies parsed functions to scalar entries held in reporters.

Overview

ParsedScalarReporter operates on scalars contained in series of scalar reporters using a parsed function expression as shown in Listing 1. This reporter allows several scalar reporters to be combined into scalar. Variables in the parsed function expression are given by the "reporter_symbols". There is one "reporter_names" for each "reporter_symbols". This is a scalar version of the ParsedVectorReporter reporter.

Listing 1:

[Mesh]
  [gmg]
    type = GeneratedMeshGenerator
    dim = 1
  []
[]

[Problem]
  solve = false
[]

[Executioner]
  type = Steady
[]

[Reporters]
  [dataFromVofV]
    type=VectorOfVectorTestReporter
    name = v_of_v
    vector_of_vectors = '101 201; 102 202; 103 203'
    outputs=none
  []
  [vecvec_sum]
    type = ParsedVectorVectorRealReductionReporter
    name = sum
    reporter_name= 'dataFromVofV/v_of_v'
    initial_value = 0
    expression = 'reduction_value+indexed_value'
  []
  [vecvec_sqsum]
    type = ParsedVectorVectorRealReductionReporter
    name = sqsum
    reporter_name= 'dataFromVofV/v_of_v'
    initial_value = 0
    expression = 'reduction_value+indexed_value*indexed_value'
  []
  [vecvec_multiply]
    type = ParsedVectorVectorRealReductionReporter
    name = multiply
    reporter_name= 'dataFromVofV/v_of_v'
    initial_value = 1
    expression = 'reduction_value*indexed_value'
  []
  [vecvec_max]
    type = ParsedVectorVectorRealReductionReporter
    name = max
    reporter_name= 'dataFromVofV/v_of_v'
    initial_value = -100000
    expression = 'max(reduction_value,indexed_value)'
  []

  [vecs]
    type = ConstantReporter
    real_vector_names = 'vec_a vec_b vec_c vec_d'
    real_vector_values = '1 2 3; 10 20 30; 100 10 1; 1 2 3 4'
    real_names = 'a b c'
    real_values='1 10 100'
    outputs=none
  []
  [vectorOperation]
    type = ParsedVectorReporter
    name = inner
    reporter_names = 'vecs/vec_a vecs/vec_b vecs/vec_c'
    reporter_symbols = 'a b c'
    constant_names = 'constant1 constant2'
    constant_expressions = '10 20'
    expression = '(a+b)*c+constant1+constant2'
  []
  [scalarOperation]
    type = ParsedScalarReporter
    name = inner
    reporter_names = 'vecs/a vecs/b vecs/c'
    reporter_symbols = 'a b c'
    constant_names = 'constant1 constant2'
    constant_expressions = '10 20'
    expression = '(a+b)*c+constant1+constant2'
  []

  [vec_d]
    type = ConstantReporter
    real_vector_names = 'vec_d'
    real_vector_values = '1 2 3 4'
    outputs=none
  []
  [vector_sum]
    type = ParsedVectorRealReductionReporter
    name = sum
    reporter_name= vec_d/vec_d
    initial_value = 0
    expression = 'reduction_value+indexed_value'
  []
  [vector_sqsum]
    type = ParsedVectorRealReductionReporter
    name = sqsum
    reporter_name= vec_d/vec_d
    initial_value = 0
    expression = 'reduction_value+indexed_value*indexed_value'
  []
  [vector_multiply]
    type = ParsedVectorRealReductionReporter
    name = multiply
    reporter_name= vec_d/vec_d
    initial_value = 1
    expression = 'reduction_value*indexed_value'
  []
  [vector_max]
    type = ParsedVectorRealReductionReporter
    name = max
    reporter_name= vec_d/vec_d
    initial_value = -100000
    expression = 'max(reduction_value,indexed_value)'
  []
[]

[Outputs]
  csv=true
[]
(modules/optimization/test/tests/reporters/vector_math/vectorMath.i)

Optimization use case

This reporter was created to compute the objective function from the misfit reporter created by OptimizationData. The scalar reporter created can then be transferred as the objective value into GeneralOptimization.

Input Parameters

  • expressionfunction expression

    C++ Type:FunctionExpression

    Unit:(no unit assumed)

    Controllable:No

    Description:function expression

  • reporter_namesThe input reporter names

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

    Unit:(no unit assumed)

    Controllable:No

    Description:The input reporter names

  • reporter_symbolsExpression symbol for each reporter

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Expression symbol for each reporter

Required Parameters

  • constant_expressionsVector of values for the constants in constant_names (can be an FParser expression)

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Vector of values for the constants in constant_names (can be an FParser expression)

  • constant_namesVector of constants used in the parsed function (use this for kB etc.)

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

    Unit:(no unit assumed)

    Controllable:No

    Description:Vector of constants used in the parsed function (use this for kB etc.)

  • epsilon1e-12Fuzzy comparison tolerance

    Default:1e-12

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Fuzzy comparison tolerance

  • 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:XFEM_MARK, FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR_CONVERGENCE, NONLINEAR, POSTCHECK, 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. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

  • nameresultName of output reporter.

    Default:result

    C++ Type:std::string

    Unit:(no unit assumed)

    Controllable:No

    Description:Name of output reporter.

  • 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

    Unit:(no unit assumed)

    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_tFalseMake time (t) variables available in the function expression.

    Default:False

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Make time (t) variables 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

    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.

  • disable_fpoptimizerFalseDisable the function parser algebraic optimizer

    Default:False

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Disable the function parser algebraic optimizer

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

  • enable_ad_cacheTrueEnable caching of function derivatives for faster startup time

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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

    Unit:(no unit assumed)

    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

    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

  • 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

Input Files