[GeoMechanicsApplication] Nodal extrapolation for interface elements - #14061
Conversation
…nt rather than geometry, integration method and element ID
Also added utility functions for creating 2D 4-noded elements and 2D 8-noded elements. In addition, fixed the position of one node of the 20-noded hexahedron.
This way also works for interface elements.
…bian matrices at the integration points
Also removed a redundant template parameter.
Use the element family type as basis to decide which geometry to produce.
It returns the geometry family of the underlying mid-geometry.
It returns the order of the underlying mid-geometry.
The corresponding unit test covers a line interface element.
…-extrapolation-for-interface-elements and fixed merge conflicts
…i.s.o. streaming in results.
…-extrapolation-for-interface-elements and resolved merge conflicts
…tion-for-interface-elements
- Use `auto` when the type can be induced. - Made more variables `const`. - Moved some variables closer to their first usage. - Added a comment to explain why the extrapolation matrix of an interface element needs to expanded after calculating it from the mid-geometry. - Reformatted a few lines that are (deliberately) skipped by clang-format. - Renamed a variable to comply with the Kratos Style guide. - Eliminated a few intermediate variables. - Removed a redundant blank line.
…tion-for-interface-elements
…eometry Also added a helper function that checks whether to collections of points are equal within a given absolute tolerance.
| } | ||
|
|
||
| std::unique_ptr<BaseType> mMidGeometry; | ||
| std::shared_ptr<BaseType> mMidGeometry; |
There was a problem hiding this comment.
Had to change this to std::shared_ptr since it is handed out now by pGetGeometryPart, which has this return type.
After changing the smart pointer type of `mMidGeometry`, I had forgotten to update the construction of the data member. Fixed that now.
rfaasse
left a comment
There was a problem hiding this comment.
Thank you for implementing well-tested and clear extrapolation functionality we need for visualizing results in the interfaces!
Also resolved an undesired dependency of the GeoMechanicsApplication core code on testing code. In addition, several Kratos expect macros have been replaced by GTest macros.
markelov208
left a comment
There was a problem hiding this comment.
Hi Anne, thank you very much for the changes. Now the tests looks like one. I have no blocking comments.
- The linear nodal extrapolator now only knows about geometry, and no longer about elements. The extrapolation utilities offer the entry point for calculating the extrapolation matrix for any kind of element, including interface elements. - Simplified expanding the extrapolation matrix for interface elements. - Defined the nodal positions in the test cases themselves to ease checking the expected values. - Added an offset to the positions of the nodes at the second side, to check whether the mid-side nodes are properly positioned between both sides. - Added a few clarifying comments.
- Renamed a data member to comply with the Kratos Style Guide.
…tion-for-interface-elements and fixed merge conflicts Also renamed a function parameter for consistency reasons.
…ints To avoid (too) many member functions for the interface elements, I have introduced a getter for the integration scheme. In turn, the integration scheme gives access to the number of integration points as well as the integration points themselves.
| #include "check_utilities.h" | ||
| #include "geo_mechanics_application_variables.h" | ||
| #include "includes/exception.h" | ||
| #include "tests/cpp_tests/test_utilities.h" |
There was a problem hiding this comment.
This dependency of the GeoMechanicsApplication core code on the test code should never have been there. It has been removed now.
| Matrix ExtrapolationUtilities::CalculateExtrapolationMatrix(const Geometry<Node>& rGeometry, | ||
| GeometryData::IntegrationMethod IntegrationMethod, | ||
| size_t ElementId) | ||
| Matrix ExtrapolationUtilities::CalculateExtrapolationMatrix(const Element& rElement) |
There was a problem hiding this comment.
This should now be the main entry point when we need to calculate the extrapolation matrix of an element (any element, including interface elements).
Also removed a few unused forward declarations.
markelov208
left a comment
There was a problem hiding this comment.
Hi Anne, thank you very much for processing the comments. From my view-point, the PR is ready to be merged. Lets wait for Richard's decision.
rfaasse
left a comment
There was a problem hiding this comment.
Thanks for processing the comments (the suggestion/discussion about restructuring took some work to implement)! In my opinion this is ready to go!
| CacheExtrapolationMatrixFor( | ||
| rElement, mpExtrapolator->CalculateElementExtrapolationMatrix( | ||
| rElement.GetGeometry(), rElement.GetIntegrationMethod())); | ||
| rElement, ExtrapolationUtilities::CalculateExtrapolationMatrix(rElement)); |
There was a problem hiding this comment.
Looking at the code, I think it's indeed nice that we now put the responsibility of casting to an interface element in the utils. The only downside I see is that if we'd like to swap out the linear extrapolator to something else in the future, that's slightly more difficult (but still very easy to change, so in my opinion this is the best option now)
📝 Description
Extended the nodal extrapolator such that it also supports interface elements (line and surface ones).
🆕 Changelog
pGetGeometryPartandGetGeometryPart(the provided part index is not being used).pGetGeometryPartreturns a shared pointer to the underlying mid-geometry, the data member that keeps the mid-geometry also had to be changed to a shared pointer.GetGeometryFamilyandGetGeometryOrderTypefor class templateInterfaceGeometry, which forward the request to the underlying mid-geometry.