This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Question about diffusion equation with Dirichlet conditions and a solution that will be exact at all nodes.

0 votes

Hello,
I begin in Fenics and i need your help please, can you explain me this part of program please, and is array a fonction of fenics or python?

u_e = interpolate(u0, V)
u_e_array = u_e.vector().array()
u_array = u.vector().array()
print 'Max error, t=%-10.3f:' % t, numpy.abs(u_e_array -u_array).max()

t += dt
u_1.assign(u)

Thanks a lot

asked May 12, 2015 by mimi FEniCS Novice (150 points)

1 Answer

0 votes
 
Best answer

array gives you a numpy representation of a FEniCS vector type. In the program above you extract the coefficient vectors underlying a Function object using vector and subsequently ask the vectors to give you a numpy representation. Then what happens next is that you take the absolute value of a difference of two vectors (which is a vector) and then take the maximum entry (the max norm).

answered May 12, 2015 by Christian Waluga FEniCS Expert (12,310 points)
selected May 13, 2015 by mimi

Thanks a lot Christian.

...