1 of 51

流體模式電漿模擬�Fluid Plasma Simulation

呂凌霄

中央大學 太空科學所

Ling-Hsiao Lyu

Institute of Space Science, National Central University

Chung-Li, Taiwan, R. O. C.

2008-07-11

2008 Laser-Plasma Summer School

1

2008年雷射電漿暑期學校

台大應力所100國際會議廳

July 11,2008

2 of 51

大綱

  • 流體電漿模式簡介
  • 為什麼要做數值模擬?
  • 流體電漿數值模擬的優缺點
  • 流體電漿模擬的基本技巧與應檢驗的事項
  • 模擬結果之診斷與分析
  • 總結與討論
    • 流體電漿模擬結果範例介紹

2

2008-07-11

2008 Laser-Plasma Summer School

3 of 51

流體電漿模式簡介

  • 考慮電漿流體物理量隨時空的變化情形
  • 流體物理量:
    • 個數密度 ( )、質量密度

    • 平均速度( )

    • Pressure tensor( )
    • Scalar pressure( )
    • Heat flux( )

2008-07-11

2008 Laser-Plasma Summer School

3

4 of 51

Governing Equations of the Fluid Variables

  • Continuity equation:
    • Time evolution of the mass density or number density or charge density
  • Momentum equation:
    • Time evolution of the average velocity
  • Energy equation: (equation of state)
    • Time evolution of the plasma pressure

2008-July-11

Fluid Plasma Simulation

4

5 of 51

Force Terms in the Momentum Equation

  • Body Forces (Force per unit volume)
    • Pressure gradient force:
    • Lorentz force:
    • Gravitational force ( solar physics, galactic physics):
    • Coriolis force (solar physics)
  • How to determine the E-field and B-field?

2008-July-11

Fluid Plasma Simulation

5

6 of 51

Governing Equations of the E, B Fields

  • Using the Maxwell’s equations to determine the evolution of E-, B-fields
    • It is true for both fluid and kinetic plasma simulations
  • For low frequency plasma phenomena (e.g., magnetohydrodynamic, MHD, plasma), the E-field is determined by the Ohm’s law (e.g., MHD Ohm’s law: ).

2008-July-11

Fluid Plasma Simulation

6

7 of 51

Examples of Fluid Plasma Model

  • 遠大於正離子時空尺度之 磁流體模式

(magnetohydrodynamic plasma model)

  • 正離子時間尺度之�電子-正離子雙流體模式

(electron-ion two-fluid plasma model)

  • 電子時間尺度之 相對論多流體模式

(relativistic multi-fluid plasma model)

2008-July-11

Fluid Plasma Simulation

7

8 of 51

遠大於正離子時空尺度之�磁流體方程式

8

The MHD Ohm’s law has

been used to eliminate the electric field

in the above equations.

2008-July-11

Fluid Plasma Simulation

9 of 51

正離子時間尺度之�電子-正離子雙流體方程式

9

2008-July-11

Fluid Plasma Simulation

10 of 51

相對論多流體方程式

10

2008-July-11

Fluid Plasma Simulation

11 of 51

為什麼要做數值模擬?

  • 檢驗理論模式
    • 理論模式通常是為了解釋一種觀測現象而設計出來的。
    • 理論模式,通常可以簡化為一組聯立的微分方程式(system ODEs or PDEs)。
    • 根據這些方程式,寫個程式,進行電腦數值模擬,看看是否可以重新建構觀測到的現象。藉以檢驗理論模式是否正確。
  • 彌補實驗或觀測上之不足
    • 實驗或觀測受到時空條件的限制,往往無法取得足夠精細的時空資訊。
    • 藉由高時空解析度的模擬結果,可幫助我們了解非線性過程中的因果關係與主要的物理機制。

11

2008-07-11

2008 Laser-Plasma Summer School

12 of 51

流體電漿數值模擬的優缺點

  • Advantage of fluid plasma simulation:
    • Simulation: relatively simple and fast
      • 流體電漿模式所用的變數,數量比較自由度也比較,因此模擬計算起來,相對於電漿粒子模擬,很多!
      • 流體電漿中的波動變化相對比較簡單,因此分析流體電漿模擬結果,要比分析電漿粒子模擬結果,容易許多。也比較容易與現成的理論相比較。

