aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/WarpXPIC.py
blob: 66930d81f7e66de684cd7d6c00476b8ab69aaa85 (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
57
58
59
60
61
62
63
# Copyright 2017 David Grote
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL

# The WarpXPIC class is the beginnings of an implementation of a standard interface
# for running PIC codes. This is the run time equivalent to the PICMI standard.
# This standard would specify the API for calling the various pieces of typical
# time step loops, for example get_self_fields and put_Efields. Ideally, a user
# could write a loop using the standard and, importing one of compliant codes, be
# able to run a customized PIC simulation with that code.

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

on> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/docs/styling.md (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2021-05-13chore: release astro-vscodeGravatar Nate Moore 6-148/+30
2021-05-13Version Packages (#195)Gravatar github-actions[bot] 23-65/+43
2021-05-13Support for import suggestions in the languageserver (#204)Gravatar Matthew Phillips 6-12/+32
2021-05-13Fix Svelte build output (#201)Gravatar Nate Moore 4-8/+14
2021-05-12[wip] Fix CI (#202)Gravatar Drew Powers 28-219/+191
2021-05-11VS Code extension (#197)Gravatar Matthew Phillips 7-20/+182
2021-05-11Fix workflows! (#198)Gravatar Nate Moore 3-2/+4
2021-05-11Add Astro.request.canonicalURL and Astro.site to global (#199)Gravatar Drew Powers 25-98/+234
2021-05-11Fix portfolio example (#196)Gravatar Drew Powers 2-3/+5
2021-05-10fix: build stuck on unhandled promise reject (#191)Gravatar Kevin (Kun) "Kassimo" Qian 2-2/+13
2021-05-10Allow default import component to be renamed based on import statement defaul...Gravatar Kevin (Kun) "Kassimo" Qian 3-8/+30
2021-05-08Add more docs on styling (#186)Gravatar Drew Powers 1-3/+321
2021-05-08Fix running the extension (#181)Gravatar Matthew Phillips 5-11/+37