-
Notifications
You must be signed in to change notification settings - Fork 201
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
Use consistent BCs for J at PEC boundaries #5650
Open
JustinRayAngus
wants to merge
6
commits into
ECP-WarpX:development
Choose a base branch
from
JustinRayAngus:field_bc_fix
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpgrote
reviewed
Feb 10, 2025
671a7d0
to
917d0d8
Compare
roelof-groenewald
requested changes
Feb 18, 2025
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.
Looks good to me! Just a few minor comments.
…BC for E as required by energy conservation.
917d0d8
to
fcd1904
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.