pynbody / genetIC

The GM initial conditions generator
GNU General Public License v3.0
21 stars 8 forks source link

Fix quadratic multilevel #33

Closed Martin-Rey closed 6 years ago

Martin-Rey commented 6 years ago

This is a proposed to the multilevel implementation of the quadratic algorithm. The part of the algorithm modifying the field is fine, it is the part producing the convector that is inaccurate.

Previously, generating the convector was inspired by the linear case. More specifically, it used only information inside the zoom region and then interpolated it on coarser levels through the method generateMultiLevelFromHighRes().

However, there is by construction very little low-k information in the zoom region independent of the coarse grid. The combination of using only the zoomed information and the approximate interpolation led to errors of order 1 when calculating the variance.

The proposed fix is to use the full information from the field (e.g. low and high ks on both grids) allowing to much tighter errors than previously, unless used in very unphysical cases. For such cases, a warning is now issued.

We can discuss further the range of tests I did to validate the behaviour of this implementation if needed. Let me know if anything/everything is unclear

apontzen commented 6 years ago

This new method seems correct to me.