stem.stem module

class stem.stem.Stem(initial_stage: Model, input_files_dir: str)

Bases: object

Class containing the main calculation.

Attributes:
  • input_files_dir (str): The directory where the input files are to be written.

  • kratos_io (stem.IO.kratos_io.KratosIO): The Kratos IO object.

  • kratos_model (KratosMultiphysics.Model): The Kratos model.

  • __stages (List[stem.model.Model]): The calculation stages.

  • __stage_settings_file_names (Dict[int, str]): The file names of the project parameters files for each stage.

  • __last_ran_stage_number (int): The number of the last ran stage.

  • __last_uvec_data (KratosMultiphysics.Parameters): The uvec data from the last ran stage

Constructor of the main calculation class.

Args:
  • initial_stage (stem.model.Model): The initial stage of the calculation.

  • input_files_dir (str): The directory where the input files are to be written.

add_calculation_stage(stage: Model)

Add a calculation stage to the calculation. The geometry and the mesh of the new stage are regenerated.

Args:
create_new_stage(delta_time: float, stage_duration: float) Model

Create a new stage based on the last stage in the calculation. Note that the stage is not added to the calculation.

Args:
  • delta_time (float): The time step of the new stage.

  • stage_duration (float): The duration of the new stage.

Returns:
finalise()

Finalise the calculation.

run_calculation()

Run the full calculation.

run_stage(stage_number: int)

Runs a single stage of the calculation.

Args:
  • stage_number (int): The number of the stage to be run.

property stages: List[Model]

The calculation stages.

Returns:
validate_latest_stage()

Validate the latest stage. The validation checks if the number of body and process model parts are the same between the last two stages. And if the mesh is the same in the new stage.

Raises:
  • Exception: If the number of body model parts are not the same between stages.

  • Exception: If the number of process model parts are not the same between stages.

write_all_input_files()

Write all input files for the calculation.