 corners. For the time integration we stagger the proper velocity of the macro particles ${\bm{u}\gamma}_p$ and the associated current density ${\bm{J}}$ backwards time. In the [<span style="font-variant:small-caps;">PhotonPlasma</span> code]{} the natural order to do the different updates in a time step is (see [Fig. \[fig:time\]]{})

![Spatial staggering in the [<span style="font-variant:small-caps;">PhotonPlasma</span> code]{}.[]{data-label="fig:yee"}](staggering2){width="0.8\linewidth"}

![Time staggering and integration order in the [<span style="font-variant:small-caps;">PhotonPlasma</span> code]{}. ${\bm{u}\gamma}_p$ and ${\bm{J}}$ are staggered $\Delta t/2$ backwards in time, while everything else is time centered.[]{data-label="fig:time"}](timestep){width="\linewidth"}

1.  [Update the proper velocity ${\bm{u}\gamma}_p$ of the macro particles using either the Boris or Vay particle pusher]{}

2.  [Calculate the charge density on the mesh $\rho^i({\bm{x}}_p^i)$, update the macro particle positions to ${\bm{x}}_p^{i+1}$, and recalculate the charge density $\rho^{i+1}({\bm{x}}_p^{i+1})$]{}

3.  [If using a charge conserving method, find the current density from the time derivative of the charge density $\hat\partial_t \rho = [\rho^{i+1}({\bm{x}}_p^{i+1}) - \rho^i({\bm{x}}_p^i)]/\Delta t$, else calculate it directly from the particle flux ${\bm{u}}_p$ interpolated on the mesh.]{}

4.  [Given the time staggered current density, update the magnetic field using an implicit method]{}

5.  [Combine the old and new magnetic field values to make a time centered update of the electric field]{}

In between step 3 and 4 first the particle-, charge- and current boundary conditions are applied, together with an exchange of particles between MPI threads. Then the particle array, local to each thread, is sorted sequentially according to the cell position. The sorting ass
corners. For the time integration we stagger the proper velocity of the macro particles $ { \bm{u}\gamma}_p$ and the consociate current concentration $ { \bm{J}}$ backwards time. In the [ < straddle style="font - variant: little - caps;">PhotonPlasma</span > code ] { } the natural order to do the unlike updates in a time step is (attend [ Fig.   \[fig: time\ ] ] { }) 

! [ Spatial staggering in the [ < span style="font - variant: little - caps;">PhotonPlasma</span > code]{}.[]{data - label="fig: yee"}](staggering2){width="0.8\linewidth " } 

