-
Notifications
You must be signed in to change notification settings - Fork 248
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
[GeoMechanicsApplication] Fix prescribed acceleration #12208
Conversation
…ns being overwritten by the time integration scheme
…nal setting of the variables.
…e value is not changed after scheme update
…g the value is not changed after scheme update
@@ -52,13 +53,13 @@ class BackwardEulerScheme : public GeoMechanicsTimeIntegrationScheme<TSparseSpac | |||
KRATOS_TRY | |||
|
|||
block_for_each(rModelPart.Nodes(), [this](Node& rNode) { | |||
// For the Backward Euler schemes the first derivatives should be |
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.
A similar comment is already placed in line 76, so I thought it was redundant to leave it here
...pplication/tests/prescribed_derivative_tests/prescribed_acceleration/MaterialParameters.json
Show resolved
Hide resolved
# Code here will be placed AFTER every test in this TestCase. | ||
pass | ||
|
||
def test_prescribed_acceleration(self): |
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.
If there are any other things to test besides the prescribed variables themselves, please let me know!
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.
Very nice and clear improvement backed up by excellent tests. Thanks for the great work Richard!
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.h
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/variables_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Show resolved
Hide resolved
def test_prescribed_acceleration(self): | ||
""" | ||
This test checks if the prescribed acceleration in the x-direction is correctly applied to the model | ||
:return: |
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.
I'm not sure what this line means. Do we need it?
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.
Removed the :return:, was there from copied test
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
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.
Dear Richard,
This seems quite consistent to me ( even if we know that the integration tests still suffer from the not yet understood ill condition ).
I appreciate the extensive unit testing.
Wijtze Pieter
const auto updated_first_time_derivative = | ||
CalculateDerivative(r_second_order_vector_variable.instance, rNode); | ||
|
||
NodeUtilities::ApplyUpdatedVectorVariableToNonFixedComponents( |
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.
I'm wondering:
Looks more like VectorDOFComponentUtilities then NodeUtilities to me,
However, we are passing rNode to get to the fixed D.O.F.
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.
Indeed, due to that last point, I'd propose to keep it like it is
...pplication/tests/prescribed_derivative_tests/prescribed_acceleration/MaterialParameters.json
Show resolved
Hide resolved
"active": [ | ||
false, | ||
true, | ||
false | ||
], | ||
"is_fixed": [ | ||
false, | ||
true, | ||
false | ||
], | ||
"value": [ | ||
0.0, | ||
0.0, | ||
0.0 | ||
], | ||
"table": [ | ||
0, | ||
0, | ||
0 | ||
] | ||
} |
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.
very long way of formatting.
"active": [false, true, false],
"is_fixed": [false, true, false],
"value": [0.0, 0.0, 0.0],
"table": [0, 0, 0,],
is a log clearer to me.
This pattern repeats in several places.
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.
Done
@@ -0,0 +1,3197 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
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.
Peculiar that the internal mid nodes are missing. However. for the boundary conditions, it may be clearer to omit the nodes and the internal mesh lines.
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.
Done
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.
Processed the review comments of @avdg81, fixed function for Release build and formatted ProjectParameters.json to make them more compact.
What's left is fixing the integration tests.
applications/GeoMechanicsApplication/custom_utilities/variables_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.cpp
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/custom_utilities/node_utilities.h
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Show resolved
Hide resolved
def test_prescribed_acceleration(self): | ||
""" | ||
This test checks if the prescribed acceleration in the x-direction is correctly applied to the model | ||
:return: |
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.
Removed the :return:, was there from copied test
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
applications/GeoMechanicsApplication/tests/test_prescribed_derivatives.py
Outdated
Show resolved
Hide resolved
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.
Seems consistent to me. my remarks are mainly on the test description.
modulus | ||
of 150000 kPa and a Poisson ratio of 0.3. | ||
|
||
No conditions or loads are applied. |
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.
Not true, the bottom has a Dirichlet condition for a, v or dp/dt. That is a form of loading.
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.
Good point, added
| 0.2 | 0.01 | | ||
|
||
- Constraints: | ||
- The Y displacements at the sides and bottom are fixed. |
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.
In this way a column that can only react as shear column is created.
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.
Thanks for the addition, added!
…ble to other two tests
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.
Complete.
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.
This is a nice and clear improvement, backed up by sound tests. Thanks for all the hard work that you have done.
@@ -229,4 +229,69 @@ KRATOS_TEST_CASE_IN_SUITE(NewmarkDynamicUPwSchemePredict_UpdatesVariablesDerivat | |||
expected_dt_water_pressure); | |||
} | |||
|
|||
KRATOS_TEST_CASE_IN_SUITE(NewmarkDynamicUPwSchemePredict_DoesNotUpdateFixedSecondDerivativeVectorVariable, |
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.
Shouldn't this name refer to Update
rather than Predict
? The same question applies to the next two unit tests in this file.
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.
You're right, I started with Predicts and changed to Updates later, I'll check all added tests
…and clang-formatted the test file
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.
I believe we're ready to go.
📝 Description
This PR aims to fix the issue with prescribed accelerations which were overwritten by the time integration schemes. Functionality is added to the schemes to check if a variable is fixed, and in that case skip the update. Unit tests and 3 integration tests are added to ensure this works correctly for all prescribed derivatives (i.e. first and second derivative of the vector variables and the first derivative of the scalar variable). A README.md is added to the new folder of tests to document its assertions.