Dear all,
A couple of weeks ago, I found out that there was a bug in CarpetRegrid2. Namely, it does not properly check for a change of radius of the refinement levels (when they are steered by a Trigger for instance). Looking a bit closer, it seems that the computed `drfac` in `CarpetRegrid2/src/regrid.cc` is nan, and thus `do_recompose` is not set to true. In particular, it means it is possible to change the radii if something else triggers a regridding (for instance, changing the number of active levels).
However, while I was trying to understand and fix this bug, it appeared there might be a deeper issue. I'm struggling to understand if it may be related to memory, compilation, ...
----------------------------
----- More details -----
----------------------------
To figure out why drfac is nan, I added manual debugging information prints in the code. Depending on what information I ask, and in what order, I don't get consistent nor sensible results. I'm reaching out here first instead of opening a ticket because I can't pinpoint the precise issue.
I haven't tried different compilers (I have gcc 11.4.0 locally), but this is happening even with a debug build (see attached make.config.defn file).
More precisely, printing `rad`, `oldrad`, `rad - oldrad` is fine (done through std::cout).
Printing (CCTK_VINFO) the numerator and denominator of `drfac` separately gives the right values for them, but the quotient `drfac` is wrong (it is 0, and not nan anymore, even when it shouldn't).
If I create new local variables
```