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

w should be the actual particle weight #98

Merged
merged 3 commits into from
Jul 25, 2017
Merged

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Jul 24, 2017

In the code before this PR, the particle quantity w represented different things:

  • For non-ionizable particles: it was the weight (i.e. number of physical particle per macroparticle) times the charge.
  • For ionizable particles: it was the weight times the ionization level, times the elementary charge e. This also implied that we had to keep an additional quantity (neutral_weight) to store the actual number of physical particle per macroparticle, inside the Ionizer class.

This is confusing, and therefore the current pull request sets w to be the actual weight (i.e. number of physical particle per macroparticle) for both non-ionizable particles and ionizable particles.

  • For non-ionizable, this implies that w has to be multiplied by the charge inside the deposition kernel (this is a minor cost)
  • For ionizable particles, w now plays the part that neutral_weight used to play. And therefore, inside the Ionizer class, neutral_weight is replaced by a new array w_times_level, which is only used for the deposition kernel, as the effective weight.

Note that a lot of the changes involve replacing neutral_weight by w_times_level in all the MPI communications. The code for the MPI communications of these optional quantities (e.g. w_times_level, ionization_level, etc.) is quite ugly, and should at some point be replaced by something better.

PS: In fact, w_times_level does not need to be communicated via MPI, since it can be recalculated at each exchange_period, from w and ionization_level. I kept the MPI communications mostly to minimize the changes in the code that this PR produces.

@RemiLehe RemiLehe requested a review from MKirchen July 24, 2017 04:08
@RemiLehe RemiLehe changed the title w should be the actual particle weight [WIP] w should be the actual particle weight Jul 24, 2017
@RemiLehe RemiLehe changed the title [WIP] w should be the actual particle weight w should be the actual particle weight Jul 25, 2017
@MKirchen
Copy link
Contributor

Nice PR! Good changes!

@MKirchen MKirchen merged commit 0a9e568 into fbpic:dev Jul 25, 2017
@RemiLehe
Copy link
Member Author

Thanks for reviewing!

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.

None yet

2 participants