Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Examples/Tests/plasma_lens/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ add_warpx_test(
OFF # dependency
)

add_warpx_test(
test_3d_plasma_lens_python # name
3 # dims
2 # nprocs
inputs_test_3d_plasma_lens_python.py # inputs
"analysis.py diags/diag1000084" # analysis
"analysis_default_regression.py --path diags/diag1000084" # checksum
OFF # dependency
)

add_warpx_test(
test_3d_plasma_lens_boosted # name
3 # dims
Expand Down
77 changes: 77 additions & 0 deletions Examples/Tests/plasma_lens/inputs_test_3d_plasma_lens_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from pywarpx import (
Bucket,
Diagnostics,
Particles,
algo,
amr,
boundary,
diagnostics,
geometry,
particles,
picmi,
warpx,
)

clight = picmi.constants.c
m_e = picmi.constants.m_e
q_e = picmi.constants.q_e

# Maximum number of time steps
max_step = 84

# number of grid points
amr.n_cell = 16, 16, 16

amr.max_level = 0

# Geometry
geometry.dims = "3"
geometry.prob_lo = -1.0, -1.0, 0.0 # physical domain
geometry.prob_hi = 1.0, 1.0, 2.0

boundary.field_lo = "pec", "pec", "pec"
boundary.field_hi = "pec", "pec", "pec"
boundary.particle_lo = "absorbing", "absorbing", "absorbing"
boundary.particle_hi = "absorbing", "absorbing", "absorbing"

# Algorithms
algo.particle_shape = 1
warpx.cfl = 0.7

vel_z = 0.5 * clight

# particles
particles.species_names = ("electrons",)

electrons = Particles.newspecies("electrons")
electrons.charge = -q_e
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be slightly different behavior since the -q_e will be evaluated in the input file rather than in the C++ parameter parsing. This could also be
electrons.charge = "-q_e"
which would be evaluated in C++.

electrons.mass = m_e
electrons.injection_style = "MultipleParticles"
electrons.multiple_particles_pos_x = 0.05, 0.0
electrons.multiple_particles_pos_y = 0.0, 0.04
electrons.multiple_particles_pos_z = 0.05, 0.05
electrons.multiple_particles_ux = 0.0, 0.0
electrons.multiple_particles_uy = 0.0, 0.0
electrons.multiple_particles_uz = vel_z / clight, vel_z / clight
electrons.multiple_particles_weight = 1.0, 1.0

particles.E_ext_particle_init_style = "repeated_plasma_lens"
particles.B_ext_particle_init_style = "repeated_plasma_lens"
particles.repeated_plasma_lens_period = 0.5
particles.repeated_plasma_lens_starts = 0.1, 0.11, 0.12, 0.13
particles.repeated_plasma_lens_lengths = 0.1, 0.11, 0.12, 0.13
particles.repeated_plasma_lens_strengths_E = 600000.0, 800000.0, 600000.0, 200000.0
particles.repeated_plasma_lens_strengths_B = 0.0, 0.0, 0.0, 0.0

# Diagnostics
diag1 = Diagnostics.Diagnostic("diag1", _species_dict={})
diagnostics._diagnostics_dict["diag1"] = diag1
diag1._electrons = Bucket.Bucket("diag1.electrons")
diag1._species_dict["electrons"] = diag1._electrons

diag1.intervals = 84
diag1.diag_type = "Full"
diag1._electrons.variables = "x", "y", "z", "ux", "uy", "uz"

warpx.init()
warpx.evolve(max_step)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"lev=0": {
"Bx": 3.742282884162779e-14,
"By": 3.7336535598484914e-14,
"Bz": 3.159003718717131e-16,
"Ex": 4.413173821920794e-06,
"Ey": 4.4408071078056295e-06,
"Ez": 8.994610614847082e-06,
"jx": 2.294712258053488e-10,
"jy": 1.8314117729146456e-10,
"jz": 2.1990787829488006e-08
},
"electrons": {
"particle_momentum_x": 7.424668342068345e-24,
"particle_momentum_y": 5.939638944348394e-24,
"particle_momentum_z": 2.730924534454989e-22,
"particle_position_x": 0.036083894319082634,
"particle_position_y": 0.028872102206249608,
"particle_position_z": 3.8947999633253403
}
}
Loading