Geo/quad extrapolation test#14600
Open
mcgicjn2 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses crashes/incorrect results when extrapolating integration-point values to nodes in GeoMechanics models containing mixed element/geometry configurations by improving extrapolation-matrix caching, and adds regression test cases for mixed-element setups.
Changes:
- Updates
GeoExtrapolateIntegrationPointValuesToNodesProcessto cache extrapolation matrices by a computed key instead oftypeidonly. - Adds new mixed-element test meshes and parameter sets (quads-only, triangles-only, and mixed).
- Extends the Python test suite with a regression test comparing mixed vs non-mixed results.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/GeoMechanicsApplication/custom_processes/geo_extrapolate_integration_point_values_to_nodes_process.hpp | Adds a cache-key helper declaration to support improved extrapolation-matrix caching. |
| applications/GeoMechanicsApplication/custom_processes/geo_extrapolate_integration_point_values_to_nodes_process.cpp | Switches cache lookups/inserts to use the new computed cache key. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation.py | Adds a new regression test for mixed-element extrapolation output consistency. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/quads/simple_mesh.mdpa | Introduces a quads-only mesh for the mixed-elements regression scenario. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/quads/ProjectParameters.json | Adds solver/process settings to run the quads-only regression case. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/triangles/simple_mesh.mdpa | Introduces a triangles-only mesh for the mixed-elements regression scenario. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/triangles/ProjectParameters.json | Adds solver/process settings to run the triangles-only regression case. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/mixed/simple_mesh.mdpa | Introduces a mixed mesh combining quads and triangles for the regression scenario. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/mixed/ProjectParameters.json | Adds solver/process settings to run the mixed-element regression case. |
| applications/GeoMechanicsApplication/tests/test_integration_node_extrapolation/mixed_elements/mixed/MaterialParameters.json | Provides local material parameters for the mixed regression case. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+204
to
+210
| // Combine geometry type and number of integration points for unique key | ||
| const auto& r_geometry = rElement.GetGeometry(); | ||
| std::size_t key = static_cast<std::size_t>(r_geometry.GetGeometryType()); | ||
| key ^= GeoElementUtilities::GetNumberOfIntegrationPointsOf(rElement) << 16; | ||
| key ^= r_geometry.size() << 16; | ||
|
|
||
| return key; |
| 13 1.5000000000 0.0000000000 0.0000000000 | ||
| 14 1.5000000000 -1.0000000000 0.0000000000 | ||
| 15 0.5000000000 -1.0000000000 0.0000000000 | ||
| End Nodes |
Comment on lines
+104
to
+120
| # two quadrilaterals | ||
| file_path_quads = os.path.join(file_path, "quads") | ||
| test_helper.run_kratos(file_path_quads) | ||
| simulation_output = reader.read_output_from(os.path.join(file_path_quads, test_name+'.post.res')) | ||
| heads_quads = GiDOutputFileReader.nodal_values_at_time( | ||
| "HYDRAULIC_HEAD", 1, simulation_output, node_ids=range(1,14)) | ||
|
|
||
| # mixed elements | ||
| file_path_mixed = os.path.join(file_path, "mixed") | ||
| test_helper.run_kratos(file_path_mixed) | ||
| simulation_output = reader.read_output_from(os.path.join(file_path_mixed, test_name+'.post.res')) | ||
| heads_mixed = GiDOutputFileReader.nodal_values_at_time( | ||
| "HYDRAULIC_HEAD", 1, simulation_output, node_ids=range(1,14)) | ||
|
|
||
|
|
||
| for head_quad, head_mixed in zip(heads_quads, heads_mixed): | ||
| self.assertAlmostEqual(head_mixed, head_quad, places=4) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Caches the extrapolation matrix for element types with different numbers of nodes
Fixes #14599