Skip to content

BUG: Checkpointing unnamed Netgen Mesh #3945

Open
@StefanoFochesatto

Description

@StefanoFochesatto

Describe the bug
When checkpointing an unnamed netgen mesh, the default name is not set correctly and should be "DEFAULT_MESH_NAME" per docs.

Steps to Reproduce
Running this example:

from firedrake import *
from netgen.geom2d import SplineGeometry

geo = SplineGeometry()

geo.AddRectangle(p1=(-1, -1),
                 p2=(1, 1),
                 bc="rectangle",
                 leftdomain=1,
                 rightdomain=0)

ngmsh = geo.GenerateMesh(maxh=0.1)

msh = Mesh(ngmsh)

with CheckpointFile("test.h5", 'w') as afile:
    afile.save_mesh(msh)

with CheckpointFile("test.h5", 'r') as afile:
    mesh = afile.load_mesh()
    # mesh = afile.load_mesh('Default') <- this works

Error message

Traceback (most recent call last):
  File "/home/stefano/FiredrakeAdapt/bugExamples/NetgenCheckpointing.py", line 21, in <module>
    mesh = afile.load_mesh()
  File "petsc4py/PETSc/Log.pyx", line 188, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "petsc4py/PETSc/Log.pyx", line 189, in petsc4py.PETSc.Log.EventDecorator.decorator.wrapped_func
  File "/home/stefano/FiredrakeAdapt/firedrake-dec24/src/firedrake/firedrake/checkpointing.py", line 1044, in load_mesh
    tmesh_name = self._get_mesh_name_topology_name_map()[name]
KeyError: 'firedrake_default'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions