ParsedFunction

Function created by parsing a string

Description

The ParsedFunction function takes a mathematical expression in "expression". The expression can be a function of time (t) or coordinate (x, y, or z). The expression can include common mathematical functions. Examples include 4e4+1e2*t, sqrt(x*x+y*y+z*z), and if(t<=1.0, 0.1*t, (1.0+0.1)*cos(pi/2*(t-1.0)) - 1.0).

Additional variables may be declared in the "symbol_names" parameter vector. The corresponding "symbol_values" parameter vector should list the items these variables are bound to. Variables can be bound to:

  • Constant number literals (for example symbol_names = kB and symbol_values = 8.61733e-5)

  • A PostProcessor name (providing the value from the PP's last execution)

  • A Function name (providing an immediate evaluation of the specified function)

  • A scalar variable name

Further information can be found at the function parser site.

warningwarning:Scalar Variable Jacobian Contributions Omitted

Note that if this function is used for any residual contribution, inclusion of scalar variables in the expression parameter will result in missing Jacobian contributions, even if using Automatic differentiation, since Functions can currently only return Real values, not ADReal values.

Example Input Syntax

[Functions]
  # A ParsedFunction allows us to supply analytic expressions
  # directly in the input file
  [./bc_func]
    type = ParsedFunction
    expression = sin(alpha*pi*x)
    symbol_names = 'alpha'
    symbol_values = '16'
  [../]

  # This function is an actual compiled function
  # We could have used ParsedFunction for this as well
  [./forcing_func]
    type = ExampleFunction
    alpha = 16
  [../]
[]
(../moose/examples/ex13_functions/ex13.i)

Input Parameters

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

    Default:LINEAR

    C++ Type:ExecFlagEnum

    Options:NONE, INITIAL, LINEAR, NONLINEAR, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, ALWAYS

    Controllable:No

    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, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, ALWAYS.

  • expressionThe user defined function.

    C++ Type:FunctionExpression

    Controllable:No

    Description:The user defined function.

  • symbol_namesSymbols (excluding t,x,y,z) that are bound to the values provided by the corresponding items in the vals vector.

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

    Controllable:No

    Description:Symbols (excluding t,x,y,z) that are bound to the values provided by the corresponding items in the vals vector.

  • symbol_valuesConstant numeric values, postprocessor names, function names, and scalar variables corresponding to the symbols in symbol_names.

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

    Controllable:No

    Description:Constant numeric values, postprocessor names, function names, and scalar variables corresponding to the symbols in symbol_names.

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:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters