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

Add particle resampling inputs to picmi.py #4257

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ class Species(picmistandard.PICMI_Species):

warpx_save_particles_at_eb: bool, default=False
Whether to save particles lost at the embedded boundary

warpx_do_resampling: bool, default=False
Whether particles will be resampled

warpx_resampling_trigger_intervals: bool, default=0
Timesteps at which to resample

warpx_resampling_trigger_max_avg_ppc: int, default=infinity
Resampling will be done when the average number of
particles per cell exceeds this number
"""
def init(self, kw):

Expand Down Expand Up @@ -203,6 +213,11 @@ def init(self, kw):
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)

# Resampling settings
self.do_resampling = kw.pop('warpx_do_resampling', None)
self.resampling_trigger_intervals = kw.pop('warpx_resampling_trigger_intervals', None)
self.resampling_triggering_max_avg_ppc = kw.pop('warpx_resampling_trigger_max_avg_ppc', None)

def initialize_inputs(self, layout,
initialize_self_fields = False,
injection_plane_position = None,
Expand Down Expand Up @@ -238,7 +253,10 @@ def initialize_inputs(self, layout,
do_not_deposit = self.do_not_deposit,
do_not_push = self.do_not_push,
do_not_gather = self.do_not_gather,
random_theta = self.random_theta)
random_theta = self.random_theta,
do_resampling=self.do_resampling,
resampling_trigger_intervals=self.resampling_trigger_intervals,
resampling_trigger_max_avg_ppc=self.resampling_triggering_max_avg_ppc)

# add reflection models
self.species.add_new_attr("reflection_model_xlo(E)", self.reflection_model_xlo)
Expand Down
Loading