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

Use consistent BCs for J at PEC boundaries #5650

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

JustinRayAngus
Copy link
Contributor

@JustinRayAngus JustinRayAngus commented Feb 8, 2025

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.

WarpX_FBF_PR

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.

…BC for E as required by energy conservation.
@JustinRayAngus JustinRayAngus added bug Something isn't working component: boundary PML, embedded boundaries, et al. labels Feb 8, 2025
@JustinRayAngus JustinRayAngus changed the title Use consistent BCs for J at PEC and PMC boundaries Use consistent BCs for J at PEC boundaries Feb 9, 2025

// Get the mirror guard cell index
amrex::IntVect iv_mirror = ijk_vec;
iv_mirror[idim] = mirrorfac[idim][iside] - ijk_vec[idim];

// Update the cell if the mirror guard cell exists
if (ijk_vec == iv_mirror && is_reflective[idim][iside] == 1) {
if (ijk_vec == iv_mirror && psign[idim][iside] == -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From our previous discussion, this if block is not needed, unless you've found a reason for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering about that, and a few other lines. I'll make the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: boundary PML, embedded boundaries, et al.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants