520 likes | 751 Views
2008 年雷射電漿暑期學校 台大應力所 100 國際會議廳 July 11,2008. 流體模式電漿模擬 Fluid Plasma Simulation. 呂凌霄 中央大學 太空科學所 Ling-Hsiao Lyu Institute of Space Science, National Central University Chung-Li, Taiwan, R. O. C. 大綱. 流體電漿模式簡介 為什麼 要做數值模擬? 流體電漿數值模擬的優缺點 流體電漿 模擬的基本技巧與 應 檢驗 的 事項 模擬結果之診斷與分析 總結與討論
E N D
2008年雷射電漿暑期學校 台大應力所100國際會議廳 July 11,2008 流體模式電漿模擬Fluid Plasma Simulation 呂凌霄 中央大學 太空科學所 Ling-Hsiao Lyu Institute of Space Science, National Central University Chung-Li, Taiwan, R. O. C. 2008 Laser-Plasma Summer School
大綱 • 流體電漿模式簡介 • 為什麼要做數值模擬? • 流體電漿數值模擬的優缺點 • 流體電漿模擬的基本技巧與應檢驗的事項 • 模擬結果之診斷與分析 • 總結與討論 • 流體電漿模擬結果範例介紹 2008 Laser-Plasma Summer School
流體電漿模式簡介 • 考慮電漿流體物理量隨時空的變化情形 • 流體物理量: • 個數密度 ( )、質量密度 • 平均速度( ) • Pressure tensor() • Scalar pressure( ) • Heat flux() 2008 Laser-Plasma Summer School
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 Fluid Plasma Simulation
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? Fluid Plasma Simulation
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: ). Fluid Plasma Simulation
Examples of Fluid Plasma Model • 遠大於正離子時空尺度之 磁流體模式 (magnetohydrodynamic plasma model) • 正離子時間尺度之電子-正離子雙流體模式 (electron-ion two-fluid plasma model) • 電子時間尺度之 相對論多流體模式 (relativistic multi-fluid plasma model) Fluid Plasma Simulation
遠大於正離子時空尺度之磁流體方程式 The MHD Ohm’s law has been used to eliminate the electric field in the above equations. Fluid Plasma Simulation
正離子時間尺度之電子-正離子雙流體方程式 Fluid Plasma Simulation
相對論多流體方程式 Go to p.17 Go to p.22 Fluid Plasma Simulation
為什麼要做數值模擬? • 檢驗理論模式 • 理論模式通常是為了解釋一種觀測現象而設計出來的。 • 理論模式,通常可以簡化為一組聯立的微分方程式(system ODEs or PDEs)。 • 根據這些方程式,寫個程式,進行電腦數值模擬,看看是否可以重新建構觀測到的現象。藉以檢驗理論模式是否正確。 • 彌補實驗或觀測上之不足 • 實驗或觀測受到時空條件的限制,往往無法取得足夠精細的時空資訊。 • 藉由高時空解析度的模擬結果,可幫助我們了解非線性過程中的因果關係與主要的物理機制。 2008 Laser-Plasma Summer School
流體電漿數值模擬的優缺點 • Advantage of fluid plasma simulation: • Simulation: relatively simple and fast • 流體電漿模式所用的變數,數量比較少,自由度也比較少,因此模擬計算起來,相對於電漿粒子模擬,快很多! • 流體電漿中的波動變化相對比較簡單,因此分析流體電漿模擬結果,要比分析電漿粒子模擬結果,容易許多。也比較容易與現成的理論相比較。 Fluid Plasma Simulation
流體電漿數值模擬的優缺點 • 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. Fluid Plasma Simulation
f(v) f(v) v v Vwave 流體電漿數值模擬適用範圍 f(v) 適合用流體數值模擬來研究的問題 v 0 Vwave 不太適合用 流體數值模擬碼 處理的物理問題 Fluid Plasma Simulation
流體電漿模擬 對時間積分時的基本技巧 • Explicit Scheme • 利用過去與現在的資訊,估算時間積分之值,以預測未來的結果。 • 運算比較快、程式比較好寫,但是誤差會不斷地累積。 • Implicit Scheme • 利用過去、現在、與未來的資訊,估算時間積分之值。其中,未來的資訊,可藉由聯立方程式求解,或利用疊代法求解。 • 運算費時、程式難寫,但是誤差不會累積。 2008 Laser-Plasma Summer School
傳統流體模擬架構 • 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. 2008 Laser-Plasma Summer School
Traditional Simulation SchemeThe 2nd Order Lax-Wendroff Scheme 適用問題: • 如果一組基本方程式可以寫成以下通量守恆形式 (例如:磁流體(MHD)方程式) • 其他只含 奇次空間微分項 的時間微分方程式也適用 (例如:Korteweg-deVries (KdV) equation) Go to pp.8-10 2008 Laser-Plasma Summer School
t Uin+1 tn+1 tn+1/2 tn xi-1 xi-1/2 xi xi+1/2 xi+1 x 通量守恆形式的時間微分方程式 • 方程式基本形式 可用二階 Lax-Wendroff scheme來進行數值模擬 • 第一步: • 第二步: 2008 Laser-Plasma Summer School
傳統流體數值模擬架構 • The implicit scheme for the diffusion term • 當方程式中出現偶次空間微分項時,切不可用 explicit schemes 來處理之,否則會出現,西洋棋盤-黑白格子狀分布的假波動結構。(Press et al., 1988) • 流體方程式中的耗散項或擴散項,多為對空間的二次微分項,宜用implicit scheme 來處理之。 2008 Laser-Plasma Summer School
Traditional Simulation SchemeDiffusion equation: Implicit scheme • The diffusion equation • The implicit scheme where 2008 Laser-Plasma Summer School
Non-traditional Simulation SchemeHigher 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. 2008 Laser-Plasma Summer School
Example of Higher Order Implicit SchemeThe 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 之值 • 重複校正(疊代)數次,直到收斂,即可進行下一步的預測 Go to pp.8-10 2008 Laser-Plasma Summer School
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之值
流體數值模擬應注意與檢驗的事項 • Always use double precision in your simulation • Normalize your equations 可以幫助你選取模擬相關係數,如系統長度、時間間距、空間間距。 • 檢查系統總能量是否守恆? • 檢查是否滿足Courant condition:∆t * Vmax < ∆x ? • 進一步的檢查:確認一下 • 當系統長度增加一倍,模擬結果沒有重大改變? • 當時間間距減半,模擬結果沒有重大改變? • 當空間間距減半,模擬結果沒有重大改變? 2008 Laser-Plasma Summer School
善用資源、能省則省、錙銖必較 Do your best to save • Memory • 務必重複使用working Arrays • CPU time • 避免重複計算:指數、對數、三角函數。 • 重複計算部份,務必先建立Table。 • Real time • Watch out your I/O scheme • 千萬不要小筆、小筆資料,分批進行傳輸,這樣會非常慢 • 要一大筆資料,一口氣一起傳輸,才快 2008 Laser-Plasma Summer School
數值模擬結果之診斷與分析 • Display your simulation results • 利用 Matlab或IDL 等軟體,寫一個簡單繪圖檔(指令檔)自動處理大量數值模擬結果。 • 利用 Excel 等軟體,個別處理總結形式的圖片. • 要用心分析你的模擬結果,不要浪費了辛苦算出來的模擬結果! • Carefully trace the time evolutions of all fluid variables. • 最好不要一邊模擬一邊做診斷繪圖。如果模擬一個Case所花費的時間,超過一天,最好把需要分析的資料存下來,用另外一台電腦慢慢的仔細分析。 • 要熟練各種數值方法,活學活用,才能做出最有效、最有創意的診斷分析。 2008 Laser-Plasma Summer School
總結與討論 • 我們的目標,希望能在 • 有限的電腦資源:RAM, HD, CPU, I/O速率 • 有限的研究時間 等條件下,利用一套精準有效的數值方法, 模擬電漿物理現象,了解非線性電漿物理過程 • 一套精準有效的數值方法,不只要穩,還要快、要準!(光是穩定,光是快,結果不正確也是枉然!) Fluid Plasma Simulation
總結與討論 • 選擇模擬碼,要對症下藥: • 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 )可以幫助我們了解模擬現象背後的物理過程。 2008 Laser-Plasma Summer School
流體電漿模擬結果範例介紹 • 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 Laser-Plasma Summer School
Velocity Shear in Space 2007 Fall AGU Meeting
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
Vortex Structures without magnetic tension force
S-Shaped Surface Waves with magnetic tension force
The arrows indicate the plasma flow direction observed in the nonlinear wave rest frame Fast-Mode Plane Waves
Theoretical Predictions and Simulation Results Flaring angle of the fast-mode nonlinear plane wave (Lai and Lyu, 2006 JGR)
好的模擬結果,幫助我們看到其他更精彩的結果!好的模擬結果,幫助我們看到其他更精彩的結果! • 根據 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 Laser-Plasma Summer School
The arrows indicate the plasma flow direction observed in the nonlinear wave rest frame Slow-Mode Plane Waves
Theoretical Predictions and Simulation Results Flaring angle of the nonlinear slow-mode plane wave
總結 • 好的模擬研究,務必做到:確實了解模擬結果! • 最好能做到:下一次,不必進行模擬,也可以大致 預估 模擬的結果。就好像 貝多芬 失聰後,仍然有能力作曲。 Fluid Plasma Simulation