Skip to content

Commit 607e17a

Browse files
authored
Add class for field ionization (#75)
* Add class for field ionization * Make interactions more generic * Update init file * Use numpy style formatting in docstring
1 parent 38a67b6 commit 607e17a

File tree

5 files changed

+50
-9
lines changed

5 files changed

+50
-9
lines changed

Examples/laser_acceleration/laser_acceleration_PICMI.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@
103103
# Set the ionization for the species number 1 (Argon)
104104
# and place the created electrons into the species number 2 (electron)
105105
if picmi.codename != 'warpx':
106-
plasma['Argon'].activate_field_ionization(
107-
model = "ADK", # Ammosov-Delone-Krainov model
108-
product_species = plasma['e-'])
106+
argon_ionization = picmi.FieldIonization(
107+
model = "ADK", # Ammosov-Delone-Krainov model
108+
ionized_species = plasma['Argon'],
109+
product_species = plasma['e-'])
109110

110111
# --- electron bunch
111112
beam_dist = picmi.GaussianBunchDistribution(
@@ -191,6 +192,9 @@
191192
sim.add_species(species=beam, layout=beam_layout,
192193
initialize_self_field=initialize_self_field)
193194

195+
if picmi.codename != 'warpx':
196+
sim.add_interaction(argon_ionization)
197+
194198
# Add the diagnostics
195199
sim.add_diagnostic(field_diag)
196200
sim.add_diagnostic(part_diag)

PICMI_Python/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from .diagnostics import *
33
from .fields import *
44
from .applied_fields import *
5+
from .interactions import *
56
from .lasers import *
67
from .particles import *
78
from .simulation import *

PICMI_Python/interactions.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"""Classes following the PICMI standard
2+
These should be the base classes for Python implementation of the PICMI standard
3+
The classes in this file are related to interactions (e.g. field ionization, collisions, QED)
4+
"""
5+
6+
from .base import _ClassWithInit
7+
8+
class PICMI_FieldIonization(_ClassWithInit):
9+
"""
10+
Field ionization on an ion species
11+
12+
Parameters
13+
----------
14+
model: string
15+
Ionization model, e.g. "ADK"
16+
17+
ionized_species: species instance
18+
Species that is ionized
19+
20+
product_species: species instance
21+
Species in which ionized electrons are stored.
22+
"""
23+
def __init__(self, model, ionized_species, product_species, **kw):
24+
self.model = model
25+
self.ionized_species = ionized_species
26+
self.product_species = product_species
27+
28+
self.handle_init(kw)
29+

PICMI_Python/particles.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ def __init__(self, particle_type=None, name=None, charge_state=None, charge=None
8484

8585
self.handle_init(kw)
8686

87-
def activate_field_ionization(self, model, product_species):
88-
# --- TODO: One way of handling interactions is to add a class for each type
89-
# --- of interaction. Instances would be added to the interactions list
90-
# --- instead of the list of parameters.
91-
self.interactions.append(['ionization', model, product_species])
92-
9387

9488
class PICMI_MultiSpecies(_ClassWithInit):
9589
"""

PICMI_Python/simulation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def __init__(self, solver=None, time_step_size=None, max_steps=None, max_time=No
6767

6868
self.diagnostics = []
6969

70+
self.interactions = []
71+
7072
self.cpu_split = cpu_split
7173
self.load_balancing = load_balancing
7274

@@ -177,6 +179,17 @@ def add_diagnostic(self, diagnostic):
177179
"""
178180
self.diagnostics.append(diagnostic)
179181

182+
def add_interaction(self, interaction):
183+
"""
184+
Add an interaction
185+
186+
Parameters
187+
----------
188+
interaction: interaction instance
189+
One of the interaction objects.
190+
"""
191+
self.interactions.append(interaction)
192+
180193
def set_max_step(self, max_steps):
181194
"""
182195
Set the default number of steps for the simulation (i.e. the number

0 commit comments

Comments
 (0)