You are on page 1of 183

The Particle-In-Cell (PIC)

simulation of plasmas
Mickael Grech, LULI, CNRS
mickael.grech@gmail.com

Les Houches, Mai 2019
References
References

Plasma Physics via Computer Simulation


C. K. Birdsall & A. B. Langdon
References

Plasma Physics via Computer Simulation


C. K. Birdsall & A. B. Langdon

Computational Electrodynamics
A. Taflove
References

Plasma Physics via Computer Simulation


C. K. Birdsall & A. B. Langdon

Computational Electrodynamics
A. Taflove

Numerical Recipies
W. H. Press et al.
The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
Cosmology

source: K. Heitmann, Argonne National Lab


The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
Cosmology Space propulsion (Plasma thruster)

source: K. Heitmann, Argonne National Lab source: Gauss Center for Supercomputing
The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
Cosmology Space propulsion (Plasma thruster)

source: K. Heitmann, Argonne National Lab source: Gauss Center for Supercomputing

Space plasmas & astrophysics

source: SMILEI dev-team


The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
Cosmology Space propulsion (Plasma thruster)

source: K. Heitmann, Argonne National Lab source: Gauss Center for Supercomputing

Space plasmas & astrophysics Laser plasma interaction

source: SMILEI dev-team


source: SMILEI dev-team
The Particle-In-Cell (PIC) method is a central tool for simulation
over a wide range of physics studies
Cosmology Space propulsion (Plasma thruster)

source: K. Heitmann, Argonne National Lab source: Gauss Center for Supercomputing

Space plasmas & astrophysics Laser plasma interaction

source: SMILEI dev-team


source: SMILEI dev-team
• Conceptually simple
• Efficiently implemented on (massively) parallel super-computers
Our starting point is the Vlasov-Maxwell description
for a collisionless plasma
Our starting point is the Vlasov-Maxwell description
for a collisionless plasma

Plasma

p
@ t fs + · rfs + FL ·rp fs = 0
ms
Our starting point is the Vlasov-Maxwell description
for a collisionless plasma

Plasma

p
@ t fs + · rfs + FL ·rp fs = 0
ms

Electromagnetic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54pTyXnq8Iw0KUl1HQBjpbuXiCgwIchlXXAjB7y//JWfr9cCvBycbtd3tQRwTbIkts1UWsE22y47YMWswwe7YI3thr9699+S9ee9frUPeYGaR/YD38QmEI6sO</latexit>
r⇥E
Our starting point is the Vlasov-Maxwell description
for a collisionless plasma

Plasma

p
@ t fs + · rfs + FL ·rp fs = 0
ms

Z
✓ ◆ ⇢(t, x) = dpfs (t, x, p)
p Z
FL = qs E+ ⇥B p
ms J(t, x) = qs dp fs (t, x, p)
ms

Electromagnetic Field
⇢ 1
r·E= @t E = J + c2 r ⇥ B
✏0 <latexit sha1_base64="TYRbxHaHQJHTE54Ro7kLa1sp9Zc=">AAACOHicbVDLSgMxFM34tr6qLt0Ei+CqzIigC4WCCO5UsFXolJLJ3LHBTDIkd8QyzGe58TPciRsXirj1C0wfC18HQg7n3Htzc6JMCou+/+RNTE5Nz8zOzVcWFpeWV6qray2rc8OhybXU5ipiFqRQ0ESBEq4yAyyNJFxGN0cD//IWjBVaXWA/g07KrpVIBGfopG71NFQskoyGPNZIQ4Q7HA4tDMRlEUYJPS7pIQ0Tw3jxzY5kDs43PV26CzIrpBvnl91qza/7Q9C/JBiTGhnjrFt9DGPN8xQUcsmsbQd+hp2CGRRcQlkJcwsZ4zfsGtqOKpaC7RTDJUq65ZSYJtq4o5AO1e8dBUut7aeRq0wZ9uxvbyD+57VzTPY7hVBZjqD46KEklxQ1HaRIY2GAo+w7wrgRblfKe8xlhC7rigsh+P3lv6S1Uw/8enC+W2scjOOYIxtkk2yTgOyRBjkhZ6RJOLknz+SVvHkP3ov37n2MSie8cc86+QHv8ws1q68W</latexit>

<latexit sha1_base64="BaebWYH9Fn4I75gFqCm1OgJ/Qm0=">AAACYXicbVFdSxtBFJ3dWj/Sqmt89GVoKBTEsBuE9sFCUATxyUKjQjaGu5O7OmR2dpm5WxKW/ZN986Uv/SNOPh6i8cLA4dxzv84khZKWwvDZ8z9sfNzc2t5pfPq8u7cfHDRvbV4agT2Rq9zcJ2BR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yfKlLTk+8/e0PDI6Nj4xGRlanpmdq46v3Bm09wIbIhUpeYiAotKamyQJIUXmUFIIoXn0fV+r35+g8bKVJ9SN8NWApdaxlIAOaldPQwzMCRBtYmHhLfUX1kY7JRFGMV8r+Q7fC3UECkISSZo/+s6KNvVml/3++B/STAgNTbAcbv6EHZSkSeoSSiwthn4GbWK3jFCYVkJc4sZiGu4xKajGpx1q+j7lnzFKR0ep8Y9Tbyvfp8oILG2m0SuMwG6sr9rPfG/WjOneKtVSJ3lhFp8GcW54pTyXnq8Iw0KUl1HQBjpbuXiCgwIchlXXAjB7y//JWfr9cCvBycbtd3tQRwTbIkts1UWsE22y47YMWswwe7YI3thr9699+S9ee9frUPeYGaR/YD38QmEI6sO</latexit>
r⇥E
1st Remark

Normalization: the Vlasov-Maxwell (relativistic) description 

provides us with a set of natural units
Velocity c
Plasma Charge e
Mass me
p Momentum me c
@ t fs + · rfs + FL ·rp fs = 0
ms Energy, Temperature me c2
Time !r 1
Length c/!r
Electromagnetic Field Number density nr = ✏0 me !r2 /e2
Current density e c nr
r·E=⇢
<latexit sha1_base64="Kv7Di3Bw6V2mFXdXfyWcywQnVGc=">AAACJHicbVBNSwMxEM36WetX1aOXYBE8lV0RVFAoiOBRwWqhW0o2O2uD2WRJZsWy7J/x4l/x4kHFgxd/i2ntQa0PBh7vzWQyL8qksOj7H97U9Mzs3Hxlobq4tLyyWltbv7I6NxxaXEtt2hGzIIWCFgqU0M4MsDSScB3dngz96zswVmh1iYMMuim7USIRnKGTerWjULFIMhryWCMNEe5x9GhhIC6LMEroaUmPfxqRzME5pq/LXq3uN/wR6CQJxqROxjjv1V7DWPM8BYVcMms7gZ9ht2AGBZdQVsPcQsb4LbuBjqOKpWC7xWhvSbedEtNEG1cK6Uj9OVGw1NpBGrnOlGHf/vWG4n9eJ8fkoFsIleUIin8vSnJJUdNhZDQWBjjKgSOMG+H+SnmfGcbRBVt1IQR/T54krd3GYSO42Ks3m+M0KmSTbJEdEpB90iRn5Jy0CCcP5Im8kFfv0Xv23rz379YpbzyzQX7B+/wC7RmmYw==</latexit>
@t E = J+r ⇥ B Pressure me c2 nr
Electric field me c !r /e
r·B=0 @t B = r⇥E
Magnetic field me !r /e
Poynting flux me c3 nr /2
1st Remark

Normalization: the Vlasov-Maxwell (relativistic) description 

provides us with a set of natural units
Velocity c
Plasma Charge e
Mass me
p Momentum me c
@ t fs + · rfs + FL ·rp fs = 0
ms Energy, Temperature me c2
Time !r 1
Length c/!r
Electromagnetic Field Number density nr = ✏0 me !r2 /e2
Current density e c nr
r·E=⇢
<latexit sha1_base64="Kv7Di3Bw6V2mFXdXfyWcywQnVGc=">AAACJHicbVBNSwMxEM36WetX1aOXYBE8lV0RVFAoiOBRwWqhW0o2O2uD2WRJZsWy7J/x4l/x4kHFgxd/i2ntQa0PBh7vzWQyL8qksOj7H97U9Mzs3Hxlobq4tLyyWltbv7I6NxxaXEtt2hGzIIWCFgqU0M4MsDSScB3dngz96zswVmh1iYMMuim7USIRnKGTerWjULFIMhryWCMNEe5x9GhhIC6LMEroaUmPfxqRzME5pq/LXq3uN/wR6CQJxqROxjjv1V7DWPM8BYVcMms7gZ9ht2AGBZdQVsPcQsb4LbuBjqOKpWC7xWhvSbedEtNEG1cK6Uj9OVGw1NpBGrnOlGHf/vWG4n9eJ8fkoFsIleUIin8vSnJJUdNhZDQWBjjKgSOMG+H+SnmfGcbRBVt1IQR/T54krd3GYSO42Ks3m+M0KmSTbJEdEpB90iRn5Jy0CCcP5Im8kFfv0Xv23rz379YpbzyzQX7B+/wC7RmmYw==</latexit>
@t E = J+r ⇥ B Pressure me c2 nr
Electric field me c !r /e
r·B=0 @t B = r⇥E
Magnetic field me !r /e
Poynting flux me c3 nr /2

