aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorGravatar Dave Grote <grote1@llnl.gov> 2017-12-04 13:51:49 -0800
committerGravatar Dave Grote <grote1@llnl.gov> 2017-12-04 13:51:49 -0800
commit176528a9498b17c22279af621a8abc1647f5413a (patch)
treef912b2c96cf1ae2b585648f39323d2df009a2849 /Python
parent727baf1436f6b4645def5d3b4534835b6ab1c822 (diff)
downloadWarpX-176528a9498b17c22279af621a8abc1647f5413a.tar.gz
WarpX-176528a9498b17c22279af621a8abc1647f5413a.tar.zst
WarpX-176528a9498b17c22279af621a8abc1647f5413a.zip
Added WarpXPIC.py back in
Diffstat (limited to 'Python')
-rw-r--r--Python/pywarpx/WarpXPIC.py50
-rw-r--r--Python/pywarpx/__init__.py1
2 files changed, 51 insertions, 0 deletions
diff --git a/Python/pywarpx/WarpXPIC.py b/Python/pywarpx/WarpXPIC.py
new file mode 100644
index 000000000..77ab8464f
--- /dev/null
+++ b/Python/pywarpx/WarpXPIC.py
@@ -0,0 +1,50 @@
+from warp.run_modes.timestepper import PICAPI
+from ._libwarpx import libwarpx
+
+class WarpXPIC(PICAPI):
+
+ def get_time(self):
+ return libwarpx.warpx_gett_new(0)
+
+ def set_time(self, time):
+ for i in range(libwarpx.warpx_finestLevel()+1):
+ libwarpx.warpx_sett_new(i, time)
+
+ def get_step_size(self):
+ libwarpx.warpx_ComputeDt()
+ return libwarpx.warpx_getdt(0)
+
+ def get_step_number(self):
+ return libwarpx.warpx_getistep(0)
+
+ def set_step_number(self, it):
+ for i in range(libwarpx.warpx_finestLevel()+1):
+ libwarpx.warpx_setistep(i, it)
+
+ def push_positions(self, dt):
+ libwarpx.warpx_PushX(0, dt)
+
+ def push_velocities_withE(self, dt):
+ libwarpx.warpx_EPushV(0, dt)
+
+ def push_velocities_withB(self, dt):
+ libwarpx.warpx_BPushV(0, dt)
+
+ def get_self_fields(self):
+ libwarpx.warpx_FieldGather(0)
+
+ def calculate_source(self):
+ libwarpx.warpx_CurrentDeposition(0)
+
+ def push_Efields(self, dt):
+ libwarpx.warpx_EvolveE(0, dt)
+ libwarpx.warpx_FillBoundaryE(0, True)
+
+ def push_Bfields(self, dt):
+ libwarpx.warpx_EvolveB(0, dt)
+ libwarpx.warpx_FillBoundaryB(0, True)
+
+ def apply_particle_boundary_conditions(self):
+ libwarpx.mypc_Redistribute() # Redistribute particles
+ libwarpx.warpx_MoveWindow() # !!! not the correct place yet
+
diff --git a/Python/pywarpx/__init__.py b/Python/pywarpx/__init__.py
index bddbb78b7..a1624d258 100644
--- a/Python/pywarpx/__init__.py
+++ b/Python/pywarpx/__init__.py
@@ -12,5 +12,6 @@ from .AMReX import AMReX
#from .timestepper import TimeStepper
from .PGroup import PGroup
from .PGroup import PGroups
+from .WarpXPIC import WarpXPIC
from ._libwarpx import add_particles