! [ Time staggering and consolidation order in the [ < span style="font - variant: small - caps;">PhotonPlasma</span > code ] { }. $ { \bm{u}\gamma}_p$ and $ { \bm{J}}$ are staggered $ \Delta t/2 $ backwards in time, while everything else is time centered.[]{data - label="fig: time"}](timestep){width="\linewidth " } 

 1.   [ Update the proper speed $ { \bm{u}\gamma}_p$ of the macro particles using either the Boris or Vay particle baby buggy ] { } 

 2.   [ Calculate the charge density on the mesh $ \rho^i({\bm{x}}_p^i)$, update the macro particle position to $ { \bm{x}}_p^{i+1}$, and recalculate the charge density $ \rho^{i+1}({\bm{x}}_p^{i+1})$ ] { } 

 3.   [ If using a charge conserving method acting, find the current density from the time derivative of the charge density $ \hat\partial_t \rho = [ \rho^{i+1}({\bm{x}}_p^{i+1 }) - \rho^i({\bm{x}}_p^i)]/\Delta t$, else count it directly from the particle flux $ { \bm{u}}_p$ interpolated on the mesh. ] { } 

 4.   [ Given the time staggered current density, update the magnetic battlefield using an implicit method ] { } 

 5.   [ compound the previous and new magnetic field values to make a time centered update of the electric airfield ] { } 

 In between step 3 and 4 first the particle-, charge- and current boundary conditions are applied, together with an rally of particles between MPI threads. Then the particle array, local to each thread, is screen sequentially harmonize to the cell position. The sorting ass
 cogners. For the time integvation we stagget rhe prmper vslocity uf the macro particles ${\bm{u}\galmq}_p$ ane the associated currevt densitj ${\bm{J}}$ bacjwarvs time. In the [<s'zn stylc="yont-vzviant:vnall-caps;">PhotonKlasma</span> cmde]{} the naturan urber to do the different updates in a time syeo is (see [Fig. \[fid:timt\]]{})

![Spwtiam staggering in the [<span style="font-bariant:vmall-caps;">PhotpnPlasma</span> code]{}.[]{data-label="vig:yfe"}](staggering2){width="0.8\llnewidth"}

![Timg stwtgering and kntegration order in tge [<span style="font-variant:small-caos;">PhoconPlasma</spqn> cofg]{}. ${\bm{u}\gamma}_p$ end ${\bm{T}}$ are staggevvd $\Deltd t/2$ baclwards in time, whmle wverything else is tike centered.[]{data-labgl="fig:time"}](thmzstep){width="\linewidth"}

1.  [Ypeate jhe psopef veuocjtb ${\bj{u}\gammw}_p$ kf the macdo particlew using either the Nowpx or Vay parficle [ufher]{}

2.  [Calculate the charge density on tve jesh $\rho^i({\bm{x}}_p^i)$, update tye macro particle posltions to ${\bm{x}}_p^{i+1}$, and recalculate the charge density $\rho^{i+1}({\bm{x}}_[^{i+1})$]{}

3.  [Ih jsiun x cjarge conserving method, find the current densyfy fgom the time deriyative of the charbe drgsity $\hat\partkal_t \rkk = [\rho^{i+1}({\bm{x}}_p^{i+1}) - \rho^i({\bm{d}}_p^i)]/\Deltw t$, eose calcujate it directly from the partixle flux ${\bm{u}}_i$ inrerpolated on the lesh.]{}

4.  [Given the time staggered current densnty, upsate the mahnetic fisud using an implkcin medhod]{}

5.  [Combine the old and gew magnevic fneld valjes jo make a time cejtered update of the eleftric fheld]{}

In betaeen step 3 and 4 first the partirke-, charge- anc wurgent bounbary cpnditions are applied, togetker with an ebchange of particnes between MPI threads. Djen the partmcle arrar, loxal ro each ghread, is sortrd sequenniclly accoeding to the cell iositkkn. The sorting crw
corners. For the time integration we stagger velocity the macro ${\bm{u}\gamma}_p$ and the time. the [<span style="font-variant:small-caps;">PhotonPlasma</span> the natural order do the different updates in a step is (see [Fig. \[fig:time\]]{}) ![Spatial staggering in the [<span style="font-variant:small-caps;">PhotonPlasma</span> code]{}.[]{data-label="fig:yee"}](staggering2){width="0.8\linewidth"} ![Time and integration order in the [<span style="font-variant:small-caps;">PhotonPlasma</span> code]{}. ${\bm{u}\gamma}_p$ and ${\bm{J}}$ are staggered t/2$ in while else is time centered.[]{data-label="fig:time"}](timestep){width="\linewidth"} 1. [Update the proper velocity ${\bm{u}\gamma}_p$ of the macro particles using either Boris or Vay particle pusher]{} 2. [Calculate the density on the mesh update the macro particle positions ${\bm{x}}_p^{i+1}$, recalculate the density 3. using a charge method, find the current density from the time derivative of the charge density $\hat\partial_t \rho = [\rho^{i+1}({\bm{x}}_p^{i+1}) \rho^i({\bm{x}}_p^i)]/\Delta t$, it directly the flux interpolated on the [Given the time staggered current density, field using an implicit method]{} 5. [Combine the and new field values to make a time update of the electric field]{} In between step and 4 first the particle-, charge- and current boundary conditions are applied, together with an particles between MPI threads. the particle array, to thread, sorted according to cell position. The sorting ass
 corners. For the time integratIon we staggEr the ProPer VeLociTy of The macro particLEs ${\bm{U}\gamma}_p$ and the associateD currEnT DensITy ${\Bm{J}}$ baCkwards TImE. iN thE [<sPaN stYlE="FoNt-varIanT:small-cAps;">PhotonPLasMa</Span> code]{} the nATuRal order to Do tHe different uPdaTes in a TiMe sTEp is (sEe [FIg. \[fig:Time\]]{})

![SpATial stAggering iN tHE [<span sTYle="font-VARiAnt:sMall-caps;">PhotonPlaSMa</SPan> code]{}.[]{data-labEl="fig:yEe"}](STaGGEriNg2){wIdth="0.8\linewiDtH"}

![Time STaggeriNG aND INteGRation order in The [<span stylE="FonT-variaNt:SmaLL-caps;">PHotonplASma</Span> code]{}. ${\bm{u}\GammA}_p$ and ${\bm{J}}$ aRe stagGEred $\DelTA t/2$ backwArds in TimE, whIle eVErYtHinG eLSe iS TiMe cENteRed.[]{data-lAbEl="Fig:tiMe"}](tiMESTEp){wiDth="\LineWidth"}

1.  [update the propEr vElocITy ${\bM{u}\gamMa}_p$ of The mAcRo parTicles Using EiTher the Boris or VAy paRticle pusHer]{}

2.  [caLcuLaTe the CHarge dEnsIty On the meSh $\rho^i({\bM{X}}_p^i)$, UpDATE tHe macro particle posItIONs To ${\bm{x}}_p^{i+1}$, aNd recaLCuLaTE the charGe DenSity $\RHO^{i+1}({\bm{x}}_P^{i+1})$]{}

3.  [If USiNg a chargE conseRViNg Method, fInD the cuRrEnt DenSity fROm thE time dErivativE of thE Charge density $\hAT\partial_t \rho = [\rHO^{i+1}({\BM{X}}_p^{I+1}) - \Rho^i({\Bm{x}}_P^i)]/\Delta t$, elsE calCUlatE it dIReCtlY From tHe parTiCLe FLux ${\bm{u}}_p$ interpolated On The mesH.]{}

4.  [GiveN the time staggEred currenT DENsity, updAte tHE mAGnetic field usiNg an iMplicit metHOd]{}

5.  [CombinE the oLd and new Magnetic fIELd values To mAke A tiMe cENTeRed update of thE ELectRiC field]{}

IN beTween stEp 3 aNd 4 fIrsT thE pArticle-, chArge- and cUrReNt BoUndAry coNDitions aRe AppLiEd, tOgethER with aN exchAnge Of PaRTicLes betwEEn mpi thrEaDs. then The PaRticlE arrAY, loCal to eaCh thread, iS soRTed sEqUeNtially According to thE cEll positioN. THe sOrting ASS
 corners. For the time int egration w e sta gge r t he  pro pervelocity of th e  mac ro particles ${\bm{u}\ gamma }_ p $ an d  t he as sociate d  c u r ren tde nsi ty ${ \bm{J }}$  backwa rds time.Inth e [<span sty l e= "font-vari ant :small-caps; ">P hotonP la sma < /span > c ode]{ } then atural  order to  d o  the d i fferent u pd ates  in a time step i s  ( s ee [Fig. \[fig :time\ ]] { }) ![S pat ial stagge ri ng in the [<s p an s t yle = "font-variant :small-caps ; ">P hotonP la sma < /span>  code ]{ } .[] {data-label ="fi g:yee"}]( stagge r ing2){w i dth="0. 8\line wid th" }

! [ Ti me  st ag g eri n gand int egration  o rd er in  the [ < s pansty le=" font- variant:small -ca ps;" > Pho tonPl asma< /spa n>  code ]{}. $ {\bm{ u} \gamma}_p$ and${\b m{J}}$ ar e s ta gge re d $\D e lta t/ 2$bac kwardsin time ,  wh il e e ve rything else is ti me c en tered.[] {data- l ab el = "fig:tim e" }]( time s t ep){w idth = "\ linewidt h"}

1 .  [U pdate t he  prope rvel oci ty ${ \ bm{u }\gamm a}_p$ of  them acro particles using eithert he B or i s or  Va y particlepush e r]{} 

2.  [ Cal c ulate  thech a rg e  density on the mes h$\rho^ i({\b m{x}}_p^i)$,update the m a cro part icle po s itions to ${\b m{x}} _p^{i+1}$, and reca lcula te the c harge den s i ty $\rho ^{i +1} ({\ bm{ x } }_ p^{i+1})$]{}3 .  [ If  usinga c harge c ons erv ing  me th od, findthe curr en tde ns ity  from the time  d eri va tiv e oft he cha rge d ensi ty  $ \ hat \partia l _t \ rho=[\ rho^ {i+ 1} ({\bm {x}} _ p^{ i+1}) -  \rho^i({ \bm { x}}_ p^ i) ]/\Delt a t$, else ca lc ulate it d ir ect ly fro m the part icle flux ${\bm{u}}_p$i nterpol ate d onthemesh.]{}
4.   [Giv ent he tim e stag gered  c urr e n t den s i ty , u pd ate the ma g n eti c fie ld  usi ng an i mplicit method]{}5. [Combine the  ol d an d ne w m a gn e tic  f i eld v alues to make a  time cent er e dupdate oft heel ectricfield]{ }

In between  step 3 a nd 4 firs tthep a rti cle-, char ge- andcurrent b o undar y  c ondit ion s areap pli ed, t ogethe r  wi th an  excha ng e of p artic le s betwee n MPI threads. Then the  parti cle a rra y, localtoe ach  thread,is s orted sequ ent ial ly ac cor d ing t o th e  c ell posit ion. The sorti n gass 
 corners._For the_time integration we stagger_the proper_velocity_of the_macro_particles ${\bm{u}\gamma}_p$ and_the associated current_density ${\bm{J}}$ backwards time._In the [<span_style="font-variant:small-caps;">PhotonPlasma</span>_code]{} the natural order to do the different updates in a time step is_(see_[Fig. \[fig:time\]]{})

![Spatial staggering_in_the_[<span style="font-variant:small-caps;">PhotonPlasma</span> code]{}.[]{data-label="fig:yee"}](staggering2){width="0.8\linewidth"}

![Time staggering and_integration order in the [<span_style="font-variant:small-caps;">PhotonPlasma</span> code]{}._${\bm{u}\gamma}_p$ and ${\bm{J}}$ are staggered $\Delta t/2$ backwards_in_time, while everything_else is time centered.[]{data-label="fig:time"}](timestep){width="\linewidth"}

1.  [Update the proper velocity_${\bm{u}\gamma}_p$ of the macro particles using_either the Boris_or_Vay_particle pusher]{}

2.  [Calculate_the charge density on the mesh_$\rho^i({\bm{x}}_p^i)$, update the macro particle positions_to ${\bm{x}}_p^{i+1}$, and recalculate the charge density_$\rho^{i+1}({\bm{x}}_p^{i+1})$]{}

3.  [If using a charge_conserving method, find the current_density from_the time derivative of the_charge density $\hat\partial_t_\rho =_[\rho^{i+1}({\bm{x}}_p^{i+1}) - \rho^i({\bm{x}}_p^i)]/\Delta_t$, else calculate it directly from_the particle flux_${\bm{u}}_p$ interpolated on the mesh.]{}

4. _[Given_the time staggered_current_density,_update the_magnetic field using_an_implicit method]{}

5.__[Combine the old and new magnetic_field_values to make a time centered update_of the electric field]{}

In_between_step 3 and 4_first the particle-, charge- and_current boundary conditions are applied, together_with an_exchange of_particles between MPI threads. Then the particle array, local to each_thread, is sorted sequentially according to_the cell position. The_sorting ass