Skip to content

Project scaffolding

Create and edit the Kratos input files: ProjectParameters.json (solver + processes), Materials.json (constitutive laws + properties) and complete case directories.

list_templates

List available case templates with descriptions, required applications and every placeholder with its default.

Templates: structural_static, structural_dynamic, structural_modal, thermal_transient, thermal_stationary, fluid_transient.

create_project

Scaffold a complete case directory from a template.

ParameterTypeDescription
directorystringcase directory (created if missing)
templatestringtemplate name from list_templates
namestringproblem name (default case)
overridesobject?placeholder overrides, e.g. {"end_time": 2.0, "young_modulus": 7e10}
create_demo_meshboolalso write a small rectangle mesh wired to the defaults, so the case runs out of the box (default false)

Returns: created file list, required_applications, and next_steps (create mesh → validate → run).

json
// create_project("/tmp/my-case", "structural_static", "cantilever",
//                {"fix_model_part": "Structure.left"})
{
  "case_dir": "/tmp/my-case",
  "created": ["/tmp/my-case/ProjectParameters.json", "/tmp/my-case/Materials.json"],
  "next_steps": ["Create the mesh at /tmp/my-case/mesh.mdpa ...", "..."]
}

create_project_parameters

Render only a ProjectParameters.json (returned, and optionally written to output_file). Same template/overrides semantics as create_project.

create_materials

Write a Materials.json from a list of material specs.

ParameterTypeDescription
output_filestringwhere to write
materialsarrayone entry per model part (below)

Each entry: model_part_name (e.g. Structure.domain), optional constitutive_law (thermal problems have none), variables (e.g. {"YOUNG_MODULUS": 2.1e11, "POISSON_RATIO": 0.3}), optional properties_id.

add_boundary_condition

Insert a boundary condition or load process block into an existing ProjectParameters.json.

ParameterTypeDescription
parameters_filestringthe file to edit
kindstringsee table below
model_partstringdotted target, e.g. Structure.right
valuenumber | number[3]?for fix/prescribe kinds
modulus, directionnumber, number[3]for directional loads
interval[start, end]?default [0.0, "End"]
process_liststring?override the target list
kindvariabletypical use
fix_displacement / prescribed_displacementDISPLACEMENTsupports / imposed motion
fix_velocity / inlet_velocityVELOCITYfluid walls / inlets
outlet_pressurePRESSUREfluid outlets
fix_temperatureTEMPERATUREthermal Dirichlet
point_load / line_load / surface_loadPOINT_LOAD / LINE_LOAD / SURFACE_LOADdirectional loads on conditions (need modulus + direction)
pressure_loadPOSITIVE_FACE_PRESSUREpressure on faces
surface_heat_fluxFACE_HEAT_FLUXthermal Neumann on conditions
volume_heat_sourceHEAT_FLUXvolumetric heating
self_weightVOLUME_ACCELERATIONgravity (modulus defaults to 9.81)
json
// add_boundary_condition(file, "line_load", "Structure.right",
//                        modulus=1e6, direction=[0, -1, 0])
{ "process_list": "loads_process_list", "added": { "python_module": "assign_vector_by_direction_to_condition_process", "...": "..." } }

WARNING

Condition-based loads (point/line/surface_load, pressure_load, surface_heat_flux) need actual load-bearing conditions in the target region — see the MDPA guide.

add_output_process

Add an output process to a ProjectParameters.json.

ParameterTypeDescription
parameters_filestringfile to edit
formatstringvtk (ParaView), json (variable time series), point (probe a coordinate)
variablesstring[]?variables to write
model_partstring?defaults to the solver root
output_pathstringfor vtk (default vtk_output)
output_filestring?for json/point
positionnumber[3]?for point

validate_project_parameters

deep mode needs Kratos

Validate a ProjectParameters.json without running anything:

  1. JSON syntax and required top-level keys,
  2. referenced mesh/materials files exist and parse,
  3. every model_part_name in processes/materials matches a mesh submodelpart,
  4. (deep: true, default) solver_settings validated against the solver's GetDefaultParameters() inside a Kratos worker.

Returns: {valid, issues: [...], warnings: [...]}.