Skip to content

Commit 9fac196

Browse files
authored
Add flux injection (#83)
* Add flux injection * Update PICMI_Python/particles.py
1 parent b840e21 commit 9fac196

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

PICMI_Python/particles.py

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PICMI_Species(_ClassWithInit):
3434
dependent.
3535
3636
- 'Boris': Standard "leap-frog" Boris advance
37-
- 'Vay':
37+
- 'Vay':
3838
- 'Higuera-Cary':
3939
- 'Li' :
4040
- 'free-streaming': Advance with no fields
@@ -68,9 +68,9 @@ def __init__(self, particle_type=None, name=None, charge_state=None, charge=None
6868

6969

7070
assert method is None or method in PICMI_Species.methods_list or method.startswith('other:'), \
71-
Exception('method must starts with either "other:", or be one of the following '+', '.join(PICMI_Species.methods_list))
71+
Exception('method must starts with either "other:", or be one of the following '+', '.join(PICMI_Species.methods_list))
7272

73-
self.method = method
73+
self.method = method
7474
self.particle_type = particle_type
7575
self.name = name
7676
self.charge = charge
@@ -282,6 +282,56 @@ def __init__(self, density,
282282
self.handle_init(kw)
283283

284284

285+
class PICMI_UniformFluxDistribution(_ClassWithInit):
286+
"""
287+
Describes a flux of particles emitted from a plane
288+
289+
Parameters
290+
----------
291+
flux: float
292+
Flux of particles [m^-2.s^-1]
293+
294+
flux_normal_axis: string
295+
x, y, or z for 3D, x or z for 2D, or r, t, or z in RZ geometry
296+
297+
surface_flux_position: double
298+
location of the injection plane [m] along the direction
299+
specified by `flux_normal_axis`
300+
301+
flux_direction: int
302+
Direction of the flux relative to the plane: -1 or +1
303+
304+
lower_bound: vector of floats, optional
305+
Lower bound of the distribution [m]
306+
307+
upper_bound: vector of floats, optional
308+
Upper bound of the distribution [m]
309+
310+
rms_velocity: vector of floats, default=[0.,0.,0.]
311+
Thermal velocity spread [m/s]
312+
313+
directed_velocity: vector of floats, default=[0.,0.,0.]
314+
Directed, average, velocity [m/s]
315+
"""
316+
317+
def __init__(self, flux, flux_normal_axis,
318+
surface_flux_position, flux_direction,
319+
lower_bound = [None,None,None],
320+
upper_bound = [None,None,None],
321+
rms_velocity = [0.,0.,0.],
322+
directed_velocity = [0.,0.,0.],
323+
**kw):
324+
self.flux = flux
325+
self.flux_normal_axis = flux_normal_axis
326+
self.surface_flux_position = surface_flux_position
327+
self.flux_direction = flux_direction
328+
self.lower_bound = lower_bound
329+
self.upper_bound = upper_bound
330+
self.rms_velocity = rms_velocity
331+
self.directed_velocity = directed_velocity
332+
333+
self.handle_init(kw)
334+
285335
class PICMI_AnalyticDistribution(_ClassWithInit):
286336
"""
287337
Describes a uniform density plasma

0 commit comments

Comments
 (0)