The value of !r is not defined a priori, and acts as a scaling factor.


2nd Remark

The Particle-In-Cell method integrates Vlasov Equation

along the trajectories of so-called quasi-particles

Vlasov Eq. is a partial differential equation (PDE) in Ns+Nv phase-space:


p
@ t fs + · rfs + FL ·rp fs = 0
ms
2nd Remark

The Particle-In-Cell method integrates Vlasov Equation

along the trajectories of so-called quasi-particles

Vlasov Eq. is a partial differential equation (PDE) in Ns+Nv phase-space:


p
@ t fs + · rfs + FL ·rp fs = 0
ms

Direct integration (Vlasov codes) has tremendous computational cost!


2nd Remark

The Particle-In-Cell method integrates Vlasov Equation

along the trajectories of so-called quasi-particles

Vlasov Eq. is a partial differential equation (PDE) in Ns+Nv phase-space:


p
@ t fs + · rfs + FL ·rp fs = 0
ms

Direct integration (Vlasov codes) has tremendous computational cost!

The PIC ansatz consists in decomposing the distribution fct:


N
X
fs (t, x, p) = wp S(x xp (t)) (p pp (t))
p=1
Shape-function Dirac-distribution
2nd Remark

The Particle-In-Cell method integrates Vlasov Equation

along the trajectories of so-called quasi-particles
Injecting this ansatz in Vlasov Eq., multiplying by p and integrating over all momenta p
XNs
pp ⇥ ⇤
wp pp · @xp S(x xp ) + @x S(x xp )
p=1
m s p

Ns
X
+ wp S(x xp ) [@t pp qs (E + vp ⇥ B)] = 0
p=1

Let us now integrate in space:


Ns
X Z
pp ⇥ ⇤
wp pp · dx @xp S(x xp ) + @x S(x xp )
p=1
ms p
Ns
X Z
+ wp dxS(x xp ) [@t pp qs (E + vp ⇥ B)] = 0
p=1

Finally leading to solving for all p: Z


@t pp = qs (Ep + v ⇥ Bp ) with (E, B)p ⌘ dx (E, B)(x) S(x xp )
3rd Remark

If one does things in a smart way, only Maxwell-Ampère
& Maxwell-Faraday Eqs. need to be solved
3rd Remark

If one does things in a smart way, only Maxwell-Ampère
& Maxwell-Faraday Eqs. need to be solved

Take the divergence of Maxwell-Ampère’s Eq. :


r · (@t E + J = r ⇥ B)
,
<latexit sha1_base64="LxOXudg1rwfba8Jg7X89kdSdLLo=">AAACOHicbVBNa9tAEF25H3GdfjjJsZchpuBQMFIpNDkETEIg9ORC3RgsY0brlb14tRK7o4AR+lu55F/0FuilhyT02l/QteVAG/fBwOO9GWbmRZmSlnz/xqs9efrs+Vb9RWP75avXb5o7u99smhsu+jxVqRlEaIWSWvRJkhKDzAhMIiUuovnp0r+4FMbKVH+lRSZGCU61jCVHctK42Qs1Rgoh5JOUIFQipjaEGRqSqMYERRjFcFbC+4p9LuEYHkZIJsJW+kkJoZHTGR2Mmy2/468AmyRYkxZbozdufg8nKc8ToYkrtHYY+BmNiuUFXImyEeZWZMjnOBVDRzW6paNi9XkJ75wygTg1rjTBSv17osDE2kUSuc4EaWYfe0vxf94wp/hwVEid5SQ0rxbFuQJKYRkjTKQRnNTCEeRGuluBz9AgJxd2w4UQPH55k/Q/dI46wZePrW53nUadvWX7rM0C9ol12TnrsT7j7Ir9YLfszrv2fnr33q+qteatZ/bYP/B+/wFijqsQ</latexit>

<latexit sha1_base64="iOw7YmAr+4gcX6HqZt2jhstj9nI=">AAAB93icbVBNS8NAEN3Ur1o/GvXoZbEInkoignorePHgoYKxhTaUzXbTLt3sht2JUkN/iRcPKl79K978N27bHLT1wcDjvRlm5kWp4AY879sprayurW+UNytb2zu7VXdv/96oTFMWUCWUbkfEMMElC4CDYO1UM5JEgrWi0dXUbz0wbbiSdzBOWZiQgeQxpwSs1HOr3RsWg+aDIRCt1WPPrXl1bwa8TPyC1FCBZs/96vYVzRImgQpiTMf3UghzooFTwSaVbmZYSuiIDFjHUkkSZsJ8dvgEH1ulj2OlbUnAM/X3RE4SY8ZJZDsTAkOz6E3F/7xOBvFFmHOZZsAknS+KM4FB4WkKuM81oyDGlhCqub0V0yHRhILNqmJD8BdfXibBaf2y7t+e1RqNIo0yOkRH6AT56Bw10DVqogBRlKFn9IrenCfnxXl3PuatJaeYOUB/4Hz+AKAOk0M=</latexit>
<latexit

@t r · E + r · J = 0 <latexit sha1_base64="imD9vJizGCG+U84pAXpsJ0GXtwk=">AAACInicbVDJSgNBEO2JW4xb1KOXxiAIQpgRwQWEgAjiKYIxQiaEmk5P0qSnZ+iuEcKQf/Hir3jx4HYS/Bg7y0ETHxQ83quiql6QSGHQdb+c3Nz8wuJSfrmwsrq2vlHc3LozcaoZr7FYxvo+AMOlULyGAiW/TzSHKJC8HvQuhn79gWsjYnWL/YQ3I+goEQoGaKVW8cxPQKMA2ULqKwgkUJ+1Y6SZH4T0ckAP/pGvB/Scuq1iyS27I9BZ4k1IiUxQbRU//HbM0ogrZBKMaXhugs1suJ9JPij4qeEJsB50eMNSBRE3zWz044DuWaVNw1jbUkhH6u+JDCJj+lFgOyPArpn2huJ/XiPF8KSZCZWkyBUbLwpTSTGmw8BoW2jOUPYtAaaFvZWyLmhgaGMt2BC86ZdnSe2wfFr2bo5KlcokjTzZIbtkn3jkmFTIFamSGmHkkTyTV/LmPDkvzrvzOW7NOZOZbfIHzvcPVGqiXA==</latexit>
3rd Remark

If one does things in a smart way, only Maxwell-Ampère
& Maxwell-Faraday Eqs. need to be solved

Take the divergence of Maxwell-Ampère’s Eq. :


r · (@t E + J = r ⇥ B)
,
<latexit sha1_base64="LxOXudg1rwfba8Jg7X89kdSdLLo=">AAACOHicbVBNa9tAEF25H3GdfjjJsZchpuBQMFIpNDkETEIg9ORC3RgsY0brlb14tRK7o4AR+lu55F/0FuilhyT02l/QteVAG/fBwOO9GWbmRZmSlnz/xqs9efrs+Vb9RWP75avXb5o7u99smhsu+jxVqRlEaIWSWvRJkhKDzAhMIiUuovnp0r+4FMbKVH+lRSZGCU61jCVHctK42Qs1Rgoh5JOUIFQipjaEGRqSqMYERRjFcFbC+4p9LuEYHkZIJsJW+kkJoZHTGR2Mmy2/468AmyRYkxZbozdufg8nKc8ToYkrtHYY+BmNiuUFXImyEeZWZMjnOBVDRzW6paNi9XkJ75wygTg1rjTBSv17osDE2kUSuc4EaWYfe0vxf94wp/hwVEid5SQ0rxbFuQJKYRkjTKQRnNTCEeRGuluBz9AgJxd2w4UQPH55k/Q/dI46wZePrW53nUadvWX7rM0C9ol12TnrsT7j7Ir9YLfszrv2fnr33q+qteatZ/bYP/B+/wFijqsQ</latexit>

