Hello,
Suppose I have calculated a solution of Poisson's equation on a certain mesh. To find u-values in an array, and mesh coordinates, I use:
u_array=u_nodal_values.array()
mesh_points=mesh.coordinates()
However, when I try to make a scatter plot of the solution u, like:
x0=mesh_points[:,0]
x1=mesh_points[:,1]
fig=pyplot.figure
ax=fig.add_subplot(1,1,1,projection='3D')
surf=ax.scatter3D(x0,x1,u_array)
I get all points randomly distributed over space, while for example
u_array2=np.array([u(Point(x,y)) for x,y in mesh_points])
works fine in a scatter plot. So why do the u_nodal_values.array() not correspond to the associated mesh.coordinates()?
This question is somewhat related to a second one. Suppose I have a numerical expression for each of my N nodal points, called d. This d is a N times 1 vector, corresponding correctly to the mesh.coordinates(), so I can plot this vector like
surf=ax.scatter3D(x0,x1,d)
Now, I want this vector d as the source function in my FEM system. So instead of an analytical source f=Expression('function of x[0] and x[1]'), I want this vector as a source for all my N nodal points. Is it possible to use this numerical expression as a source function in FEniCS?
Thanks for any help,
Adriaan