|
8 | 8 | max_steps = 20
|
9 | 9 |
|
10 | 10 | # -----------------------------
|
11 |
| -# User-defined Constants (from my_constants) |
| 11 | +# User-defined Constants (from your inputs file) |
12 | 12 | # -----------------------------
|
13 | 13 | zc = 20.e-6
|
14 | 14 | zp = 20.05545177444479562e-6
|
|
24 | 24 | xmin, zmin = -100e-6, 0.0
|
25 | 25 | xmax, zmax = 100e-6, 100e-6
|
26 | 26 |
|
27 |
| -# Set moving_window_velocity so that the window moves along z |
| 27 | +# Use 'open' as boundary conditions since PICMI does not support 'pml' |
28 | 28 | grid = picmi.Cartesian2DGrid(
|
29 | 29 | number_of_cells=[nx, nz],
|
30 | 30 | lower_bound=[xmin, zmin],
|
|
33 | 33 | upper_boundary_conditions=['open', 'open'],
|
34 | 34 | warpx_max_grid_size=128,
|
35 | 35 | warpx_blocking_factor=32,
|
36 |
| - moving_window_velocity=[0.0, picmi.constants.c] # window moving along z |
| 36 | + # No moving window is specified |
37 | 37 | )
|
38 | 38 |
|
39 | 39 | # -----------------------------
|
|
50 | 50 | # electrons.zmin = zc - lgrad*log(400), zmax = 25.47931e-6
|
51 | 51 | zmin_e = zc - lgrad * math.log(400)
|
52 | 52 | zmax_e = 25.47931e-6
|
53 |
| -# For species initialization, supply 3-element bounds (x, dummy y, z) |
| 53 | +# PICMI requires 3-element bounds for species even in 2D (dummy y coordinate = 0) |
54 | 54 | electrons_distribution = picmi.UniformDistribution(
|
55 |
| - density=nc, |
| 55 | + density=nc, |
56 | 56 | lower_bound=[xmin, 0.0, zmin_e],
|
57 | 57 | upper_bound=[xmax, 0.0, zmax_e],
|
58 | 58 | fill_in=True,
|
|
84 | 84 | )
|
85 | 85 |
|
86 | 86 | # -----------------------------
|
87 |
| -# Laser Initialization (2D version) |
| 87 | +# Laser Initialization |
88 | 88 | # -----------------------------
|
89 |
| -# For a 2D simulation, define laser parameters with 2-element vectors (x,z) |
| 89 | +# Supply full 3-element vectors for laser parameters. |
90 | 90 | laser1 = picmi.GaussianLaser(
|
91 | 91 | wavelength=0.8e-6,
|
92 | 92 | waist=5e-6,
|
93 | 93 | duration=15e-15,
|
94 |
| - focal_position=[0.0, 15e-6 + 5e-6], # (x, z) |
95 |
| - centroid_position=[0.0, 5e-6 - picmi.constants.c * 25e-15], |
96 |
| - propagation_direction=[0, 1], # along z |
97 |
| - polarization_direction=[1, 0], # along x |
| 94 | + focal_position=[0.0, 0.0, 15e-6 + 5e-6], # [x, y, z] |
| 95 | + centroid_position=[0.0, 0.0, 5e-6 - picmi.constants.c * 25e-15], |
| 96 | + propagation_direction=[0, 0, 1], |
| 97 | + polarization_direction=[1, 0, 0], |
98 | 98 | E0=4.e12,
|
| 99 | + fill_in=False, # Disable continuous injection |
99 | 100 | )
|
100 | 101 | laser_antenna = picmi.LaserAntenna(
|
101 |
| - position=[0.0, 5e-6], |
102 |
| - normal_vector=[0, 1], |
| 102 | + position=[0.0, 0.0, 5e-6], |
| 103 | + normal_vector=[0, 0, 1], |
103 | 104 | )
|
104 | 105 |
|
105 | 106 | # -----------------------------
|
|
119 | 120 | solver=solver,
|
120 | 121 | max_steps=max_steps,
|
121 | 122 | verbose=1,
|
122 |
| - particle_shape="cubic", |
| 123 | + particle_shape="cubic", # corresponds to order 3 particle shape |
123 | 124 | warpx_use_filter=1,
|
124 | 125 | warpx_serialize_initial_conditions=1,
|
125 | 126 | )
|
126 | 127 |
|
127 |
| -# For species, use GriddedLayout with 2 macroparticles per cell (2D) |
| 128 | +# Use GriddedLayout with 2 macroparticles per cell (2D layout) |
128 | 129 | sim.add_species(
|
129 | 130 | electrons,
|
130 | 131 | layout=picmi.GriddedLayout(grid=grid, n_macroparticle_per_cell=[2, 2])
|
|
0 commit comments