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

Cropping of particles at boundaries for deposition for charge conservation #5649

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

dpgrote
Copy link
Member

@dpgrote dpgrote commented Feb 8, 2025

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.

Only in Villasenor and Buneman current deposition in this commit
@JustinRayAngus
Copy link
Contributor

The cropping should not be applied at PMC (symmetry) boundaries. Only at physical boundaries like conductors and insulators.

Comment on lines +490 to +494
|| 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));
}
Copy link
Contributor

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;
}
Copy link
Contributor

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

Comment on lines +953 to +957
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;
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants