Hi Guillaume,
> But I can't figure out why : in the foreach() loop f1[] equals to f[],
> so why is it changing anything ?
Good question.
The answer is that the way f is refined is different from the way f1 is
refined (as defined by the refine()/prolongation() property of the fields).
f is a VOF scalar, so is refined using a VOF geometric reconstruction
which keeps the interface sharp. See
http://basilisk.fr/src/fractions.h#fraction_refine
As a result, the interpolation error (corresponding with the 1e-4
threshold) is sensitive to the curvature of the interface. In effect the
wavelet decomposition used to estimate the interpolation error is done
"along the interface".
f1 is a default scalar field and is just refined assuming that it is a
differentiable field (in contrast with the VOF field). As a result the
interpolation error is sensitive to the curvature _of the field itself_
(i.e. the norm of the Hessian), not the curvature of the interface.
Since the "curvature of the field" is large anywhere close to the
interface, the mesh is refined everywhere close to the interface, not
just in regions where the interface itself is curved (as for the VOF field).
Note that in most cases refining the interface according to its
curvature (i.e. using the VOF field) is the correct way to adapt the mesh.
If you find yourself tweaking this, as you are doing here, you need to
ask yourself whether you are really adapting the mesh according to the
right criterion (i.e. the right field).
cheers,
Stephane