PHAREHUB / PHARE

💫 Parallel Hybrid Particle In Cell code with Adaptive mesh REfinement
https://phare.readthedocs.io
GNU General Public License v3.0
69 stars 25 forks source link

coarsening moments and NaNs on moment ghosts #181

Closed nicolasaunai closed 4 years ago

nicolasaunai commented 4 years ago

This issue concerns the coarsening of moments only. Moments are defined on primal nodes.

At refinement ratio 2 a coarse grid node needs 3 fine nodes, the one on top, and the two next to it on the left and right side, with coefs 0.5, 0.25 0.25.

image

the problem is that for the coarse nod that falls on top of the fine patch border node, that node needs the first fine primal ghost... which is currently set to NaN.

as a result, many coarse node (all those falling on top of a fine border node) will have NaNs, which is bad.

Several options:

image

second option seems easier even if introducing a special case...

second option variant could use the fine node on top AND the one inside, but the dissymmetry is weird.

nicolasaunai commented 4 years ago

Actually, the problem is only for moments...

it could be possible, since we have the field in the coarsening operator, to check with its name if it's a moment and then we'd have to look wether a fine ghost node appears in the fine indexes to coarsen and then skip the ghost and take only 1 fine node, as said above...

but this seems complicated. I'm investigating instead another method that consists in not placing a NaN on the first ghost node, but copying the first physical index there...

image

this way no NaNs anymore when coarsening...