LeastSquaresFit

Performs a polynomial least squares fit on the data contained in another VectorPostprocessor

Description

LeastSquaresFit 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 provides the option of either outputting the polynomial coefficients of the least squares fit as a single vector, or outputting a user-defined number of samples from the polynomial using the fitted coefficients.

This VectorPostprocessor is closely related to the LeastSquaresFitHistory VectorPostprocessor, which performs the same type of least squares fit, but stores the results in a set of vectors that store the full history of the individual coefficients over 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 VectorPostprocessor 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.

By default, if an insufficient number of points is provided in these data vectors, the order of the polynomial will be truncated to one less than the number of points. If the truncate_order parameter is set to `false, an error will be generated in this case.

The user must define whether the output should be in the form of polynomial coefficients or samples using the output parameter. If the option to output polynomial coefficients is used, they are stored in a vector named coefficients. If samples are requested, the names of the sample vectors are the same as those of the data specified by x_name and y_name.

Input Parameters

  • orderThe order of the polynomial fit

    C++ Type:unsigned int

    Controllable:No

    Description:The order of the polynomial fit

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

    C++ Type:VectorPostprocessorName

    Controllable:No

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

  • x_nameThe name of the independent variable

    C++ Type:std::string

    Controllable:No

    Description:The name of the independent variable

  • y_nameThe name of the dependent variable

    C++ Type:std::string

    Controllable:No

    Description:The name of the dependent variable

Required Parameters

  • contains_complete_historyFalseSet 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:False

    C++ Type:bool

    Controllable:No

    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

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

    Default:TIMESTEP_END

    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.

  • num_samplesThe number of samples to be output

    C++ Type:unsigned int

    Controllable:No

    Description:The number of samples to be output

  • outputCoefficientsThe quantity to output. Options are: Coefficients Samples

    Default:Coefficients

    C++ Type:MooseEnum

    Options:Coefficients, Samples

    Controllable:No

    Description:The quantity to output. Options are: Coefficients Samples

  • parallel_typeREPLICATEDSet how the data is represented within the VectorPostprocessor (VPP); 'distributed' indicates that data within the VPP is distributed and no auto communication is performed, this setting will result in parallel output within the CSV output; 'replicated' indicates that the data within the VPP is correct on processor 0, the data will automatically be broadcast to all processors unless the '_auto_broadcast' param is set to false within the validParams function.

    Default:REPLICATED

    C++ Type:MooseEnum

    Options:DISTRIBUTED, REPLICATED

    Controllable:No

    Description:Set how the data is represented within the VectorPostprocessor (VPP); 'distributed' indicates that data within the VPP is distributed and no auto communication is performed, this setting will result in parallel output within the CSV output; 'replicated' indicates that the data within the VPP is correct on processor 0, the data will automatically be broadcast to all processors unless the '_auto_broadcast' param is set to false within the validParams function.

  • 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

    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.

  • sample_x_maxThe maximum x value of the of samples to be output

    C++ Type:double

    Controllable:No

    Description:The maximum x value of the of samples to be output

  • sample_x_minThe minimum x value of the of samples to be output

    C++ Type:double

    Controllable:No

    Description:The minimum x value of the of samples to be output

  • truncate_orderTrueTruncate the order of the fitted polynomial if an insufficient number of data points are provided. If this is set to false, an error will be generated in that case.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Truncate the order of the fitted polynomial if an insufficient number of data points are provided. If this is set to false, an error will be generated in that case.

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

    Default:1

    C++ Type:double

    Controllable:No

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

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

    Default:0

    C++ Type:double

    Controllable:No

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

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

    Default:1

    C++ Type:double

    Controllable:No

    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

    Controllable:No

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

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

    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>

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

    Description:Set the enabled status of the MooseObject.

  • 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

    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

    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

    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

    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>

    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

    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