bluemira.mesh.tools
Converter from MSH to XDMF mesh file formats, derived from F. Loiseau, R. Delaporte-Mathurin, and C. Weickhmann’s https://github.com/floiseau/msh2xdmf
Credit: F. Loiseau, R. Delaporte-Mathurin, and C. Weickhmann
Functions
|
Convert a MSH file to an XMDF file. |
|
Import a Dolfinx v0.9 mesh and optional boundary/subdomain tags. |
Module Contents
- bluemira.mesh.tools.msh_to_xdmf(mesh_name: str, dimensions: tuple[int, Ellipsis] | int = (0, 2), directory: str = '.')
Convert a MSH file to an XMDF file.
- Parameters:
mesh_name (str) – Name of the MSH file to convert to XDMF
dimensions (Union[Tuple[int], int]) – Dimensions of the mesh (0: x, 1: y, 2: z), defaults to x-z (0, 1, 2) would be a 3-D mesh
directory (str) – Directory in which the MSH file exists and where the XDMF files will be written
- Raises:
If the file does not exist
If the dimensionality != [2, 3]
If no domain physical groups are found
Notes
- Creates the following files:
DOMAIN_SUFFIX
BOUNDARY_SUFFIX
LINKFILE_SUFFIX
- bluemira.mesh.tools.import_mesh(file_prefix: str = 'mesh', *, subdomains: bool = False, directory: str = '.') tuple[dolfinx.mesh.Mesh, dolfinx.mesh.Mesh, dolfinx.mesh.Mesh, dict]
Import a Dolfinx v0.9 mesh and optional boundary/subdomain tags.
- Parameters:
file_prefix (str) – File prefix for the mesh (defaults to ‘mesh’)
subdomains (bool) – Whether subdomains are present (defaults to False)
directory (str) – Directory containing the mesh and tag files
- Returns:
mesh – Dolfin Mesh object containing the domain
boundaries_mf – Dolfin MeshFunctionSizet object containing the boundaries
subdomains_mf – Dolfin MeshFunctionSizet object containing the subdomains
link_dict – Link dictionary between MSH and XDMF objects
- Raises:
FileNotFoundError – If required mesh files are missing
- Return type:
tuple[dolfinx.mesh.Mesh, dolfinx.mesh.Mesh, dolfinx.mesh.Mesh, dict]