aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/WarpXPIC.py
blob: dc66ec26a5a91596846a4eb63731ac6aa969a2bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copyright 2017 David Grote
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL

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(self.istep,True) # !!! not the correct place yet

vatar/d5cd6cffb9d23320b28bc3de0c2614dc?s=13&d=retro' width='13' height='13' alt='Gravatar' /> Weiqun Zhang 3-422/+160 2016-11-16update particle pusherGravatar Weiqun Zhang 1-0/+8 2016-11-16start to update particle for 2dGravatar Weiqun Zhang 2-14/+54 2016-11-16update initialization of particles for 2dGravatar Weiqun Zhang 1-2/+19 2016-11-16update evec push for 2dGravatar Weiqun Zhang 3-64/+67 2016-11-16update bvec push for 2dGravatar Weiqun Zhang 3-48/+66 2016-11-16rename PICSAR_f.H -> WarpX_f.HGravatar Weiqun Zhang 7-6/+3 2016-11-16start 2DGravatar Weiqun Zhang 6-10/+39 2016-11-15change main() back to C++ style because it is called by pythonGravatar Weiqun Zhang 2-14/+21 2016-11-10Explicitly specify particle shape order in the testsGravatar Remi Lehe 1-0/+5 2016-11-10Corrected the type of a .true. and .false.Gravatar Remi Lehe 1-36/+36 2016-11-10Revert "Revert "Convert all logical in logical(c_long) as required by Picsar""Gravatar Remi Lehe 2-16/+17 This reverts commit 4ef96c642b8dad49ec79987e6b87149d7395c8b7. 2016-11-09Revert "Convert all logical in logical(c_long) as required by Picsar"Gravatar Remi Lehe 2-17/+16 This reverts commit e79c90f63b188bd8a45d6feb087861d90b0a7076. 2016-11-09Initial python wrapped versionGravatar Dave Grote 21-10/+456 2016-11-09Convert all logical in logical(c_long) as required by PicsarGravatar mathieu_lobet 2-16/+17