The document says I have to use evaluate to get the information of these coordinates :
*class* `ufl.geometry.` `SpatialCoordinate` (*domain* )
Bases: [`ufl.geometry.GeometricCellQuantity`](https://fenicsproject.org/olddocs/ufl/1.4.0/ufl.html?highlight=spatialcoordinate%20evaluate#ufl.geometry.GeometricCellQuantity)
UFL geometry representation: The coordinate in a domain.
In the context of expression integration, represents the domain coordinate of each quadrature point.
In the context of expression evaluation in a point, represents the value of that point.
`evaluate` (*x*, *mapping*, *component*, *index_values* )
`is_cellwise_constant` ()
Return whether this expression is spatially constant over each cell.
`name` *= 'x'*
`shape` ()
I also found similar questions, but he dealt with object, whereas mine is spatialcoordinate from mesh.
How can I deal with this?
The reason why I am doing this is that I have to extract the calculated FEM solution and coordinate to numpy data.(There is no problem in Pyvista visualiaztion) Thus, to match the coordinate (x,y) and solution f(x,y) I have to find out the indexes of every point.
Dear Robin, I really appreciate your quick, concise, and wonderful solution. I can see my coordinates!
However, how can I find some related document?
Thanks a lot.
You are very welcome . I could not find some related document unfortunately. If I recall correctly I found these pieces of code before on a different forum post when I was struggling with the same issue. However I can very much recommend the tutorial written by dokken at Implementation — FEniCSx tutorial . In this first chapter you will also find the code for tabulating the DoF for function spaces
Dear Robin,
Thanks for your reply.
Seems that I missed the very basics.^^;; I should have read the documents more carefully.
Again, thanks for spending your valuable time on answer.
As @rsmeets says, for certain function spaces you can get the dof coordinates directly with dolfinx.fem.FunctionSpace.tabulate_dof_coordinates. This is not the case for finite elements whose degree of freedom is based on functionals that does integration and not point eval. Then the dofs are associated with a cell,edge or facet, such as DefElement.