PiecewiseConstant

Defines data using a set of x-y data pairs

Description

The PiecewiseConstant function defines the data using a set of x-y data pairs. Instead of linearly interpolating between the values, however, the PiecewiseConstant function is constant when the abscissa is between the values provided by the user. The direction parameter controls whether the function takes the value of the abscissa of the user-provided point to the right or left value at which the function is evaluated. Also available is right_inclusive and left_inclusive options, which will return the value of the function at the specified abscissa.

Example Input Syntax

[Functions]
  [a]
    type = PiecewiseConstant
    xy_data = '0.5 0.1
               1.0 0.2
               1.5 0.1'
    direction = left
  []
  [b]
    type = PiecewiseConstant
    x = '0.5 1.0 1.5'
    y = '0.1 0.2 0.1'
    direction = right
  []
  [c]
    type = PiecewiseConstant
    data_file = pc.csv
    direction = left
    format = columns
  []
  [d]
    type = PiecewiseConstant
    data_file = pc.csv
    direction = right
    format = columns
  []
[]
(test/tests/functions/piecewise_constant/piecewise_constant.i)

Input Parameters

  • axisThe axis used (x, y, or z) if this is to be a function of position

    C++ Type:MooseEnum

    Options:x, y, z

    Controllable:No

    Description:The axis used (x, y, or z) if this is to be a function of position

  • directionLEFTDirection to look to find value: LEFT RIGHT LEFT_INCLUSIVE RIGHT_INCLUSIVE

    Default:LEFT

    C++ Type:MooseEnum

    Options:LEFT, RIGHT, LEFT_INCLUSIVE, RIGHT_INCLUSIVE

    Controllable:No

    Description:Direction to look to find value: LEFT RIGHT LEFT_INCLUSIVE RIGHT_INCLUSIVE

  • execute_onLINEARThe 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, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

    Default:LINEAR

    C++ Type:ExecFlagEnum

    Options:FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, 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, the available options include FORWARD, ADJOINT, HOMOGENEOUS_FORWARD, ADJOINT_TIMESTEP_BEGIN, ADJOINT_TIMESTEP_END, NONE, INITIAL, LINEAR, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM.

  • scale_factor1Scale factor to be applied to the ordinate values

    Default:1

    C++ Type:double

    Controllable:Yes

    Description:Scale factor to be applied to the ordinate 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:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters

  • data_fileFile holding CSV data

    C++ Type:FileName

    Controllable:No

    Description:File holding CSV data

  • formatrowsFormat of csv data file that is in either in columns or rows

    Default:rows

    C++ Type:MooseEnum

    Options:columns, rows

    Controllable:No

    Description:Format of csv data file that is in either in columns or rows

  • x_index_in_file0The abscissa index in the data file

    Default:0

    C++ Type:unsigned int

    Controllable:No

    Description:The abscissa index in the data file

  • x_titleThe title of the column/row containing the x data in the data file

    C++ Type:std::string

    Controllable:No

    Description:The title of the column/row containing the x data in the data file

  • xy_in_file_onlyTrueIf the data file only contains abscissa and ordinate data

    Default:True

    C++ Type:bool

    Controllable:No

    Description:If the data file only contains abscissa and ordinate data

  • y_index_in_file1The ordinate index in the data file

    Default:1

    C++ Type:unsigned int

    Controllable:No

    Description:The ordinate index in the data file

  • y_titleThe title of the column/row containing the y data in the data file

    C++ Type:std::string

    Controllable:No

    Description:The title of the column/row containing the y data in the data file

Data From Csv File Parameters

  • json_uoJSONFileReader holding the data

    C++ Type:UserObjectName

    Controllable:No

    Description:JSONFileReader holding the data

  • x_keysOrdered vector of keys in the JSON tree to obtain the abscissa

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

    Controllable:No

    Description:Ordered vector of keys in the JSON tree to obtain the abscissa

  • y_keysOrdered vector of keys in the JSON tree to obtain the ordinate

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

    Controllable:No

    Description:Ordered vector of keys in the JSON tree to obtain the ordinate

Data From Json Parameters

  • xThe abscissa values

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

    Controllable:No

    Description:The abscissa values

  • xy_dataAll function data, supplied in abscissa, ordinate pairs

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

    Controllable:No

    Description:All function data, supplied in abscissa, ordinate pairs

  • yThe ordinate values

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

    Controllable:No

    Description:The ordinate values

Data From Input File Parameters

Input Files