How to work with Groups (Meshes)
What is a Group?
A Group is a subset of entities of the domain. In numerical simulation, they are useful to identify parts of the domain that have different data associated to them. For instance, the nodes belonging to a fluid inlet can belong to a group, the nodes where we want to plot some result can belong to a different group, the elements that belong to a rigid body can belong to a different group, etc... As a big difference with Partitions, the Groups can overlap, in such a way that a node can belong to different groups. This is the reason why Groups know what entities they contain, while the entities not necessarily know what Groups they belong to.
How to use Groups in Kratos? The Meshes
The keyword that Kratos uses for Group is Mesh. A Mesh is a subset of a Model Part which can contain simultaneously Nodes, Elements, Conditions and Shared Data.
The main features of the Mesh are the following:
- It contains pointers to the entities included (not copies of the entities)
- It has an interface accessible from C++ and Python for the most usual operations.
- The Nodes are loopable. The Elements and the Conditions are loopable too.
- It features a container (Mesh Data) which can store variables of any kind, as many as wanted
Important Note: All the entities of the Model Part are saved by default in Mesh 0, so when the Model Part loops over all its entities, it actually loops over the entities of Mesh 0. All the other meshes point to entities that are already included in Mesh 0. Care must be taken when adding an newly created entity to a Mesh. It must be added to Mesh 0 as well if we want the ModelPart to be aware of the inclusion of the new entity.
How to create Meshes?
The easiest option is to write it in the input file (.mdpa file). The syntax is the following:
Begin Mesh 2 Begin MeshData IDENTIFIER Custom_Name YOUNG_MODULUS 1.0e9 EULER_ANGLES  (0.0,0.0,0.0) End MeshData Begin MeshNodes 3 5 7 End MeshNodes Begin MeshElements 10 12 End MeshElements Begin MeshConditions 6 7 End MeshConditions End Mesh