Repository navigation
Update Gap SBM worflow in 2D - #15019
Conversation
| // System includes | ||
| #include <cmath> | ||
| #include <limits> | ||
| #include <memory> |
| return SpanIndexY + rSkinBinsPerSpan.NumberOfSpansY * SpanIndexZ; | ||
| } | ||
|
|
||
| static std::size_t FindSpanNnzIndex( |
There was a problem hiding this comment.
I would keep this one. It's nested but readable I think.
| const NurbsVolumeType& rGapVolume) const; | ||
|
|
||
| /** | ||
| * @brief Prints diagnostic information about the orientation of a 3D gap Coons volume. |
| const double Xi, | ||
| const double Eta, | ||
| const bool WithRespectToXi, | ||
| const bool with_respect_to_xi, |
| }; | ||
|
|
||
| // Select the closest admissible skin node using directional span probes. | ||
| auto select_candidate = [&](const Node::Pointer& pSurrogateNode) { |
There was a problem hiding this comment.
I personally don't like define this in here...
| std::unordered_set<IndexType> visited_candidate_ids; | ||
| visited_candidate_ids.reserve(16); | ||
|
|
||
| auto search_span = [&](const SpanId& r_span_id) { |
| candidate_conditions.reserve(2000); | ||
|
|
||
| const bool filter_by_layer = !rLayer.empty(); | ||
| auto node_has_requested_layer = [&](Node::Pointer p_candidate_node) { |
| return std::find(candidate_layers.begin(), candidate_layers.end(), rLayer) != candidate_layers.end(); | ||
| }; | ||
|
|
||
| auto condition_matches_requested_layer = [&](const ConditionPointerType& p_condition) { |
| return node_has_requested_layer(p_geometry->pGetPoint(0)) || node_has_requested_layer(p_geometry->pGetPoint(1)); | ||
| }; | ||
|
|
||
| auto search_with_direction = [&](const array_1d<double, 3>& rSearchDirection) { |
…e Quantized coordinates.
AlejandroCornejo
left a comment
There was a problem hiding this comment.
I'll continue after some changes have been made
| PointType& rLowPoint, | ||
| PointType& rHighPoint) | ||
| { | ||
| const auto& r_geometry = rObject->GetGeometry(); |
There was a problem hiding this comment.
this should be in the .cpp
| const PointerType& rObject, | ||
| PointType& rCentralPoint) | ||
| { | ||
| rCentralPoint = rObject->GetGeometry().Center(); |
There was a problem hiding this comment.
FYI, this is the updatod configuration center, not the reference one (relevant in finite strain)
There was a problem hiding this comment.
It’s correct. These are auxiliary skin conditions used for the spatial search during geometry setup, before the analysis starts. At that point, the current and reference coordinates of the new skin nodes are the same. The center is not used for the finite-strain calculations or at the quadrature points.
In the future, we could reuse the search to recompute the gap elements with the moved skin, rebuilding the bins first. For now, it’s only called once in SetupGeometryModel, before solving.
| PointType low, high; | ||
| CalculateBoundingBox(rObject, low, high, Radius); | ||
| for (std::size_t d = 0; d < Dimension; ++d) { | ||
| if (high[d] < rLowPoint[d] - Epsilon || low[d] > rHighPoint[d] + Epsilon) { |
There was a problem hiding this comment.
I think taht all these auxiliar methods should be gathered in some utilities and reused in many processes
|
|
||
| static inline void Distance( | ||
| const PointerType& rObj_1, | ||
| const PointerType& rObj_2, |
There was a problem hiding this comment.
again, it may be useful to have the current or ref distance..
There was a problem hiding this comment.
I've added some comments saying that the distances are computed in the current configuration, but the process is called only during the geometry setup.
| // | ||
| // License: BSD License | ||
| // Kratos default license: kratos/license.txt | ||
| // |
There was a problem hiding this comment.
name of the developers?
There was a problem hiding this comment.
beside why not using the IGA header?
| if (mpIgaModelPart->GetRootModelPart().Conditions().size() > 0) | ||
| id = mpIgaModelPart->GetRootModelPart().Conditions().back().Id() + 1; | ||
|
|
||
| auto& neighbour_geometries = p_surrogate_1->GetValue(NEIGHBOUR_GEOMETRIES); |
There was a problem hiding this comment.
In general is safer to check if this variable has been set before (Has) otherwise you may be gathering trash
|
|
||
| auto& neighbour_geometries = p_surrogate_2->GetValue(NEIGHBOUR_GEOMETRIES); | ||
|
|
||
| if (norm_2(surrogate_middle_point-neighbour_geometries[0]->Center()) < 1e-12) { |
| const auto& r_left_skin_node = rSkinSubModelPart.GetNode(LeftProjectionId); | ||
| const auto& r_right_skin_node = rSkinSubModelPart.GetNode(RightProjectionId); | ||
|
|
||
| CoordinatesArrayType skin_mid_point_coords = 0.5 * (r_left_skin_node.Coordinates() + r_right_skin_node.Coordinates()); |
|
|
||
| Vector normal_direction = r_right_skin_node.Coordinates() - r_left_skin_node.Coordinates(); | ||
| const double direction_norm = norm_2(normal_direction); | ||
| if (direction_norm > 1.0e-16) { |
There was a problem hiding this comment.
in here the tolerance is more strict?
| rModelPart.AddConditions(new_condition_list.begin(), new_condition_list.end()); | ||
| } | ||
|
|
||
| // Instantiate gap elements and attach surrogate reference data. |
There was a problem hiding this comment.
please use standard commented separators to clearly identify the different methods...
…common to the SbanekSbm and SnakeGapSbm processes. Use of a single tolerance defined in the header. Little reorganization and cleaning of the code
|
The code should be a little cleaner now. All the geometrical operations common to SnakeSbm and SnakeGapSbm processes have been moved to a common utility. We have defined a unique tollerance in the header for the gap sbm, scaled appropriately for all the operations by means of the physical quantities available. Regarding the general comment on the Current Coordinates, right now the process is only called in the geometry setup, so they coincide with the material coordinates. For future applications, in which we might want to recompute the gap elements on the current configuration, I think it's convenient to keep this implementation and recreate the elements on the updated geometry. |
Update Gap SBM worflow in 2D
About:
Optimized and debugged the 2D Gap SBM implementation. A 3D implementation, multipatch support, and box refinement in IGA are planned next.
Description
Moved the 2D Gap SBM implementation into its own .cpp file to prepare for a separate 3D implementation. Fixed projection and quadrature issues, added handling for multiple immersed geometry layers, and introduced CSR-based knot-span storage for faster, more efficient searches.
Key changes
Validation
Changelog