Skip to content

[GeoMechanicsApplication] Nodal extrapolation for interface elements - #14061

Merged
avdg81 merged 42 commits into
masterfrom
geo/nodal-extrapolation-for-interface-elements
Dec 15, 2025
Merged

[GeoMechanicsApplication] Nodal extrapolation for interface elements#14061
avdg81 merged 42 commits into
masterfrom
geo/nodal-extrapolation-for-interface-elements

Conversation

@avdg81

@avdg81 avdg81 commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

📝 Description
Extended the nodal extrapolator such that it also supports interface elements (line and surface ones).

🆕 Changelog

  • The interface geometry can now return its mid-geometry through the member functions pGetGeometryPart and GetGeometryPart (the provided part index is not being used).
  • Since pGetGeometryPart returns 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.
  • Added overrides for members GetGeometryFamily and GetGeometryOrderType for class template InterfaceGeometry, which forward the request to the underlying mid-geometry.
  • Any interface element can now return a list of its integration points (regardless of the adopted integration scheme).
  • Any interface element can now return its mid-geometry.
  • When calculating the linear extrapolation matrix, we now only need to provide it with the element itself rather than the element's geometry and integration method. This change enables us to define a unified API that works for all elements (recall that the integration method could not be easily extended towards ones that are commonly used by interface elements).
  • Added a utility function that returns the integration points of any element, including interface elements.
  • Added a utility function that calculates the determinants of the Jacobian matrices of any element, including interface elements.
  • Extended the nodal linear extrapolator such that it also supports any interface element.
  • Made a utility function that generates nodes public.
  • Added element setup functions that create linear and quadratic quadrilateral elements.
  • Extended several existing unit tests to cover the newly added overrides for interface geometry (i.e. getting the geometry's family as well as its order).
  • Added new unit tests to cover the proper construction of the mid-geometry of any interface geometry.
  • The unit tests of the linear nodal extrapolator have been updated such that they work with elements rather than geometries.
  • Added a helper function that checks whether two given lists of points are equal to within a provided tolerance on a pair-by-pair basis.
  • Reuse the UBlas utility functions to create expected matrices and vectors.

avdg81 and others added 30 commits November 28, 2025 15:00
…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.
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
…-extrapolation-for-interface-elements and resolved merge conflicts
- 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.
…eometry

Also added a helper function that checks whether to collections of points are equal within a given absolute tolerance.
@avdg81
avdg81 requested a review from a team as a code owner December 11, 2025 15:56
@avdg81 avdg81 added the GeoMechanics Issues related to the GeoMechanicsApplication label Dec 11, 2025
}

std::unique_ptr<BaseType> mMidGeometry;
std::shared_ptr<BaseType> mMidGeometry;

@avdg81 avdg81 Dec 11, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Had to change this to std::shared_ptr since it is handed out now by pGetGeometryPart, which has this return type.

@rfaasse
rfaasse self-requested a review December 11, 2025 16:02
After changing the smart pointer type of `mMidGeometry`, I had forgotten to update the construction of the data member. Fixed that now.

@rfaasse rfaasse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for implementing well-tested and clear extrapolation functionality we need for visualizing results in the interfaces!

Comment thread applications/GeoMechanicsApplication/tests/cpp_tests/test_utilities.h Outdated
Comment thread applications/GeoMechanicsApplication/custom_utilities/extrapolation_utilities.cpp Outdated
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 markelov208 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Anne, thank you very much for the changes. Now the tests looks like one. I have no blocking comments.

Comment thread applications/GeoMechanicsApplication/custom_geometries/interface_geometry.h Outdated
- 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"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should now be the main entry point when we need to calculate the extrapolation matrix of an element (any element, including interface elements).

@markelov208 markelov208 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in GeoMechanicsApplication (Deltares) Dec 15, 2025

@rfaasse rfaasse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

@avdg81
avdg81 merged commit 06d5fdb into master Dec 15, 2025
9 of 10 checks passed
@avdg81
avdg81 deleted the geo/nodal-extrapolation-for-interface-elements branch December 15, 2025 09:01
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in GeoMechanicsApplication (Deltares) Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GeoMechanics Issues related to the GeoMechanicsApplication

Development

Successfully merging this pull request may close these issues.

[GeoMechanicsApplication] Add support for line and interface elements when extrapolating results to nodes

4 participants