<latexit sha1_base64="iOw7YmAr+4gcX6HqZt2jhstj9nI=">AAAB93icbVBNS8NAEN3Ur1o/GvXoZbEInkoignorePHgoYKxhTaUzXbTLt3sht2JUkN/iRcPKl79K978N27bHLT1wcDjvRlm5kWp4AY879sprayurW+UNytb2zu7VXdv/96oTFMWUCWUbkfEMMElC4CDYO1UM5JEgrWi0dXUbz0wbbiSdzBOWZiQgeQxpwSs1HOr3RsWg+aDIRCt1WPPrXl1bwa8TPyC1FCBZs/96vYVzRImgQpiTMf3UghzooFTwSaVbmZYSuiIDFjHUkkSZsJ8dvgEH1ulj2OlbUnAM/X3RE4SY8ZJZDsTAkOz6E3F/7xOBvFFmHOZZsAknS+KM4FB4WkKuM81oyDGlhCqub0V0yHRhILNqmJD8BdfXibBaf2y7t+e1RqNIo0yOkRH6AT56Bw10DVqogBRlKFn9IrenCfnxXl3PuatJaeYOUB/4Hz+AKAOk0M=</latexit>
<latexit

@t r · E + r · J = 0 <latexit sha1_base64="imD9vJizGCG+U84pAXpsJ0GXtwk=">AAACInicbVDJSgNBEO2JW4xb1KOXxiAIQpgRwQWEgAjiKYIxQiaEmk5P0qSnZ+iuEcKQf/Hir3jx4HYS/Bg7y0ETHxQ83quiql6QSGHQdb+c3Nz8wuJSfrmwsrq2vlHc3LozcaoZr7FYxvo+AMOlULyGAiW/TzSHKJC8HvQuhn79gWsjYnWL/YQ3I+goEQoGaKVW8cxPQKMA2ULqKwgkUJ+1Y6SZH4T0ckAP/pGvB/Scuq1iyS27I9BZ4k1IiUxQbRU//HbM0ogrZBKMaXhugs1suJ9JPij4qeEJsB50eMNSBRE3zWz044DuWaVNw1jbUkhH6u+JDCJj+lFgOyPArpn2huJ/XiPF8KSZCZWkyBUbLwpTSTGmw8BoW2jOUPYtAaaFvZWyLmhgaGMt2BC86ZdnSe2wfFr2bo5KlcokjTzZIbtkn3jkmFTIFamSGmHkkTyTV/LmPDkvzrvzOW7NOZOZbfIHzvcPVGqiXA==</latexit>

Assume charge is conserved, i.e., @t ⇢ + r · J = 0 <latexit sha1_base64="zTAP8yLWV0DmxWIHTkKJ80sA/vw=">AAACE3icbVBNSxxBEO1ZNdHVJKsevRQugrCwzIRAkkNgwUvwpOCqsDMsNb09u832dA/dNYFl2B/hJX8lFw9RvHrJLf/G3nUOfj0oeLxXRVW9tFDSURj+Dxorq2vv3q9vNDe3Pnz81NreOXemtFz0uVHGXqbohJJa9EmSEpeFFZinSlyk06OFf/FLWCeNPqNZIZIcx1pmkiN5adjqxAVakqiGBLGdGOhArDFVCDEfGYIqTjM4nsMPCGHYaofdcAl4TaKatFmNk2HrXzwyvMyFJq7QuUEUFpRUi4VciXkzLp0okE9xLAaeasyFS6rlU3M48MoIMmN9aYKl+nSiwty5WZ76zhxp4l56C/Etb1BS9i2ppC5KEpo/LspKBWRgkRCMpBWc1MwT5Fb6W4FP0CInn2PThxC9fPk16X/ufu9Gp1/avV6dxjrbY/vskEXsK+uxn+yE9RlnV+wP+8tugt/BdXAb3D22NoJ6Zpc9Q3D/APxBnGo=</latexit>


3rd Remark

If one does things in a smart way, only Maxwell-Ampère
& Maxwell-Faraday Eqs. need to be solved

Take the divergence of Maxwell-Ampère’s Eq. :


r · (@t E + J = r ⇥ B)
,
<latexit sha1_base64="LxOXudg1rwfba8Jg7X89kdSdLLo=">AAACOHicbVBNa9tAEF25H3GdfjjJsZchpuBQMFIpNDkETEIg9ORC3RgsY0brlb14tRK7o4AR+lu55F/0FuilhyT02l/QteVAG/fBwOO9GWbmRZmSlnz/xqs9efrs+Vb9RWP75avXb5o7u99smhsu+jxVqRlEaIWSWvRJkhKDzAhMIiUuovnp0r+4FMbKVH+lRSZGCU61jCVHctK42Qs1Rgoh5JOUIFQipjaEGRqSqMYERRjFcFbC+4p9LuEYHkZIJsJW+kkJoZHTGR2Mmy2/468AmyRYkxZbozdufg8nKc8ToYkrtHYY+BmNiuUFXImyEeZWZMjnOBVDRzW6paNi9XkJ75wygTg1rjTBSv17osDE2kUSuc4EaWYfe0vxf94wp/hwVEid5SQ0rxbFuQJKYRkjTKQRnNTCEeRGuluBz9AgJxd2w4UQPH55k/Q/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Ibtkn3jkmFTIFamSGmHkkTyTV/LmPDkvzrvzOW7NOZOZbfIHzvcPVGqiXA==</latexit>

Assume charge is conserved, i.e., @t ⇢ + r · J = 0 <latexit sha1_base64="zTAP8yLWV0DmxWIHTkKJ80sA/vw=">AAACE3icbVBNSxxBEO1ZNdHVJKsevRQugrCwzIRAkkNgwUvwpOCqsDMsNb09u832dA/dNYFl2B/hJX8lFw9RvHrJLf/G3nUOfj0oeLxXRVW9tFDSURj+Dxorq2vv3q9vNDe3Pnz81NreOXemtFz0uVHGXqbohJJa9EmSEpeFFZinSlyk06OFf/FLWCeNPqNZIZIcx1pmkiN5adjqxAVakqiGBLGdGOhArDFVCDEfGYIqTjM4nsMPCGHYaofdcAl4TaKatFmNk2HrXzwyvMyFJq7QuUEUFpRUi4VciXkzLp0okE9xLAaeasyFS6rlU3M48MoIMmN9aYKl+nSiwty5WZ76zhxp4l56C/Etb1BS9i2ppC5KEpo/LspKBWRgkRCMpBWc1MwT5Fb6W4FP0CInn2PThxC9fPk16X/ufu9Gp1/avV6dxjrbY/vskEXsK+uxn+yE9RlnV+wP+8tugt/BdXAb3D22NoJ6Zpc9Q3D/APxBnGo=</latexit>

One gets: @t (r · E
<latexit sha1_base64="CpsL09UBDxu5xNYCkMt9wxNn+Y0=">AAACE3icbVA9SwNBEN3zM8avqKXNYhAiYrgTQS2EgAiWCkaFXAhzm71kyd7usTsnhCM/wsa/YmOhYmtj579xE1No9MHA470ZZuZFqRQWff/Tm5qemZ2bLywUF5eWV1ZLa+vXVmeG8TrTUpvbCCyXQvE6CpT8NjUckkjym6h3OvRv7rixQqsr7Ke8mUBHiVgwQCe1SrthCgYFyBbSSqggkhCytsY8jGJ6NqB7NDRdvUNPqE9bpbJf9Uegf0kwJmUyxkWr9BG2NcsSrpBJsLYR+Ck28+FCJvmgGGaWp8B60OENRxUk3Dbz0VMDuu2UNo21caWQjtSfEzkk1vaTyHUmgF076Q3F/7xGhvFRMxcqzZAr9r0oziRFTYcJ0bYwnKHsOwLMCHcrZV0wwNDlWHQhBJMv/yX1/epxNbg8KNdq4zQKZJNskQoJyCGpkXNyQeqEkXvySJ7Ji/fgPXmv3tt365Q3ntkgv+C9fwEZMpx4</latexit>
⇢) = 0
3rd Remark

If one does things in a smart way, only Maxwell-Ampère
& Maxwell-Faraday Eqs. need to be solved

Take the divergence of Maxwell-Ampère’s Eq. :


r · (@t E + J = r ⇥ B)
,
<latexit sha1_base64="LxOXudg1rwfba8Jg7X89kdSdLLo=">AAACOHicbVBNa9tAEF25H3GdfjjJsZchpuBQMFIpNDkETEIg9ORC3RgsY0brlb14tRK7o4AR+lu55F/0FuilhyT02l/QteVAG/fBwOO9GWbmRZmSlnz/xqs9efrs+Vb9RWP75avXb5o7u99smhsu+jxVqRlEaIWSWvRJkhKDzAhMIiUuovnp0r+4FMbKVH+lRSZGCU61jCVHctK42Qs1Rgoh5JOUIFQipjaEGRqSqMYERRjFcFbC+4p9LuEYHkZIJsJW+kkJoZHTGR2Mmy2/468AmyRYkxZbozdufg8nKc8ToYkrtHYY+BmNiuUFXImyEeZWZMjnOBVDRzW6paNi9XkJ75wygTg1rjTBSv17osDE2kUSuc4EaWYfe0vxf94wp/hwVEid5SQ0rxbFuQJKYRkjTKQRnNTCEeRGuluBz9AgJxd2w4UQPH55k/Q/dI46wZePrW53nUadvWX7rM0C9ol12TnrsT7j7Ir9YLfszrv2fnr33q+qteatZ/bYP/B+/wFijqsQ</latexit>

