coordinates of nodes where the solutions satisfy a condition


79
views
1
5 weeks ago by
Dear all,

I have solved a Poisson equation. Now, I need to get the coordinates of all nodes of which the solution is larger than, say 0.5. I tried to google this topic but could not find any. My initial attempt is:

indices = np.where(self.u.vector() > 0.5)[0]  # self.u = FunctionSpace(self.mesh, "CG", 1)

I guess that I should do something mesh.get_coordinates (indices) to retrieve the corresponding coords, but mesh does not have such a function.


Bests,
Phu
Community: FEniCS Project

1 Answer


4
5 weeks ago by
Conisder this:

indices = np.where(self.u.vector() > 0.5)[0] 
dof_x   = FunctionSpace(self.mesh, "CG", 1).tabulate_dof_coordinates().reshape((-1, 2))
print dof_x[indices]​
Thanks a lot Hernan. That works.
written 4 weeks ago by Nguyen Vinh Phu  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »