lowderchris/fluxon-mhd

Value interpolation not quite right

Closed this issue · 1 comments

There seem to be two problems with the interpolation routines.

  1. When doing interpolation using a global neighbor search, the interpolated values aren't what we would expect.
  2. When doing interpolation using a local neighbor search, the interpolated values aren't even close to what we would expect in certain places, though they are close to their global values in other places.

There are two avenues of investigation:

  • Check the interpolation routine itself. Start there.
  • Check the neighbor definitions and neighbor searches.

The Perl subroutine interpolate_tester.pdl.txt shows the problem by interpolating the 'x' vector, and then calculating the magnitude of the difference vector between what was requested and what was returned. The attached Flux::World
global_500_fluxons_step03000.flux.txt can be used as input. The graphic
interpolate_value_x_distributions
shows histograms of the magnitudes of the difference vectors, illustrating the long tail obtained using the standard vertex search.

A brief overview of changes implemented / being implemented in the fix-geometry branch to attempt to address these issues:

  • Simplex definition changes
    • Vertex selection accounts for distance, preferring nearer points
    • Branched simplex selection method
    • Selection refined to prefer regular simplexes
  • Interpolation scheme changes
    • Redefined interpolation from four points based on simplex volume ratios
    • Implemented corresponding techniques in lower dimensions for three and two interpolation points
    • Creation of a toggle to 'trust' interpolation from three and fewer points, if user-requested

These changes result in both an expansion of locations for which four suitable simplex points can be found and a reduction of coordinate interpolation error in these regions to within ~1e-15 R_sun for the example world here.

diffmag_globloc_all
Utilizing the same example world, I've mapped out a similar plot of coordinate interpolation error (though in reversed color scheme, sorry!). For both the global and local searches, the errors appear to be reduced. The larger values here are the result of interpolating with three or fewer points.

All of the above points are now implemented within the fix-geometry branch, with the exception of the 'trust' toggle. Disabling this toggle (default) would not attempt to interpolate with three or fewer points, and would simply return NaNs.