Create functions in the local grid to get the index space of cells on periodic or free boundaries
Create functions similar to the boundaryIndexSpace function in the local grid to:
- If the i/j/k offset is on a free boundary, return the index space that is within
halo_widthof the boundary. - If the i/j/k offset is on a periodic boundary, return the periodic index space.
- Otherwise, return an empty index space
This makes access to the boundary cells more straightforward. For example, after performing a periodic halo exchange each process calls this function to iterate over cells received across a periodic boundary for coordinate correction. For free boundaries, it calls this function to iterate over the cells for extrapolation of position from cells in the mesh.
I want to clarify a few things first - we have boundaryIndexSpace for both Own and Ghost - not sure if you need the owned boundary or the ghosted boundary cells. There is no current support for indices only on periodic boundaries. If I understand correctly:
- This is already possible with
boundaryIndexSpace? - This could be
periodicIndexSpace(necessary to distinguish since many cases explicitly don't want to apply BC on a periodic boundary and this would otherwise be an empty boundary index space). This should build on thesharedIndexSpaceconcept, but exclude those not on the system boundary - Make sense
Note these will all be collections of index spaces since each one (each relative offset) needs to be contiguous in order to use in multidimensional range policies. We could support that better as well (all boundaries, all periodic boundary spaces, etc.)
-
I had to take another look at our code to remind myself what we are doing. Currently,
boundaryIndexSpacereturns the boundary index space (or an empty index space ifoff_ijkis not on a boundary) only if the boundary is free. This is fine. -
Yes, creating a
periodicIndexSpacefunction that behaves oppositely toboundaryIndexSpaceis what we are looking for. It would return an empty space if the boundary in theoff_ijkdirection is not periodic, otherwise it would return the index space of however large the ghosted region along the boundary is.