BOUT-dev icon indicating copy to clipboard operation
BOUT-dev copied to clipboard

Iteration count in restarted simulations

Open johnomotani opened this issue 2 years ago • 0 comments

#2534 and #2549 seem to have had an unintended side-effect: the 'Step' in e.g.

1.330e-01       5393       3.64e+03    80.5    2.5    6.7    0.0   10.3
|  Step 126 of 1000. Elapsed 1:00:40.6 ETA 881:49:29.6

Now prints the total iteration count (including all previous restarts), not the step in the current run.

I think the reason for the change is that now the global iteration in src/bout.cxx is set equal to Solver::iteration by this line https://github.com/boutproject/BOUT-dev/blob/ab69d52f362dcaaddb22f3bd3b16aa7bab924d84/src/bout%2B%2B.cxx#L671-L672 but before #2534, Solver::iteration was counting the total iteration count over all restarts (which was written to hist_hi), and the global iteration in src/bout.cxx was counting from 0 in each run (which was written to iteration in the dump file).

I think the original behaviour is what we want, so we need some iteration counter that counts the iteration count in the current run. I think it might make more sense to have a second counter in Solver, which starts from 0 in each run, but also gets incremented by Solver::incrementIterationCounter(). If we do that, it makes sense to have a second getter for the 'local' counter (don't like using local/global for this sense, but what should we call the two counters?). Not sure which of the counters should be returned from Solver::incrementIterationCounter() - I'd probably lean towards keeping the current behaviour (return the 'global' counter). If we have both counters in Solver, I think we can also get rid of the global iteration in src/bout++.cxx.

Any thoughts anyone? And what names should we use for the variables/getters for the two counters?

johnomotani avatar Sep 12 '22 16:09 johnomotani