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

[Core] Add Process for MPC Visualization #12254

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

matekelemen
Copy link
Contributor

Add a process that generates Element2D2Ns from MasterSlaveConstraints. These elements can then be written to files with any other output process.

The input and output model parts are controlled by the user and can belong to completely separate trees, so the interference of the generated elements with the solver can be prevented.

trebuchet_arm_mpc

FYI @sunethwarna

Copy link
Member

@philbucher philbucher left a comment

Choose a reason for hiding this comment

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

somehow this seems more complicated than I thought it would be

I would like to review in more detail, but wont have time until next weekend

Copy link
Member

Choose a reason for hiding this comment

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

I would not add this, afaik this should not be necessary when using the Registry right @rubenzorrilla ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd love to use Registry, but I have absolutely no idea how it works and I haven't seen any documentation or examples yet.

@matekelemen
Copy link
Contributor Author

matekelemen commented Apr 7, 2024

somehow this seems more complicated than I thought it would be

same here; there are 2 things that make this more difficult than I initially thought:

  • elements connect nodes, but MPCs connect DoFs. I need to be able to handle cases where each DoF of a node is constrained by a different type of DoF (which is why elements are grouped by the pair of variables the related MPCs constrain).
  • MPCs can be created and destroyed between time steps (e.g.: contact problems)

P.S.: good luck with your defense!

second_type second;
};

std::optional<ModelPart*> mpInputModelPart;
Copy link
Member

Choose a reason for hiding this comment

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

optional of a raw pointer does not make much sense does it?

This is kinda optional of an optional no?
You are not using any optional features

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm wrapping optionals around pointers to make sure I don't cause segfaults if I forget to check the pointer.

I never assign default-constructed pointers or nullptr to the optional, which means that if the optional has a value, it is a valid pointer. On the other hand, if the pointer was never assigned, then nor was the optional, in which case an exception is thrown instead of a segfault.

Comment on lines +136 to +138
// Max reduce across MPI ranks
const DataCommunicator& r_mpi = rModelPart.GetCommunicator().GetDataCommunicator();
return static_cast<Element::IndexType>(r_mpi.MaxAll(static_cast<long unsigned int>(output))); // <== explicit casts for MSVC
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll need to think this through because each rank will start issuing element IDs at the same index.

public:
KRATOS_CLASS_POINTER_DEFINITION(MultipointConstraintToElementProcess);

MultipointConstraintToElementProcess() noexcept;
Copy link
Member

Choose a reason for hiding this comment

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

Add some doxygen here and the separators. like Operations, Life Cycle, etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants