CHLNDDEV / OceanMesh2D

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).
https://github.com/sponsors/krober10nd
GNU General Public License v3.0
179 stars 65 forks source link

Precise nearest neighbor mapping for extremely close points (e.g., weirs/levess) #207

Closed WPringle closed 3 years ago

WPringle commented 3 years ago

adding precise option (calls Matlab's native knnsearch) in nearest_neighbor_map and calling in the carry over weirs routine since sometimes the weir points can be so close together that the precision of ANN ourKNNsearch fails while matlab's knnsearch works

I added a check for the presence of knnsearch in case the user doesn't have it.

krober10nd commented 3 years ago

wow how thin are your weirs that this is a problem?

WPringle commented 3 years ago

So they made them on top of each other but to get it work with OM2D I moved them slightly by around ~1e-6 deg

krober10nd commented 3 years ago

ah okay 10 cm. seems reasonable :]

krober10nd commented 3 years ago

Did you see the small change in #206 ? I had to make these arrays column otherwise I could not carry over.

WPringle commented 3 years ago

Added code for toggling plotting of fort.24 in Make_f24 and fixing slope_calc bug in #208

krober10nd commented 3 years ago

Is this completed to warrant running all the tests?

WPringle commented 3 years ago

yes it's completed

krober10nd commented 3 years ago

Running Example_2 produces the following figure with several incorrectly labeled ocean boundaries.

Screen Shot 2021-04-08 at 8 29 57 PM
WPringle commented 3 years ago

Running Example_2 produces the following figure with several incorrectly labeled ocean boundaries.

Screen Shot 2021-04-08 at 8 29 57 PM

right but this is not related to this PR right

WPringle commented 3 years ago

I'll make a new PR for improving the make_bc

krober10nd commented 3 years ago

I guess. I thought that we had used OurKnnsearch for labeling boundaries.

WPringle commented 3 years ago

this PR doesn't use that change. Only for carrying over weirs. Otherwise the "approximate" nearest neighbor (i.e. ourKNNsearch) is used.

krober10nd commented 3 years ago

All tests/examples worked out (we'll need to do a different PR to highlight the API change in make_bc that we talked about on Slack). I could not test the global example on my laptop due to insufficient RAM.