<latexit sha1_base64="iOw7YmAr+4gcX6HqZt2jhstj9nI=">AAAB93icbVBNS8NAEN3Ur1o/GvXoZbEInkoignorePHgoYKxhTaUzXbTLt3sht2JUkN/iRcPKl79K978N27bHLT1wcDjvRlm5kWp4AY879sprayurW+UNytb2zu7VXdv/96oTFMWUCWUbkfEMMElC4CDYO1UM5JEgrWi0dXUbz0wbbiSdzBOWZiQgeQxpwSs1HOr3RsWg+aDIRCt1WPPrXl1bwa8TPyC1FCBZs/96vYVzRImgQpiTMf3UghzooFTwSaVbmZYSuiIDFjHUkkSZsJ8dvgEH1ulj2OlbUnAM/X3RE4SY8ZJZDsTAkOz6E3F/7xOBvFFmHOZZsAknS+KM4FB4WkKuM81oyDGlhCqub0V0yHRhILNqmJD8BdfXibBaf2y7t+e1RqNIo0yOkRH6AT56Bw10DVqogBRlKFn9IrenCfnxXl3PuatJaeYOUB/4Hz+AKAOk0M=</latexit>
<latexit

@t r · E + r · J = 0 <latexit sha1_base64="imD9vJizGCG+U84pAXpsJ0GXtwk=">AAACInicbVDJSgNBEO2JW4xb1KOXxiAIQpgRwQWEgAjiKYIxQiaEmk5P0qSnZ+iuEcKQf/Hir3jx4HYS/Bg7y0ETHxQ83quiql6QSGHQdb+c3Nz8wuJSfrmwsrq2vlHc3LozcaoZr7FYxvo+AMOlULyGAiW/TzSHKJC8HvQuhn79gWsjYnWL/YQ3I+goEQoGaKVW8cxPQKMA2ULqKwgkUJ+1Y6SZH4T0ckAP/pGvB/Scuq1iyS27I9BZ4k1IiUxQbRU//HbM0ogrZBKMaXhugs1suJ9JPij4qeEJsB50eMNSBRE3zWz044DuWaVNw1jbUkhH6u+JDCJj+lFgOyPArpn2huJ/XiPF8KSZCZWkyBUbLwpTSTGmw8BoW2jOUPYtAaaFvZWyLmhgaGMt2BC86ZdnSe2wfFr2bo5KlcokjTzZIbtkn3jkmFTIFamSGmHkkTyTV/LmPDkvzrvzOW7NOZOZbfIHzvcPVGqiXA==</latexit>

Assume charge is conserved, i.e., @t ⇢ + r · J = 0 <latexit sha1_base64="zTAP8yLWV0DmxWIHTkKJ80sA/vw=">AAACE3icbVBNSxxBEO1ZNdHVJKsevRQugrCwzIRAkkNgwUvwpOCqsDMsNb09u832dA/dNYFl2B/hJX8lFw9RvHrJLf/G3nUOfj0oeLxXRVW9tFDSURj+Dxorq2vv3q9vNDe3Pnz81NreOXemtFz0uVHGXqbohJJa9EmSEpeFFZinSlyk06OFf/FLWCeNPqNZIZIcx1pmkiN5adjqxAVakqiGBLGdGOhArDFVCDEfGYIqTjM4nsMPCGHYaofdcAl4TaKatFmNk2HrXzwyvMyFJq7QuUEUFpRUi4VciXkzLp0okE9xLAaeasyFS6rlU3M48MoIMmN9aYKl+nSiwty5WZ76zhxp4l56C/Etb1BS9i2ppC5KEpo/LspKBWRgkRCMpBWc1MwT5Fb6W4FP0CInn2PThxC9fPk16X/ufu9Gp1/avV6dxjrbY/vskEXsK+uxn+yE9RlnV+wP+8tugt/BdXAb3D22NoJ6Zpc9Q3D/APxBnGo=</latexit>

One gets: @t (r · E
<latexit sha1_base64="CpsL09UBDxu5xNYCkMt9wxNn+Y0=">AAACE3icbVA9SwNBEN3zM8avqKXNYhAiYrgTQS2EgAiWCkaFXAhzm71kyd7usTsnhCM/wsa/YmOhYmtj579xE1No9MHA470ZZuZFqRQWff/Tm5qemZ2bLywUF5eWV1ZLa+vXVmeG8TrTUpvbCCyXQvE6CpT8NjUckkjym6h3OvRv7rixQqsr7Ke8mUBHiVgwQCe1SrthCgYFyBbSSqggkhCytsY8jGJ6NqB7NDRdvUNPqE9bpbJf9Uegf0kwJmUyxkWr9BG2NcsSrpBJsLYR+Ck28+FCJvmgGGaWp8B60OENRxUk3Dbz0VMDuu2UNo21caWQjtSfEzkk1vaTyHUmgF076Q3F/7xGhvFRMxcqzZAr9r0oziRFTYcJ0bYwnKHsOwLMCHcrZV0wwNDlWHQhBJMv/yX1/epxNbg8KNdq4zQKZJNskQoJyCGpkXNyQeqEkXvySJ7Ji/fgPXmv3tt365Q3ntkgv+C9fwEZMpx4</latexit>
⇢) = 0

If at time t=0, Poisson & Gauss Eqs. are satisfied,


and if current deposition is made in a way that conserve charge,
then solving only Maxwell-Ampère & Maxwell-Faraday ensures
that both Eqs. remain satisfied at later time.
Initialization of a PIC simulation
Initialization of a PIC simulation

1) for each species of your plasma, create your quasi-particles


e.g. defining the species density, velocity and temperature profiles
Initialization of a PIC simulation
⇢, J

1) for each species of your plasma, create your quasi-particles


e.g. defining the species density, velocity and temperature profiles

2) loop over all particles and project charge and current density
onto the grid
Initialization of a PIC simulation
⇢, J

1) for each species of your plasma, create your quasi-particles


e.g. defining the species density, velocity and temperature profiles

2) loop over all particles and project charge and current density
onto the grid

3) knowing the charge density solve Poisson’s Eq. to get


the electrostatic field
Initialization of a PIC simulation
⇢, J

E, B

1) for each species of your plasma, create your quasi-particles


e.g. defining the species density, velocity and temperature profiles

2) loop over all particles and project charge and current density
onto the grid

3) knowing the charge density solve Poisson’s Eq. to get


the electrostatic field

4) add any (user defined) external fields provided they are divergence-free
The Particle-In-Cell loop
⇢, J

E, B
The Particle-In-Cell loop
⇢, J

E, B

Gather fields at particle position


[E, B] ! [Ep , Bp ]
The Particle-In-Cell loop
⇢, J

E, B

Gather fields at particle position


[E, B] ! [Ep , Bp ]

Push all particles


qs
dt u p = FL
8p ms
dt x p = u p / p
The Particle-In-Cell loop
⇢, J

E, B

Gather fields at particle position


[E, B] ! [Ep , Bp ]

Push all particles


qs
dt u p = FL
8p ms
dt x p = u p / p

Project current densities on grid*


[xp , pp ] ! [⇢, J]

* using a charge conserving scheme


The Particle-In-Cell loop
⇢, J

E, B

Gather fields at particle position


[E, B] ! [Ep , Bp ]

Solve Maxwell’s Eqs. Push all particles


@t E = J+r ⇥ B qs
dt u p = FL
8p ms
@t B = r⇥E dt x p = u p / p

Project current densities on grid*


[xp , pp ] ! [⇢, J]

* using a charge conserving scheme


The Particle-In-Cell loop
⇢, J

E, B

Gather fields at particle position


[E, B] ! [Ep , Bp ]

Solve Maxwell’s Eqs. Push all particles


@t E = J+r ⇥ B qs
t dt u p = FL
8p ms
@t B = r⇥E dt x p = u p / p

Project current densities on grid*


[xp , pp ] ! [⇢, J]

* using a charge conserving scheme


Outlines

• Numerical approach: how to build up your PIC code

• Parallelization: getting ready for the super-computers

• Additional modules: beyond the collisionless plasma

• Some physics highlights: what you can do with a PIC code


