Skip to content

Environment & introspection

Discover what your Kratos installation provides. Catalog tools (elements, conditions, constitutive laws, processes) parse the Kratos C++/Python sources; runtime tools query the live build through the worker bridge.

kratos_check_installation

needs Kratos (gracefully reports when unavailable)

Verify that Kratos is importable and report the environment.

Parameters: none.

Returns: kratos_root, pythonpath, ld_library_path, pip_installed, importable, version, build_type, num_threads, is_distributed, compiled_applications (list). When Kratos is missing, importable: false plus a hint.

json
{
  "importable": true,
  "version": "10.4.2-...-Release-x86_64",
  "num_threads": 20,
  "compiled_applications": ["ConvectionDiffusionApplication", "FluidDynamicsApplication", "..."]
}

When Kratos is missing, the hint field points at kratos_install.

kratos_install

Install Kratos Multiphysics via pip into the server's own Python environment — no local build required. Official wheels exist for Linux and Windows x86_64 only; on macOS or other unsupported platforms this fails and you need a local KRATOS_ROOT build instead (see Installation).

ParameterTypeDescription
applicationsstring[]?application names to install alongside the core, e.g. ["StructuralMechanicsApplication", "LinearSolversApplication"] — each is mapped to its PyPI name by prefixing Kratos (so StructuralMechanicsApplicationKratosStructuralMechanicsApplication)
allboolinstall the KratosMultiphysics-all omnibus package (essentially every application) instead of naming individual ones; largest download, simplest choice (default false)
upgradeboolpass --upgrade to pip (default false)

Returns: {ok, packages, returncode}; on failure stderr_tail and a hint; on success a nested check — the same payload kratos_check_installation returns, so a single call installs and confirms. No server restart is needed — the very next tool call sees the new install.

json
// kratos_install(applications=["StructuralMechanicsApplication", "LinearSolversApplication"])
{
  "ok": true,
  "packages": ["KratosMultiphysics", "KratosStructuralMechanicsApplication", "KratosLinearSolversApplication"],
  "returncode": 0,
  "check": { "importable": true, "version": "...", "compiled_applications": ["StructuralMechanicsApplication", "..."] }
}

Which applications to install

Match them to the template you're using — kratos_list_solvers and list_templates name the required_applications for each analysis type. LinearSolversApplication is needed by essentially every template (it provides sparse_lu, the default linear solver).

kratos_list_applications

List every application in the source tree with a compiled flag.

Parameters: none. Returns: {applications: [{name, compiled}], num_compiled, num_source}.

kratos_list_elements

List element type names parsed from KRATOS_REGISTER_ELEMENT macros.

ParameterTypeDescription
applicationstring?e.g. StructuralMechanicsApplication (or Core)
name_filterstring?case-insensitive substring, e.g. SmallDisplacement

Returns: [{name, application, compiled}].

kratos_list_conditions

Same parameters/shape as kratos_list_elements, for conditions (the boundary entities used by loads and fluxes — see the MDPA guide for the crucial load-condition vs geometric-condition distinction).

kratos_list_constitutive_laws

Same parameters/shape, for material models (LinearElastic3DLaw, Newtonian2DLaw, ...).

kratos_list_variables

needs Kratos

List Kratos variables grouped by type, from the live kernel.

ParameterTypeDescription
type_filterstring?one of double, array_1d_3, bool, int, vector, matrix, ...
name_filterstring?substring, e.g. TEMP

Returns: {type: [names]} — e.g. {"array_1d_3": ["DISPLACEMENT", ...]}.

kratos_list_solvers

List known solver_type values per analysis type with the Python module implementing each, plus all *_solver.py modules found in the source tree.

ParameterTypeDescription
analysis_typestring?structural, thermal, fluid, potential_flow

kratos_list_processes

List Python process modules usable as python_module in ProjectParameters process lists.

ParameterTypeDescription
applicationstring?filter by owning application (or Core)
name_filterstring?substring, e.g. assign_vector
with_defaultsboolalso attach each module's default_settings and param_types, parsed from source (best effort; default false)

kratos_get_process_defaults

Return a process' default settings — the parameter names, default values, coarse types (bool/number/string/array/json/null) and which parameters are model-part references — parsed straight from the process' Python source (its ValidateAndAssignDefaults block, or a GetDefaultParameters classmethod). This is the schema you need to author a process block in a process list, the same way kratos_get_solver_defaults gives you a solver's schema.

This is pure AST parsing of the Kratos source (no live build needed), ported from the sibling Flowgraph project's parse-processes.py. It also backs the auto-filled defaults in add_boundary_condition / add_output_process.

ParameterTypeDescription
python_modulestringa value from kratos_list_processes, e.g. assign_scalar_variable_process, vtk_output_process

Returns: {python_module, default_settings, param_types, input_model_parts, output_params, help}, or {"error": ...} when the source is unavailable, the module is unknown, or it declares defaults in a non-standard way (e.g. C++-validated output processes such as vtk_output_process, whose defaults live in C++).

json
// kratos_get_process_defaults("assign_scalar_variable_process") → (excerpt)
{
  "default_settings": { "model_part_name": "please_specify", "variable_name": "SPECIFY_VARIABLE",
                        "value": 0.0, "constrained": true, "interval": [0.0, 1e30] },
  "param_types": { "variable_name": "string", "value": "number", "constrained": "bool" },
  "input_model_parts": ["model_part_name"]
}

kratos_get_solver_defaults

needs Kratos

Return the complete default solver_settings for a solver, straight from its GetDefaultParameters() — the authoritative schema of every accepted key.

ParameterTypeDescription
analysis_typestringstructural / thermal / fluid / potential_flow
solver_typestringa value from kratos_list_solvers, e.g. Static, transient, Monolithic
json
// kratos_get_solver_defaults("structural", "Static") → (excerpt)
{
  "solver_type": "mechanical_solver",
  "model_import_settings": { "input_type": "mdpa", "input_filename": "unknown_name" },
  "linear_solver_settings": {},
  "convergence_criterion": "residual_criterion",
  "max_iteration": 10
}