cashocs.io.mesh.import_mesh#
- cashocs.io.mesh.import_mesh(mesh_file: str, comm: MPI.Comm | None = None) _typing.MeshTuple [source]#
Imports a mesh file for use with cashocs / FEniCS.
This function imports a mesh file. The mesh file can either be a Gmsh mesh file or an xdmf mesh file that was generated by GMSH and converted to .xdmf with the function
cashocs.convert()
. If there are Physical quantities specified in the GMSH file, these are imported to the subdomains and boundaries output of this function and can also be directly accessed via the measures, e.g., withdx(1)
,ds(1)
, etc.- Parameters:
mesh_file (str) – The location of the mesh file in .xdmf or .msh file format.
comm (MPI.Comm | None) – MPI communicator that is to be used for creating the mesh.
- Returns:
A tuple (mesh, subdomains, boundaries, dx, ds, dS), where mesh is the imported FEM mesh, subdomains is a mesh function for the subdomains, boundaries is a mesh function for the boundaries, dx is a volume measure, ds is a surface measure, and dS is a measure for the interior facets.
- Return type:
_typing.MeshTuple
Notes
In case the boundaries in the Gmsh .msh file are not only marked with numbers (as physical groups), but also with names (i.e. strings), these strings can be used with the integration measures
dx
andds
returned by this method. E.g., if one specified the following in a 2D Gmsh .geo filePhysical Surface("domain", 1) = {i,j,k};
where i,j,k are representative for some integers, then this can be used in the measure
dx
(as we are 2D) as follows. The commanddx(1)
is completely equivalent to
dx("domain")
and both can be used interchangeably.