Update: after some tests, I found that the error only occur when I define another mesh in the same code. Do you know what's going wrong ?
For instance:
Nx = int(Lx/res) + 1
Ny = int(Ly/res) + 1
hor_mesh = RectangleMesh(Nx,Ny,Lx,Ly,quadrilateral=True)
V = FunctionSpace(hor_mesh, "CG", 1)
h_n1 = Function(V)
i=0
while i<100:
dumb_file = DumbCheckpoint("h_"+str(i), mode=FILE_READ)
dumb_file.load(h_n1)
i+=1
Nx_aux = int(Lx/0.2) + 1
Ny_aux = int(Ly/0.1) + 1
aux_mesh = RectangleMesh(Nx_aux,Ny_aux,Lx,Ly,quadrilateral=True)
Nx = int(Lx/res) + 1
Ny = int(Ly/res) + 1
hor_mesh = RectangleMesh(Nx,Ny,Lx,Ly,quadrilateral=True)
V = FunctionSpace(hor_mesh, "CG", 1)
h_n1 = Function(V)
i=0
while i<100:
dumb_file = DumbCheckpoint("h_"+str(i), mode=FILE_READ)
dumb_file.load(h_n1)
i+=1
does not work:
Traceback (most recent call last):
File "main.py", line 115, in <module>
dumb_file.load(h_n1)
File "/Users/mmfg/firedrake/src/firedrake/firedrake/checkpointing.py", line 237, in load
v.load(self.vwr)
File "PETSc/Vec.pyx", line 447, in petsc4py.PETSc.Vec.load (src/petsc4py.PETSc.c:95805)
petsc4py.PETSc.Error: error code 76
[0] VecLoad() line 925 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/interface/vector.c
[0] VecLoad_Default() line 397 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/utils/vecio.c
[0] VecLoad_HDF5() line 257 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/utils/vecio.c
[0] Error in external library
[0] Error in HDF5 call H5Dopen2() Status -1
Exception RuntimeError: RuntimeError("Can't decrement id ref count (Can't close file, there are objects still open)",) in 'h5py._objects.ObjectID.__dealloc__' ignored
Nx = int(Lx/res) + 1
Ny = int(Ly/res) + 1
hor_mesh = RectangleMesh(Nx,Ny,Lx,Ly,quadrilateral=True)
V = FunctionSpace(hor_mesh, "CG", 1)
h_n0 = Function(V)
...
[assign value to h_n0]
...
h_data = DumbCheckpoint("h", mode=FILE_CREATE)
h_data.store(h_n0)
 When trying to load it in another code, with:
Nx = int(Lx/res) + 1
Ny = int(Ly/res) + 1
hor_mesh = RectangleMesh(Nx,Ny,Lx,Ly,quadrilateral=True)
V = FunctionSpace(hor_mesh, "CG", 1)
h_n1 = Function(V)
dumb_file = DumbCheckpoint("h", mode=FILE_READ)
dumb_file.load(h_n1)
I get the following error:
File "TOC.py", line 130, in <module>
dumb_file.load(h_n1)
File "/Users/mmfg/firedrake/src/firedrake/firedrake/checkpointing.py", line 237, in load
v.load(self.vwr)
File "PETSc/Vec.pyx", line 447, in petsc4py.PETSc.Vec.load (src/petsc4py.PETSc.c:95805)
petsc4py.PETSc.Error: error code 76
[0] VecLoad() line 925 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/interface/vector.c
[0] VecLoad_Default() line 397 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/utils/vecio.c
[0] VecLoad_HDF5() line 257 in /private/var/folders/7h/wbj8xp7n3g5cfbr32ctcmwzcy3jf53/T/pip-yGXqPh-build/src/vec/vec/utils/vecio.c
[0] Error in external library
[0] Error in HDF5 call H5Dopen2() Status -1
Exception RuntimeError: RuntimeError("Can't decrement id ref count (Can't close file, there are objects still open)",) in 'h5py._objects.ObjectID.__dealloc__' ignored
Do you know what this error mean ?
Thank you,
Floriane