merged hierarchies interpolations results in spurious values
Opened this issue · 2 comments
Here is a L2 patch of the Pzz component of the ion pressure (it does not matter that's this)
and below are cuts at x=21 obtained different means.
The blue curve is obtained from the interpolator Pizz_i
evaluated at (21, yp[106:118]) from a hierarchy made with merged=True,interp="nearest"
Notice the drop at y=11.7.
In green, the real patch data values for that location. Notice there is no drop at 11.7.
In red and orange the same cut but made 1 node left and right to the above cut.
With interp=nearest, one expects the blue curve to somehow be in the middle of the red and orange.
Clearly there is a problem
fig, ax = plt.subplots()
x0 = 21
ax.plot(yp[106:130],Pizz_i(21,yp[106:130]), marker='+', label="merged nearest x=21")
ax.axvline(p[2].patch_datas["Pzz"].y[2])
ax.axvline(p[2].patch_datas["Pzz"].y[-3])
ax.plot(p[2].patch_datas["Pzz"].y[2:-2],p[2].patch_datas["Pzz"].dataset[3,2:-2], label="x=20.9")
ax.plot(p[2].patch_datas["Pzz"].y[2:-2],p[2].patch_datas["Pzz"].dataset[4,2:-2], label="true patch data x=21")
ax.plot(p[2].patch_datas["Pzz"].y[2:-2],p[2].patch_datas["Pzz"].dataset[5,2:-2], label="x=21.1")
ax.legend()
Ok, plotting the data of the patch aove also gives :
I think the error is that I don't calculate the ghosts of my pressure diag.
However, there is in flat_finest_field_2d :
# all but 1 ghost nodes are removed in order to limit
# the overlapping, but to keep enough point to avoid
# any extrapolation for the interpolator
needed_points = pdata.ghosts_nbr - 1
It's possible somehow the interpolator keeps the value of the one ghost from the right patch instead of the domain value of the left one.
we should figure out how to tell the interpolator not to learn from ghost values.