Oups, perfect thanks a lot ! 

-- 
Edouard Oudet : http://www-ljk.imag.fr/membres/Edouard.Oudet/ 
IMAG - Bureau 164 
700 avenue Centrale 
38400 Saint Martin d'Hères 
+33 (0)4 57 42 17 71 (office LJK) 
+33 (0)4 79 68 82 06 (home) 


De: "Yves Renard" <[email protected]> 
À: "EDOUARD OUDET" <[email protected]> 
Cc: "getfem-users" <[email protected]> 
Envoyé: Mardi 7 Novembre 2017 17:17:02 
Objet: Re: [Getfem-users] gradient interpolation matrix 


Dear Edouard, 

The mesh is in fact the one on of the variable (think that there is possibly 
more than one mesh in a model), i.e. the mesh on which the clood of points will 
be distributed on the different elements to make the interpolation. So the 
right command should be 

GU = md.interpolation('Grad_u', pts.T, tmesh) 

Best regards, 

Yves. 


Le 07/11/2017 à 09:19, EDOUARD OUDET a écrit : 



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) 


--------- 





-- 

  Yves Renard ( [ mailto:[email protected] | [email protected] ] 
)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE [ http://math.univ-lyon1.fr/~renard | 
http://math.univ-lyon1.fr/~renard ] --------- 

Reply via email to