diff options
author | 2022-04-06 09:25:50 -0700 | |
---|---|---|
committer | 2022-04-06 09:25:50 -0700 | |
commit | 5ea23bf77ad1f6e599769baf56b279c953cac01b (patch) | |
tree | c9421355368369221590bf48f30cf0ab856ea3ec /Python/pywarpx/picmi.py | |
parent | 4b3c619d81d6b8290c0b543a9b45f20e414823b9 (diff) | |
download | WarpX-5ea23bf77ad1f6e599769baf56b279c953cac01b.tar.gz WarpX-5ea23bf77ad1f6e599769baf56b279c953cac01b.tar.zst WarpX-5ea23bf77ad1f6e599769baf56b279c953cac01b.zip |
Added PlasmaLens class to PICMI (#3025)
* Added PlasmaLens class to PICMI
* Added CI test
* Added PICMI input file
* Fixed the output dir for the CI test
* Add `_plt` to Output File Prefix
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 71e1b7ca5..ae5fc8bd4 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -360,9 +360,9 @@ class ParticleListDistribution(picmistandard.PICMI_ParticleListDistribution): species.multiple_particles_pos_x = self.x species.multiple_particles_pos_y = self.y species.multiple_particles_pos_z = self.z - species.multiple_particles_vel_x = self.ux/constants.c - species.multiple_particles_vel_y = self.uy/constants.c - species.multiple_particles_vel_z = self.uz/constants.c + species.multiple_particles_vel_x = np.array(self.ux)/constants.c + species.multiple_particles_vel_y = np.array(self.uy)/constants.c + species.multiple_particles_vel_z = np.array(self.uz)/constants.c species.multiple_particles_weight = self.weight if density_scale is not None: species.multiple_particles_weight = self.weight*density_scale @@ -953,6 +953,38 @@ class EmbeddedBoundary(picmistandard.base._ClassWithInit): pywarpx.warpx.__setattr__('eb_potential(x,y,z,t)', expression) +class PlasmaLens(picmistandard.base._ClassWithInit): + """ + Custom class to setup a plasma lens lattice. + The applied fields are dependent on the transverse position + - Ex = x*stengths_E + - Ey = y*stengths_E + - Bx = +y*stengths_B + - By = -x*stengths_B + """ + def __init__(self, period, starts, lengths, strengths_E=None, strengths_B=None, **kw): + self.period = period + self.starts = starts + self.lengths = lengths + self.strengths_E = strengths_E + self.strengths_B = strengths_B + + assert (self.strengths_E is not None) or (self.strengths_B is not None),\ + Exception('One of strengths_E or strengths_B must be supplied') + + self.handle_init(kw) + + def initialize_inputs(self): + + pywarpx.particles.E_ext_particle_init_style = 'repeated_plasma_lens' + pywarpx.particles.B_ext_particle_init_style = 'repeated_plasma_lens' + pywarpx.particles.repeated_plasma_lens_period = self.period + pywarpx.particles.repeated_plasma_lens_starts = self.starts + pywarpx.particles.repeated_plasma_lens_lengths = self.lengths + pywarpx.particles.repeated_plasma_lens_strengths_E = self.strengths_E + pywarpx.particles.repeated_plasma_lens_strengths_B = self.strengths_B + + class Simulation(picmistandard.PICMI_Simulation): # Set the C++ WarpX interface (see _libwarpx.LibWarpX) as an extension to |