From e130e57efcee4fb08cae9a5888c67c83db63abb4 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Mon, 30 Aug 2021 16:26:55 -0400 Subject: Make buffer of scraped particles available to Python code (#2164) * Added wrapper to get number of particle species tracked by the scraper Not sure if this is going to be useful, but it demonstrates a method to get information from the ParticleBoundaryBuffer into Python. * Stubbed out the main wrapper functions * Added parameters to wrapper * Added wrapper for getting the number of particles scraped of a species on a boundary * added picmi arguments to scrape particles at the domain boundary * Added wrapper to get the full particle buffer into python * rearanged the getBuffer properties code a little * Added docstrings +other suggested changes * Added num_particles_impacted_boundary docstring * fixed mistake in docstring * Changed boundary parameter to be a string for clarity * Fixed issue with the boundary parameter for scraping * Fixed issue with the boundary input for scraping stats wrapper * Added demonstration of particle scraping wrapper * Added analysis.py file * Fix typo in one of the dimension maps Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> * Added before esolve to warpx evolve * added test for the scraped particle buffer wrappers * Moved python PICMI particle boundary scrape test * Renamed test file to the correct name * Removed old test * added special functionality to get the timestep at which particles were scraped * removed debug print * added python wrapper for the clearParticles() function of the scraper buffer * added special wrapper function to get the timesteps at which the particles in the boundary buffer were scraped * updated test to match the non-PICMI test for the particle scraper buffer * Fix uncaught rebase mistake * re-activated picmi test of accessing the scraped particle buffers via python * added documentation for the new parameters involved in the scraped particle buffer and fixed remaining issue with picmi test * changes requested during code review Co-authored-by: mkieburtz Co-authored-by: Roelof Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> --- Python/pywarpx/picmi.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index e68636b89..71c18769b 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -85,6 +85,15 @@ class Species(picmistandard.PICMI_Species): self.self_fields_verbosity = kw.pop('warpx_self_fields_verbosity', None) self.save_previous_position = kw.pop('warpx_save_previous_position', None) + # For the scraper buffer + self.save_particles_at_xlo = kw.pop('warpx_save_particles_at_xlo', None) + self.save_particles_at_xhi = kw.pop('warpx_save_particles_at_xhi', None) + self.save_particles_at_ylo = kw.pop('warpx_save_particles_at_ylo', None) + self.save_particles_at_yhi = kw.pop('warpx_save_particles_at_yhi', None) + self.save_particles_at_zlo = kw.pop('warpx_save_particles_at_zlo', None) + self.save_particles_at_zhi = kw.pop('warpx_save_particles_at_zhi', None) + self.save_particles_at_eb = kw.pop('warpx_save_particles_at_eb', None) + def initialize_inputs(self, layout, initialize_self_fields = False, injection_plane_position = None, @@ -108,6 +117,13 @@ class Species(picmistandard.PICMI_Species): self_fields_required_precision = self.self_fields_required_precision, self_fields_max_iters = self.self_fields_max_iters, self_fields_verbosity = self.self_fields_verbosity, + save_particles_at_xlo = self.save_particles_at_xlo, + save_particles_at_xhi = self.save_particles_at_xhi, + save_particles_at_ylo = self.save_particles_at_ylo, + save_particles_at_yhi = self.save_particles_at_yhi, + save_particles_at_zlo = self.save_particles_at_zlo, + save_particles_at_zhi = self.save_particles_at_zhi, + save_particles_at_eb = self.save_particles_at_eb, save_previous_position = self.save_previous_position) pywarpx.Particles.particles_list.append(self.species) -- cgit v1.2.3