-
Notifications
You must be signed in to change notification settings - Fork 17
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
Implement binary Coulomb collisions between plasma species #676
Conversation
…SA PIC loop Co-authored-by: Axel Huebl <axelhuebl@lbl.gov> Co-authored-by: Andrew Myers <atmyers@lbl.gov> Co-authored-by: Yinjian Zhao <yinjianzhao@lbl.gov> Co-authored-by: Remi Lehe <rlehe@lbl.gov>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To continue with this work, let's merge it with minor suggestions after @AlexanderSinn reviewed it.
Then, the following things must be fixed:
- normalized units
- adding the constant of motion (or unifying it with psi, as discussed offline, this needs some changes in the particle pusher)
- not changing psi (this is non-physical), but rather the constant of motion
- currently, the safety nets are minimal: if a user fails at providing correct names in
collision.species = name name
it just segfaults. It should be asserted that the names in thecollision.species
are inplasmas.names
Co-authored-by: Severin Diederichs <65728274+SeverinDiederichs@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See review
Update: I merged dev into this branch to include the new psi+1 handling. Now it all works as expected (CI passes, as well as the tests above). This is ready for review/merge. |
// particle's Lorentz factor | ||
const amrex::Real g1_tmp = (1.0_rt+u1x*u1x*inv_c2 + u1y*u1y*inv_c2 + psi1*psi1) / (2.0_rt*psi1); | ||
amrex::Real u1z = PhysConstSI::c * (g1_tmp - psi1); | ||
|
||
// particle's Lorentz factor | ||
const amrex::Real g2_tmp = (1.0_rt+u2x*u2x*inv_c2 + u2y*u2y*inv_c2 + psi2*psi2) / (2.0_rt*psi2); | ||
amrex::Real u2z = PhysConstSI::c * (g2_tmp - psi2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what's different from WarpX
const amrex::Real ga = std::sqrt( T_R(1.0) + (u1x*u1x+u1y*u1y+u1z*u1z)*inv_c2 ); | ||
psi1 = ga - u1z/PhysConstSI::c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as well as backward conversion here
const amrex::Real ga = std::sqrt( T_R(1.0) + (u2x*u2x+u2y*u2y+u2z*u2z)*inv_c2 ); | ||
psi2 = ga - u2z/PhysConstSI::c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
This PR proposes an implementation of binary Coulomb collisions between plasma species. It is largely inspired by the WarpX implementation (see ECP-WarpX/WarpX#539 for the original PR), based on this article by F. Pérez et al. In particular files ComputeTemperature.H, ElasticCollisionPerez.H, ShuffleFisherYates.H, and UpdateMomentumPerez.H were copy-pasted before being modified, and are kept as close as possible to the WarpX implementation on purpose, in view of a potential future merge. The main authors @Yin-YinjianZhao @ax3l @RemiLehe @atmyers are co-authors of this commit.
The module can be used by adding e.g.
in an input file (assuming the electron plasma species is called
plasma
).Main changes
As mentioned above, files ComputeTemperature.H, ElasticCollisionPerez.H, ShuffleFisherYates.H, and UpdateMomentumPerez.H were copy-pasted from WarpX, and modified to work with the specifics of quasi-static PIC:
psi
instead. Therefore,uz
is replaced bypsi
in the argument of a few functions.uz
. Conversions were added betweenpsi
anduz
in this file.Other changes are:
CoulombCollision
was created (see CoulombCollision.H/cpp). For each type of collisions enabled (i.e., between 2 plasma species, potentially twice the same), a new instance of this class is created. The vector of objects is stored in class MultiPlasma.TileSort
were implemented so it works on CPU and GPU.In the loop over slices in
HiPACE::Evolve
, after each particle push by 1 longitudinal cell, plasma particles of the relevant species are sorted per-cell and collided pairwise within each cell.Tests
Linear regime: comparison with WarpX
This HiPACE++ input file and this WarpX input file were run on GPU, giving the following:
Lineout: transverse cut of the fields, where we compare the general shape of the fields and the difference between with and without collisions:
x-z slice of the Ez field:
x-z slice of the Ex - c*By field:
The number of ppc was increased to 8x8x1 to observe a good agreement.
Non-linear regime: comparison with WarpX
This HiPACE++ input file and this WarpX input file were run on GPU, giving the following:
Lineout: transverse cut of the fields, where we compare the general shape of the fields and the difference between with and without collisions:
x-z slice of the Ez field:
x-z slice of the Ex - c*By field:
The agreement is not excellent for the non-linear regime (even without collisions), in particular because these runs are a bit far from convergence. However, changing the parameters turned out to be difficult because of ECP-WarpX/WarpX#2886.
TODO (for future PRs)
psi
, which has an impact on the algorithm in the relativistic regime.The three last tests can be performed in the WarpX vs. HiPACE++ framework.