forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for function loading data from JSON
refs idaholab#25058
- Loading branch information
Showing
5 changed files
with
116 additions
and
49 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
test/tests/functions/piecewise_constant/gold/piecewise_constant_json_out.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,12 @@ | ||
time,from_json | ||
0,1 | ||
1,1 | ||
2,1 | ||
3,1 | ||
4,1 | ||
5,1 | ||
6,-1 | ||
7,-1 | ||
8,10 | ||
9,10 | ||
10,10 |
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
43 changes: 43 additions & 0 deletions
43
test/tests/functions/piecewise_constant/piecewise_constant_json.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,43 @@ | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 1 | ||
[] | ||
|
||
[Problem] | ||
solve = false | ||
[] | ||
|
||
[UserObjects] | ||
[json] | ||
type = JSONFileReader | ||
filename = 'function_values.json' | ||
[] | ||
[] | ||
|
||
[Functions] | ||
[from_json] | ||
type = PiecewiseConstant | ||
json_uo = 'json' | ||
x_keys = "los_datos some_key some_other_key" | ||
y_keys = "los_datos second_key some_other_key" | ||
[] | ||
[] | ||
|
||
[Postprocessors] | ||
[from_json] | ||
type = FunctionValuePostprocessor | ||
function = from_json | ||
execute_on = 'TIMESTEP_END INITIAL' | ||
[] | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
dt = 1 | ||
start_time = 0 | ||
end_time = 10 | ||
[] | ||
|
||
[Outputs] | ||
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
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,16 +1,28 @@ | ||
[Tests] | ||
issues = '#2272' | ||
issues = '#2272 #xxx' | ||
design = 'source/functions/PiecewiseConstant.md' | ||
[./piecewise_constant] | ||
[piecewise_constant] | ||
type = 'Exodiff' | ||
input = 'piecewise_constant.i' | ||
exodiff = 'piecewise_constant_out.e' | ||
requirement = "The Function system shall include an object that creates a function based on x- and y-data pairs and returns an explicit value from the supplied data when queried (i.e., linear interpolation is not performed)." | ||
[../] | ||
[./piecewise_constant_simple] | ||
requirement = "The system shall include an object that creates a function based on x- and y-data " | ||
"pairs and returns an explicit value from the supplied data when queried (i.e., " | ||
"linear interpolation is not performed)." | ||
[] | ||
[piecewise_constant_simple] | ||
type = 'CSVDiff' | ||
input = 'piecewise_constant_simple.i' | ||
csvdiff = 'piecewise_constant_simple_out.csv' | ||
requirement = "The Function system shall include an object that creates a function based on x- and y-data pairs and returns an explicit value from the supplied data when queried (i.e., linear interpolation is not performed) in a simple simulation, with both negative and positive values." | ||
[../] | ||
requirement = "The system shall include an object that creates a function based on x- and y-data " | ||
"pairs and returns an explicit value from the supplied data when queried (i.e., " | ||
"linear interpolation is not performed) in a simple simulation, with both negative " | ||
"and positive values." | ||
[] | ||
[piecewise_constant_from_json] | ||
type = CSVDiff | ||
input = 'piecewise_constant_json.i' | ||
csvdiff = 'piecewise_constant_json_out.csv' | ||
requirement = "The system shall be able to compute a piecewise constant function based on x- and " | ||
"y-data loaded from a JSON file." | ||
[] | ||
[] |