diff options
author | 2020-05-05 12:56:06 -0700 | |
---|---|---|
committer | 2020-05-05 12:56:06 -0700 | |
commit | 4f8be8496923ace8c94bfb6cd9a926b95e8b41bc (patch) | |
tree | 056f993515fa29ad382acc8ef2d98ebc7a217763 /Python/pywarpx/picmi.py | |
parent | b33b550bc60b0f75f65a81a3fe9267363dc9f3e6 (diff) | |
download | WarpX-4f8be8496923ace8c94bfb6cd9a926b95e8b41bc.tar.gz WarpX-4f8be8496923ace8c94bfb6cd9a926b95e8b41bc.tar.zst WarpX-4f8be8496923ace8c94bfb6cd9a926b95e8b41bc.zip |
PICMI: Add analytic laser (#800)
* In PICMI, added AnalyticLaser
* Bug fixes for PICMI AnalyticLaser
* In PICMI, use laser's name input option
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 86ffad728..ef5e810d7 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -476,7 +476,8 @@ class ElectrostaticSolver(picmistandard.PICMI_ElectrostaticSolver): class GaussianLaser(picmistandard.PICMI_GaussianLaser): def initialize_inputs(self): self.laser_number = pywarpx.lasers.nlasers + 1 - self.name = 'laser{}'.format(self.laser_number) + if self.name is None: + self.name = 'laser{}'.format(self.laser_number) self.laser = pywarpx.Lasers.newlaser(self.name) @@ -491,12 +492,31 @@ class GaussianLaser(picmistandard.PICMI_GaussianLaser): self.laser.phi2 = self.phi2 +class AnalyticLaser(picmistandard.PICMI_AnalyticLaser): + def initialize_inputs(self): + self.laser_number = pywarpx.lasers.nlasers + 1 + if self.name is None: + self.name = 'laser{}'.format(self.laser_number) + + self.laser = pywarpx.Lasers.newlaser(self.name) + + self.laser.profile = "parse_field_function" + self.laser.wavelength = self.wavelength # The wavelength of the laser (in meters) + self.laser.e_max = self.Emax # Maximum amplitude of the laser field (in V/m) + self.laser.polarization = self.polarization_direction # The main polarization vector + self.laser.__setattr__('field_function(X,Y,t)', self.field_expression) + + for k,v in self.user_defined_kw.items(): + setattr(pywarpx.my_constants, k, v) + + class LaserAntenna(picmistandard.PICMI_LaserAntenna): def initialize_inputs(self, laser): laser.laser.position = self.position # This point is on the laser plane laser.laser.direction = self.normal_vector # The plane normal direction - laser.laser.profile_focal_distance = laser.focal_position[2] - self.position[2] # Focal distance from the antenna (in meters) - laser.laser.profile_t_peak = (self.position[2] - laser.centroid_position[2])/constants.c # The time at which the laser reaches its peak (in seconds) + if isinstance(laser, GaussianLaser): + laser.laser.profile_focal_distance = laser.focal_position[2] - self.position[2] # Focal distance from the antenna (in meters) + laser.laser.profile_t_peak = (self.position[2] - laser.centroid_position[2])/constants.c # The time at which the laser reaches its peak (in seconds) class Simulation(picmistandard.PICMI_Simulation): |