Cabana icon indicating copy to clipboard operation
Cabana copied to clipboard

Create functions in the local grid to get the index space of cells on periodic or free boundaries

Open JStewart28 opened this issue 1 year ago • 2 comments

Create functions similar to the boundaryIndexSpace function in the local grid to:

  1. If the i/j/k offset is on a free boundary, return the index space that is within halo_width of the boundary.
  2. If the i/j/k offset is on a periodic boundary, return the periodic index space.
  3. 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.

JStewart28 avatar Jul 30 '24 21:07 JStewart28

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:

  1. This is already possible with boundaryIndexSpace?
  2. 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 the sharedIndexSpace concept, but exclude those not on the system boundary
  3. 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.)

streeve avatar Jul 31 '24 21:07 streeve

  1. I had to take another look at our code to remind myself what we are doing. Currently, boundaryIndexSpace returns the boundary index space (or an empty index space if off_ijk is not on a boundary) only if the boundary is free. This is fine.

  2. Yes, creating a periodicIndexSpace function that behaves oppositely to boundaryIndexSpace is what we are looking for. It would return an empty space if the boundary in the off_ijk direction is not periodic, otherwise it would return the index space of however large the ghosted region along the boundary is.

JStewart28 avatar Aug 01 '24 02:08 JStewart28