ogstools.msh2vtu package#
- ogstools.msh2vtu.my_remove_orphaned_nodes(my_mesh)[source]#
Auxiliary function to remove points not belonging to any cell
- ogstools.msh2vtu.find_cells_at_nodes(cells, node_count, cell_start_index)[source]#
- Return type:
list[set]
- ogstools.msh2vtu.find_connected_domain_cells(boundary_cells_values, domain_cells_at_node)[source]#
find out to which domain elements a boundary element belongs
- Return type:
tuple[ndarray, ndarray]
- ogstools.msh2vtu.msh2vtu(filename, output_path=Path(), output_prefix='', dim=0, delz=False, swapxy=False, reindex=False, keep_ids=False, ascii=False, log_level='DEBUG')[source]#
Convert a gmsh mesh (.msh) to an unstructured grid file (.vtu).
Prepares a Gmsh-mesh for use in OGS by extracting domain-, boundary- and physical group-submeshes, and saves them in vtu-format. Note that all mesh entities should belong to physical groups.
- Parameters:
filename (Path) – Gmsh mesh file (.msh) as input data
output_path (Path) – Path of output files, defaults to current working dir
output_prefix (str) – Output files prefix, defaults to basename of inputfile
dim (int | list[int]) – Spatial dimension (1, 2 or 3), trying automatic detection, if not given. If multiple dimensions are provided, all elements of these dimensions are embedded in the resulting domain mesh.
delz (bool) – Delete z-coordinate, for 2D-meshes with z=0. Note that vtu-format requires 3D points.
swapxy (bool) – Swap x and y coordinate
reindex (bool) – Renumber physical group / region / Material IDs to be renumbered beginning with zero.
keep_ids (bool) – By default, rename ‘gmsh:physical’ to ‘MaterialIDs’ and change type of corresponding cell data to INT32. If True, this is skipped.
ascii (bool) – Save output files (.vtu) in ascii format.
log_level (int | str) – Level of log output. Possible values: <https://docs.python.org/3/library/logging.html#levels>
- Returns:
0 if successful, otherwise error message.
- Return type:
int