MPAS-Dev / MPAS-Limited-Area

Python tool to create a regional subset of a global MPAS Mesh
http://mpas-dev.github.io/
21 stars 10 forks source link

Handle duplicate boundary points in the mark_boundary method #8

Closed mgduda closed 5 years ago

mgduda commented 5 years ago

This merge adds logic to allow the mark_boundary method to handle duplicate boundary points.

If the list of boundary points contains consecutive locations that lie within the same MPAS grid cell, the computation to create a path from the first cell to its successor will result in a divide by zero in the following code:

            pta = np.cross(pta, ptb)
            temp = np.linalg.norm(pta)
            cross = pta / temp

To handle duplicate boundary points, we now check whether the MPAS cell index for the sourceCell and targetCell are the same, and if they are, we can skip the processing of the pair of points.