Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checkpoints #178

Merged
merged 3 commits into from
Dec 22, 2017
Merged

Fix checkpoints #178

merged 3 commits into from
Dec 22, 2017

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Dec 18, 2017

This is a reimplementation of PR #162, decided after off-line discussion with @MKirchen.

From the original PR:

The checkpoint / restart feature was broken:

  • In load_species the weights were multiplied by the charge q. This should not be done anymore.
  • If a diag_period was at the same time as a checkpoint_period, a wrong diagnostic was written at the first step (i_step == 0) after the restart (wrong charge/currents). With this PR, a check is performed based on a new attribute (is_restarted) of the Simulation object.

The current PR fixes the second issue by swapping the order of the diagnostics and the particle exchange (particle exchange first, then diagnostics). Since the particle exchange phase is always followed by a deposition of charge (including immediately after a restart, see the remark on i_step==0), the charge will now always be available for the diagnostics. In addition, I added a similar line for the currents (only done when i_step==0, not for each particle exchange).

As a side-effect, note that this also takes care of the fact that the charge/currents were not deposited on the very first diagnostics (even without restart).

@MKirchen MKirchen self-requested a review December 22, 2017 10:42
@MKirchen MKirchen merged commit e92b0be into fbpic:dev Dec 22, 2017
@RemiLehe RemiLehe deleted the fix_checkpoints branch December 23, 2017 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants