This guide explains how the plugin works in the background and how it can be used.
The workflow for creating Kratos input files (currently supported format: mdpa
) follows the workflow of Kratos itself. The implementation is very modular, such that it can easily be extended (or even adapted to other preprocessors) in the future.
The main components are:
ModelPart
: Kratos cannot be imported inside of Salome. Hence a Python version of the Kratos-ModelPart was developed, which has a matching interface for the most part. I.e. it is possible to add Nodes, Elements, Properties etc, just like with the Kratos-ModelPart. For users familiar with Kratos using it is straight forward.write_mdpa
: This function takes aModelPart
as input and writes anmdpa
file from it. This is basically what the ModelPartIO does. It was kept a bit more modular to be easier to extend in the future.GeometriesIO
: This class takes (Salome) meshes as input and createsNodes
,Elements
andConditions
from it. It works purely based on connectivities and could therefore serve as a prototype for creatingModelPart
s fromGeometries
inside of the solvers in KratosMeshInterface
: The interface for accessing the Salome Mesh (created with theMesh
module). It directly accesses the database of Salome and extracts the mesh information the user requested.
Those components are combined in the following way:
- An empty
ModelPart
is created MeshInterface
s are created for the Salome meshes that are to be used- The created
ModelPart
and theMeshInterface
s are given to theGeometriesIO
in order to createNodes
,Elements
andConditions
. A separate dictionary is used to specify which entities to create. - After the
ModelPart
is filled with entities, it is being passed towrite_mdpa
for creating themdpa
file.
The GUI is currently under development. This section will be added once the GUI of the plugin fully developed.
The plugin offers a wide range of usecases:
- The most basic and straight forward way of creating
mdpa
files from salome meshes is to useCreateMdpaFile
of create_kratos_input_tui.py. Several examples demonstrate this. - In case the user wants to modify the
ModelPart
before creating anmdpa
file, then the functionCreateModelPart
is suitable. After modifying theModelPart
the functionwrite_mdpa
can be called separately. - For a more customized usage the main components introduced above can of course also be used individually. It is recommended to take a look at the workflow inside of
create_kratos_input_tui.py
as a starting point.
The plugin uses the Python logging module, the logs are placed in important parts of the code. Logging is done to the console as well as to a file (kratos_salome_plugin.log
). Beside the regular logs also exceptions are being logged.
In case problems with the plugin occur it is very helpful to provide the this log-file.