Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merged hierarchies interpolations results in spurious values #793

Open
nicolasaunai opened this issue Dec 13, 2023 · 2 comments
Open

merged hierarchies interpolations results in spurious values #793

nicolasaunai opened this issue Dec 13, 2023 · 2 comments
Assignees
Labels
bug 🔥 Something isn't working
Milestone

Comments

@nicolasaunai
Copy link
Member

nicolasaunai commented Dec 13, 2023

Here is a L2 patch of the Pzz component of the ion pressure (it does not matter that's this)

image

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()

image

@nicolasaunai nicolasaunai added the bug 🔥 Something isn't working label Dec 13, 2023
@nicolasaunai
Copy link
Member Author

Ok, plotting the data of the patch aove also gives :

image

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.

@nicolasaunai
Copy link
Member Author

we should figure out how to tell the interpolator not to learn from ghost values.

@nicolasaunai nicolasaunai added this to the 1.0 milestone May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working
Projects
Status: Fix me 🔥
Development

No branches or pull requests

2 participants