Skip to content

Commit

Permalink
Add class for field ionization (#75)
Browse files Browse the repository at this point in the history
* Add class for field ionization

* Make interactions more generic

* Update init file

* Use numpy style formatting in docstring
  • Loading branch information
NeilZaim authored Oct 21, 2022
1 parent 38a67b6 commit 607e17a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 9 deletions.
10 changes: 7 additions & 3 deletions Examples/laser_acceleration/laser_acceleration_PICMI.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@
# Set the ionization for the species number 1 (Argon)
# and place the created electrons into the species number 2 (electron)
if picmi.codename != 'warpx':
plasma['Argon'].activate_field_ionization(
model = "ADK", # Ammosov-Delone-Krainov model
product_species = plasma['e-'])
argon_ionization = picmi.FieldIonization(
model = "ADK", # Ammosov-Delone-Krainov model
ionized_species = plasma['Argon'],
product_species = plasma['e-'])

# --- electron bunch
beam_dist = picmi.GaussianBunchDistribution(
Expand Down Expand Up @@ -191,6 +192,9 @@
sim.add_species(species=beam, layout=beam_layout,
initialize_self_field=initialize_self_field)

if picmi.codename != 'warpx':
sim.add_interaction(argon_ionization)

# Add the diagnostics
sim.add_diagnostic(field_diag)
sim.add_diagnostic(part_diag)
Expand Down
1 change: 1 addition & 0 deletions PICMI_Python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .diagnostics import *
from .fields import *
from .applied_fields import *
from .interactions import *
from .lasers import *
from .particles import *
from .simulation import *
29 changes: 29 additions & 0 deletions PICMI_Python/interactions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Classes following the PICMI standard
These should be the base classes for Python implementation of the PICMI standard
The classes in this file are related to interactions (e.g. field ionization, collisions, QED)
"""

from .base import _ClassWithInit

class PICMI_FieldIonization(_ClassWithInit):
"""
Field ionization on an ion species
Parameters
----------
model: string
Ionization model, e.g. "ADK"
ionized_species: species instance
Species that is ionized
product_species: species instance
Species in which ionized electrons are stored.
"""
def __init__(self, model, ionized_species, product_species, **kw):
self.model = model
self.ionized_species = ionized_species
self.product_species = product_species

self.handle_init(kw)

6 changes: 0 additions & 6 deletions PICMI_Python/particles.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ def __init__(self, particle_type=None, name=None, charge_state=None, charge=None

self.handle_init(kw)

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


class PICMI_MultiSpecies(_ClassWithInit):
"""
Expand Down
13 changes: 13 additions & 0 deletions PICMI_Python/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def __init__(self, solver=None, time_step_size=None, max_steps=None, max_time=No

self.diagnostics = []

self.interactions = []

self.cpu_split = cpu_split
self.load_balancing = load_balancing

Expand Down Expand Up @@ -177,6 +179,17 @@ def add_diagnostic(self, diagnostic):
"""
self.diagnostics.append(diagnostic)

def add_interaction(self, interaction):
"""
Add an interaction
Parameters
----------
interaction: interaction instance
One of the interaction objects.
"""
self.interactions.append(interaction)

def set_max_step(self, max_steps):
"""
Set the default number of steps for the simulation (i.e. the number
Expand Down

0 comments on commit 607e17a

Please sign in to comment.