PiecewiseLinear

Linearly interpolates between pairs of x-y data

Description

The PiecewiseLinear function performs linear interpolations between user-provided pairs of x-y data. The x-y data can be provided in three ways. The first way is through a combination of the x and y parameters, which are lists of the x and y coordinates of the data points that make up the function. The second way is in the xy_data parameter, which is a list of pairs of x-y data that make up the points of the function. This allows for the function data to be specified in columns by inserting line breaks after each x-y data point. Finally, the x-y data can be provided in an external file containing comma-separated values. The file name is provided in data_file, and the data can be provided in either rows (default) or columns, as specified in the format parameter.

By default, the x-data corresponds to time, but this can be changed to correspond to x, y, or z coordinate with the axis line. If the function is queried outside of its range of x data, it returns the y value associated with the closest x data point, unless the parameter extrap is set to true, in which case extrapolation is performed instead.

Example Input Syntax

[Functions]
  [./ic_function]
    type = PiecewiseLinear
    data_file = piecewise_linear_columns.csv #Will generate error because data is expected in rows
    scale_factor = 1.0
  [../]
[]
(test/tests/misc/check_error/function_file_test1.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

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

  • extrapFalseIf true, extrapolates when sample point is outside of abscissa range

    Default:False

    C++ Type:bool

    Controllable:No

    Description:If true, extrapolates when sample point is outside of abscissa range

  • 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