Running Kratos Simulations
The Problemtype sidebar section turns an .mdpa preview into a case builder: pick a physics problemtype, fill in the solver settings, assign boundary conditions and materials to SubModelParts, and the extension generates everything a Kratos Multiphysics run needs — then launches it in an integrated terminal.

What gets generated
Clicking Generate case files writes three files next to the .mdpa:
| File | Contents |
|---|---|
ProjectParameters.json | The full Kratos parameters document: analysis_stage, problem_data, solver_settings (pointing at your mdpa), processes (your condition assignments) and output_processes |
<Problemtype>Materials.json | One properties entry per material assignment (model_part_name, constitutive law, variables) |
MainKratos.py | The generic launcher: reads the JSON, imports the analysis_stage module and runs the simulation |
Output is always configured through Kratos' vtk_output_process, so results land in a vtk_output/ folder that this extension can preview directly — including time-series playback that extends live while the solver is still writing steps.
Your form choices are auto-saved to <name>.kratoscase.json next to the mdpa and restored the next time you open the preview. The file is plain JSON — commit it to version control to share the case setup.
Configure the Kratos location
Open Settings → Extensions → Kratos MDPA Preview (or search kratos. in settings):
| Setting | Meaning |
|---|---|
kratos.pythonPath | Python executable used to run cases. Empty = python3 (python on Windows) |
kratos.installPath | Root of a compiled Kratos build (the folder containing KratosMultiphysics/ and libs/, or a source checkout — see below). Leave empty for a pip-installed Kratos |
kratos.extraEnv | Extra environment variables for the run terminal, e.g. {"OMP_NUM_THREADS": "4"} |
kratos.problemtypes.extraPaths | Directories scanned for user problemtypes (default .kratos/problemtypes) |
Two common setups:
- pip-installed Kratos (recommended):
pip install KratosMultiphysics-allinto any Python, pointkratos.pythonPathat that interpreter, leavekratos.installPathempty. - Custom-compiled Kratos: run Kratos Case: Select Kratos Installation Folder… from the Command Palette and pick either the install root (the directory holding
KratosMultiphysics/andlibs/) or your Kratos source checkout — an in-tree build underbin/Release(orRelWithDebInfo/Debug/FullDebug) is detected automatically. The command validates the layout and writeskratos.installPath(workspace settings when a workspace is open). The run terminal then getsPYTHONPATHplus the platform's shared-library path (LD_LIBRARY_PATHon Linux,DYLD_LIBRARY_PATHon macOS,PATHon Windows). Note macOS System Integrity Protection stripsDYLD_*variables for protected binaries — a pip install avoids the issue entirely.
Build a case
- Open the
.mdpain the MDPA preview and expand the Problemtype section. - Pick a problemtype. Built-ins: Structural Mechanics, Fluid Dynamics (monolithic Navier-Stokes), Convection-Diffusion (thermal), Potential Flow (aerodynamics) and Shallow Water (2D free-surface).
- Fill the Problem data form (analysis type, time step, end time…).
- Under Conditions, pick a condition and a SubModelPart and press +:
- Assign the Body / Parts pseudo-condition to your domain SubModelPart(s) — it marks the computing domain and emits no process.
- Assign boundary conditions (displacement, inlet, temperature…) and loads to boundary SubModelParts. Each assignment shows its parameter fields inline; × removes it.
- Under Materials, assign a constitutive law to each Parts SubModelPart and adjust its variables.
- Under Output (VTK), choose the file format, output cadence and the nodal variables to write.
- Generate case files — the generated
ProjectParameters.jsonopens for inspection. Warnings (e.g. an assignment referencing a SubModelPart that no longer exists) surface as notifications.
Element types and the case mesh
Kratos solvers expect specific element/condition block names in the mdpa, and your mesh may be named for different physics (or come from a generic mesher). Each problemtype declares what its solver needs, and Generate checks the mesh: when any block name differs, a renamed copy <name>_case.mdpa is written next to the original (which stays untouched) and model_import_settings.input_filename points at it. A notification lists the renames; Properties blocks are preserved verbatim.
- Structural has no solver-side element replacement, so concrete names are required: the Element formulation field picks
SmallDisplacementElement<d>D<n>NorTotalLagrangianElement<d>D<n>N, and surface/line condition blocks becomeSurfaceLoadCondition3D3N/LineLoadCondition2D2N. - Fluid, Convection-Diffusion, Potential Flow and Shallow Water solvers replace elements internally, so their meshes get generic names (
Element3D4N,WallCondition3D3N,SurfaceCondition3D3N,LineCondition2D2N). - Point (single-node) condition blocks are never renamed — their names are load-specific (e.g.
PointLoadCondition3D1N).
If the mesh already matches, no copy is made and the case points at the original mdpa.
Run and watch results
Run case re-generates the files and opens a terminal named Kratos: <case> with the configured environment, running python MainKratos.py in the case directory. The solver's output streams in the terminal; Ctrl+C interrupts it.
Open results opens the first file in vtk_output/ with the VTK preview. Because the preview watches its folder, the timeline grows automatically as the solver writes more steps — you can watch the solution evolve while it runs.
All three actions are also available from the Command Palette: Kratos Case: Generate Case Files, Kratos Case: Run Case, Kratos Case: Open Results.
Notes
- Process
model_part_names are derived as<RootModelPart>.<SubModelPart.Path.With.Dots>— e.g. assigning toParts/Solidin the Structural problemtype producesStructure.Parts.Solid. - Materials use Kratos'
ReadMaterialsUtility, which assigns properties per SubModelPart — theproperties_ids in the materials file do not need to match the property ids inside the mdpa. - Solver settings mirror what the GiD interface writes for the same problems, so cases behave the same either way.
- Need physics the built-ins don't cover? Author your own problemtype in JavaScript or Python. Faithful Python ports of all three built-ins ship as copyable examples in
example/problemtypes/.