Skip to content
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

Merged
merged 34 commits into from
Mar 22, 2024

Conversation

rfaasse
Copy link
Contributor

@rfaasse rfaasse commented Mar 19, 2024

📝 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.

@@ -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
Copy link
Contributor Author

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

# Code here will be placed AFTER every test in this TestCase.
pass

def test_prescribed_acceleration(self):
Copy link
Contributor Author

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!

Copy link
Contributor

@avdg81 avdg81 left a 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!

def test_prescribed_acceleration(self):
"""
This test checks if the prescribed acceleration in the x-direction is correctly applied to the model
:return:
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

@WPK4FEM WPK4FEM left a 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(
Copy link
Contributor

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.

Copy link
Contributor Author

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

Comment on lines 127 to 147
"active": [
false,
true,
false
],
"is_fixed": [
false,
true,
false
],
"value": [
0.0,
0.0,
0.0
],
"table": [
0,
0,
0
]
}
Copy link
Contributor

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.

Copy link
Contributor Author

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"?>
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor Author

@rfaasse rfaasse left a 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.

def test_prescribed_acceleration(self):
"""
This test checks if the prescribed acceleration in the x-direction is correctly applied to the model
:return:
Copy link
Contributor Author

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

@rfaasse rfaasse requested review from avdg81 and WPK4FEM March 22, 2024 09:58
Copy link
Contributor

@WPK4FEM WPK4FEM left a 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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!

WPK4FEM
WPK4FEM previously approved these changes Mar 22, 2024
Copy link
Contributor

@WPK4FEM WPK4FEM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete.

Copy link
Contributor

@avdg81 avdg81 left a 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,
Copy link
Contributor

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.

Copy link
Contributor Author

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

@rfaasse rfaasse enabled auto-merge (squash) March 22, 2024 15:13
@rfaasse rfaasse requested review from avdg81 and WPK4FEM March 22, 2024 16:18
Copy link
Contributor

@avdg81 avdg81 left a 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.

@rfaasse rfaasse merged commit 1166a00 into master Mar 22, 2024
11 checks passed
@rfaasse rfaasse deleted the geo/12184-fix-prescribed-acceleration branch March 22, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants