Test of VectorInterp() on the FV3 grid - #125
Conversation
|
Diagnostic report — mint / VectorInterp grid C24_SCRIP_desc.181018.nc · 3,456 cells 16,200 src/mntVectorInterp.cpp:87 Root cause B Four cells touch the pole vertex exactly — one per neighboring panel — each storing it as a plain quad corner with averageLonAtPole-assigned longitude. Cell 1427, for instance, is stored as: 84° Recommendation |
|
Thanks @ta440 for submitting this bug |
* test for vector interp on the FV3 grid (#125) * make FindCell aware of the periodicity by haing getBucketId also probe +/- periodicity * setCubedSphere(bool) — a new, explicit flag on the locator, threaded down only from grids where fixLonAcrossDateline && averageLonAtPole (the flags that already meant "gnomonic cubed sphere" on Grid_t, just never passed to the locator before). Wired into mnt_vectorinterp_buildLocator only — deliberately not into PolylineIntegral/RegridEdges, since their line-intersection code (collectIntersectionPoints) does its own independent flat-straight-line math that a spherical containsPoint would put out of sync with — that's a separate, deeper fix (great-circle arc intersection) I've documented at both call sites rather than half-applying. Spherical bilinear patch (sphericalBilinearMap, invertSphericalBilinearPatch, containsPointCubedSphere) — for a cubed-sphere face, containment and parametric coordinates now come from one consistent model (double-slerp patch + Gauss-Newton inverse), instead of pairing an accurate spherical containment test with vtkQuad::EvaluatePosition's unrelated flat model — which is what caused the interpolation blow-ups. Performance: each face's XYZ corners/centroid/radius are precomputed once in BuildLocator, and a cheap centroid-distance pre-filter (proven safe — 2× margin above the measured worst case) rejects the large majority of candidate cells before ever running Newton. Net: the originally-reported test went from 2s → 928s (suite) → back to 2s / 44s suite-wide. * fixed compilation warnings --------- Co-authored-by: Timothy Andrews <75810156+ta440@users.noreply.github.com>
Adds a test of applying the VectorInterp() function on the FV3 cubed-sphere grid. Here, we aim to interpolate winds to regularly spaced nodes on a 2x2 lon-lat grid.