Dear Lawrence (thank you also Alastair for the suggestion),


I think your last crude way is what I need, as I'd like to extrapolate results from 3 meshes to get the estimate of the exact solution. I also refine mesh externally in gmsh. Therefore I need results from a few runs with different meshes. I'd like to save the solution and open it in a different file for further study.


I tried to use DumbCheckpoint. Firedrake seems to complain when I store the solution held in a certain object structure and then try to load it without the same structure (even in the same file). Details below. I don't run MPI.


Thank you,

Tomasz


...

import firedrake as fd

...

# store solution

dumb_file = fd.DumbCheckpoint("results_crude/phi", mode=fd.FILE_CREATE)

dumb_file.store(CS.W.phi) # some object structure

...


# this works (in the same file, same object structure):

#dumb_file = fd.DumbCheckpoint("results_crude/phi", mode=fd.FILE_READ)

#dumb_file.load(CS.W.phi)


# this doesn't work (same mesh and function space, no object structure):

mesh = fd.Mesh("cylinder_coarse.msh")

V = fd.FunctionSpace(mesh, "CG", 1)

phi = fd.Function(V)

dumb_file = fd.DumbCheckpoint("results_crude/phi", mode=fd.FILE_READ)

dumb_file.load(phi)



Error listing:

Traceback (most recent call last):
  File "main.py", line 15, in <module>
    fn.time_evolution()
  File "/home/tommy/work/programs/lin_coupled_3d/lib/functions.py", line 96, in time_evolution
    dumb_file.load(phi)
  File "/home/tommy/programs/firedrake/local/lib/python2.7/site-packages/firedrake/checkpointing.py", line 235, in load
    v.load(self.vwr)
  File "PETSc/Vec.pyx", line 447, in petsc4py.PETSc.Vec.load (src/petsc4py.PETSc.c:96066)
petsc4py.PETSc.Error: error code 76
[0] VecLoad() line 975 in /tmp/pip-qTWKue-build/src/vec/vec/interface/vector.c
[0] VecLoad_Default() line 409 in /tmp/pip-qTWKue-build/src/vec/vec/utils/vecio.c
[0] VecLoad_HDF5() line 267 in /tmp/pip-qTWKue-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
*** The MPI_File_close() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[tommy-comp:19947] Local abort after MPI_FINALIZE completed successfully; not able to aggregate error messages, and not able to guarantee that all other processes were killed!


From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Gregory, Alastair C A <a.gregory14@imperial.ac.uk>
Sent: 25 October 2016 11:37:24
To: firedrake
Subject: Re: [firedrake] mapping between two meshes
 

Dear Tomasz,


I would like to check the convergence of my solution as I refine the mesh.

Say, I have two solutions in CG1 space, f_coarse on mesh_coarse and f_fine on mesh_fine, which is a refined mesh_coarse. Can I map/interpolate/project f_fine onto mesh_coarse in Firedrake?


You can do this through the multigrid tools.


# make an empty coarse function (Here, Vc is the coarse FS)

f_coarse_ = Function(Vc)


# project fine onto coarse

inject(f_fine, f_coarse_)


# check error

norm(assemble(f_coarse - f_coarse_))


Many Thanks,

Alastair Gregory
-------------------------------------------------------------------

Research Assistant (Maths Foresees Grant)
Imperial College London

Office 759 Huxley Building, South Kensington

(Tel: 07794 243913) | (Email: a.gregory14@imperial.ac.uk)
------------------------------------------------------------------------------------

From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk>
Sent: 25 October 2016 11:25:45
To: firedrake
Subject: [firedrake] mapping between two meshes
 

Dear all,


I would like to check the convergence of my solution as I refine the mesh.

Say, I have two solutions in CG1 space, f_coarse on mesh_coarse and f_fine on mesh_fine, which is a refined mesh_coarse. Can I map/interpolate/project f_fine onto mesh_coarse in Firedrake?


Thank you,

Tomasz