aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/picmi.py
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2021-07-21 18:13:51 -0700
committerGravatar GitHub <noreply@github.com> 2021-07-21 18:13:51 -0700
commite6cd2bf5c2f7e6ffdb4dc2a1a5cec238a90c9415 (patch)
treee8fcd509047c6041ba7357defc8a157a80931a9c /Python/pywarpx/picmi.py
parent36386817a21ceef27ac9e6b8c0301f7987a27bc7 (diff)
downloadWarpX-e6cd2bf5c2f7e6ffdb4dc2a1a5cec238a90c9415.tar.gz
WarpX-e6cd2bf5c2f7e6ffdb4dc2a1a5cec238a90c9415.tar.zst
WarpX-e6cd2bf5c2f7e6ffdb4dc2a1a5cec238a90c9415.zip
PICMI - Embedded boundary (#2104)
* added functionality to picmi.py to allow an embedded boundary to be set from a python run script * added test: embedded sphere run from python (the test is the same as ElectrostaticSphereEB) * added a line to prepare_file_travis.py so that tests with USE_EB=True are not included in Python CI test list * fixed import path in analysis.py file for new test * added WarpX_EB flag to setup.py so that embedded boundary functionality can be included in pip installs of pywarpx
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r--Python/pywarpx/picmi.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py
index 63c9143aa..570416aaf 100644
--- a/Python/pywarpx/picmi.py
+++ b/Python/pywarpx/picmi.py
@@ -715,6 +715,22 @@ class Mirror(picmistandard.PICMI_Mirror):
pywarpx.warpx.mirror_z_npoints.append(self.number_of_cells)
+class EmbeddedBoundary(picmistandard.base._ClassWithInit):
+ """Custom class to handle set up of embedded boundaries in WarpX. If
+ embedded boundary initialization is added to picmistandard this can be
+ changed to inherit that functionality."""
+
+ def __init__(self, implicit_function, potential=None, **kw):
+ self.implicit_function = implicit_function
+ self.potential = potential
+
+ self.handle_init(kw)
+
+ def initialize_inputs(self):
+ pywarpx.warpx.eb_implicit_function = self.implicit_function
+ pywarpx.warpx.__setattr__('eb_potential(t)', self.potential)
+
+
class Simulation(picmistandard.PICMI_Simulation):
def init(self, kw):
@@ -735,6 +751,8 @@ class Simulation(picmistandard.PICMI_Simulation):
self.use_fdtd_nci_corr = kw.pop('warpx_use_fdtd_nci_corr', None)
self.amr_check_input = kw.pop('warpx_amr_check_input', None)
+ self.embedded_boundary = kw.pop('warpx_embedded_boundary', None)
+
self.inputs_initialized = False
self.warpx_initialized = False
@@ -795,6 +813,9 @@ class Simulation(picmistandard.PICMI_Simulation):
self.injection_plane_positions[i],
self.injection_plane_normal_vectors[i])
+ if self.embedded_boundary is not None:
+ self.embedded_boundary.initialize_inputs()
+
for i in range(len(self.lasers)):
self.lasers[i].initialize_inputs()
self.laser_injection_methods[i].initialize_inputs(self.lasers[i])