-
Notifications
You must be signed in to change notification settings - Fork 277
ModelPart and SubModelPart
In the previous part of the tutorial, we already saw how the ModelPart is the object containing Element, Conditions, Nodes and Properties.
A fundamental feature is that it can also hierarchically contain "SubModelParts" intended as other ModelParts which belong to the same parent. This relation can be repeated recursively, so that each "root" ModelPart can actually own a tree of SubModelParts.
The parent-son relation is such that anything that belongs to a given SubModelPart also belongs to the parent ModelPart. This implies that the ultimate "owner" of any Node, Element, etc, will be the "root" ModelPart. The consistency of the tree is ensured by the ModelPart API, which provides the tools needed for creating or removing anything any of the contained objects.
Let's try to make an example to explain this better.
#create a ModelPart root
model_part = ModelPart("Main")
#now create a SubModelPart
model_part.CreateSubModelPart("Inlets")
#let's output what is there:
print(model_part)
the output is:
we could now verify if a given submodelpart exists, or how many SubModelParts exist as
model_part.HasSubModelPart("Inlets") #returns True
model_part.NumberOfSubModelParts() #returns 1
model_part.GetSubModelPart("Inlets").Name #returns the name --> Inlets
let's now create some other SubModelParts
#on the first level
model_part.CreateSubModelPart("Temp")
model_part.CreateSubModelPart("Outlet")
#on the second level --> "sub-sub modelparts"
sub_model_part_1 = model_part.GetSubModelPart("Inlets")
sub_model_part_1.CreateSubModelPart("Inlet1")
sub_model_part_1.CreateSubModelPart("Inlet2")
#output
print(model_part)
each modelpart is only directly aware of its first level siblings. that is
model_part.HasSubmodelPart("Inlet1") --> returns False
however
model_part.GetSubModelPart("Inlets").HasSubmodelPart("Inlet1") --> returns True
self.assertEqual(model_part.NumberOfSubModelParts(), 3)
self.assertEqual(model_part.GetSubModelPart("Inlets").Name, "Inlets")
self.assertEqual(model_part.GetSubModelPart("Outlet").Name, "Outlet")
- Getting Kratos (Last compiled Release)
- Compiling Kratos
- Running an example from GiD
- Kratos input files and I/O
- Data management
- Solving strategies
- Manipulating solution values
- Multiphysics
- Video tutorials
- Style Guide
- Authorship of Kratos files
- Configure .gitignore
- How to configure clang-format
- How to use smart pointer in Kratos
- How to define adjoint elements and response functions
- Visibility and Exposure
- Namespaces and Static Classes
Kratos structure
Conventions
Solvers
Debugging, profiling and testing
- Compiling Kratos in debug mode
- Debugging Kratos using GDB
- Cross-debugging Kratos under Windows
- Debugging Kratos C++ under Windows
- Checking memory usage with Valgind
- Profiling Kratos with MAQAO
- Creating unitary tests
- Using ThreadSanitizer to detect OMP data race bugs
- Debugging Memory with ASAN
HOW TOs
- How to create applications
- Python Tutorials
- Kratos For Dummies (I)
- List of classes and variables accessible via python
- How to use Logger
- How to Create a New Application using cmake
- How to write a JSON configuration file
- How to Access DataBase
- How to use quaternions in Kratos
- How to do Mapping between nonmatching meshes
- How to use Clang-Tidy to automatically correct code
- How to use the Constitutive Law class
- How to use Serialization
- How to use GlobalPointerCommunicator
- How to use PointerMapCommunicator
- How to use the Geometry
- How to use processes for BCs
- How to use Parallel Utilities in futureproofing the code
- Porting to Pybind11 (LEGACY CODE)
- Porting to AMatrix
- How to use Cotire
- Applications: Python-modules
- How to run multiple cases using PyCOMPSs
- How to apply a function to a list of variables
- How to use Kratos Native sparse linear algebra
Utilities
Kratos API
Kratos Structural Mechanics API