Skip to content

Commit

Permalink
Preserve default mesh name after Netgen mesh creation (#3951)
Browse files Browse the repository at this point in the history
* Preserve  default mesh name after Netgen mesh creation to avoid checkpointing errors

* Ensure consistent handling of mesh and topology names for Netgen and non-Netgen meshes
  • Loading branch information
MohamedAlyLoutfy authored Jan 15, 2025
1 parent 723ca72 commit cbfc2b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,7 @@ def Mesh(meshfile, **kwargs):
netgen_flags = kwargs.get("netgen_flags", {"quad": False, "transform": None, "purify_to_tets": False})
netgen_firedrake_mesh = FiredrakeMesh(meshfile, netgen_flags, user_comm)
plex = netgen_firedrake_mesh.meshMap.petscPlex
plex.setName(_generate_default_mesh_topology_name(name))
else:
basename, ext = os.path.splitext(meshfile)
if ext.lower() in ['.e', '.exo']:
Expand All @@ -3099,10 +3100,11 @@ def Mesh(meshfile, **kwargs):
distribution_name=kwargs.get("distribution_name"),
permutation_name=kwargs.get("permutation_name"),
comm=user_comm)
mesh = make_mesh_from_mesh_topology(topology, name)
if netgen and isinstance(meshfile, netgen.libngpy._meshing.Mesh):
netgen_firedrake_mesh.createFromTopology(topology, name=plex.getName(), comm=user_comm)
netgen_firedrake_mesh.createFromTopology(topology, name=name, comm=user_comm)
mesh = netgen_firedrake_mesh.firedrakeMesh
else:
mesh = make_mesh_from_mesh_topology(topology, name)
mesh._tolerance = tolerance
return mesh

Expand Down

0 comments on commit cbfc2b2

Please sign in to comment.