Couple PIC particles to a field solver
Particles in a particle-in-cell solver advance one of two ways: in the field's Runge–Kutta stage loop, as a companion of the field stepper, or with a two-level pusher staggered with the fields. Tutorial 13 builds a 1-D plasma both ways; this page is the choice. The properties of each: Particles.
In the field's stage loop
The particles are a second stepper, sp%initialize_companion(st, ...), driven through the same calls in the same stage window; their residual is the Lorentz force gathered at the stage positions. Two questions decide whether a scheme can carry them: does it give charge-conserving stage currents, and up to which
type(stepper) :: st
integer(I4P) :: s
print '(A)', 'scheme stage currents largest omega dt'
do s=1, size(RK_SCHEMES)
call st%initialize(trim(RK_SCHEMES(s)), FORM_BUTCHER, lb=[1, 1], ub=[8, 1], components=.true.)
print '(A16,L10,F18.4)', RK_SCHEMES(s), st%stage_current_admissible(), st%imag_axis_bound()
call st%destroy
enddo$ cookbook_particles route
scheme stage currents largest omega dt
euler T 0.0000
ssp-22 T 0.0000
ssp-33 T 1.7321
ssp-54 T 3.2784
ssp-104 T 4.9215
rk4 T 2.8284
lsrk-33 T 1.7321
lsrk-54 T 3.3407
lsrk-64 T 4.8948
lsrk-74 T 5.6770
lsrk-124 T 10.9538
lsrk-134 T 6.5491
lsrk-144 T 6.0793
heun-euler-21 T 0.0000
cash-karp-54 T 0.0000
dopri-54 F 0.9972
calvo-65 F 2.6093
feagin-108 T 1.1540
runge-2 T 0.0000
heun-2 T 0.0000
kutta-3 T 1.7321
ralston-4 T 2.8284
shanks-4 T 2.8284
butcher-6 T 0.0000
ssp-53 T 2.6952
jiang-shu-4 T 2.8284
ssp-43 T 2.1562
shanks-7 T 1.9484
shanks-7b T 2.8616
shanks-8 T 0.0000
cooper-verner-8 T 3.0018
tmy-7s T 2.4708
stepanov-10 T 0.0000
zhang-10 T 0.0000
bs-32 F 1.7321
fehlberg-45 F 0.0000
tsitouras-54 F 0.4780
stepanov-54 F 0.5256
pp-54a F 0.3720
pp-54b T 0.0000
dopri-65 F 1.7644
tsit-pap-64 T 1.7644
verner-65a F 1.3068
verner-65r F 0.0000
tsit-pap-75 T 0.0000
verner-76e F 0.0000
verner-76r F 0.0000
sharp-smart-76 F 3.9069
fehlberg-78 F 1.8824
verner-78a F 4.0838
tsit-pap-86 T 2.9149
dopri-87 F 0.0000
verner-87e F 0.0000
verner-87r F 2.5913
enright-ver-87 F 3.0015
fehlberg-89 F 0.0000
verner-89 F 0.1944
tsitouras-98 F 2.6896
verner-98e F 2.7570
verner-98r F 2.7022
sharp-98 F 0.0000
dopri-853 T 5.9604
bs-54 F 1.6643stage_current_admissible()is true for every scheme of the catalogue: each hasand , so lookaheadandstage_currentkeep Gauss's law at every stage (Tutorial 13 shows the calls).eulerandssp-22have no imaginary-axis interval: their gyration grows at any step. Takedtbelowimag_axis_bound() / omega_maxof the fastest mode, the cyclotron and the plasma frequencies included.- The coupled step is the field's scheme: its order, and a gyration energy that decays by
per step (Particles).
With a two-level pusher
The positions live at selah_push call, deposit the current of the move
real(R_P), parameter :: PI=acos(-1._R_P), VE=0.5_R_P
real(R_P) :: p(8,1), e(3,1), b(3,1), dt, g, u0, ue
integer(I4P) :: k, n
b(:,1) = [0._R_P, 0._R_P, 1._R_P]
print '(A)', 'pusher gyration: angle error |u| error drift: |u - u_E| / u_E x / t - v_E'
do k=1, size(PUSHERS)
! one gyration: u = (1, 0, 0) at t^{-1/2}, at the origin; the exact period is 2 pi gamma (2 pi for Boris's v)
g = merge(1._R_P, sqrt(2._R_P), PUSHERS(k) == PUSHER_BORIS)
dt = 2 * PI * g / 32
p(:,1) = [0._R_P, 0._R_P, 0._R_P, 1._R_P, 0._R_P, 0._R_P, 1._R_P, 1._R_P] ! x 1:3, u 4:6, q 7, m 8
e = 0._R_P
do n=1, 32
call selah_push(PUSHERS(k), LAYOUT_V_FIRST, 1_I4P, dt, 1_I4P, 4_I4P, 7_I4P, 8_I4P, p, e, b, c=1._R_P)
enddo
u0 = norm2(p(4:6,1))
write(*, '(A14,ES22.3,A12)', advance='no') NAMES(k), atan2(p(5,1), p(4,1)), small(u0 - 1._R_P)
! the drift: E + v x B = 0 at v = v_E
ue = VE ; if (PUSHERS(k) /= PUSHER_BORIS) ue = VE / sqrt(1._R_P - VE**2) ! u_E = gamma_E v_E
p(:,1) = [0._R_P, 0._R_P, 0._R_P, ue, 0._R_P, 0._R_P, 1._R_P, 1._R_P]
e(:,1) = [0._R_P, VE, 0._R_P]
do n=1, 100
call selah_push(PUSHERS(k), LAYOUT_V_FIRST, 1_I4P, 1._R_P, 1_I4P, 4_I4P, 7_I4P, 8_I4P, p, e, b, c=1._R_P)
enddo
print '(A21,A16)', small(norm2(p(4:6,1) - [ue, 0._R_P, 0._R_P]) / ue), small(p(1,1) / 100 - VE)
enddo$ cookbook_particles pushers
pusher gyration: angle error |u| error drift: |u - u_E| / u_E x / t - v_E
boris 2.007E-02 round-off round-off round-off
boris-rel 2.007E-02 round-off 1.88E-02 1.15E-02
vay 2.007E-02 round-off round-off round-off
higuera-cary 5.094E-03 round-off round-off round-off- Every pusher keeps
in a pure magnetic field to round-off. - Boris, the relativistic Boris and Vay lag the gyration by the same angle,
rad, the lag of a turn of per step instead of . Higuera–Cary's lag is smaller on this case. - The relativistic Boris does not keep the force-free state:
moves off and the particle drifts at the wrong mean speed. Vay and Higuera–Cary keep it to round-off; the non-relativistic Boris keeps its own ( exact). - So:
PUSHER_BORISbelow relativistic speeds;PUSHER_HIGUERA_CARYfor relativistic particles (volume-preserving, force-free state kept);PUSHER_VAYwhere volume preservation does not matter;PUSHER_BORIS_RELATIVISTICto reproduce a code that uses it.
The relativistic pushers take c= (here 1); a Gaussian-units caller passes LAYOUT_V_LAST takes the particles as p(np, ncomp) and the fields as (np, 3).