Skip to content

Commit 21c38d6

Browse files
authored
Add applied particle field from file (#113)
1 parent 0b12f22 commit 21c38d6

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

PICMI_Python/applied_fields.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,34 @@ def __init__(self, x_front_location=None, y_front_location=None, z_front_locatio
167167

168168
self.handle_init(kw)
169169

170-
170+
class PICMI_LoadAppliedField(_ClassWithInit):
171+
"""
172+
The E and B fields read from file are applied to the particles directly. (They are not affected by the field solver.)
173+
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
174+
175+
Parameters
176+
----------
177+
read_fields_from_path: string
178+
Path to file with field data
179+
180+
load_B: bool, default=True
181+
If False, do not load magnetic field
182+
183+
load_E: bool, default=True
184+
If False, do not load electric field
185+
"""
186+
def __init__(self, read_fields_from_path, load_B=True, load_E=True, **kw):
187+
self.load_B = load_B
188+
self.load_E = load_E
189+
self.read_fields_from_path = read_fields_from_path
190+
191+
self.handle_init(kw)
192+
193+
171194
class PICMI_LoadGriddedField(_ClassWithInit):
172195
"""
173-
The data read in is used to initialize the E and B fields on the grid at the start of the simulation.
174-
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
196+
The data read in is used to initialize the E and B fields on the grid at the start of the simulation.
197+
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
175198
176199
Parameters
177200
----------
@@ -188,5 +211,5 @@ def __init__(self, read_fields_from_path, load_B=True, load_E=True, **kw):
188211
self.load_B = load_B
189212
self.load_E = load_E
190213
self.read_fields_from_path = read_fields_from_path
191-
214+
192215
self.handle_init(kw)

0 commit comments

Comments
 (0)