MPAS-Dev / MPAS-Tools

MPAS Tools Repository
Other
39 stars 65 forks source link

Generalize angleEdge for planar meshes in MpasMeshConverter #396

Closed matthewhoffman closed 3 years ago

matthewhoffman commented 3 years ago

In MpasMeshConverter, the planar mesh calculation for angleEdge assumes the connectivity of periodic_hex such that angleEdge would always be between 0 and 180.

This commit eliminates that assumption and makes the angleEdge calculation applicable to any mesh. This is necessary for angleEdge to be correct for planar meshes made with JIGSAW, for example.

matthewhoffman commented 3 years ago

image A before (left) and after (right) image for a variable resolution mesh generated by JIGSAW.

Note that angleEdge is defined as the CW angle between the eastward direction and the vector connecting the two cell centers straddling an edge. (However the choice of which cell is 1 or 2 is arbitrary, so there are two possible angle values (differing by 180) - so this image does not make it possible to determine if the correct one is used.)

xylar commented 3 years ago

@matthewhoffman, merge when you're ready. I can make a new release of the conda package whenever you like.

matthewhoffman commented 3 years ago

Thanks, Xylar. We don't have any urgent need for this fix, so hopefully a conda package update can wait until there are other needs.

xylar commented 3 years ago

Sounds good. It's not a ton of work to release a package but it's a pain to update the various conda environment we use. So I'll wait on all of that until another need arises. Thanks for finding and fixing this bug!