Outlines

• Numerical approach: how to build up your PIC code

• Parallelization: getting ready for the super-computers

• Additional modules: beyond the collisionless plasma

• Some physics highlights: what you can do with a PIC code


Step 1
Field gathering: interpolation at particle position
Step 1
Field gathering: interpolation at particle position

E, B
Step 1
Field gathering: interpolation at particle position

E, B
Step 1
Field gathering: interpolation at particle position

x
E, B E, B
Step 1
Field gathering: interpolation at particle position

x
E, B E, B
Step 1
Field gathering: interpolation at particle position

S(x)

x
E, B E, B
Step 1
Field gathering: interpolation at particle position

S(x)

x
E, B E, B
Step 1
Field gathering: interpolation at particle position

S(x)

x
E, B E, B

Z
(E, B)p ⌘ dx (E, B)(x) S(x xp )
Step 1
Field gathering: interpolation at particle position

S(x)

x
E, B E, B

Z
(E, B)p ⌘ dx (E, B)(x) S(x xp )
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
x(n)
p
E(n) , B(n)
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
x(n)
p
E(n) , B(n)

t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
x(n)
p
E(n) , B(n)
1
(n 2)
up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
x(n)
p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t

1
(n 2)
up
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t

1
(n 2) qs t 1
um = up + Ep (n 2)
ms 2 up
um
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t

1
(n 2) qs t 1
um = up + Ep (n 2)
ms 2 up
1 um
up =
(n
up 2 ) + qs t M(Bp ) um
ms up
Step 2
The Boris leap-frog pusher is a very popular method
to advance particles

n t t
(n+1)
x(n)
p x p
E(n) , B(n)
1 1
(n (n+ 2 )
up 2) up t
(n 1
2) t (n + 12 ) t

1
(n 2) qs t 1
um = up + Ep (n 2)
ms 2 up
1 um
(n 2 ) qs
up = up + t M(Bp ) um
ms up
1
(n+ 2 ) qs t 1
(n+ 2 )
up = up + Ep up
ms 2
Step 3
Charge-conserving current deposition scheme are available
among which Esirkepov’s is ‘most’ popular

xx

Esirkepov, Comp. Phys. Comm. 135, 144 (2001)


Step 3
Charge-conserving current deposition scheme are available
among which Esirkepov’s is ‘most’ popular

xx
(n)
xp
<latexit sha1_base64="v99XcHHQZRnT1nDUY8D6sfDiTBQ=">AAACBHicbVA9SwNBEN2LXzF+RS3THAYhNuFOBC0DNpYRzAck8djbTJIle3vH7pwkHFfY+FdsLBSx9UfY+W/cJFdo4oOBx3szOzvPjwTX6DjfVm5tfWNzK79d2Nnd2z8oHh41dRgrBg0WilC1fapBcAkN5CigHSmggS+g5Y+vZ37rAZTmobzDaQS9gA4lH3BG0UhesdRFmOD8ncQXMaTJxIvuk4o8S1OvWHaqzhz2KnEzUiYZ6l7xq9sPWRyARCao1h3XibCXUIWcCUgL3VhDRNmYDqFjqKQB6F4yX57ap0bp24NQmZJoz9XfEwkNtJ4GvukMKI70sjcT//M6MQ6uegmXUYwg2WLRIBY2hvYsEbvPFTAUU0MoU9z81WYjqihDk1vBhOAun7xKmudV16m6txflWi2LI09K5IRUiEsuSY3ckDppEEYeyTN5JW/Wk/VivVsfi9aclc0ckz+wPn8A+3yY6w==</latexit>

Esirkepov, Comp. Phys. Comm. 135, 144 (2001)


Step 3
Charge-conserving current deposition scheme are available
among which Esirkepov’s is ‘most’ popular

xx
(n)
xp
<latexit sha1_base64="v99XcHHQZRnT1nDUY8D6sfDiTBQ=">AAACBHicbVA9SwNBEN2LXzF+RS3THAYhNuFOBC0DNpYRzAck8djbTJIle3vH7pwkHFfY+FdsLBSx9UfY+W/cJFdo4oOBx3szOzvPjwTX6DjfVm5tfWNzK79d2Nnd2z8oHh41dRgrBg0WilC1fapBcAkN5CigHSmggS+g5Y+vZ37rAZTmobzDaQS9gA4lH3BG0UhesdRFmOD8ncQXMaTJxIvuk4o8S1OvWHaqzhz2KnEzUiYZ6l7xq9sPWRyARCao1h3XibCXUIWcCUgL3VhDRNmYDqFjqKQB6F4yX57ap0bp24NQmZJoz9XfEwkNtJ4GvukMKI70sjcT//M6MQ6uegmXUYwg2WLRIBY2hvYsEbvPFTAUU0MoU9z81WYjqihDk1vBhOAun7xKmudV16m6txflWi2LI09K5IRUiEsuSY3ckDppEEYeyTN5JW/Wk/VivVsfi9aclc0ckz+wPn8A+3yY6w==</latexit>
x(n+1)
p
<latexit sha1_base64="5a+gLP7Z3Z/pKXGa6SgJrKe6wK8=">AAACBXicbVDLSsNAFJ3UV62vqktdBItQEUoigi4LblxWsA9oY5hMb9uhk0mYuZGWkI0bf8WNC0Xc+g/u/Bunj4VWD1w4nHPv3LkniAXX6DhfVm5peWV1Lb9e2Njc2t4p7u41dJQoBnUWiUi1AqpBcAl15CigFSugYSCgGQyvJn7zHpTmkbzFcQxeSPuS9zijaCS/eNhBGOH0nVRBN0tHfnyXluWpe5JlfrHkVJwp7L/EnZMSmaPmFz873YglIUhkgmrddp0YvZQq5ExAVugkGmLKhrQPbUMlDUF76XR7Zh8bpWv3ImVKoj1Vf06kNNR6HAamM6Q40IveRPzPayfYu/RSLuMEQbLZol4ibIzsSSR2lytgKMaGUKa4+avNBlRRhia4ggnBXTz5L2mcVVyn4t6cl6rVeRx5ckCOSJm45IJUyTWpkTph5IE8kRfyaj1az9ab9T5rzVnzmX3yC9bHNxCEmOQ=</latexit>

Esirkepov, Comp. Phys. Comm. 135, 144 (2001)


Step 3
Charge-conserving current deposition scheme are available
among which Esirkepov’s is ‘most’ popular

xx
(n)
xp
<latexit sha1_base64="v99XcHHQZRnT1nDUY8D6sfDiTBQ=">AAACBHicbVA9SwNBEN2LXzF+RS3THAYhNuFOBC0DNpYRzAck8djbTJIle3vH7pwkHFfY+FdsLBSx9UfY+W/cJFdo4oOBx3szOzvPjwTX6DjfVm5tfWNzK79d2Nnd2z8oHh41dRgrBg0WilC1fapBcAkN5CigHSmggS+g5Y+vZ37rAZTmobzDaQS9gA4lH3BG0UhesdRFmOD8ncQXMaTJxIvuk4o8S1OvWHaqzhz2KnEzUiYZ6l7xq9sPWRyARCao1h3XibCXUIWcCUgL3VhDRNmYDqFjqKQB6F4yX57ap0bp24NQmZJoz9XfEwkNtJ4GvukMKI70sjcT//M6MQ6uegmXUYwg2WLRIBY2hvYsEbvPFTAUU0MoU9z81WYjqihDk1vBhOAun7xKmudV16m6txflWi2LI09K5IRUiEsuSY3ckDppEEYeyTN5JW/Wk/VivVsfi9aclc0ckz+wPn8A+3yY6w==</latexit>
x(n+1)
p
<latexit sha1_base64="5a+gLP7Z3Z/pKXGa6SgJrKe6wK8=">AAACBXicbVDLSsNAFJ3UV62vqktdBItQEUoigi4LblxWsA9oY5hMb9uhk0mYuZGWkI0bf8WNC0Xc+g/u/Bunj4VWD1w4nHPv3LkniAXX6DhfVm5peWV1Lb9e2Njc2t4p7u41dJQoBnUWiUi1AqpBcAl15CigFSugYSCgGQyvJn7zHpTmkbzFcQxeSPuS9zijaCS/eNhBGOH0nVRBN0tHfnyXluWpe5JlfrHkVJwp7L/EnZMSmaPmFz873YglIUhkgmrddp0YvZQq5ExAVugkGmLKhrQPbUMlDUF76XR7Zh8bpWv3ImVKoj1Vf06kNNR6HAamM6Q40IveRPzPayfYu/RSLuMEQbLZol4ibIzsSSR2lytgKMaGUKa4+avNBlRRhia4ggnBXTz5L2mcVVyn4t6cl6rVeRx5ckCOSJm45IJUyTWpkTph5IE8kRfyaj1az9ab9T5rzVnzmX3yC9bHNxCEmOQ=</latexit>

