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 aModelPartas input and writes anmdpafile 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,ElementsandConditionsfrom it. It works purely based on connectivities and could therefore serve as a prototype for creatingModelParts fromGeometriesinside of the solvers in KratosMeshInterface: The interface for accessing the Salome Mesh (created with theMeshmodule). 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
ModelPartis created MeshInterfaces are created for the Salome meshes that are to be used- The created
ModelPartand theMeshInterfaces are given to theGeometriesIOin order to createNodes,ElementsandConditions. A separate dictionary is used to specify which entities to create. - After the
ModelPartis filled with entities, it is being passed towrite_mdpafor creating themdpafile.
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
mdpafiles from salome meshes is to useCreateMdpaFileof create_kratos_input_tui.py. Several examples demonstrate this. - In case the user wants to modify the
ModelPartbefore creating anmdpafile, then the functionCreateModelPartis suitable. After modifying theModelPartthe functionwrite_mdpacan 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.pyas 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.