aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2021-09-24 10:03:51 -0700
committerGravatar GitHub <noreply@github.com> 2021-09-24 10:03:51 -0700
commite1c1c8bac405069440bfa393dfb7197a6be3ffbc (patch)
tree51ebcc33091f8920fc9ab65df99de0ccd7ef404b /Python/pywarpx/picmi.py
parent129a533e3b899eaf62a49e9c1f6a47f5cfda9465 (diff)
downloadWarpX-e1c1c8bac405069440bfa393dfb7197a6be3ffbc.tar.gz
WarpX-e1c1c8bac405069440bfa393dfb7197a6be3ffbc.tar.zst
WarpX-e1c1c8bac405069440bfa393dfb7197a6be3ffbc.zip
Stochastic particle reflection from absorbing domain boundaries (#2281)
* added tunable particle reflection from absorbing domain boundaries * extended picmi.py to allow setting boundary reflection coefficients and added a CI test for the reflection implementation * allow R(E) to be specified, except for embedded boundaries * changed approach for particle reflection, now the ParticleBoundaries object will hold the reflection coefficient; reflection from EBs not implemented * added functionality to reflect from EB; still needs to be tested for accuracy * added support for energy dependent reflection models for domain boundaries * fixed at least one issue causing CI fails - building reflection model parsers for not physical particle containers * switched reflection coefficients to be functions of the velocity component perpendicular to the boundary rather than energy * reverted initial work on reflecting from EBs * changed naming convention for new CI test for particle reflection * switched useMPI back to 1 in test * breaking changes while trying to sort out GPU issue * fixed issue with CUDA compilation - hopefully :) * various code improvements from PR review suggestions * fix of major issues * no need to parse the reflection models at every step * skip particles that are already flagged for removal in ApplyBoundaryConditions
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index 1bb46e439..d3fa599d8 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -86,6 +86,15 @@ class Species(picmistandard.PICMI_Species):
self.save_previous_position = kw.pop('warpx_save_previous_position', None)
self.do_not_deposit = kw.pop('warpx_do_not_deposit', None)
+ # For particle reflection
+ self.reflection_model_xlo = kw.pop('warpx_reflection_model_xlo', None)
+ self.reflection_model_xhi = kw.pop('warpx_reflection_model_xhi', None)
+ self.reflection_model_ylo = kw.pop('warpx_reflection_model_ylo', None)
+ self.reflection_model_yhi = kw.pop('warpx_reflection_model_yhi', None)
+ self.reflection_model_zlo = kw.pop('warpx_reflection_model_zlo', None)
+ self.reflection_model_zhi = kw.pop('warpx_reflection_model_zhi', None)
+ # self.reflection_model_eb = kw.pop('warpx_reflection_model_eb', 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)
@@ -127,6 +136,16 @@ class Species(picmistandard.PICMI_Species):
save_particles_at_eb = self.save_particles_at_eb,
save_previous_position = self.save_previous_position,
do_not_deposit = self.do_not_deposit)
+
+ # add reflection models
+ self.species.add_new_attr("reflection_model_xlo(E)", self.reflection_model_xlo)
+ self.species.add_new_attr("reflection_model_xhi(E)", self.reflection_model_xhi)
+ self.species.add_new_attr("reflection_model_ylo(E)", self.reflection_model_ylo)
+ self.species.add_new_attr("reflection_model_yhi(E)", self.reflection_model_yhi)
+ self.species.add_new_attr("reflection_model_zlo(E)", self.reflection_model_zlo)
+ self.species.add_new_attr("reflection_model_zhi(E)", self.reflection_model_zhi)
+ # self.species.add_new_attr("reflection_model_eb(E)", self.reflection_model_eb)
+
pywarpx.Particles.particles_list.append(self.species)
if self.initial_distribution is not None: