Basic Techniques of Standard PIC code. II. Advanced PIC code a. Parallel
Computing b. Noise Reduction Method c. Gyro-PIC Code for Kinetic-MHD
Simulation.
International School on Plasma Turbulence and Transport. August 16-18, 2007, Chengdu, China
Numerical Simulation Techniques for Nonlinear Kinetic Physics H. Naitou, Yamaguchi University I.
II.
Standard PIC Code a. Basic Idea of Particle Simulation b. Basic Techniques of Standard PIC code Advanced PIC code a. Parallel Computing b. Noise Reduction Method c. Gyro-PIC Code for Kinetic-MHD Simulation
I. Standard PIC Code a. Basic Idea of Particle Simulation b. Basic Techniques of Standard PIC Code
Image of a Plasma in 3-D Dynamics of Charged Particles in a Box
OpenGL Mac Window Linux
red: ion blue: electron
Basic Equations describing Plasmas Equations of motion for charged particles!6Ne+6Ni"
drsj (t) = v sj (t) dt dv sj (t) qs = E(rsj (t),t ) + v sj (t) " B(rsj (t),t) dt ms s = e, i j = 1, N s
[
]
Equations for Electromagnetic Fields #(r,t) " • E(r,t) = $0 " • B(r,t) = 0 'B(r,t) " % E(r,t) = & 't ( 'E(r,t) + " % B(r,t) = µ0 *J(r,t) + $0 ) 't ,
Charge Density Ns
"(r,t) =
% q %#[r $ r (t)] s
s= e,i
sj
j=1
Current Density
!
Ns
J(r,t) =
$q $ v s
s= e,i
j=1
sj
(t) " [r # rsj (t)]
Microscopic Distribution Functon
Ns
Fs (r,v,t) = $" [ v # v sj (t)] " [r # rsj (t)] j=1
% s (r,t) = qs & Fs (r,v,t)dv J s (r,t) = qs & v Fs (r,v,t)dv
!
! !
Klimontovich Equation " " Fs (r,v,t) + • [vFs (r,v,t)] "t "r ' " $ qs + • & (E(r,t) + v # B(r,t)) Fs (r,v,t)) = 0 "v % m s (
!
" " Fs (r,v,t) + v • Fs (r,v,t) "t "r qs " + (E(r,t) + v # B(r,t)) • Fs (r,v,t) = 0 ms "v
Vlasov Equation Rosenbluth Chopping Collisionless Fluid in Phase Space
qs " qs / M, ms " ms / M (qs /ms = const., M " #) " " f s (r,v,t) + v • f s (r,v,t) "t "r ! qs " + (E(r,t) + v # B(r,t)) • f s (r,v,t) = 0 ms "v
Super Particle Model (1) Consider a hydrogen plasma in a cube of 10 cm x 10 cm x 10 cm. Let the density of this plasma be 1012 cm-3. There are 1015 electrons and 1015 ions. Is it possible to simulate this plasma by 109 super-electrons and 109 super-ions?
m
SP e
6
= 10 me ,
m
SP i
6
= 10 mi ,
e q
SP
SP i
6
= 10 e 6
= 10 qi
Super Particle Model (2) From ZSP (Zero Size Particle) to FSP (Finite Size Particle) .
real particles
FSP ZSP
SP s
q
qs, ms M = 30
m
SP s
= M qs = M ms
SP s
q " (r # rj ) !
qsSP S(r " r j )
Super Particle Model (3) Equations of Motion:
dr dv qsSP = v, = SP dt dt ms
(
E(rs )+ v $ B(rs ) )
Independent of M Coulomb Electric Field around the Point Particle Locating at
!
the Origin:
qsSP r E(r) = 4 " #0 r 2 r Enhanced by the factor of M
Super Particle Model (4) How are next quantities in the super particle model?
Density
!!
!
n sSP = (1/ M) n s
ns
TsSP = M Ts
Ts
Temperature !!!
n s qs2 Plasma Angular Frequency !! " ps = # m 0 s
" SP ps = " ps
Ts m! s
v tsSP = v ts
!
Thermal Velocity
!
! !!!
v ts =
! Debye Length
!!!!!
! Gyro-Frequency
!
!
$Ds =
v ts ! #0 Ts = " ps n s qs2
qs B " cs = ms
! !
"SP Ds = "Ds
" csSP = " cs
Image of a Simulation Plasma in 2-D Field quantities are calculated only at grid points. Particles can move freely in the system
General Directions for Particle Simulation #Increase Statistics. $$$$The More Particles, the Better. $$$$Approach to the Collisionless Plasma. Use the Maximum of the Memory. The Accuracy of the Time Integration of the Equation of Motion:
O[!t3], O[!x3]
I. Standard PIC Code a. Basic Idea of Particle Simulation b. Basic Techniques of Standard PIC Code
Time Integration (Particle Pushing) Numerical Solution for Ordinary differential equation
particle pushing (without magnetic field) dv qs = E " dt ms
!
!
dr =v dt
"
Time Integration by Leap-Frog Method Time Reversal Invariance
particle pushing (with magnetic field) (1)
We can solve the above equation for v n +1/ 2 . The answer is in the next view - graph.
!
particle pushing (with magnetic field) (2) v" = v n"1/ 2 + v+
v'
!
qs v =v +v $ B(rn )#t 2ms
v + " v"
"
'
!
v!
" q B tan = s 2 2 ms
!
!
!
"
"
qs v =v + v $ B(rn )#t 2 ms % q B(r )#t ( s n 1+ ' * & 2ms ) +
"
!
qs E(rn )#t 2ms
"
1
'
qs v n +1/ 2 = v + E(rn )#t 2ms +
!
!
rn +1 = rn + v n +1/ 2 #t !
Charge Assignment in 2-D
Field Calculation Numerical Solution of the Poisson Equation
Fast Fourier Transformation
Finite Difference Method (SOR-Method)
!"!#$%&& '!()%&
Interpolation of the Field in 2-D
Calculation of the Electric Field from the Potential in 2-D
E = "#$
E x i, j E y i, j
$ i+1, j " $ i"1, j =" 2% $ i, j +1 " $ i, j"1 =" 2%
Flow Chart of Particle Simulation
Charge Assignment " Field Calculation " Particle Pushing
!
Initial Conditions Example: $$$Load electrons and ions uniformly in space. Nonuniform loading in space. $$$Put electrons on each ions to eliminate the initial field. $$$Use Maxwellian distribution.
Boundary Conditions Field Quantities: $$$$Periodic Boundary Condition. $$$$Fixed Potential at the Wall. $$$$Connect to Vacuum Field. Particles: $$$$Periodic Boundary Condition. $$$$Absorbing Boundary Condition. $$$$Putting at the Boundary (Floating Electrode) In a system having particle loss, we need a particle source. $$$$Volume Source.
Surface Source.
Bottleneck of the Standard PIC Code a. Must resolve high frequency and short-wavelength modes. " pe , " ce , #De b. Must use huge number of particles. c. Large fluctuation level and large collision frequency. ! d. Need for huge computer resources.
!
Conditions for Numerical Stability Electromagnetic Code.
"De # $ $t % 0.2&
'1 pe
" #c "t (k max c"t $ 1)
Aliasing in $$Space and Time.
!
II. Advanced PIC Code a. Parallel Computing b. Noise Reduction Method c. Gyro-PIC Code for Kinetic-MHD Simulation
Parallel Computing Distributed Memory
CPU
CPU
CPU
CPU
MEM.
MEM.
MEM.
MEM.
%&MPI (Message Passing Interface)
Xeon Based PC-Cluster
Advanced Computational Science 2 CPU / 1 PC (Shared Memory) Hyper Threading Technology
Opteron Based PC-Cluster
2 CPU / 1 PC (Distributed Memory)
II. Advanced PIC Code a. Parallel Computing b. Noise Reduction Method c. Gyro-PIC Code for Kinetic-MHD Simulation
Noise Reduction Method (1) df # # " f (r,v,t) + v • f (r,v,t) dt #t #r q # + ( E(r,t) + v $ B(r,t)) • f (r,v,t) = 0 m #v
f (r,v,t) = f 0 (r,v) + " f (r,v,t) f 0 : Equilibrium Distribution "f : Perturbed Distribution
!
!
" f (r,v,t) = w(r,v,t)g(r,v,t) !
w : Weight (Marker) g : Arbitrary Distribution Function (Marker)
Noise Reduction Method (2) d( f 0 + wg) df 0 dg dw = +w + g=0 dt dt dt dt
!
Note that df 0 " q " = v • f 0 (r,v,t) + ( E(r,t) + v # B(r,t)) • f 0 (r,v,t) $ 0 dt "r m "v dg and =0 . dt & df 0 dw 1 df 0 1#f =" = " % " w( dt g dt f0 $ g ' dt
!
!
& 1 f0 f " wg 1 # f Q = = = % " w( g g f0 g f0 f0 $ g '
Noise Reduction Method (3) Method of Characteristics g(r,v,t) = $"[r # r j (t)]"[v # v j (t)] j
" f (r,v,t) = $ w j (t) "[r # r j (t)]"[v # v j (t)] j
!
dw j 1 df 0 = " (1" w j ) dt f 0 dt
!
! !
w j = w(r j ,v j ) : weight of a marker r= r j ,v= v j
Setting g(r,v,0) = g0 = f 0 , we have f (r,v,t) f (r,v,0) f 0 = = =1 g(r,v,t) g(r,v,0) g0 because f and g are constant arong the trajectory.
II. Advanced PIC Code a. Parallel Computing b. Noise Reduction Method c. Gyro-PIC Code for Kinetic-MHD Simulation
Review.1: Vector Potential, A B="#A " • B = " • (" # A) = 0
!
!
% (" # A) %B : Faraday’s Law "#E=$ =$ %t %t ' %A * &" # ) E + , = 0 ( %t + %A &E + = $"%t %A EL = "#$ : electrostatic electric field
E = "#$ " !
%t
%A ET = " : induced electric field %t
Review.2: Darwin Model Extended Ampere's Law : & %E ) " # B = µ0 ( J + $ 0 + ' %t *
!
" # B = µ0 J +
1 $E c 2 $t
Neglecting electromagnetic wave ! propagating with the speed of light, " # B = µ0 JT " # (" # A) = µ0 JT $"(" • A) % " • "A = µ0 JT 2
" A = #µ0 JT
QCoulomb's Guage (" • A = 0)
Review.3: Equations of Motion dr =v dt dv m = q EL + q ET + q (v " B) dt #A in the eqs. of motion? #t Taking a time derivative of Ampere's law, %JT " # $ (# $ ET ) = µ0 %t
How to estimate ET = "
! !
We can estimate J by the microscopic representation. N
!
J (r,t ) =
" q " v (t) # [r $ r (t)] s
s= i,e
sj
j=1
sj
Review.4: Gyro-Motion eB qi B Gyro - frequency : "e = , "i = me mi Gyro - period :
#e =
2$ 2$ , #i = "e "i
Gyro - radius :
%e =
ve v , %i = i "e "i
Thermal gyro - radius : % te =
!
me Te miTi , % ti = eB eB
Review.5: Guiding Center Motion(1) " Necessity of gyro-kinetic-PIC simulation.
Advanced Gyro-PIC Code for Kinetic MHD Simulation 1. More faithful to physics. 2. Kinetic Effects such as ion Landau damping are naturally included. 3. To check the validity of “closure” in the GK-fluid code. 4. Easy to include energetic particles. 4. Needs for computer resources should be modest. Can run on PC, small PC cluster.
Development of new advanced GK-particle code • • • • • •
Cylindrical geometry. Same normalization as the GRM-code. Helical Symmetry is assumed. FLR effects is neglected. Benchmark with the results of the GRM-code. Utilize techniques developed for the fluid code. ------ mesh accumulation, mode selection, etc. ********************************************* • Include new algorithm ------- split weight method, etc.
Normalization Same as that of GRM code.
r z " "# r, " "# z, a 2$R v vA t " "# v, " "# t, vA 2$R 2$RAz 2$R% " "# Az , " "# %, 2 2 a B0 v A a B0 where R is a major radius, a minor radius, v A = c& ci /& pi Alfven velocity. de c = # #$ de , a " pe a
!
di c = # #$ di a " pi a
GK-particle model (1) * z
2
A (r,",z) = Az (r,",z) # $ (1# r ) * z
%A 1 %Az Br = , B" = # r %" %r 1 %& %& Er = , E" = # r %" %r
GK-particle model (2) Phase : Az (r,",z) =
%A
z,m,n
(r)exp(im" # i2$nz)
m= n
& (r,",z) =
%&
m,n
(r)exp(im" # i2$nz)
m= n
Estimation only at z = 0 is needed in the code. Representations shown above are needed when we estimate the derivative in z.
GK-pariticle model (3) Angular momentum : pz,sj = v z,sj + K s Az (s = e,i) where
" Ki = (" = a /R) 2#di mi Ke = $ Ki me Assumption : qi = e, qe = $e
GK-particle model (4) drsj 1 #$ (rsj ,% sj ) v z,sj #Az (rsj ,% sj ) =" + dt rsj #% rsj #% d% sj 1 $ (rsj ,% sj ) #Az* (rsj ,% sj ) ) = ( " v z,sj + dt rsj ' #r #r * & #$ (rsj ,% sj ) dpz,sj #Az (rsj ,% sj ) ) = K s(" + v z,sj + dt #z #z ' * where j = 1,2,, , ,,N and N is a number of simulation particles : N = N e = N i .
GK-particle model (5) Gyrokinetic Poisson's equation : N + 2% % 2 - *' (r ( rej )' () ( ) ej ) " #$ = &di -, N j=1 . % ( *' (r ( rij )' () ( ) ij )0 N j=1 0/ N
L.H.S is a polarization ion density response. Gyrokinetic Poisson's equation represents quasi - neutrality condition.
GK-particle model (6) Ampere's law : + 2 %1 1 (. -" # $ ' 2 + 2 *0 Az & de di )/ , N N + . 21 1 1 - 5 pze3 (r $ rej )3 (4 $ 4 ej ) $ 5 pzi3 (r $ rij )3 (4 $ 4 ij )0 = 2di -, N j=1 N j=1 0/ . A +1 N . Az + 1 N + 2 - 53 (r $ rej )3 (4 $ 4 ej ) $10 + 2z - 53 (r $ rij )3 (4 $ 4 ij ) $10 de -, N j=1 0/ di -, N j=1 0/
!f method (1) Decompose f s into equilibrium and perturbed parts. f s (r,", pz ,t) = f s0 (r, pz ) + #f s (r,", pz ,t) Perturbed part :
#f s (r,", pz ,t) = % w sj (t)# [ r $ rsj (t)]# [" $ " sj (t)] j
dw sj 1 ' dr &f s0 dpz &f s0 * = $(1$ w sj ) ) + , dt f s0 ( dt &r dt &pz +
r= rsj ," =" sj
!
!f method (2) Gyrokinetic Poisson's equation : N +% N . 2 % % - * w sj' (r ( rej )' () ( ) ej )( * w sj' (r ( rij )' () ( ) ij )0 " 2# $ = &di -, N j=1 N j=1 0/ Ampere's law : + 2 %1 1 (. -" # $ ' 2 + 2 *01Az & de di )/ , . 22 + 2 N 2 N - 5 pze w ej1 (r $ rej )1 (4 $ 4 ej ) $ 5 pzi w ij1 (r $ rij )1 (4 $ 4 ij )0 = 3di -, N j=1 N j=1 0/ . A +2 N . Az + 2 N + 2 - 5 w ej1 (r $ rej )1 (4 $ 4 ej )0 + 2z - 5 w ij1 (r $ rij )1 (4 $ 4 ij )0 de -, N j=1 0/ di -, N j=1 0/
Parameters Safety factor profile :
r q(r ) = q 1 ! 4 (1 ! q0 ) a ' % 0 % &%
q0 = 0.85, Equilibrium density profile:
+ + ,
* 2 $" ( ( " ) #"
!1
q(0.5a)=1.0, q(a) = 2.125
$! 0& & %
' r"r 0) n(r) = n 1 " # n tanh ln )(
r0/a = 0.5,
ln/a = 0.16,
"n = 0
! Key Parameters:
de / a=0.06,
!s / a=0.06,
Assumption : Single Helicity
m/n=1
!i / a=0.06
Magnetic Field Structure t = 17
R/a=18 m() 8 hours
4 million particles
Potential Profile t = 17
Perturbed Current Profile t = 17
Energy Conservation electron kinetic energy potential energy
t = 17 magnetic field energy
ion kin. energy total energy
Summary 1. New 2D gyro-PIC code for kinetic MHD is almost completed. cylindrical geometry non-uniform mesh in radial direction use only standard techniques 2. Kinetic internal kink mode simulation was done successfully. 3. Easy to compare with the GRM code. 3. Possible to do productive runs on single PC or small PC-cluster.
Future Plan 1. Try new techniques to treat high speed electrons. 2. Extend to multi-helicity (3D) code. 3. Toroidal effects.