Skip to content

Commit

Permalink
Add applied particle field from file (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe authored Jun 27, 2024
1 parent 0b12f22 commit 21c38d6
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions PICMI_Python/applied_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,34 @@ def __init__(self, x_front_location=None, y_front_location=None, z_front_locatio

self.handle_init(kw)


class PICMI_LoadAppliedField(_ClassWithInit):
"""
The E and B fields read from file are applied to the particles directly. (They are not affected by the field solver.)
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
Parameters
----------
read_fields_from_path: string
Path to file with field data
load_B: bool, default=True
If False, do not load magnetic field
load_E: bool, default=True
If False, do not load electric field
"""
def __init__(self, read_fields_from_path, load_B=True, load_E=True, **kw):
self.load_B = load_B
self.load_E = load_E
self.read_fields_from_path = read_fields_from_path

self.handle_init(kw)


class PICMI_LoadGriddedField(_ClassWithInit):
"""
The data read in is used to initialize the E and B fields on the grid at the start of the simulation.
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
The data read in is used to initialize the E and B fields on the grid at the start of the simulation.
The expected format is the file is OpenPMD with axes (x,y,z) in Cartesian, or (r,z) in Cylindrical geometry.
Parameters
----------
Expand All @@ -188,5 +211,5 @@ def __init__(self, read_fields_from_path, load_B=True, load_E=True, **kw):
self.load_B = load_B
self.load_E = load_E
self.read_fields_from_path = read_fields_from_path

self.handle_init(kw)

0 comments on commit 21c38d6

Please sign in to comment.