I am facing a coding error in FEniCS when I run the heat equation code it’s fail with,
error = np.abs(u_e.vector().array() - u.vector().array())
AttributeError: 'dolfin.cpp.la.PETScVector' object has no attribute 'array’
I believe the idea is to calculate the difference between u and the exact solution for each time level and put them in array then we going to take the maxium value.(if not, correct me please!)
the Original code for computing the error is
u_e = interpolate(u_D, V)
error = np.abs(u_e.vector().array() - u.vector().array()).max()
print('t = %.2f: error = %.3g' % (t, error))
Where u_D is the boundary condition.
I am not sure how I can make it works so any advice from you would appreciated.
Thanks in advance
Per the comment of roby,
array()has been replaced byget_local(). So in lines 62-65 of the third fenics tutorial, the following works: