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:
ElementAdditionalProcessParameters: (
stem.additional_processes.Excavation,stem.additional_processes.ParameterFieldParameters)
- class stem.IO.kratos_io.KratosIO(ndim: int)
Bases:
objectClass containing methods to write mesh and problem data to Kratos
- Attributes:
ndim (int): The number of dimensions of the problem.
project_folder (str): folder to store the project files (mesh, project and material parameters as well as json files). Defaults to the working directory.
material_io (
stem.IO.kratos_material_io.KratosMaterialIO): The material IO object.loads_io (
stem.IO.kratos_loads_io.KratosLoadsIO): The loads IO object.boundaries_io (
stem.IO.kratos_boundaries_io.KratosBoundariesIO): The boundaries IO object.outputs_io (
stem.IO.kratos_output_io.KratosOutputsIO): The outputs IO object.solver_io (
stem.IO.kratos_solver_io.KratosSolverIO): The solver IO object.additional_process_io (
stem.IO.kratos_additional_process_io.KratosAdditionalProcessesIO): The IO object for the additional processes.__use_linear_elastic_solver (bool): Flag to determine if the linear elastic solver is used.
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:
body_model_part (
stem.model_part.BodyModelPart): the body model part to write to mdpa.
- 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:
process_model_part (
stem.model_part.ModelPart): the process model part to write to mdpa.
- 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.