-
Notifications
You must be signed in to change notification settings - Fork 199
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
Cropping of particles at boundaries for deposition for charge conservation #5649
base: development
Are you sure you want to change the base?
Conversation
Only in Villasenor and Buneman current deposition in this commit
The cropping should not be applied at PMC (symmetry) boundaries. Only at physical boundaries like conductors and insulators. |
|| field_boundary_lo[idim] == FieldBoundaryType::PMC)); | ||
is_absorbing[idim][1] = (tilebox.bigEnd(idim) >= domain_box.bigEnd(idim) && | ||
(field_boundary_hi[idim] == FieldBoundaryType::PEC | ||
|| field_boundary_hi[idim] == FieldBoundaryType::PMC)); | ||
} |
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.
PMC ==> PECInsulator
if (check[0] && x < xmin) { return xmin; } | ||
if (check[1] && x > xmax) { return xmax; } | ||
return x; | ||
} |
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.
I don't think this is sufficient for D>1. You need to crop the full position vector where the particle intersects the boundary. See the truncate_boundaries() routine in picnic/src/particle_tools/MeshInterpChargeConservingF.ChF
amrex::Real const zp_np1_c = ParticleUtils::crop_at_boundary(zp_np1, xyzmin.z, xyzmax.z, is_absorbing[WARPX_ZINDEX]); | ||
// Keep these double to avoid bug in single precision | ||
double const z_new = (zp_np1 - xyzmin.z)*dinv.z; | ||
double const z_new = (zp_np1_c - xyzmin.z)*dinv.z; | ||
double const z_old = (zp_n - xyzmin.z)*dinv.z; | ||
double const z_bar = (zp_nph - xyzmin.z)*dinv.z; | ||
double const z_bar = (z_new + z_old)*0.5_rt; |
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 implemented, this will not achieved the desired result. We can talk offline about this.
This modifies the deposition (and field gather), cropping particle orbits at the boundary of the domain for PEC and PMC boundaries. This is a simple way of achieving charge conservation as particles are absorbed at boundaries.
Should this always be done or should a flag be added to turn this feature on?
Only in Villasenor and Buneman current deposition now. Will be extended to Esirkepov.
A second necessary change (with reflective boundaries) is to stop the particle orbits at the boundary so that in the next time step, the particles start at the boundary.