2008-July-11

Fluid Plasma Simulation

12

13 of 51

流體電漿數值模擬的優缺點

  • Limitation of fluid plasma simulation:
    • The fluid model fails when the kinetic effect becomes important or when the equation of state we assumed is incorrect.

2008-July-11

Fluid Plasma Simulation

13

14 of 51

流體電漿數值模擬適用範圍

14

Vwave

0

f (v)

v

f (v)

v

Vwave

f (v)

v

適合用流體數值模擬來研究的問題

不太適合用

流體數值模擬碼

處理的物理問題

2008-July-11

Fluid Plasma Simulation

15 of 51

流體電漿模擬 對時間積分時�的基本技巧

  • Explicit Scheme
    • 利用過去與現在的資訊,估算時間積分之值,以預測未來的結果。
    • 運算比較快、 程式比較好寫,但是誤差會不斷地累積。
  • Implicit Scheme
    • 利用過去、現在、與未來的資訊,估算時間積分之值。其中,未來的資訊,可藉由聯立方程式求解,或利用疊代法求解。
    • 運算費時、程式難寫,但是誤差不會累積。

2008-07-11

2008 Laser-Plasma Summer School

15

16 of 51

傳統流體模擬架構

  • The 2nd order Lax-Wendroff Scheme
    • 速度快、誤差不大、記憶體用量省。
    • An explicit scheme,誤差會累積。
    • 只適合模擬只含奇次空間微分項的時間微分方程式
  • 參考文獻

Press, W. H., B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling, Numerical Recipes (in C or in FORTRAN and Pascal), Cambridge University Press, Cambridge, 1988.

Richtmyer, R. D., and K. W. Morton, Difference Methods for Initial-Value Problems, 2nd edition, John Wiley & Sons, Inc., 1967.

16

2008-07-11

2008 Laser-Plasma Summer School

17 of 51

Traditional Simulation SchemeThe 2nd Order Lax-Wendroff Scheme

適用問題:

  1. 如果一組基本方程式可以寫成以下通量守恆形式 (例如:磁流體(MHD)方程式)

  • 其他只含 奇次空間微分項 的時間微分方程式也適用

