small bug during restart

From: Yves Revaz <>
Date: Thu, 17 Mar 2011 16:27:28 +0100

Dear Gadget list,

I've found what looks like a little bug in version <=2.0.6 of Gadget.
Fortunately, it has absolutly no impact on the physics. It is however
to be corrected.

In some conditions, when restarting a simulation from the restart files
(using option 1 in the command line), on can end up with different results,
compared to the one we would obtain if the simulation was not stopped.

This problem can be easily tested with the example "gassphere" or
probably with
any other example where the parameter TreeDomainUpdateFrequency is
different from 0.

After a deep investigation, the origin of the problem is the following :

If, when a simulation is restarted, during the first step the domain
decomposition is not performed, the tree is updated dynamically in the
routine "move_particles":

if (All.NumForcesSinceLastDomainDecomp < All.TotNumPart *

At this point, "force_update_pseudoparticles()" is called which in turn
"force_treeupdate_pseudos()". In this latter routine, a loop over
all Topleaves is performed using the variable NTopleaves.
Unfortunately, the value of NTopleaves is set to 0 (undefined) when
from the restart files, because the tree has not been created and because
NTopleaves is not stored in the restart files.

In this case, "force_treeupdate_pseudos()" does nothing while it should
normally slightly
move the centers of the tree-cells.

This generates a small difference (compared to the simulation that has
not been stopped)
that propagates and amplifies with time.

In the other case, if, when a simulation is restarted, during the first
step the domain decomposition
is performed, NTopleaves is set correctly and no differences are observed.

I think a simple solution to this problem will be to store NTopleaves in the
restart files.

With best regards,

yves revaz

                                                 (o o)
   Dr. Yves Revaz
   Laboratory of Astrophysics
   Ecole Polytechnique Fédérale de Lausanne (EPFL)
   Observatoire de Sauverny     Tel : ++ 41 22 379 24 28
   51. Ch. des Maillettes       Fax : ++ 41 22 379 22 05
   1290 Sauverny             e-mail :
   SWITZERLAND                  Web :
Received on 2011-03-17 16:27:28

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:31 CET