getfem-users
[Top][All Lists]
Advanced

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

[Getfem-users] using matplotlib


From: jeff witz
Subject: [Getfem-users] using matplotlib
Date: Thu, 3 Mar 2011 17:03:30 +0100

Hello,

I almost succeed in using matplotlib for plotting 2 dimensionnal linear triangle !

So I have a two dimensional NonLinearelasticity problem, so I do the computation and extract the solution

u = md.variable('u')

In order to be able to plot solution in matplotlib 1.0.1 I need node table and element table. So I build this table :


NbNod=m.pts().shape[1]
NbElem = m.cvid().shape[0]
NbNodElem=m.pid_from_cvid(0)[0].shape[0]
ElemTab = np.zeros((NbElem,NbNodElem))
for i in range(NbElem):
    for j in range(NbNodElem):
        ElemTab[i,j]=m.pid_in_cvids(i)[j]

NodTab=np.transpose(m.pts())

The main issue remain in the fact that I don't understand how the u vector is sorted.
So when I plot the results the values don't correspond to the computed solution. Could you explain me how I can sort it.

Logically this vector is 324 : 2* NbNod

I try to use mf.basic_dof_nodes(), but I don't really understand the way output vector

mf.basic_dof_nodes().shape
Out[100]: (2, 324)

which is equal to (2,2*NbNod)

Could you help me to solve this out ?

I think it would be great to be able to treat the data without leaving ipython.

I just want to plot a simple tripcolor (pcolor in matlab) with a quiver over it. It will be quite simple once I have the good u vector

I hope I can solve this before the Course I have to give Monday to show the student that everything can be done simply in python.

Best regards.




--
Jean-François WITZ

reply via email to

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