# LeastSquaresFitHistory

Performs a polynomial least squares fit on the data contained in another VectorPostprocessor and stores the full time history of the coefficients

## Description

LeastSquaresFitHistory is used perform a polynomial least squares fit of data provided through another VectorPostprocessor. It computes the coefficients for a polynomial of arbitrary, user-specified order that minimize the error using a standard least-squares procedure.This object stores the polynomial coefficients in a set of vectors that contain the full history of those values for a transient analysis.

This VectorPostprocessor is closely related to the LeastSquaresFit VectorPostprocessor, which performs the same type of least squares fit, but stores the results in a single vector, the history of which is not stored.

The polynomial coefficients are stored in a set of vectors named coef_0 through coef_n, where is the specified order of the polynomial. Each of these vectors stores the full history of its coeficient in time, so that the combination of component for each of these vectors defines the polynomial fit for time step . In addition, a vector named time stores the values of the solution time for each step of a transient analysis.

The vectors of values of the independent () and dependent () variables on which the least squares fit is performed are provided through another VectorPostprocessor, which must provide two equally-sized vectors of data upon which to operate. The name of this VectorPostprocesor is provided using the vectorpostprocessor parameter, and the names of the data vectors are provided with the x_name and y_name parameters. The vectors of data can be shifted and/or scaled through the use of optional parameters.

## Input Parameters

• vectorpostprocessorThe vectorpostprocessor on whose values we perform a least squares fit

C++ Type:VectorPostprocessorName

Options:

Description:The vectorpostprocessor on whose values we perform a least squares fit

• y_nameThe name of the dependent variable

C++ Type:std::string

Options:

Description:The name of the dependent variable

• x_nameThe name of the independent variable

C++ Type:std::string

Options:

Description:The name of the independent variable

• orderThe order of the polynomial fit

C++ Type:unsigned int

Options:

Description:The order of the polynomial fit

### Required Parameters

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

Default:TIMESTEP_END

C++ Type:ExecFlagEnum

Options:NONE INITIAL LINEAR NONLINEAR TIMESTEP_END TIMESTEP_BEGIN FINAL CUSTOM

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

• x_shift0Value used to shift x values (shifting is done before scaling)

Default:0

C++ Type:double

Options:

Description:Value used to shift x values (shifting is done before scaling)

• x_scale1Value used to scale x values (scaling is done after shifting)

Default:1

C++ Type:double

Options:

Description:Value used to scale x values (scaling is done after shifting)

• y_scale1Value used to scale y values (scaling is done after shifting)

Default:1

C++ Type:double

Options:

Description:Value used to scale y values (scaling is done after shifting)

• y_shift0Value used to shift y values (shifting is done before scaling)

Default:0

C++ Type:double

Options:

Description:Value used to shift y values (shifting is done before scaling)

### Optional Parameters

• enableTrueSet the enabled status of the MooseObject.

Default:True

C++ Type:bool

Options:

Description:Set the enabled status of the MooseObject.

• 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

Options:

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.

• outputsVector of output names were you would like to restrict the output of variables(s) associated with this object

C++ Type:std::vector

Options:

Description:Vector of output names were you would like to restrict the output of variables(s) associated with this object

• contains_complete_historyTrueSet this flag to indicate that the values in all vectors declared by this VPP represent a time history (e.g. with each invocation, new values are added and old values are never removed). This changes the output so that only a single file is output and updated with each invocation

Default:True

C++ Type:bool

Options:

Description:Set this flag to indicate that the values in all vectors declared by this VPP represent a time history (e.g. with each invocation, new values are added and old values are never removed). This changes the output so that only a single file is output and updated with each invocation

• control_tagsAdds user-defined labels for accessing object parameters via control logic.

C++ Type:std::vector

Options:

Description:Adds user-defined labels for accessing object parameters via control logic.

• 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

Options:

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

• force_preauxFalseForces the GeneralUserObject to be executed in PREAUX

Default:False

C++ Type:bool

Options:

Description:Forces the GeneralUserObject to be executed in PREAUX