Hi Daniel,
> value at the center of the cell. This gives an interpolation function
> which looks a little bit weird in some points inside the cell.
In what way does it look "weird"?
> I do not know if there is a reason why you included the cell center
> value in the interpolation and not just using bilinear interpolation
> from the corner values, which gives a more nice (and at least
> intuitive from my point of view) interpolation function.
Yes, bilinear is what I was doing before. A problem with bilinear is
that the bilinearly-interpolated value at the center of the cell is
the average of the 4-corner values i.e. this is a "filtered" version
of the field (it will be much smoother than the original cell-centered
field). The idea with the current implementation is to replace
bilinear interpolation with linear interpolation in the 4 triangles
(in 2D) covering the square and sharing the cell-center. This should
be a linear, continuous (C0) representation of the field which
evaluates to the original values at cell centers.
Note that the same problem (i.e. smoothing due to bilinear
representation) can be seen visually in GfsView i.e. the fields
represented using "Linear" or "Isolines" look much smoother (i.e.
loose details) compared to the "Squares" representation. This is
because both "Linear" and "Isolines" still use bilinear interpolation
on squares rather than linear interpolation on triangles. Fixing this
would lead to a more accurate representation for both "Linear" and
"Isolines".
Note also that the way corner values are interpolated
(gfs_cell_corner_interpolator) is pretty old and somewhat messy. I
think it could be reimplemented much more cleanly and efficiently
using gfs_domain_locate() rather than the do_path() stuff. Also, it
uses "distance-weighted" interpolation which is probably not the best
way to do it.
Generally it would be nice to check that this interpolation business
does what it is meant to do i.e. write a test case which checks the
order of convergence etc... when discretising and interpolating a
known function on both constant-resolution and variable-resolution
meshes.
cheers
Stephane