Closed mgduda closed 6 years ago
@xylar and @matthewhoffman We've tested these changes for non-periodic meshes, but if either of you would be able to easily test this PR with a periodic mesh, that would be really helpful.
@mgduda, I'll see if I can find a good test case on our side and will review this next week.
I agree with @mark-petersen. We have periodic meshes, some of which have missing cells (because they have been culled) but we never have fluxes at those boundary edges so we would not have a way of seeing that this bug has been fixed in MPAS-O.
@matthewhoffman, do you happen to have a mesh that is periodic in one dimension and has been culled in the other dimension? Do any MPAS-LandIce tests have fluxes at boundary edges?
@mgduda, I took a look at a periodic grid that includes cell culling in MPAS-O. It seems the cell-culler tool we use always makes sure that cell1 = cellsOnEdge(1,iEdge)
is the valid cell index so that cell2 = cellsOnEdge(2,iEdge)
would be equal to nCells+1
for a boundary edge. This means that we never encounter the case cell1 == nCells+1
in any of our meshes.
Here are a couple of images from a mesh (from the sub_ice_shelf_2D
COMPASS test case) that show this:
So I think you can feel free to merge this PR. We don't have a way to create a mesh where cell1 == nCells+1 .and. is_periodic
, and it seems like too much work to go out of our way to create such a mesh just to test this PR.
@matthewhoffman Did you have any comments or concerns about this PR?
@mgduda , we do have tests we can modify to be periodic, so I spent some time setting that up, and then realized that we don't actually have any code that makes use of edgeNormalVectors
, so I wasn't actually testing anything. So go ahead and merge this.
This merge corrects the sign of edgeNormalVectors for positive inflow boundary edges.
For edges that represent positive normal inflow along the boundary of a mesh, i.e., for edges where (cellsOnEdge(1,iEdge) == nCells+1), the mpas_initialize_vectors subroutine had incorrectly computed the value of the edgeNormalVectors field due to the transposition of the iEdge and cell2 locations in the difference.