stem.IO.io_utils module

class stem.IO.io_utils.IOUtils

Bases: object

static create_value_and_table(part_name: str, parameters: LoadParametersABC | BoundaryParametersABC, current_time: float) Tuple[List[float], List[int]]

Assemble values and tables for the boundary condition from the value attribute of the boundary parameters. If the displacement or rotation is time-dependent, a table is required. If the displacement or rotation is constant, a value is required. Each direction (x,y,z), requires either a table or a value. When a table is provided, the value is interpolated. If a value is provided, the table is set to 0.

Args:
Raises:
  • ValueError: if table ids are not initialised.

  • ValueError: when element in parameters.value is not of type int, float or Table.

  • ValueError: when provided parameters class doesn’t implement values (e.g. AbsorbingBoundary).

Returns:
  • _value (List[float]): list of values for the boundary condition or load

  • _table (List[int]): list of table ids for the boundary condition or load

static create_vector_constraint_table_process_dict(global_domain: str, part_name: str, parameters: LoadParametersABC | BoundaryParametersABC, variable_name: str, current_time: float) Dict[str, Any]

Creates a dictionary containing the vector constraint table process parameters. The vector constraint table process is used for loads and boundary conditions. This process applies either a constant value or a time-dependent table to the load or boundary condition.

Args:
  • global_domain (str): name of the global domain

  • part_name (str): name of the model part on which the load is applied

  • parameters (Union[stem.load.LoadParametersABC, stem.boundary.BoundaryParametersABC]): boundary parameters object.

  • variable_name (str): name of the variable to which the boundary condition or load is applied

  • current_time (float): current time of the analysis.

Returns:
  • Dict[str, Any]: dictionary containing the load parameters

static write_json_file(output_folder: str, file_name: str, dictionary: Dict[Any, Any])

Write a dictionary to a json file.

Args:
  • output_folder (str): output folder path

  • file_name (str): name of the json file

  • dictionary (Dict[Any, Any]): dictionary to be written to the json file