Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
m: int, optional
The mode on which to imprint the profile
For m = 0 : gaussian profile, linearly polarized beam
For m = 1 : annular profile
"""
# Initialize the fields
tau = ctau/c
lambda0 = 2*np.pi/k0
# Create the relevant laser profile
if m == 0:
profile = GaussianLaser( a0=a0, waist=w, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
elif m == 1:
profile = LaguerreGaussLaser( 0, 1, a0=a0, waist=w, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
elif m == -1:
profile = DonutLikeLaguerreGaussLaser( 0, -1, a0=a0/2**.5,
waist=w, tau=tau, lambda0=lambda0, z0=z0, zf=zf )
# Add the profiles to the simulation
add_laser_pulse( sim, profile, method = 'direct_envelope' )
The initial a0 of the pulse
m: int, optional
The mode on which to imprint the profile
"""
# Initialize the fields
tau = ctau/c
lambda0 = 2*np.pi/k0
# Create the relevant laser profile
if m == 0:
profile = GaussianLaser( a0=a0, waist=w0, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
elif m == 1:
# Put the peak of the Laguerre-Gauss at pi/4 to check that the
# angular dependency is correctly captured
profile = LaguerreGaussLaser( 0, 1, a0, w0, tau,
z0, lambda0=lambda0, zf=zf, theta0=np.pi/4 )
# Add the profiles to the simulation
add_laser_pulse( sim, profile, method = 'direct_envelope' )
m: int, optional
The mode on which to imprint the profile
For m = 0 : gaussian profile, linearly polarized beam
For m = 1 : annular profile
"""
# Initialize the fields
tau = ctau/c
lambda0 = 2*np.pi/k0
# Create the relevant laser profile
if m == 0:
profile = GaussianLaser( a0=a0, waist=w0, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
elif m == 1:
profile = LaguerreGaussLaser( 0, 1, a0, w0, tau,
z0, lambda0=lambda0, zf=zf )
# Add the profiles to the simulation
add_laser_pulse( sim, profile, method = 'direct_envelope' )
Whether to have pop-up windows show the comparison between
analytical and simulated results
"""
# Automatically choose higher number of macroparticles along theta
p_nt = 2*Nm
# Initialize the simulation object
sim = Simulation( Nz, zmax, Nr, rmax, Nm, dt,
p_zmin, p_zmax, p_rmin, p_rmax, p_nz, p_nr, p_nt, n_e,
use_cuda=use_cuda, boundaries='open' )
# Create the relevant laser profile
if Nm == 1:
# Build an azimuthally-polarized pulse from 2 Laguerre-Gauss profiles
profile = LaguerreGaussLaser( 0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2, theta0=0. ) \
+ LaguerreGaussLaser( 0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=0., theta0=-np.pi/2 )
elif Nm == 2:
profile = GaussianLaser(a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2 )
elif Nm == 3:
profile = LaguerreGaussLaser(0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2 )
add_laser_pulse( sim, profile )
# Configure the moving window
sim.set_moving_window( v=c )
# Add diagnostics
if write_fields:
sim.diags.append( FieldDiagnostic(diag_period, sim.fld, sim.comm ) )
if write_particles:
m: int, optional
The mode on which to imprint the profile
For m = 1 : gaussian profile, linearly polarized beam
For m = 0 : annular profile, polarized in E_theta
"""
# Initialize the fields
a0 = E0*e/(m_e*c**2*k0)
tau = ctau/c
lambda0 = 2*np.pi/k0
# Create the relevant laser profile
if m == 0:
# Build a radially-polarized pulse from 2 Laguerre-Gauss profiles
profile = LaguerreGaussLaser( 0, 1, 0.5*a0, w, tau, z0, zf=zf,
lambda0=lambda0, theta_pol=0., theta0=0. ) \
+ LaguerreGaussLaser( 0, 1, 0.5*a0, w, tau, z0, zf=zf,
lambda0=lambda0, theta_pol=np.pi/2, theta0=np.pi/2 )
elif m == 1:
profile = GaussianLaser( a0=a0, waist=w, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
elif m == 2:
profile = LaguerreGaussLaser( 0, 1, a0=a0, waist=w, tau=tau,
lambda0=lambda0, z0=z0, zf=zf )
# Add the profiles to the simulation
add_laser_pulse( sim, profile )
"""
# Automatically choose higher number of macroparticles along theta
p_nt = 2*Nm
# Initialize the simulation object
sim = Simulation( Nz, zmax, Nr, rmax, Nm, dt,
p_zmin, p_zmax, p_rmin, p_rmax, p_nz, p_nr, p_nt, n_e,
use_cuda=use_cuda, boundaries='open', use_envelope=True,
v_comoving=0.99*c, use_galilean=True,
initialize_ions=True)
# Create the relevant laser profile
if Nm == 1:
profile = GaussianLaser(a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2 )
elif Nm == 3:
profile = LaguerreGaussLaser(0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2)
add_laser_pulse( sim, profile, method = 'direct_envelope' )
# Configure the moving window
sim.set_moving_window( v=c )
# Add diagnostics
if write_fields:
sim.diags.append( FieldDiagnostic(diag_period, sim.fld, sim.comm,
fieldtypes=["rho", "E", "B", "J","a"]) )
if write_particles:
sim.diags.append( ParticleDiagnostic(diag_period,
{'electrons': sim.ptcl[0]}, sim.comm ) )
# Prevent current correction for MPI simulation
if sim.comm.size > 1:
sim = Simulation( Nz, zmax, Nr, rmax, Nm, dt,
p_zmin, p_zmax, p_rmin, p_rmax, p_nz, p_nr, p_nt, n_e,
use_cuda=use_cuda, boundaries='open' )
# Create the relevant laser profile
if Nm == 1:
# Build an azimuthally-polarized pulse from 2 Laguerre-Gauss profiles
profile = LaguerreGaussLaser( 0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2, theta0=0. ) \
+ LaguerreGaussLaser( 0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=0., theta0=-np.pi/2 )
elif Nm == 2:
profile = GaussianLaser(a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2 )
elif Nm == 3:
profile = LaguerreGaussLaser(0, 1, a0=a0, waist=w0, tau=tau, z0=z0,
theta_pol=np.pi/2 )
add_laser_pulse( sim, profile )
# Configure the moving window
sim.set_moving_window( v=c )
# Add diagnostics
if write_fields:
sim.diags.append( FieldDiagnostic(diag_period, sim.fld, sim.comm ) )
if write_particles:
sim.diags.append( ParticleDiagnostic(diag_period,
{'electrons': sim.ptcl[0]}, sim.comm ) )
# Prevent current correction for MPI simulation
if sim.comm.size > 1:
correct_currents=False