(例如: Korteweg-deVries (KdV) equation

17

2008-07-11

2008 Laser-Plasma Summer School

18 of 51

常用符號的定義

18

19 of 51

通量守恆形式的時間微分方程式

  • 方程式基本形式

可用二階 Lax-Wendroff scheme來進行數值模擬

  • 第一步:

  • 第二步:

19

xi-1

xi+1

xi-1/2

xi+1/2

xi

tn

tn+1

tn+1/2

Uin+1

t

x

2008-07-11

2008 Laser-Plasma Summer School

20 of 51

傳統流體數值模擬架構

  • The implicit scheme for the diffusion term
    • 當方程式中出現 偶次空間微分 項時,切不可用 explicit schemes 來處理之,否則會出現,西洋棋盤-黑白格子狀分布的假波動結構。 (Press et al., 1988)
    • 流體方程式中的耗散項或擴散項,多為對空間的二次微分項,宜用 implicit scheme 來處理之。

20

2008-07-11

2008 Laser-Plasma Summer School

21 of 51

Traditional Simulation SchemeDiffusion equation: Implicit scheme

  • The diffusion equation
  • The implicit scheme

21

where

2008-07-11

2008 Laser-Plasma Summer School

22 of 51

Non-traditional Simulation Scheme�Higher Order Implicit Scheme

  • 高階implicit流體數值模擬架構
    • 高階:誤差小、需要用到較多記憶體
    • Implicit scheme:誤差不會累積、需要較多記憶體
    • 過去的老電腦跑不動,適合在現在與未來高速的電腦上運算
    • 範例: The 4th Order Predictor-Corrector Method
  • 參考文獻

Shampine, L. F., and M. K. Gordon, Computer Solution of Ordinary Differential Equation: the Initial Value Problem, W. H. Freeman and Company, San Francisco, 1975.

22

2008-07-11

2008 Laser-Plasma Summer School

23 of 51

Example of Higher Order Implicit Scheme�The 4th Order Predictor-Corrector Method

  • 空間微、積分:
    • 利用Fast Cubic Spline或其他高階差分法,求網格點上的空間微分、積分之值
  • 初始三步驟:
    • 利用 the 4th order Runge-Kutta method ,求 y1, y2, y3之值
  • 預測步驟:
    • 利用 the 4th order Adams’ open formula,根據 yn, yn-1, yn-2, yn-3 , 預測yn+1之值
  • 校正(疊代)步驟:
    • 利用 the 4th order Adams’ close formula ,根據前一次預測所得的 yn+1 ,以及原有之 yn, yn-1, yn-2, 重新預測 yn+1 之值
  • 重複校正(疊代)數次,直到收斂,即可進行下一步的預測

23

2008-07-11

2008 Laser-Plasma Summer School

24 of 51

The 4th Order Predictor-Corrector Method� Shampine and Gordon, 1975

  • 預測步驟:利用 yn, yn-1, yn-2, yn-3 , 預測yn+1之值 (the 4th order Adams’ open formula)

  • 校正(疊代)步驟:利用前一次預測所得的 yn+1 ,以及原有之 yn, yn-1, yn-2, 重新預測 yn+1 之值 (the 4th order Adams’ close formula)

  • 重複校正(疊代)數次,直到收斂,即可進行下一步的預測
  • 因為當 n < 4 the 4th order Adams’ open formula 不適用,故利用 the 4th order Runge-Kutta method 來求 y1, y2, y3之值

24

25 of 51

流體數值模擬�應注意與檢驗的事項

  • Always use double precision in your simulation
  • Normalize your equations 可以幫助你選取模擬相關係數,如系統長度、時間間距、空間間距。
    • 檢查系統總能量是否守恆?
    • 檢查是否滿足 Courant condition: ∆t * Vmax < ∆x ?
  • 進一步的檢查: 確認一下
    • 當系統長度增加一倍,模擬結果沒有重大改變?
    • 當時間間距減半,模擬結果沒有重大改變?
    • 當空間間距減半,模擬結果沒有重大改變?

25

2008-07-11

2008 Laser-Plasma Summer School

26 of 51

善用資源、能省則省、錙銖必較

Do your best to save

  • Memory
    • 務必重複使用working Arrays
  • CPU time
    • 避免重複計算:指數、對數、三角函數。
    • 重複計算部份,務必先建立Table。
  • Real time
    • Watch out your I/O scheme
    • 千萬不要小筆、小筆資料,分批進行傳輸 ,這樣會非常慢
    • 要一大筆資料,一口氣一起傳輸,才快

26

2008-07-11

2008 Laser-Plasma Summer School

27 of 51

數值模擬結果之診斷與分析

  • Display your simulation results
    • 利用 Matlab或 IDL 等軟體,寫一個簡單繪圖檔(指令檔)自動處理大量數值模擬結果。
    • 利用 Excel 等軟體,個別處理總結形式的圖片.
  • 要用心分析你的模擬結果,不要浪費了辛苦算出來的模擬結果!
    • Carefully trace the time evolutions of all fluid variables.
    • 最好不要一邊模擬一邊做診斷繪圖。如果模擬一個Case所花費的時間,超過一天,最好把需要分析的資料存下來,用另外一台電腦慢慢的仔細分析。
  • 要熟練各種數值方法,活學活用,才能做出最有效、最有創意的診斷分析。

27

2008-07-11

2008 Laser-Plasma Summer School

28 of 51

總結與討論

  • 我們的目標,希望能在
    1. 有限的電腦資源:RAM, HD, CPU, I/O速率
    2. 有限的研究時間

等條件下,利用一套 精準有效 的數值方法,

模擬電漿物理現象,了解非線性電漿物理過程

  • 一套 精準有效 的數值方法,不只要,還要、要(光是穩定,光是快,結果不正確也是枉然!)

28

2008-July-11

Fluid Plasma Simulation

29 of 51

總結與討論

  • 選擇模擬碼,要對症下藥:
    • Choose a right simulation code for your problem
  • 要隨時保有:宏觀的視野與微觀的警惕。
    • 知道自己的模擬碼,適用的底線在哪裡!
  • 能省則省,錙銖必較:
    • Do your best to save memory, CPU time, and real time (Watch out your I/O scheme).
  • 好的診斷( good diagnostics )可以幫助我們了解模擬現象背後的物理過程。

29

2008-07-11

2008 Laser-Plasma Summer School

30 of 51

流體電漿模擬結果範例介紹

  • Nonlinear evolutions of velocity-shear instabilities in the MHD plasma
    • Medium velocity shear

Formation of vortex or undulant wavy structures

    • Strong velocity shear

Formation of fast-mode Mach-cone-like solitary waves

    • Weak velocity shear

Formation of slow-mode Mach-cone-like solitary waves in a limited range of parameters

2008-07-11

2008 Laser-Plasma Summer School

30

31 of 51

Velocity Shear in Space

2007 Fall AGU Meeting

31

32 of 51

Nonlinear Evolution of �Velocity-Shear Instability

  • Classical Results :
    • Vortexes (without tension force)
    • Undulant surface wave              
    • (with presence of tension force)

  • New Results :
    • Nonlinear half-plane solitary waves
      • Nonlinear fast-mode solitary waves (Lai and Lyu, 2006 JGR)
      • Nonlinear slow-mode solitary waves (Lai and Lyu, 2008 JGR)

2007 Fall AGU Meeting

32

33 of 51

Vortex Structures

33

without magnetic tension force

34 of 51

Jet Flow�Pairs of vortexes with opposite vorticities

34

35 of 51

Simple Velocity Shear �Vortexes with the same vorticity

35

36 of 51

S-Shaped Surface Waves

36

with magnetic tension force

37 of 51

Fast-Mode Plane Waves

37

38 of 51

Fast-Mode Plane Waves

38

The arrows indicate the plasma flow direction observed in the nonlinear wave rest frame

39 of 51

Another Example of�Fast-Mode Plane Waves

39

40 of 51

Fast-mode Mach-cone wave�(Jet flow: MFy0 >1)

40

41 of 51

Fast-mode Mach-cone wave�(Velocity shear : MFy0 >1)

41

42 of 51

Formation of Nonlinear Fast-Mode Plane Wave

42

43 of 51

Theoretical Predictions �and Simulation Results

Flaring angle of the fast-mode nonlinear plane wave (Lai and Lyu, 2006 JGR)

43

44 of 51

好的模擬結果,幫助我們看到其他更精彩的結果!

  • 根據 fast-mode Mach-cone-like solitary waves 的成因,我們大膽的推斷,速度切也可以造成 slow-mode Mach-cone-like solitary waves in the MHD plasma.
    • 結果,我們真的找到了!雖然 slow-mode Mach-cone-like solitary waves 的 solution space 非常小,只能存在於 a limited range of parameters!

2008-07-11

2008 Laser-Plasma Summer School

44

45 of 51

Friedrichs Diagrams of �Slow-Mode Group Velocity

45

46 of 51

Slow-Mode Plane Waves

46

47 of 51

Slow-Mode Plane Waves

47

The arrows indicate the plasma flow direction observed in the nonlinear wave rest frame

48 of 51

Formation of Nonlinear Slow-Mode Plane Wave

48

49 of 51

Theoretical Predictions �and Simulation Results

Flaring angle of the nonlinear slow-mode plane wave

49

50 of 51

總結

  • 好的模擬研究,務必做到:確實了解模擬結果!

  • 最好能做到:下一次,不必進行模擬,也可以大致 預估 模擬的結果。就好像 貝多芬 失聰後,仍然有能力作曲。

50

2008-July-11

Fluid Plasma Simulation

51 of 51

台大應力所 國際會議廳的對聯

學業尚未成功

博士仍須努力

       -陳立夫

鷹架理論:站得高,才看得遠,想得深,學得也廣。

數值模擬,就像所有的實驗一樣,可以幫助你永遠的學習!

2008-07-11

2008 Laser-Plasma Summer School

51