diff options
author | 2018-09-27 18:44:21 -0700 | |
---|---|---|
committer | 2018-09-27 18:44:21 -0700 | |
commit | 9f0f6ff5664b8106fdfff4db0d994757aa7e3c75 (patch) | |
tree | 6a701e20857430fda2c0220476a68a9d0b20579b | |
parent | dd9caf2503759fb26548802778afdb2f45a896c9 (diff) | |
download | WarpX-9f0f6ff5664b8106fdfff4db0d994757aa7e3c75.tar.gz WarpX-9f0f6ff5664b8106fdfff4db0d994757aa7e3c75.tar.zst WarpX-9f0f6ff5664b8106fdfff4db0d994757aa7e3c75.zip |
Reorganized.
-rw-r--r-- | Example/laser_acceleration/laser_acceleration_PICMI.py | 115 |
1 files changed, 82 insertions, 33 deletions
diff --git a/Example/laser_acceleration/laser_acceleration_PICMI.py b/Example/laser_acceleration/laser_acceleration_PICMI.py index 6217d4a03..ae7349636 100644 --- a/Example/laser_acceleration/laser_acceleration_PICMI.py +++ b/Example/laser_acceleration/laser_acceleration_PICMI.py @@ -2,23 +2,86 @@ import numpy as np from pywarpx import picmi #from warp import picmi +########################## +# physics parameters +########################## + +# --- laser + +laser_a0 = 4. # Normalized potential vector +laser_wavelength = 8e-07 # Wavelength of the laser (in meters) +laser_waist = 5e-06 # Waist of the laser (in meters) +laser_duration = 15e-15 # Duration of the laser (in seconds) +laser_polarization = np.pi/2. # Polarization angle (in rad) +laser_injection_loc = 9.e-6 # Position of injection (in meters, along z) +laser_focal_distance = 100.e-6 # Focal distance from the injection (in meters) +laser_t_peak = 30.e-15 # The time at which the laser reaches its peak + # at the antenna injection location (in seconds) +# --- plasma + +plasma_density = 1.e24 +plasma_min = [-20.e-6, -20.e-6, 0.0e-6] +plasma_max = [ 20.e-6, 20.e-6, 1.e-3] + + +########################## +# numerics parameters +########################## + +# --- Nb time steps + +max_steps = 1000 + +# --- grid + nx = 64 ny = 64 nz = 480 -xmin = -30.e-6 -xmax = +30.e-6 -ymin = -30.e-6 -ymax = +30.e-6 +xmin = 1.5*plasma_min[0] +xmax = 1.5*plasma_max[0] +ymin = 1.5*plasma_min[1] +ymax = 1.5*plasma_max[1] zmin = -56.e-6 -zmax = +12.e-6 +zmax = 12.e-6 moving_window_velocity = [0., 0., picmi.c] -injected_plasma_density = 1.e23 number_per_cell_each_dim = [2, 2, 1] -plasma_min = [-20.e-6, -20.e-6, 0.0e-6] -plasma_max = [ 20.e-6, 20.e-6, zmax] + +########################## +# physics components +########################## + +# --- laser + +laser = picmi.GaussianLaser(wavelength = laser_wavelength, + waist = laser_waist, + duration = laser_duration, + focal_position = [0., 0., laser_focal_distance + laser_injection_loc], + centroid_position = [0., 0., laser_injection_loc - picmi.c*laser_t_peak], + polarization_angle = laser_polarization, + propagation_direction = [0,0,1], + E0 = laser_a0*2.*np.pi*picmi.m_e*picmi.c**2/(picmi.q_e*laser_wavelength)) # Maximum amplitude of the laser field (in V/m) + +laser_antenna = picmi.LaserAntenna(position = [0., 0., laser_injection_loc], # This point is on the laser plane + normal_vector = [0., 0., 1.]) # The plane normal direction + +# --- plasma + +uniform_plasma = picmi.UniformDistribution(density = plasma_density, + lower_bound = plasma_min, + upper_bound = plasma_max, + fill_in = True) + +electrons = picmi.Species(particle_type = 'electron', + name = 'electrons', + initial_distribution = uniform_plasma) + + +########################## +# numerics components +########################## grid = picmi.Cartesian3DGrid(number_of_cells = [nx, ny, nz], lower_bound = [xmin, ymin, zmin], @@ -28,34 +91,15 @@ grid = picmi.Cartesian3DGrid(number_of_cells = [nx, ny, nz], moving_window_velocity = moving_window_velocity, warpx_max_grid_size=32, warpx_coord_sys=0) -solver = picmi.ElectromagneticSolver(grid=grid, cfl=1.) - -t_peak = 30.e-15 # The time at which the laser reaches its peak at the antenna (in seconds) -focal_distance = 100.e-6 # Focal distance from the antenna (in meters) -antenna_z0 = 9.e-6 # This point is on the laser plane -laser = picmi.GaussianLaser(wavelength = 0.8e-6, # The wavelength of the laser (in meters) - waist = 5.e-6, # The waist of the laser (in meters) - duration = 15.e-15, # The duration of the laser (in seconds) - polarization_angle = np.pi/2., # The main polarization vector - focal_position = [0., 0., focal_distance + antenna_z0], # Focal position (m) - E0 = 16.e12, # Maximum amplitude of the laser field (in V/m) - centroid_position = [0., 0., antenna_z0 - picmi.c*t_peak], # Position of the laser centroid in Z at time 0 - propagation_direction = [0,0,1]) - -laser_antenna = picmi.LaserAntenna(position = [0., 0., antenna_z0], # This point is on the laser plane - normal_vector = [0., 0., 1.]) # The plane normal direction +solver = picmi.ElectromagneticSolver(grid=grid, method='CKC', cfl=1.) -uniform_plasma = picmi.UniformDistribution(density = injected_plasma_density, - lower_bound = plasma_min, - upper_bound = plasma_max, - fill_in = True) -electrons = picmi.Species(particle_type = 'electron', - name = 'electrons', - initial_distribution = uniform_plasma) +########################## +# simulations setup +########################## sim = picmi.Simulation(solver = solver, - max_steps = 1000, + max_steps = max_steps, verbose = 1, cfl = 1.0, warpx_plot_int = 100, @@ -68,10 +112,15 @@ sim.add_species(electrons, layout=picmi.GriddedLayout(grid=grid, n_macroparticle sim.add_laser(laser, injection_method=laser_antenna) + +########################## +# simulation run +########################## + # write_inputs will create an inputs file that can be used to run # with the compiled version. sim.write_input_file(file_name = 'inputs_from_PICMI') # Alternatively, sim.step will run WarpX, controlling it from Python -#sim.step() +sim.step(max_steps) |