In 1D, current deposition is easily done directly from charge conservation:


@ x Jx = @ t ⇢
while other component are ‘directly’ projected onto the grid (see interpolation)

Esirkepov, Comp. Phys. Comm. 135, 144 (2001)


Step 3
Charge-conserving current deposition scheme are available
among which Esirkepov’s is ‘most’ popular

xx
(n)
xp
<latexit sha1_base64="v99XcHHQZRnT1nDUY8D6sfDiTBQ=">AAACBHicbVA9SwNBEN2LXzF+RS3THAYhNuFOBC0DNpYRzAck8djbTJIle3vH7pwkHFfY+FdsLBSx9UfY+W/cJFdo4oOBx3szOzvPjwTX6DjfVm5tfWNzK79d2Nnd2z8oHh41dRgrBg0WilC1fapBcAkN5CigHSmggS+g5Y+vZ37rAZTmobzDaQS9gA4lH3BG0UhesdRFmOD8ncQXMaTJxIvuk4o8S1OvWHaqzhz2KnEzUiYZ6l7xq9sPWRyARCao1h3XibCXUIWcCUgL3VhDRNmYDqFjqKQB6F4yX57ap0bp24NQmZJoz9XfEwkNtJ4GvukMKI70sjcT//M6MQ6uegmXUYwg2WLRIBY2hvYsEbvPFTAUU0MoU9z81WYjqihDk1vBhOAun7xKmudV16m6txflWi2LI09K5IRUiEsuSY3ckDppEEYeyTN5JW/Wk/VivVsfi9aclc0ckz+wPn8A+3yY6w==</latexit>
x(n+1)
p
<latexit sha1_base64="5a+gLP7Z3Z/pKXGa6SgJrKe6wK8=">AAACBXicbVDLSsNAFJ3UV62vqktdBItQEUoigi4LblxWsA9oY5hMb9uhk0mYuZGWkI0bf8WNC0Xc+g/u/Bunj4VWD1w4nHPv3LkniAXX6DhfVm5peWV1Lb9e2Njc2t4p7u41dJQoBnUWiUi1AqpBcAl15CigFSugYSCgGQyvJn7zHpTmkbzFcQxeSPuS9zijaCS/eNhBGOH0nVRBN0tHfnyXluWpe5JlfrHkVJwp7L/EnZMSmaPmFz873YglIUhkgmrddp0YvZQq5ExAVugkGmLKhrQPbUMlDUF76XR7Zh8bpWv3ImVKoj1Vf06kNNR6HAamM6Q40IveRPzPayfYu/RSLuMEQbLZol4ibIzsSSR2lytgKMaGUKa4+avNBlRRhia4ggnBXTz5L2mcVVyn4t6cl6rVeRx5ckCOSJm45IJUyTWpkTph5IE8kRfyaj1az9ab9T5rzVnzmX3yC9bHNxCEmOQ=</latexit>

In 1D, current deposition is easily done directly from charge conservation:


@ x Jx = @ t ⇢
while other component are ‘directly’ projected onto the grid (see interpolation)

In 2D & 3D, Esirkepov’s method allows to conserve charge (within machine presicion)
1 1 1
(n+ 2 ) (n+ 2 ) x (n+ 2 )
(Jx,p ) 1 = (Jx,p ) 1 + qs wp (Wx ) 1
i+ 2 ,j i 2 ,j t i+ 2 ,j
1 1 1
(n+ 2 ) (n+ 2 ) y (n+ 2 )
(Jy,p ) 1 = (Jy,p ) 1 + qs w p (Wy ) 1
i,j+ 2 i,j 2 t j,i+ 2

Esirkepov, Comp. Phys. Comm. 135, 144 (2001)


Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t t

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
⇢(n)

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
⇢(n)
E(n)

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
⇢(n)
E(n) E(n+1)

Solving Ampère’s equation: @t Ey = Jy @ x Bz

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
1
⇢(n) B(n+ 2 )
E(n) E(n+1)

Solving Ampère’s equation: @t Ey = Jy @ x Bz


1
time-centering (Ey )(n+1) (Ey )(n) (n+ 2 ) (n+ 12 )
= Jy (@x Bz )
t

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
1
⇢(n) B(n+ 2 )
E(n) E(n+1)

Solving Ampère’s equation: @t Ey = Jy @ x Bz


1
time-centering (Ey )(n+1) (Ey )(n) (n+ 2 ) (n+ 12 )
= Jy (@x Bz )
t 1
(n+ 2 ) (n
1
(Bz ) 1 (Bz ) 2)
(n+1) (n) 1 1
space-centering (Ey )i (Ey )i (n+ 2 ) i+ 2 i+ 2
= (Jy )i
t x

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
1 3
⇢(n) B(n+ 2 ) B(n+ 2 )
E(n) E(n+1)

Solving Ampère’s equation: @t Ey = Jy @ x Bz


1
time-centering (Ey )(n+1) (Ey )(n) (n+ 2 ) (n+ 12 )
= Jy (@x Bz )
t 1
(n+ 2 ) (n
1
(Bz ) 1 (Bz ) 2)
(n+1) (n) 1 1
space-centering (Ey )i (Ey )i (n+ 2 ) i+ 2 i+ 2
= (Jy )i
t x

Solving Faraday’s equation: @t Bz = @x Ey

A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
The Finite-Difference Time-Domain (FDTD) method is
a popular method for solving Maxwell’s Equations
n t J(n+ 12 ) t
1 3
⇢(n) B(n+ 2 ) B(n+ 2 )
E(n) E(n+1)

Solving Ampère’s equation: @t Ey = Jy @ x Bz


1
time-centering (Ey )(n+1) (Ey )(n) (n+ 2 ) (n+ 12 )
= Jy (@x Bz )
t 1
(n+ 2 ) (n
1
(Bz ) 1 (Bz ) 2)
(n+1) (n) 1 1
space-centering (Ey )i (Ey )i (n+ 2 ) i+ 2 i+ 2
= (Jy )i
t x

Solving Faraday’s equation: @t Bz = @x Ey


3 1
(n+ 2 ) (n+ 2 )
(Bz )i+ 1 (Bz )i+ 1 (n+1) (n+1)
(Ey )i+1 (Ey )i
space/time-centering 2 2
=
t x
A. Taflove, Computation electrodynamics: The finite-difference time-domain method, 3rd Ed. (2005)
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition
The numerical electromagnetic wave equation in a vacuum

@tN E = +rN ⇥ B

@tN B = rN ⇥ E

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition
The numerical electromagnetic wave equation in a vacuum

1 1
(n+ 2 ) (n 2)
@tN F = t 1
F F
@tN E N
= +r ⇥ B
with: 
@tN B = rN ⇥ E @µN F = µ 1 F 1 F 1
i+ 2 i 2

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition
The numerical electromagnetic wave equation in a vacuum

1 1
(n+ 2 ) (n 2)
@tN F = t 1
F F
@tN E N
= +r ⇥ B
with: 
@tN B = rN ⇥ E @µN F = µ 1 F 1 F 1
i+ 2 i 2

Using the standard technique to derive the wave equation leads to:
X
N N
@tt E+ @µµ E=0
µ

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition
The numerical electromagnetic wave equation in a vacuum

1 1
(n+ 2 ) (n 2)
@tN F = t 1
F F
@tN E N
= +r ⇥ B
with: 
@tN B = rN ⇥ E @µN F = µ 1 F 1 F 1
i+ 2 i 2

Using the standard technique to derive the wave equation leads to:
X
N N
@tt E+ @µµ E=0
µ

Looking for numerical solution in the form:

(n) ⇥
(Ey ) 1 = Ey0 exp ı ikx x + (j + 12 )ky y
i,j+ 2 ,k
+kkz z n! t]}

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

After some algebra, one finds the numerical dispersion relation:


sin2 (! t/2) X sin2 (kµ µ/2)
2
= 2
t µ
µ

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

After some algebra, one finds the numerical dispersion relation:


sin2 (! t/2) X sin2 (kµ µ/2)
2
= 2
t µ
µ
There exists a stability condition: Courant-Friedrich-Lewy (CFL)
X 1/2
2
t< µ
µ

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

After some algebra, one finds the numerical dispersion relation:


sin2 (! t/2) X sin2 (kµ µ/2)
2
= 2
t µ
µ
There exists a stability condition: Courant-Friedrich-Lewy (CFL)
X 1/2 2D p
2
t< µ t< x/ 2
x= y
µ

Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
Step 4
Numerical analysis of the FDTD solvers gives you access to
the numerical dispersion relation & CFL condition

