getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-users] Using getfem for projections problems (bug ?)


From: Pablo Winant
Subject: [Getfem-users] Using getfem for projections problems (bug ?)
Date: Mon, 25 Oct 2010 14:48:47 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101006 Thunderbird/3.1.5

 Hello,

I am trying to use python-getfem to solve a nonlinear functional problem : PHI(g) = 0 where g is the unknown function. For this purpose, I create a mesh, choose fems on it. Then for given coefficients on this elements, I compute PHI(g) ( which require evaluating g at many points).

I have tried to use slice to specify the points at which I am evaluating the approximating function but I was wondering whether there was a better way to do it.

Currently I have :

---------------------------
import getfem as gf
from getfem import Mesh,MeshFem,Slice

M = Mesh('cartesian', np.array([0,0.5,1.0]), np.array([0,0.5,1.0]) )
MF = MeshFem(M)
MF.set_classical_fem(1)

theta0 = MF.eval('x[0]*x[1]') # this is just a random value for theta0

sl = Slice('points', M, np.array([[0.3,0.4,0.5],[0.3,0.4,0.5]]))

result = gf.compute_interpolate_on(MF,theta0,sl)

print result
-> array([ 0.09,  0.16,  0.25,  0.25,  0.25,  0.25])
print sl.pts
-> array([[ 0.3,  0.4,  0.5,  0.5,  0.5,  0.5],
       [ 0.3,  0.4,  0.5,  0.5,  0.5,  0.5]])
-------------------------

The problem is that is central point [0.5,0.5], is duplicated 4 times and as a result, the function is also evaluated 4 times on it. Is this expected behaviour ? How can I simply evaluate a linear combination of fem at any points ?


There is another related question. When specifying the vector of coefficients I would also like to restrict the coefficients on the frontier of the domain to be 0, but I found no simple way to do it. What is the best way to retrieve the indices of the corresponding points ?



Thank you for your help,

Best,

Pablo Winant



reply via email to

[Prev in Thread] Current Thread [Next in Thread]