As you can see in my previous post I use the old Bricks method to get the correct data structure for the tensor in python.
> C=gf.MdBrick.get(b0, 'param','A')
> C[:]=0
C.shape gives Out[75]: (2, 2, 2, 2)
This tensor can be easily created from scratch using the zeros function :
C=zeros((2,2,2,2))
If I put the important step :
# create a MeshFem of for a field of dimension 2 (i.e. a vector field)
mf = gf.MeshFem(m, 2) # assign the T3P1 fem elements to all convexes of the MeshFem mf.set_fem(gf.Fem('FEM_PK(2,1)')) # assign the numerical integration mim = gf.MeshIm(m, gf.Integ('IM_TRIANGLE(2)'))
# Create an empty real model md = gf.Model('real') # Define u as the primal variable to be solved md.add_fem_variable('u', mf)
So there is something I surly mess, but if I try this
md.add_generic_elliptic_brick(mim, 'varname', 'C') RuntimeError: (Getfem::InterfaceError) -- Error in getfem_models.cc, line 402 : Undefined model variable varname
if I try : md.add_generic_ellipticr_brick(mim, 'A','C')
RuntimeError: (Getfem::InterfaceError) -- Error in getfem_models.cc, line 402 : Undefined model variable A
So it's sure that there is something I misunderstand, but I can't point out what it is ...