forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve issues with polynomial order truncation in LeastSquaresFit cl…
…oses idaholab#13498 Add a 'truncate_order' option to LeastSquaresFit and LeastSquaresFitHistory Correct logic for determining required points for a given polynomial order in PolynomialFit.C Add tests for fits of polynomials with order 0, 1, and 2 Add test for insufficient order error
- Loading branch information
Showing
15 changed files
with
144 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/tests/vectorpostprocessors/least_squares_fit/fit_data_0.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,u | ||
0.0,1.0 |
3 changes: 3 additions & 0 deletions
3
test/tests/vectorpostprocessors/least_squares_fit/fit_data_1.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,u | ||
0.0,1.0 | ||
1.0,2.0 |
4 changes: 4 additions & 0 deletions
4
test/tests/vectorpostprocessors/least_squares_fit/fit_data_2.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
id,u | ||
0.0,1.0 | ||
1.0,3.0 | ||
2.0,7.0 |
2 changes: 2 additions & 0 deletions
2
.../tests/vectorpostprocessors/least_squares_fit/gold/csv0_least_squares_fit_coeffs_0000.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coefficients | ||
1 |
3 changes: 3 additions & 0 deletions
3
.../tests/vectorpostprocessors/least_squares_fit/gold/csv1_least_squares_fit_coeffs_0000.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
coefficients | ||
1 | ||
1 |
4 changes: 4 additions & 0 deletions
4
.../tests/vectorpostprocessors/least_squares_fit/gold/csv2_least_squares_fit_coeffs_0000.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
coefficients | ||
1 | ||
1 | ||
1 |
40 changes: 40 additions & 0 deletions
40
test/tests/vectorpostprocessors/least_squares_fit/least_squares_fit_csv_data.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[Problem] | ||
solve = false | ||
[] | ||
|
||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 1 | ||
nx = 1 | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
start_time = 0.0 | ||
end_time = 0.0 | ||
[] | ||
|
||
[VectorPostprocessors] | ||
[./csv_data] | ||
type = CSVReader | ||
csv_file = fit_data_0.csv | ||
header = true | ||
outputs = none | ||
[../] | ||
[./least_squares_fit_coeffs] | ||
type = LeastSquaresFit | ||
vectorpostprocessor = csv_data | ||
x_name = 'id' | ||
y_name = 'u' | ||
order = 0 | ||
output = coefficients | ||
truncate_order = false | ||
execute_on = initial | ||
[../] | ||
[] | ||
|
||
[Outputs] | ||
file_base = csv0 | ||
execute_on = initial | ||
csv = true | ||
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,45 @@ | ||
[Tests] | ||
[./least_squares] | ||
issues = '#7907 #4464' | ||
requirement = 'The LeastSquaresFit vectorpostprocessor shall compute a least squares fit of a first-order polynomial sampled from a solution field using LineValueSampler with shifting and scaling parameters specified' | ||
design = 'LeastSquaresFit.md LineValueSampler.md' | ||
type = 'CSVDiff' | ||
input = 'least_squares_fit.i' | ||
csvdiff = 'out_least_squares_fit_coeffs_0001.csv out_least_squares_fit_sample_0001.csv out_shift_and_scale_y_least_squares_fit_sample_0001.csv out_shift_and_scale_x_least_squares_fit_coeffs_0001.csv out_shift_and_scale_x_least_squares_fit_sample_0001.csv out_shift_and_scale_y_least_squares_fit_coeffs_0001.csv' | ||
[../] | ||
[./least_squares_csv0] | ||
issues = '#13498' | ||
requirement = 'The LeastSquaresFit vectorpostprocessor shall compute a least squares fit of a zeroth-rder polynomial with data provided by a CSVReader' | ||
design = 'LeastSquaresFit.md CSVReader.md' | ||
type = 'CSVDiff' | ||
input = 'least_squares_fit_csv_data.i' | ||
csvdiff = 'csv0_least_squares_fit_coeffs_0000.csv' | ||
[../] | ||
[./least_squares_csv1] | ||
issues = '#13498' | ||
requirement = 'The LeastSquaresFit vectorpostprocessor shall compute a least squares fit of a first-rder polynomial with data provided by a CSVReader' | ||
design = 'LeastSquaresFit.md CSVReader.md' | ||
type = 'CSVDiff' | ||
input = 'least_squares_fit_csv_data.i' | ||
cli_args = 'VectorPostprocessors/csv_data/csv_file=fit_data_1.csv VectorPostprocessors/least_squares_fit_coeffs/order=1 Outputs/file_base=csv1' | ||
csvdiff = 'csv1_least_squares_fit_coeffs_0000.csv' | ||
[../] | ||
[./least_squares_csv2] | ||
issues = '#13498' | ||
requirement = 'The LeastSquaresFit vectorpostprocessor shall compute a least squares fit of a second-rder polynomial with data provided by a CSVReader' | ||
design = 'LeastSquaresFit.md CSVReader.md' | ||
type = 'CSVDiff' | ||
input = 'least_squares_fit_csv_data.i' | ||
cli_args = 'VectorPostprocessors/csv_data/csv_file=fit_data_2.csv VectorPostprocessors/least_squares_fit_coeffs/order=2 Outputs/file_base=csv2' | ||
csvdiff = 'csv2_least_squares_fit_coeffs_0000.csv' | ||
[../] | ||
[./least_squares_csv3_order_err] | ||
issues = '#13498' | ||
requirement = 'The LeastSquaresFit vectorpostprocessor shall generate an error if a fit for a third-order polynomial is requested and only three data points are provided' | ||
design = 'LeastSquaresFit.md CSVReader.md' | ||
type = 'RunException' | ||
expect_err = 'PolynomialFit requires an order less than the size of the input vector' | ||
input = 'least_squares_fit_csv_data.i' | ||
cli_args = 'VectorPostprocessors/csv_data/csv_file=fit_data_2.csv VectorPostprocessors/least_squares_fit_coeffs/order=3 Outputs/file_base=csv2_order_err' | ||
[../] | ||
[] |