stem.IO.kratos_io module

stem.IO.kratos_io.ElementAdditionalProcessParameters = (<class 'stem.additional_processes.Excavation'>, <class 'stem.additional_processes.ParameterFieldParameters'>, <class 'stem.additional_processes.ExtrapolateIntegrationPointToNodesParameters'>)

Type alias for additional process parameter classes which can be applied to elements.

TypeAlias:
class stem.IO.kratos_io.KratosIO(ndim: int)

Bases: object

Class containing methods to write mesh and problem data to Kratos

Attributes:

Constructor of KratosIO class

Args:
  • ndim (int): The number of dimensions of the problem.

initialise_model_ids(model: Model)

Initialise the ids of the model parts and tables.

Args:

model (stem.model.Model): the model object containing the model parts and tables.

write_conditions_process_model_part(process_model_part: ModelPart, mat_id: int, kratos_element_type: str) List[str]

Writes the conditions of the process model part to the mdpa file.

Args:
  • process_model_part (stem.model_part.ModelPart): the process model part to write to mdpa.

  • mat_id (int): the material id connected to the conditions block

  • kratos_element_type (str): the kratos element type for the condition.

Raises:
  • ValueError: if model part is not a process model part

  • ValueError: if mesh not initialised first

Returns:
  • block_text (List[str]): list of strings for the elements of the body model part. Each element is a line in the mdpa file.

write_elements_body_model_part(body_model_part: BodyModelPart, mat_id: int, kratos_element_type: str) List[str]

Writes the elements of the body model part to the mdpa file

Args:
  • body_model_part (stem.model_part.BodyModelPart): the body model part to write to mdpa.

  • mat_id (int): the material id connected to the element block

  • kratos_element_type (str): the kratos element type

Raises:
  • ValueError: if model part is not a body model part

Returns:
  • block_text (List[str]): list of strings for the elements of the body model part. Each element is a line in the mdpa file.

write_input_files_for_kratos(model: Model, mesh_file_name: str, materials_file_name: str = 'MaterialParameters.json', project_file_name: str = 'ProjectParameters.json')

Writes all required input files for a Kratos simulation, i.e: project parameters json; material parameters json and the mdpa mesh file.

Args:
  • model (stem.model.Model): The model object containing all the required info.

  • mesh_file_name (str): The name of the mesh file.

  • materials_file_name (str): The name of the materials file.

  • project_file_name (str): name of the project parameters file. Defaults to ProjectParameters.json.

Raises:
  • ValueError: if solver settings are not initialised in model.

write_submodelpart_body_model_part(body_model_part: BodyModelPart) List[str]

Writes the submodelpart block for a body model part (physical parts with materials).

Args:
Raises:
  • ValueError: if model part is not a body model part

  • ValueError: if mesh not initialised first

Returns:
  • block_text (List[str]): list of strings for the submodelpart. Each element is a line in the mdpa file.

write_submodelpart_process_model_part(process_model_part: ModelPart) List[str]

Writes the submodelpart block for a process model part (loads, boundary conditions or additional processes such as excavations).

Args:
Raises:
  • ValueError: if model part is not a process model part

  • ValueError: if mesh not initialised first

Returns:
  • block_text (List[str]): list of strings for the submodelpart. Each element is a line in the mdpa file.