-
Notifications
You must be signed in to change notification settings - Fork 291
add function to read from a csv to test helper #14486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Sabine-van-Dijk
wants to merge
12
commits into
master
Choose a base branch
from
14470-geomechanicsapplication-function-to-read-from-a-csv
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
79cd7a5
added function get_values_from_csv to test_helper
Sabine-van-Dijk e891461
adjusted code for node (one key) to be applicable on the CROW case.
Sabine-van-Dijk 7a69a7d
Merge remote-tracking branch 'origin/master' into 14470-geomechanicsa…
Sabine-van-Dijk 985f5bf
add csv files for the expected values of triaxial
Sabine-van-Dijk a6ea7e6
add a function to get the values from the csv as a vector including a…
Sabine-van-Dijk f4f26b4
rewrite the triaxial test to use the new functions and csv's
Sabine-van-Dijk 57b2d07
add function to read gouped csv files e.g. per phase
Sabine-van-Dijk 0cfb729
add csv files to test the new functions on the crs test
Sabine-van-Dijk 9f61e42
changed the order of the stresses and strains in the triaxial test
Sabine-van-Dijk 6e6798b
Merge remote-tracking branch 'origin/master' into 14470-geomechanicsa…
Sabine-van-Dijk bc35ccc
Minor changes to the function names
Sabine-van-Dijk a7c5f07
changed the ordering of the tensor element naming
Sabine-van-Dijk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
...icsApplication/tests/test_element_lab/test_crs/drained/linear_elastic/expected_strain.csv
This file contains hidden or 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,31 @@ | ||
| phase,element_id,ip_index,strain_xx,strain_yy,strain_zz,strain_xy,strain_yz,strain_xz | ||
| 1,1,0,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,1,1,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,1,2,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,0,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,1,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,2,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 2,1,0,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,1,1,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,1,2,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,0,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,1,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,2,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 3,1,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,1,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,1,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 5,1,0,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,1,1,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,1,2,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,0,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,1,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,2,0.0,-0.4,0.0,0.0,0.0,0.0 |
31 changes: 31 additions & 0 deletions
31
...icsApplication/tests/test_element_lab/test_crs/drained/linear_elastic/expected_stress.csv
This file contains hidden or 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,31 @@ | ||
| phase,element_id,ip_index,stress_xx,stress_yy,stress_zz,stress_xy,stress_yz,stress_xz | ||
| 1,1,0,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 1,1,1,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 1,1,2,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 1,2,0,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 1,2,1,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 1,2,2,-400000,-1200000,-400000,0.0,0.0,0.0 | ||
| 2,1,0,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 2,1,1,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 2,1,2,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 2,2,0,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 2,2,1,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 2,2,2,-200000,-600000,-200000,0.0,0.0,0.0 | ||
| 3,1,0,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 3,1,1,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 3,1,2,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 3,2,0,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 3,2,1,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 3,2,2,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,1,0,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,1,1,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,1,2,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,2,0,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,2,1,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 4,2,2,-1000000,-3000000,-1000000,0.0,0.0,0.0 | ||
| 5,1,0,-1600000,-4800000,-1600000,0.0,0.0,0.0 | ||
| 5,1,1,-1600000,-4800000,-1600000,0.0,0.0,0.0 | ||
| 5,1,2,-1600000,-4800000,-1600000,0.0,0.0,0.0 | ||
| 5,2,0,-1600000,-4800000,-1600000,0.0,0.0,0.0 | ||
| 5,2,1,-1600000,-4800000,-1600000,0.0,0.0,0.0 | ||
| 5,2,2,-1600000,-4800000,-1600000,0.0,0.0,0.0 |
31 changes: 31 additions & 0 deletions
31
...anicsApplication/tests/test_element_lab/test_crs/drained/mohr_coulomb/expected_strain.csv
This file contains hidden or 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,31 @@ | ||
| phase,element_id,ip_index,strain_xx,strain_yy,strain_zz,strain_xy,strain_yz,strain_xz | ||
| 1,1,0,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,1,1,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,1,2,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,0,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,1,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 1,2,2,0.0,-0.1,0.0,0.0,0.0,0.0 | ||
| 2,1,0,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,1,1,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,1,2,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,0,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,1,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 2,2,2,0.0,-0.05,0.0,0.0,0.0,0.0 | ||
| 3,1,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,1,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,1,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 3,2,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,1,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,0,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,1,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 4,2,2,0.0,-0.25,0.0,0.0,0.0,0.0 | ||
| 5,1,0,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,1,1,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,1,2,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,0,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,1,0.0,-0.4,0.0,0.0,0.0,0.0 | ||
| 5,2,2,0.0,-0.4,0.0,0.0,0.0,0.0 |
31 changes: 31 additions & 0 deletions
31
...anicsApplication/tests/test_element_lab/test_crs/drained/mohr_coulomb/expected_stress.csv
This file contains hidden or 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,31 @@ | ||
| phase,element_id,ip_index,stress_xx,stress_yy,stress_zz,stress_xy,stress_yz,stress_xz | ||
| 1,1,0,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 1,1,1,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 1,1,2,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 1,2,0,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 1,2,1,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 1,2,2,-901878,-2228430,-901878,0.0,0.0,0.0 | ||
| 2,1,0,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 2,1,1,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 2,1,2,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 2,2,0,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 2,2,1,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 2,2,2,-501878,-1028430,-501878,0.0,0.0,0.0 | ||
| 3,1,0,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 3,1,1,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 3,1,2,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 3,2,0,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 3,2,1,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 3,2,2,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,1,0,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,1,1,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,1,2,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,2,0,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,2,1,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 4,2,2,-2256970,-5567250,-2256970,0.0,0.0,0.0 | ||
| 5,1,0,-3612050,-8906070,-3612050,0.0,0.0,0.0 | ||
| 5,1,1,-3612050,-8906070,-3612050,0.0,0.0,0.0 | ||
| 5,1,2,-3612050,-8906070,-3612050,0.0,0.0,0.0 | ||
| 5,2,0,-3612050,-8906070,-3612050,0.0,0.0,0.0 | ||
| 5,2,1,-3612050,-8906070,-3612050,0.0,0.0,0.0 | ||
| 5,2,2,-3612050,-8906070,-3612050,0.0,0.0,0.0 |
10 changes: 10 additions & 0 deletions
10
...ns/GeoMechanicsApplication/tests/test_element_lab/test_triaxial/drained/expected_disp.csv
This file contains hidden or 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,10 @@ | ||
| node_id,disp_x,disp_y,disp_z | ||
| 1,0.0,-0.2,0.0 | ||
| 2,0.0527776,-0.2,0.0 | ||
| 3,0.0,-0.100033,0.0 | ||
| 4,0.0524025,-0.0996931,0.0 | ||
| 5,0.0,0.0,0.0 | ||
| 6,0.105197,-0.2,0.0 | ||
| 7,0.105114,-0.100049,0.0 | ||
| 8,0.0524406,0.0,0.0 | ||
| 9,0.104632,0.0,0.0 |
7 changes: 7 additions & 0 deletions
7
.../GeoMechanicsApplication/tests/test_element_lab/test_triaxial/drained/expected_strain.csv
This file contains hidden or 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,7 @@ | ||
| element_id,ip_index,strain_xx,strain_yy,strain_zz,strain_xy,strain_yz,strain_xz | ||
| 1,0,0.104863,-0.19973,0.104946,0.000440186,0.0,0.0 | ||
| 1,1,0.104939,-0.199861,0.105022,0.000100528,0.0,0.0 | ||
| 1,2,0.10444,-0.199182,0.104773,6.24562e-05,0.0,0.0 | ||
| 2,0,0.1055,-0.200303,0.104922,3.84218e-05,0.0,0.0 | ||
| 2,1,0.104915,-0.200106,0.105298,-4.97694e-06,0.0,0.0 | ||
| 2,2,0.105631,-0.200818,0.105335,0.000287088,0.0,0.0 |
7 changes: 7 additions & 0 deletions
7
.../GeoMechanicsApplication/tests/test_element_lab/test_triaxial/drained/expected_stress.csv
This file contains hidden or 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,7 @@ | ||
| element_id,ip_index,stress_xx,stress_yy,stress_zz,stress_xy,stress_yz,stress_xz | ||
| 1,0,-99.9808,-252.622,-99.9806,0.193199,0.0,0.0 | ||
| 1,1,-99.8828,-252.381,-99.8827,0.0448209,0.0,0.0 | ||
| 1,2,-100.045,-252.78,-100.045,0.0314238,0.0,0.0 | ||
| 2,0,-99.9991,-252.668,-99.9991,0.00846584,0.0,0.0 | ||
| 2,1,-99.967,-252.589,-99.967,-0.0103576,0.0,0.0 | ||
| 2,2,-100.064,-252.827,-100.064,0.137162,0.0,0.0 |
10 changes: 10 additions & 0 deletions
10
.../GeoMechanicsApplication/tests/test_element_lab/test_triaxial/undrained/expected_disp.csv
This file contains hidden or 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,10 @@ | ||
| node_id,disp_x,disp_y,disp_z | ||
| 1,0.0,-0.2,0.0 | ||
| 2,0.045,-0.2,0.0 | ||
| 3,0.0,-0.1,0.0 | ||
| 4,0.045,-0.1,0.0 | ||
| 5,0.0,0.0,0.0 | ||
| 6,0.09,-0.2,0.0 | ||
| 7,0.09,-0.1,0.0 | ||
| 8,0.045,0.0,0.0 | ||
| 9,0.09,0.0,0.0 |
3 changes: 3 additions & 0 deletions
3
...eoMechanicsApplication/tests/test_element_lab/test_triaxial/undrained/expected_strain.csv
This file contains hidden or 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 @@ | ||
| element_id,ip_index,strain_xx,strain_yy,strain_zz,strain_xy,strain_yz,strain_xz | ||
| 1,0,0.09,-0.2,0.09,0.0,0.0,0.0 | ||
| 2,0,0.09,-0.2,0.09,0.0,0.0,0.0 |
3 changes: 3 additions & 0 deletions
3
...eoMechanicsApplication/tests/test_element_lab/test_triaxial/undrained/expected_stress.csv
This file contains hidden or 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 @@ | ||
| element_id,ip_index,stress_xx,stress_yy,stress_zz,stress_xy,stress_yz,stress_xz | ||
| 1,0,-100.0,-4740.0,-100.0,0.0,0.0,0.0 | ||
| 2,0,-100.0,-4740.0,-100.0,0.0,0.0,0.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I'm getting a bit confused. Why would the node IDs be equal to the sorted expected displacements? I would have expected something like (since the node IDs are the keys in the map with the expected displacements, right?):
I can guess why the code works, but I'm not 100% sure. Perhaps iterating over a map yields the keys? If yes, then I would prefer the more explicit expression, i.e. by adding
.keys(). Thank you.I'm also wondering whether the node IDs need to be sorted or not. It seems to me that the code would also work if the node IDs are not sorted. Or am I overlooking something?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the python sorting techniques it works like the following example:
sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})
[1, 2, 3, 4, 5]
They do not need to be sorted necessarily, but it was just a way to get the keys. I will add the .keys() for clarity. I can also do just expected_displacement.keys() without sorted. that returns a dict object then instead of a list but it also works here. Please let me know if that is even more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay maybe not a real dict object but I don't know what to call it.
Just
expected_displacement.keys()returns: dict_keys([1, 2, 3, 4, 5, 6, 7, 8, 9])