Question about the use of assemble function

Asked by Erwan Liberge on 2013-05-24

Hello,

I have a question about the use of the assemble function.

I have tested the following lines :

from dolfin import *

mesh = UnitSquareMesh(1,1)

mesh.cells()
>>
array([[0, 1, 3],
       [0, 2, 3]], dtype=uint32)
The first cell is defined using the nodes 0 , 1 and 3, and the second using the nodes 0, 2 and 3
v=TestFunction(V)
u=TrialFunction(V)
a=inner(u,v)*dx()
A=assemble(a)

The value of the assembled matrix should be 0 for the entries (1;2) and (2;1), because the nodes 1 and 3 are not connected.

print A.array()
>> [[ 0.08333333 0.04166667 0.04166667 0. ]
 [ 0.04166667 0.16666667 0.08333333 0.04166667]
 [ 0.04166667 0.08333333 0.16666667 0.04166667]
 [ 0. 0.04166667 0.04166667 0.08333333]]

The result is not what I expected. And I don't understand this matrix. "Hand computing" doesn't give the same result.

Any idea what the problem could be ?

I use the last version of dolfin, installed using dorsal, and "STABLE_BUID=false"
Thanks,

Erwan

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Blechta
Solved:
2013-05-24
Last query:
2013-05-24
Last reply:
2013-05-24
Best Jan Blechta (blechta) said : #1

Note that questions at launchpad are now closed and nobody reads them (except this particular case). Check http://fenicsproject.org/support/

To the question:
you didn't write what is your V but I guess that problem is that you assume that DOFs are ordered as vertices which is not true since 1.1 release. Functions V.dofmap().vertex_to_dof_map() and V.dofmap().dof_to_vertex_map() as well as other DofMap functions may be useful if you need to know how DOF indexing and MeshEntity indexing correspond.

Jan

Erwan Liberge (erwan-liberge) said : #2

Thanks Jan Blechta, that solved my question.