I tried to use the model object for the gradient interpolation on a different mesh in the following example.
I obtained the error
Conda/deps/usr/lib/python2.7/site-packages/getfem/getfem.py", line 2708, in get
return getfem('model_get',self.id, *args)
RuntimeError: (Getfem::InterfaceError) -- Error in getfem_generic_assembly.cc, line 11624 void getfem::ga_compile_node(getfem::pga_tree_node, const getfem::ga_workspace&, getfem::ga_instruction_set&, getfem::ga_instruction_set::region_mim_instructions&, const getfem::mesh&, bool, getfem::ga_if_hierarchy&):
The finite element of variable u has to be defined on the same mesh than the integration method used
Obviously there is something wrong in my call but unfortunately, I was not able to identify the problem with the mesh(es) and the integration method...
Sorry to disturb you again,
best,
Edouard.
#######################################################
import getfem as gf
import numpy as np
degp = 2; NX = 30
tmesh = gf.Mesh('regular_simplices', np.arange(0,1+1./NX,1./NX),
np.arange(0,1+1./NX,1./NX))
tmeshfem = gf.MeshFem(tmesh, 1)
tmeshfem.set_fem(gf.Fem('FEM_PK(2,' + str(degp) + ')'))
tmeshim = gf.MeshIm(tmesh, gf.Integ('IM_TRIANGLE(6)'))
U = np.random.rand(tmeshfem.nb_basic_dof())
md = gf.Model('real')
md.add_fem_variable('u', tmeshfem)
md.to_variables(U)
md.add_Laplacian_brick(tmeshim, 'u')
pts = np.random.rand(3,2)/4. + 0.5
tpts = np.array([0,1,2])
tmeshi = gf.Mesh('ptND', pts.T, tpts.T)
GU = md.interpolation('Grad_u', pts.T, tmeshi)
---------