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

New Rom Utility Functions #12274

Merged
merged 3 commits into from
Apr 17, 2024
Merged

New Rom Utility Functions #12274

merged 3 commits into from
Apr 17, 2024

Conversation

SADPR
Copy link
Contributor

@SADPR SADPR commented Apr 12, 2024

PR Description

This PR introduces a set of new utility functions to the RomAuxiliaryUtilities class.

Description

  1. GetHRomConditionParentsIds

    • Purpose: Retrieves the parent elements of specified conditions, vital for constructing reduced order models where maintaining the parent element of a selected condition is necessary. This extension allows for fetching parent elements for any list of condition ids, whereas previously this was only possible for a map containing the original HROM conditions and elements weights.
  2. GetNodalNeighbouringElementIds

    • Purpose: Fetches element IDs neighboring specified nodes. This extension allows for fetching neighboring elements for any list of nodes, whereas previously this was only possible for elements within a given model part.
  3. GetNodalNeighbouringConditionIds

    • Purpose: Functions similarly to the GetNodalNeighbouringElementIds but targets conditions adjacent to given nodes.

These utilities were particularly valuable for cosimulation scenarios where the transfer on the interface becomes a challenge.

Copy link
Member

@Rbravo555 Rbravo555 left a comment

Choose a reason for hiding this comment

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

Some minor comments. Here's another one, note that you are using both neighbOUr (UK) and neighbOr (US) interchangeably.

return Kratos::RomAuxiliaryUtilities::GetNodalNeighbouringElementIds(rModelPart, rGivenModelPart);})
.def_static("GetNodalNeighbouringElementIds", [](Kratos::ModelPart& rModelPart, const std::vector<Kratos::IndexType>& rNodeIds, bool retrieveSingleNeighbour) {
return Kratos::RomAuxiliaryUtilities::GetNodalNeighbouringElementIds(rModelPart, rNodeIds, retrieveSingleNeighbour);})
.def_static("GetNodalNeighbouringConditionIds", &RomAuxiliaryUtilities::GetNodalNeighbouringConditionIds)
.def_static("GetConditionIdsNotInHRomModelPart", &RomAuxiliaryUtilities::GetConditionIdsNotInHRomModelPart)
Copy link
Member

Choose a reason for hiding this comment

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

why are we adding a return here? I had not seen return in other pybind stuff

const auto& r_elem = r_neigh_elements[i];
parent_ids_set.insert(r_elem.Id() - 1);
break;
}
Copy link
Member

Choose a reason for hiding this comment

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

This +1 in the condId(line 513) and r_elem.Id()-1 in line 519 are related to the difference in ids in numpy and in Kratos? let us mark it as #FIXME, to have it in mind for an upcoming PR fixing all these indexes

Copy link
Member

@Rbravo555 Rbravo555 left a comment

Choose a reason for hiding this comment

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

LGTM

@Rbravo555 Rbravo555 merged commit 2110029 into master Apr 17, 2024
11 checks passed
@Rbravo555 Rbravo555 deleted the Kratos_ROM_Add_AuxiliaryUtilities branch April 17, 2024 08:23
ROM Application Project automation moved this from In progress to Done Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants