Efficient alternative for locate_cell
to find all elements that share a point
#3782
-
Hello, I have a similar issue than #3015. I need the cell that contains point where where However, if |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There are two issues here. One is the point evaluation functional. The other is your query about points that are on the edges of cells. For the point evaluation functional, it sounds to me like Spyro is attempting to hand code something that Firedrake already explicitly supports. The right way to do this is to use function spaces defined on vertex only meshes. The exact case is described in https://doi.org/10.5194/gmd-17-5369-2024, especially listing 2. The same approach is used for an FWI demo in: https://www.firedrakeproject.org/demos/full_waveform_inversion.py.html and the VertexOnlyMesh is described in some more detail here: https://www.firedrakeproject.org/point-evaluation.html#primary-api-interpolation-onto-a-vertex-only-mesh The second point is what to do on the boundaries of cells. The short version is that you don't actually ever know that you are on the boundary of a cell, because the roundoff errors mean that this is always uncertain. Even if you did know, the difference in even a discontinuous quantity from one side of the face to another is truncation error, so if it's at a level that matters to your answer this indicates that you're under-resolved. Averaging won't get you out of that. Strictly speaking, point evaluation of a discontinuous function isn't actually well-defined anywhere so you're committing a variational crime by doing that point evaluation at all, but the magnitude of the crime is at most the truncation error (because you could have projected the quantity into a continuous space), so simply ignoring it and evaluating on whichever of the cells the algorithm finds is probably reasonable for most cases. |
Beta Was this translation helpful? Give feedback.
There are two issues here. One is the point evaluation functional. The other is your query about points that are on the edges of cells.
For the point evaluation functional, it sounds to me like Spyro is attempting to hand code something that Firedrake already explicitly supports. The right way to do this is to use function spaces defined on vertex only meshes. The exact case is described in https://doi.org/10.5194/gmd-17-5369-2024, especially listing 2. The same approach is used for an FWI demo in: https://www.firedrakeproject.org/demos/full_waveform_inversion.py.html and the VertexOnlyMesh is described in some more detail here: https://www.firedrakeproject.org/point-evaluation.html#prima…