After some algebra, one finds the numerical dispersion relation:


sin2 (! t/2) X sin2 (kµ µ/2)
2
= 2
t µ
µ
There exists a stability condition: Courant-Friedrich-Lewy (CFL)
X 1/2 2D p
2
t< µ t< x/ 2
x= y
µ

vph /c
The FDTD solver is subject to numerical 1
dispersion as the numerical light wave 9
ky y
9
velocity is found to depend on its 0.
=

0.9
wavenumber and orientation. v ph

0.8
=
h

=
vp
0.7

h
vp
kx x
Nuter et al., Eur. Phys. J. D (2014); All papers by B. Godfrey, from the 70’s up to now !!!
A quick summary
The PIC approach in a nutshell
There are still a few things to know before running 

your first PIC simulation
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
• some numerical instabilities have to be taken care off carefully

- numerical heating usually requires 
 x . De
- numerical-Cherenkov can also plague simulation with relativistically 

drifting particles
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
• some numerical instabilities have to be taken care off carefully

- numerical heating usually requires 
 x . De
- numerical-Cherenkov can also plague simulation with relativistically 

drifting particles
• PIC codes are usually very robust, beware of your results!

A PIC code will most likely not crash, even if your simulation is 

complete non-sense!
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
• some numerical instabilities have to be taken care off carefully

- numerical heating usually requires 
 x . De
- numerical-Cherenkov can also plague simulation with relativistically 

drifting particles
• PIC codes are usually very robust, beware of your results!

A PIC code will most likely not crash, even if your simulation is 

complete non-sense!

• I did not discuss boundary conditions 



nor ghost-cells
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
• some numerical instabilities have to be taken care off carefully

- numerical heating usually requires 
 x . De
- numerical-Cherenkov can also plague simulation with relativistically 

drifting particles
• PIC codes are usually very robust, beware of your results!

A PIC code will most likely not crash, even if your simulation is 

complete non-sense!

• I did not discuss boundary conditions 



nor ghost-cells
There are still a few things to know before running 

your first PIC simulation
• noise is inherent to PIC code

electromagnetic fluctuations inherent to a thermal plasma

the level of noise is however much exaggerated in PIC codes
• some numerical instabilities have to be taken care off carefully

- numerical heating usually requires 
 x . De
- numerical-Cherenkov can also plague simulation with relativistically 

drifting particles
• PIC codes are usually very robust, beware of your results!

A PIC code will most likely not crash, even if your simulation is 

complete non-sense!

• I did not discuss boundary conditions 



nor ghost-cells
Outlines

• Numerical approach: how to build your PIC code

• High-performance computing:

getting ready for the super-computers

• Additional modules: beyond the collisionless plasma

• Some physics highlights: what you can do with a PIC code


Parallelization is mandatory for large-scale PIC simulation
Parallelization is mandatory for large-scale PIC simulation

Large scale PIC simulation of


magnetic reconnection at the earth magnetopause

t = 220 ⌦ci1
Simulation box: 1280 !cpi ⇥ 256 !cpi
ne 25600 ⇥ 10240 PIC cells
nr 1
run up to t = 800 ⌦
t = 370 ⌦ci1 ci
Nt ⇠ 9.5 ⇥ 105 timesteps
y !pi /c

for a total of 22 ⇥ 109 quasi-particles.

1
t= 800 ⌦ci

x !pi /c
Parallelization is mandatory for large-scale PIC simulation

Large scale PIC simulation of


magnetic reconnection at the earth magnetopause

t = 220 ⌦ci1
Simulation box: 1280 !cpi ⇥ 256 !cpi
ne 25600 ⇥ 10240 PIC cells
nr 1
run up to t = 800 ⌦
t = 370 ⌦ci1 ci
Nt ⇠ 9.5 ⇥ 105 timesteps
y !pi /c

for a total of 22 ⇥ 109 quasi-particles.

1
t= 800 ⌦ci
Required simulation time:
14 000 000 hours ~ 1600 years!!!

x !pi /c
Parallelization is mandatory for large-scale PIC simulation

Large scale PIC simulation of


magnetic reconnection at the earth magnetopause

t = 220 ⌦ci1
Simulation box: 1280 !cpi ⇥ 256 !cpi
ne 25600 ⇥ 10240 PIC cells
nr 1
run up to t = 800 ⌦
t = 370 ⌦ci1 ci
Nt ⇠ 9.5 ⇥ 105 timesteps
y !pi /c

for a total of 22 ⇥ 109 quasi-particles.

1
t= 800 ⌦ci
Required simulation time:
14 000 000 hours ~ 1600 years!!!

Solution:
x !pi /c
share the work on 16384 CPUs !!!
High-performance computing new paradigms & challenges
High-performance computing new paradigms & challenges

Tianhe-2 34 PF:
17 MW
High-performance computing new paradigms & challenges

Tianhe-2 34 PF: Exascale 1000 PF:


17 MW 500 MW
High-performance computing new paradigms & challenges

Tianhe-2 34 PF: Exascale 1000 PF:


17 MW 500 MW
High-performance computing new paradigms & challenges

Tianhe-2 34 PF: Exascale 1000 PF:


17 MW 500 MW

Parallelism*
massive

hybrid MPI-OpenMP
dynamic (load balance)
Memory
shared vs. distributed

cache use
Vectorization**
SIMD
Parallel I/O
hdf5, openPMD
High-performance computing new paradigms & challenges

Tianhe-2 34 PF: Exascale 1000 PF:


17 MW 500 MW

Parallelism*
massive

hybrid MPI-OpenMP
dynamic (load balance)
Memory
shared vs. distributed

cache use
Vectorization**
SIMD
Parallel I/O
hdf5, openPMD

*Derouillat et al., Comp. Phys. Comm. 222, 351 (2018)


**Beck et al., arXiv:1810.03949
Step 1: Parallelization

PIC codes are well adapted to massive parallelism
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Simulation (LWFA)
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

CE-2 CE-3

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

CE-4 CE-5

CE-6 CE-7

Patch Decomposition Shared memory


Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

CE-4 CE-5

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only
Dynamic scheduler

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only
Dynamic scheduler

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only
Dynamic scheduler

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

PIC codes are well adapted to massive parallelism

My Super-Computer
My Simulation (LWFA)
CE
computing element
CE-0 CE-1

MPI
Message

Passing
 CE-2 CE-3
Interface

OpenMP CE-4 CE-5


shared mem. only
Dynamic scheduler

CE-6 CE-7
Domain Decomposition
Patch Decomposition Shared memory
Step 1: Parallelization

Hybrid parallelization significantly improves performance
100 iterations [s]
time to compute

iteration number
Step 1: Parallelization

Hybrid parallelization significantly improves performance
100 iterations [s]
time to compute

time of bubble
formation

iteration number
Step 1: Parallelization

Hybrid parallelization significantly improves performance
100 iterations [s]
time to compute

768 MPI x 1 OMP

time of bubble
formation

iteration number
Step 1: Parallelization

Hybrid parallelization significantly improves performance
100 iterations [s]
time to compute

768 MPI x 1 OMP

time of bubble 384 MPI x 2 OMP


formation 256 MPI x 3 OMP
128 MPI x 6 OMP
64 MPI x 12 OMP

iteration number
Step 1: Parallelization

Hybrid parallelization significantly improves performance
100 iterations [s]
time to compute

speed-up x5 768 MPI x 1 OMP

time of bubble 384 MPI x 2 OMP


formation 256 MPI x 3 OMP
128 MPI x 6 OMP
64 MPI x 12 OMP

iteration number
Step 1: Parallelization

Dynamic load balancing further improve performances
Step 1: Parallelization

Dynamic load balancing further improve performances
Step 1: Parallelization

Dynamic load balancing further improve performances
Step 1: Parallelization

Dynamic load balancing further improve performances

128 MPI x 6 OMP

64 MPI x 12 OMP

same with DLB


Step 1: Parallelization

Dynamic load balancing further improve performances

128 MPI x 6 OMP

64 MPI x 12 OMP
speed-up x1.6
same with DLB
Step 1: Parallelization

Hybrid + Dynamic Load Balancing
Step 1: Parallelization

Hybrid + Dynamic Load Balancing

x 8
-u p
e d
p e
S
Step 2: Vectorization

Vectorization in a nutshell
Step 2: Vectorization

Vectorization in a nutshell

Beck et al., arXiv:1810.03949


Step 2: Vectorization

Vectorization in a nutshell

Smart (particles) operators:


- interpolator, pusher, projector


Beck et al., arXiv:1810.03949


Step 2: Vectorization

Vectorization in a nutshell

Smart (particles) operators:


- interpolator, pusher, projector

Smart (particles) data structures:
- beware random mem. access
- contiguous memory
- sort at all times!

