Use consistent BCs for J at PEC boundaries #5650
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes the BC handling for J at PEC boundaries consistent with that needed for energy conservation.
Currently, the boundary conditions for J at PEC (i.e. conductor) and PMC (i.e symmetry) is set to be consistent with that needed for charge conservation when using reflecting and thermal particle boundary conditions. This is the correct thing to do for a symmetry boundary, but it can results in artificial numerical heating at PEC boundaries when using shape factors larger than one.
Energy conservation demands that the boundary handling for J be consistent with the E field boundary conditions used to gather E for the pushing the particles. If an even BC is used for E_i, then J_i deposited to the ghost cells should be added to the mirror location inside the domain. Likewise, if the BC used for E_i is odd, then J_i deposited to the ghost cells should be subtracted from its mirror location inside the domain. Note that this is independent of the boundary condition applied to the particles.
The figures below show electron temperature profiles at t=0 and t = 5 ns from 1D simulations of a uniform electron-deuterium plasma in a box. The electrons and ions are initialized with uniform density ne = ni = 1e17/cc and Te = Ti = 1 eV. The time advance uses the energy-conserving implicit solver. Coulomb collisions between all species pairs are included. All simulations use reflecting BCs for particles at both boundaries and shape factor = 2. The left most figure shows results using PMC (i.e. symmetry) boundary conditions for the fields, which as described above is consistent with the current way that J is handled at the boundaries in the development branch. The electron temperature remains the same at later times for this choice of field boundary conditions. The center figure shows results using PEC field boundaries with the development branch, which shows artificial numerical heating at the boundaries. The figure on the right shows results using PEC field boundaries with reflecting particles using this PR, which shows no signs of artificial numerical heating.
Further details of how to treat boundary conditions for J (and for rho), and subtleties with using the reflecting boundary condition on non-symmetry planes for charged particles is given here WarpX_PEC_PR.pdf
Note that the changes in this PR restore energy conservation, but charge conservation at the boundaries is not maintained. This can be restored with a proper treatment of particles going in and out of the PEC boundaries. This will be done in a future PR.