Skip to content

Commit

Permalink
Merge pull request #2 from GianlucaOberreit/mironov_templatization_pr…
Browse files Browse the repository at this point in the history
…ivate

Fix BSI + add tests
  • Loading branch information
GianlucaOberreit authored Jan 27, 2025
2 parents 4253299 + 3496d62 commit 556eb3f
Show file tree
Hide file tree
Showing 95 changed files with 3,181 additions and 1,800 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ exec_script.sh.*
.DS_Store
tables/*
*.stats*
.venv*
2 changes: 1 addition & 1 deletion benchmarks/collisions/ionization_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

timestep2 = int(np.double(S2.namelist.Main.timestep))
D += [
S2.ParticleBinning(0,sum={"ekin":[0,1]}, linestyle="", marker=".", color=color )
S2.ParticleBinning(0,sum={"ekin":[0,1]}, linestyle="", marker=".", color=color, label=elm )
]


Expand Down
115 changes: 115 additions & 0 deletions benchmarks/tst1d_25_bsi_ionisation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# ----------------------------------------------------------------------------------------
# SIMULATION PARAMETERS FOR THE PIC-CODE SMILEI
# ----------------------------------------------------------------------------------------

import math

l0 = 2.0 * math.pi # wavelength in normalized units
t0 = l0 # optical cycle in normalized units
rest = 6000.0 # nb of timestep in 1 optical cycle
resx = 4000.0 # nb cells in 1 wavelength
Lsim = 0.01 * l0 # simulation length
Tsim = 0.2 * t0 # duration of the simulation


Main(
geometry="1Dcartesian",
interpolation_order=2,
cell_length=[l0 / resx],
grid_length=[Lsim],
number_of_patches=[4],
timestep=t0 / rest,
simulation_time=Tsim,
EM_boundary_conditions=[["silver-muller"]],
reference_angular_frequency_SI=6 * math.pi * 1e14,
)

Species(
name="hydrogen",
ionization_model="barrier_suppression",
ionization_electrons="electron",
atomic_number=1,
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=40,
mass=1836.0 * 1000.0,
charge=0.0,
number_density=0.1,
boundary_conditions=[
["remove", "remove"],
],
)

Species(
name="carbon",
ionization_model="barrier_suppression",
ionization_electrons="electron",
atomic_number=6,
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=40,
mass=1836.0 * 1000.0,
charge=0.0,
number_density=0.1,
boundary_conditions=[
["remove", "remove"],
],
)

Species(
name="electron",
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=0,
mass=1.0,
charge=-1.0,
charge_density=0.0,
boundary_conditions=[
["remove", "remove"],
],
keep_interpolated_fields=["Ex", "Ey", "Ez", "Wx", "Wy", "Wz"],
)


def By(t):
return 1e-7 * math.sin(t)


def Bz(t):
return 0.1 * math.sin(t)


Laser(
box_side="xmin",
space_time_profile=[By, Bz],
)

DiagScalar(every=20)

DiagFields(every=20, time_average=1, fields=["Ex", "Ey", "Ez"])

DiagParticleBinning(
deposited_quantity="weight",
every=20,
species=["hydrogen"],
axes=[["charge", -0.5, 1.5, 2]],
)

DiagParticleBinning(
deposited_quantity="weight",
every=20,
species=["carbon"],
axes=[["charge", -0.5, 6.5, 7]],
)

DiagTrackParticles(
species="electron",
every=[1, 1000, 30],
attributes=["x", "px", "py", "pz", "w", "Wy"],
)

DiagNewParticles(
species="electron",
every=100,
attributes=["x", "py", "w", "q"],
)
115 changes: 115 additions & 0 deletions benchmarks/tst1d_26_TL_ionisation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# ----------------------------------------------------------------------------------------
# SIMULATION PARAMETERS FOR THE PIC-CODE SMILEI
# ----------------------------------------------------------------------------------------

import math

l0 = 2.0 * math.pi # wavelength in normalized units
t0 = l0 # optical cycle in normalized units
rest = 6000.0 # nb of timestep in 1 optical cycle
resx = 4000.0 # nb cells in 1 wavelength
Lsim = 0.01 * l0 # simulation length
Tsim = 0.2 * t0 # duration of the simulation


Main(
geometry="1Dcartesian",
interpolation_order=2,
cell_length=[l0 / resx],
grid_length=[Lsim],
number_of_patches=[4],
timestep=t0 / rest,
simulation_time=Tsim,
EM_boundary_conditions=[["silver-muller"]],
reference_angular_frequency_SI=6 * math.pi * 1e14,
)

Species(
name="hydrogen",
ionization_model="Tong_Lin",
ionization_electrons="electron",
atomic_number=1,
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=40,
mass=1836.0 * 1000.0,
charge=0.0,
number_density=0.1,
boundary_conditions=[
["remove", "remove"],
],
)

Species(
name="carbon",
ionization_model="Tong_Lin",
ionization_electrons="electron",
atomic_number=6,
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=40,
mass=1836.0 * 1000.0,
charge=0.0,
number_density=0.1,
boundary_conditions=[
["remove", "remove"],
],
)

Species(
name="electron",
position_initialization="regular",
momentum_initialization="cold",
particles_per_cell=0,
mass=1.0,
charge=-1.0,
charge_density=0.0,
boundary_conditions=[
["remove", "remove"],
],
keep_interpolated_fields=["Ex", "Ey", "Ez", "Wx", "Wy", "Wz"],
)


def By(t):
return 1e-7 * math.sin(t)


def Bz(t):
return 0.1 * math.sin(t)


Laser(
box_side="xmin",
space_time_profile=[By, Bz],
)

DiagScalar(every=20)

DiagFields(every=20, time_average=1, fields=["Ex", "Ey", "Ez"])

DiagParticleBinning(
deposited_quantity="weight",
every=20,
species=["hydrogen"],
axes=[["charge", -0.5, 1.5, 2]],
)

DiagParticleBinning(
deposited_quantity="weight",
every=20,
species=["carbon"],
axes=[["charge", -0.5, 6.5, 7]],
)

DiagTrackParticles(
species="electron",
every=[1, 1000, 30],
attributes=["x", "px", "py", "pz", "w", "Wy"],
)

DiagNewParticles(
species="electron",
every=100,
attributes=["x", "py", "w", "q"],
)
125 changes: 125 additions & 0 deletions benchmarks/tst1d_27_fullPPT_ionisation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# ----------------------------------------------------------------------------------------
# SIMULATION PARAMETERS FOR THE PIC-CODE SMILEI
# ----------------------------------------------------------------------------------------

import math
l0 = 2.0*math.pi # wavelength in normalized units
t0 = l0 # optical cycle in normalized units
rest = 6000.0 # nb of timestep in 1 optical cycle
resx = 4000.0 # nb cells in 1 wavelength
Lsim = 0.01*l0 # simulation length
Tsim = 0.2*t0 # duration of the simulation


Main(
geometry = "1Dcartesian",

interpolation_order = 2,

cell_length = [l0/resx],
grid_length = [Lsim],

number_of_patches = [ 4 ],

timestep = t0/rest,
simulation_time = Tsim,

EM_boundary_conditions = [ ['silver-muller'] ],

reference_angular_frequency_SI = 6*math.pi*1e14,

)

Species(
name = 'hydrogen',
ionization_model = 'tunnel_full_PPT',
ionization_electrons = 'electron',
atomic_number = 1,
position_initialization = 'regular',
momentum_initialization = 'cold',
particles_per_cell = 40,
mass = 1836.0*1000.,
charge = 0.0,
number_density = 0.1,
boundary_conditions = [
["remove", "remove"],
],
)

Species(
name = 'carbon',
ionization_model = 'tunnel_full_PPT',
ionization_electrons = 'electron',
atomic_number = 6,
position_initialization = 'regular',
momentum_initialization = 'cold',
particles_per_cell = 40,
mass = 1836.0*1000.,
charge = 0.0,
number_density = 0.1,
boundary_conditions = [
["remove", "remove"],
],
)

Species(
name = 'electron',
position_initialization = 'regular',
momentum_initialization = 'cold',
particles_per_cell = 0,
mass = 1.0,
charge = -1.0,
charge_density = 0.0,
boundary_conditions = [
["remove", "remove"],
],
keep_interpolated_fields = ["Ex", "Ey", "Ez", "Wx", "Wy", "Wz"],
)

def By(t):
return 1e-7 * math.sin(t)
def Bz(t):
return 0.1 * math.sin(t)

Laser(
box_side = "xmin",
space_time_profile = [By, Bz],
)

DiagScalar(every = 20)

DiagFields(
every = 20,
time_average = 1,
fields = ["Ex", "Ey", "Ez"]
)

DiagParticleBinning(
deposited_quantity = "weight",
every = 20,
species = ["hydrogen"],
axes = [
["charge", -0.5, 1.5, 2]
]
)

DiagParticleBinning(
deposited_quantity = "weight",
every = 20,
species = ["carbon"],
axes = [
["charge", -0.5, 6.5, 7]
]
)

DiagTrackParticles(
species = "electron",
every = [1,1000,30],
attributes = ["x","px","py","pz","w","Wy"]
)

DiagNewParticles(
species = "electron",
every = 100,
attributes = ["x","py","w","q"],
)
Loading

0 comments on commit 556eb3f

Please sign in to comment.