Beck et al., arXiv:1810.03949
Step 2: Vectorization

SMILEI uses an adaptive vectorization approach
Step 2: Vectorization

SMILEI uses an adaptive vectorization approach

x2.6

x3
Step 2: Vectorization

Laser-driven hole-boring

@ 32 PPC : speed-up x 1.5


Step 2: Vectorization

Laser-driven hole-boring
Step 2: Vectorization

Laser-driven hole-boring
Step 2: Vectorization

Weibel-mediated collisionless shocks

Z
(c/ω)
a) X (c/ω)

Normalized electron
Y density (ne/nc)
(c/ω)

b) Front of the
right flow
Z Isotropization
(c/ω) region
Density
filaments Front of the
left flow

Y
(c/ω)

@ 32 PPC : speed-up x 1.5 Computational


Step 2: Vectorization

Weibel-mediated collisionless shocks
Step 2: Vectorization

Weibel-mediated collisionless shocks
Outlines

• Numerical approach: how to build your PIC code

• Parallelization: getting ready for the super-computers

• Additional modules: beyond the collisionless plasma

• Some physics highlights: what you can do with a PIC code


Collisions can be introduced using an ad-hoc Monte-Carlo module
Collisions can be introduced using an ad-hoc Monte-Carlo module

Collisions are computed inside the cell


Collisions can be introduced using an ad-hoc Monte-Carlo module

Collisions are computed inside the cell


To avoid the N-body problem, quasi-particles in the cell are randomly “paired”

species 1

species 2
Collisions can be introduced using an ad-hoc Monte-Carlo module

Collisions are computed inside the cell


To avoid the N-body problem, quasi-particles in the cell are randomly “paired”

species 1

species 2
Collisions can be introduced using an ad-hoc Monte-Carlo module

Collisions are computed inside the cell


To avoid the N-body problem, quasi-particles in the cell are randomly “paired”

species 1

species 2

A single particle goes through many ( N 1 ) collisions at small angle ✓


which translates in a total deflection angle (not necessarily small)

1
2
Collisions can be introduced using an ad-hoc Monte-Carlo module

Collisions are computed inside the cell


To avoid the N-body problem, quasi-particles in the cell are randomly “paired”

species 1

species 2

A single particle goes through many ( N 1 ) collisions at small angle ✓


which translates in a total deflection angle (not necessarily small)
for each pair (Monte-Carlo)

- compute the collision rate

1 - compute the deflection angle
2 - deflect one or both particles

Nanbu, Phys. Rev. E 55, 4642 (1997); J. Comp. Phys. 145, 639 (1998)
F. Pérez et al., Phys. Plasmas 19, 083104 (2012)
PIC codes are then able to treat purely collisional processes

Thermalization Isotropization
(hydrogen plasma) (electron plasma)

J. Derouillat et al., SMILEI: a collaborative, open-source, multi-purpose PIC code for plasma simulation,

to be submitted (available upon request)
Similarly field and collisional ionization can be treated using
a Monte-Carlo approach

Field ionization of Carbon by Stopping power of a cold aluminium


a 5x1016 W/cm2 20 fs laser pulse plasma of density 1021 cm-3
1.00
Z⋆ = 0
Z⋆ = 1
0.75 Z⋆ = 2
NZ ⋆ (t)/N0(t = 0)

Z⋆ = 3
Z⋆ = 4
0.50

0.25

0.00
0 4 8 12 16
b) ct/λ0

R. Nuter et al., Phys. Plasmas 18, 033107 (2011); F. Pérez et al., Phys. Plasmas 19, 083104 (2012)
J. Derouillat et al., SMILEI: a collaborative, open-source, multi-purpose PIC code for plasma simulation,

to be submitted (available upon request)
Adding Quantum Electrodynamics (QED) effect is also
very interesting for forthcoming multi-petawatt facilities
Adding Quantum Electrodynamics (QED) effect is also
very interesting for forthcoming multi-petawatt facilities
Nonlinear Thomson and
High-Energy Photon Production

Compton sca6ering

e
h

e +n L !e + h

Bremsstrahlung

e
Z+

h
Adding Quantum Electrodynamics (QED) effect is also
very interesting for forthcoming multi-petawatt facilities

Electron-Positron Pair Production


Nonlinear Thomson and Mul8-Photon
High-Energy Photon Production

Compton sca6ering Breit-Wheeler Process


e+
h
e e
h

e +n L !e + h h+n L ! e + e+
Bremsstrahlung Pair produc8on in strong
Coulomb field

e e
Z + e Z+
Z+
h
e + e+
h e
e
Outlines

• Numerical approach: how to build your PIC code

• Parallelization: getting ready for the super-computers

• Additional modules: beyond the collisionless plasma

• Some physics highlights: what you can do with a PIC code


PIC codes are an excellent tool to support theoretical modelling
Even 1D simulation can bring a deep insight into the physics at play
PIC codes are an excellent tool to support theoretical modelling
Even 1D simulation can bring a deep insight into the physics at play

Relativistically-Induced Transparency
PIC codes are an excellent tool to support theoretical modelling
Even 1D simulation can bring a deep insight into the physics at play

Relativistically-Induced Transparency

E. Siminos et al., Phys. Rev. E 86, 056404 (2012)


PIC codes are an excellent tool to support theoretical modelling
Even 1D simulation can bring a deep insight into the physics at play

Relativistically-Induced Transparency Weibel instability in the presence


of an external magnetic field

E. Siminos et al., Phys. Rev. E 86, 056404 (2012) A. Grassi et al., Phys. Rev. E (in press)
PIC codes can help design & interpret experimental campaigns
2D and 3D simulations on super-computers will be necessary here
PIC codes can help design & interpret experimental campaigns
2D and 3D simulations on super-computers will be necessary here

High-harmonic generation
& electron acceleration from
laser-solid interaction

G. Bouchard, F. Quéré, CEA/IRAMIS


PIC codes can help design & interpret experimental campaigns
2D and 3D simulations on super-computers will be necessary here

High-harmonic generation
& electron acceleration from
laser-solid interaction

G. Bouchard, F. Quéré, CEA/IRAMIS


PIC codes can help design & interpret experimental campaigns
2D and 3D simulations on super-computers will be necessary here

High-harmonic generation Laser wakefield acceleration


& electron acceleration from of electrons
laser-solid interaction

G. Bouchard, F. Quéré, CEA/IRAMIS


PIC codes can help design & interpret experimental campaigns
2D and 3D simulations on super-computers will be necessary here

High-harmonic generation Laser wakefield acceleration


& electron acceleration from of electrons
laser-solid interaction

G. Bouchard, F. Quéré, CEA/IRAMIS A. Sävert et al., Phys. Rev. Lett. 115, 055002 (2015)
PIC codes are very versatile: they can be applied to a wide range
of physical scenarii, from laser-plasma interaction to astrophysics
PIC codes are very versatile: they can be applied to a wide range
of physical scenarii, from laser-plasma interaction to astrophysics

Pair production on Relativistic shocks


multi-petawatt laser facilities in electron-positron plasmas

M. Lobet et al., arXiv:1510.02301v2 (2015) Plotnikov, Grassi & Grech, MNRAS


Conclusions
Conclusions

• PIC codes are very popular, versatile & efficient tools



for plasma simulation
Conclusions

• PIC codes are very popular, versatile & efficient tools



for plasma simulation
• A large variety of physical problems can be addressed

using PIC codes
Conclusions

• PIC codes are very popular, versatile & efficient tools



for plasma simulation
• A large variety of physical problems can be addressed

using PIC codes
• Additional physics modules can be implemented in PIC codes,

but the physics cannot be scaled anymore ( !r needs to be defined!)
Conclusions

• PIC codes are very popular, versatile & efficient tools



for plasma simulation
• A large variety of physical problems can be addressed

using PIC codes
• Additional physics modules can be implemented in PIC codes,

but the physics cannot be scaled anymore ( !r needs to be defined!)
• The PIC method is conceptually simple & can be efficiently

implemented in a (massively) parallel framework
Conclusions

• PIC codes are very popular, versatile & efficient tools



for plasma simulation
• A large variety of physical problems can be addressed

using PIC codes
• Additional physics modules can be implemented in PIC codes,

but the physics cannot be scaled anymore ( !r needs to be defined!)
• The PIC method is conceptually simple & can be efficiently

implemented in a (massively) parallel framework
• Implementation on new & future architectures requires

a strong input (co-development) from HPC specialists
Checkout SMILEI !!!
Code, Diagnostics/visualization tools and tutorials
available online!

http://www.maisondelasimulation.fr/smilei
Checkout SMILEI !!!
Code, Diagnostics/visualization tools and tutorials
available online!

http://www.maisondelasimulation.fr/smilei

You might also like