Computational MHD: A Model Problem for Widely Separated Time and Space Scales Dalton D. Schnack Center for Energy and Space Science Center for Magnetic Self-Organization in Laboratory and Space Plasmas Science Applications International Corp. San Diego, CA 92121 USA Computational MHD • Computational MHD is challenging because of: – – – – Widely separated spatial scales Widely separated time scales Extreme anisotopy Closure uncertainties • Different types of MHD problems – Kinetic energy dominant (convection, dynamo) – Magnetic energy dominant (corona, lab plasmas) – Require different computational approaches • Will review approaches that have been successful of simulating highly magnetized plasmas Types of MHD Problems Weakly Nonlinear Strongly Nonlinear • • KE ~ ME Flow is important – – – – – • • • • Shocks Turbulence Dynamos Convection Jets Properties of “statistical” state with all wavelengths represented Relatively simple BCs and geometry Important stiffness comes from nonlinearity Advection is important • • KE << ME Dominated by magnetic field – Coronal loops – Magnetic fusion • Slow departures from equilibrium (instabilities) – Culmination in disruptive behavior • • Complex BCs and geometry Important stiffness comes from linear properties – Resistive layers, current sheets – Slowly growing instabilities – Parasitic modes • Advection not so important Different Problems Require Different Approaches • Flow dominated plasmas – Stellar interiors, convection, dynamo – Magnetic forces are weak (b >> 1) – Collisional – Fluid equations good at all scales – Closures: characterize subgrid scale turbulence Can adapt hydrodynamic algorithms • Magnetically dominated plasmas – Coronal loops, laboratory fusion plasmas – Magnetic forces are strong (b ~ 1 in corona, b << 1 in fusion plasmas) – Low collisionality – Fluid equations not valid at small scales – Closures: characterize non-local kinetic effects (collective particle dynamics) Need to develop new algorithms “Sub-grid Scale” Models • • Computational resources limit the number of degrees of freedom in discrete model Important physical processes occur below the scale of the grid – Large Reynolds’ number turbulence – Kinetic effects in low collisionality plasmas • Must be captured in a sub-grid scale model – Turbulence • Averaging - characterize effect of small scales on large scales (new dependent variables) u = <u> + w, <<u>> = <u>, <w> = 0, <wiwj> ≠ 0 • Closure - expressions or equations for new variables, <ui∂iuj> => -n∂2<uj> • Maintain consistency - Stokes’ theorem, flux conservation,…. – Kinetic effects • Characterize non-local kinetic effects as local stress tensor, heat flux, ….. • Chapman-Enskog-like closures (integration along field lines) • Subcycling kinetic/particle • • We still don’t know exactly what equations to solve! Extensive validation against experiment and observation is required To come…… • • • • • • • • Building discrete models of physical systems Physical basis for MHD MHD boundary conditions Spatial approximations Temporal approximations (mostly implicit) Examples Extensions to MHD Where can we go from here? Finite Dimensional Models Discrete Models • Physics described by PDEs on the continuum – “Infinite” degrees of freedom (eigenmodes) • Build discrete model with finite (N) degrees of freedom: PDEs ==> N algebraic equations – Need convergence: Discrete solution => PDE solution as N • Requirements for convergence: – Consistency: discrete equations => differential equations as N (including boundary conditions!) – Stability: small errors cannot grow without bound • Lax’s Theorem: Stability implies convergence for well posed consistent approximations Guides for Building Discrete Models • No unique, consistent, stable discrete analog • Guide: Discrete system should have as many properties of physical system as possible – – – – Conservation laws Normal modes (eigenfunctions and eigenvalues) Self-adjointness, symmetries, anti-symmetries Boundary conditions • Not a purely mathematical exercise • Requires experience and intuition The MHD Model Physics Problem: Modeling Magnetized Plasmas • Dynamics of electrical conducting fluids in the presence of a magnetic field • Must solve material dynamics and Maxwell simultaneously • Simplest model is MHD, but….. Not just hydrodynamics with Lorentz force! What Equations to Solve? • Complete description => kinetic equation – 6 dimensions + time – Useless in practice • Take successive velocity moments of the kinetic equation ==> fluid model (3 dimensions + time) – Each moment equation contains the next higher order moment – Must truncate, or close, the system – Closure assumption: highest order moment can be written in terms of lower order moments • Assume V2/c2 << 1 – Ignore displacement current – Implies quasi-neutrality “Single-fluid” form (me=0, ne=ni=n) • Combine equations for different species n nV t dV p i p e J B dt 1 E V B J B p e J Ideal MHD ne Resistive MHD min Two- fluid effects (Hall + diamagnetic) Equations for p i and p e , + closures • Equivalent to two-fluid model Possible Fluid Models Model Vi 1,2 General , mn , i L 1 , Vthi 2 b VA Momentum Ohm’s law Whistlers4 KAW5 GV6 dV p J B dt E V B 1 J B pe ne Yes Yes Yes E V B 1 JB ne Yes No No E V B No No No E VE B No Yes Yes || gv i i Vthi / ci Vthi ci Drift Vthi MHD 7 2 ci V 0 Vthi 3 Hall MHD Ideal MHD b nc i mn dV J B || dt b nc i mn dV p J B dt || b nc i dVE mn mnV* i VE dt mnV||i VE || i (I bb) (b nc i ) p1 J B 1 || pe ne What a Difference B Makes! Hydrodynamics • Cannot support shearing displacements • Linear: – Sound wave • Nonlinear (Riemann problem): – 3 waves • Shock • Expansion • Contact discontinuity – 4 possible combinations What a Difference B Makes! Hydrodynamics • Cannot support shearing displacements • Linear: – Sound wave • Nonlinear (Riemann problem): – 3 waves • Shock • Expansion • Contact discontinuity – 4 possible combinations MHD • Can support shearing displacements • Linear: – Sound wave – Compressional Alfvén wave – Shear Alfvén wave • Nonlinear (Riemann problem): – 7 waves • 3 shocks • 3 contact discontinuities • Expansion – 648 possible combinations! The Challenges of Computational MHD Challenges for Computational MHD • Strongly magnetized plasmas exhibit: – Extreme separation of time scales – Extreme separation of spatial scales – Extreme anisotropy • Each has implications for algorithms 1. Extreme Separation of Time Scales A S Alfvén transit time evol Sound transit time R MHD evolution time Resistive diffusion time • Lundquist number: R S A ~ 10812 1 • Explicit time step impractical: t x A L A N Requires implicit methods evol 2. Extreme Separation of Spatial Scales • Important dynamics occurs in internal boundary layers – Structure is determined by plasma resistivity or other dissipation – Small dissipation cannot be ignored • Long wavelength along magnetic field • Extremely localized across magnetic field: -a /L ~ S << 1 for S >> 1 • It is these long, thin structures that evolve nonlinearly on the slow time scale • Requires specialized gridding 3. Extreme Anisotropy • Magnetic field locally defines special direction in space • Important dynamics are extended along field direction, very narrow across it • Propagation of normal modes (waves) depends strongly on local field direction • Transport (heat and momentum flux) is also highly anisotropic • Requires accurate treatment of B Inaccuracies can lead to “spectral pollution” and anomalous perpendicular transport MHD Boundary Conditions • Hydrodynamics: – Conservation laws in flux-divergence form: U F t – Specify normal flux at boundary: • Depends on inflow/outflow, super/sub-sonic • Magnetic flux in MHD: B E t • Must also specify Etan, and nothing more! If algorithm requires more than this, it is inconsistent!! Building a Discrete Model: Spatial Discretization Types of Spatial Discretization • 2 general types of approximation – Local (minimize error locally) • Finite differences – Taylor series expansion • Finite volumes – Local integral formulation – Global/Galerkin (minimize error globally) • Based on expansion in basis functions – Spectral methods » Basis functions defined globally – Finite element methods » Basis functions defined locally • All are used in computational MHD Spatial Approximation • Replace: • With: dU A(U) dt dUi N AijU j dt j1 A(Ui ) F(x) i 1,2,...,N , xi , i 1,N; x xi xi1 Grid Error Discrtization • Cannot separate boundary conditions from approximation and/or grid – Discrete problem should not require more BCs Finite Volumes • An “algorithm” for generating finite difference formulas – Physically motivated – Integrate conservation laws of small “finite volume” defined by grid – Exactly conservative – Consistent BCs • MHD also requires “finite area” – Magnetic flux conservation – Consistent BCs Ftop atop Fleft aleft aright V Fright abottom Fbottom E x top ltop Ey left lleft A lright lbottom E xbottom Ey right Finite Volumes for MHD • Primary and dual grids (one possibility) y Centroid: , p, V Vertex: A,E x Face: B,V Conserves mass, momentum, magnetic flux z • Faces and edges on physical boundary to preserve BCs Galerkin (Non-local) Methods • Finite differences and finite volumes minimize error locally – Based on Taylor series expansion • Galerkin methods minimize error globally – Based on expansion in basis functions • Solve “weak form” of problem u(x,t) Lu(x,t) t u v Ludx 0 t Minimize global error by expansion in basis functions Galerkin Discrete Approximation Mij du j dt Lij u j Mij dVbia j Lij dVbi La j Mass Matrix Response Matrix • Solution generally requires inverting the mass matrix • Different basis functions give different methods – Usually: bi = ai • ai=exp(ikx) => Fourier spectral methods • ai=localized polynomial => finite element methods Finite Elements • Project onto basis of locally defined polynomials of degree p, e.g.: p = 1 • Integrate by parts: x x j1 , x x j j1 x x a j (x) j1 , x j1 x j 0 u j 2a j a j ai a j Mij dVai u dV u dS a uj j j i t x x x x 2 S Boundary term • • • • • • Polynomials of degree p converge as hp+1 Natural implementation of boundary conditions Automatically preserves self-adjointness Excellent for smooth functions Works well with arbitrary grid shapes Now widely used in MHD x j1 x x j x j x x j1 otherwise Solenoidal Constraint • Faraday: B E t • Depends on B0 t 0 • Cannotbe guaranteed in discrete model U – Modified wave system t F R B – Projection – Diffusion B B 2 B B E B , B B t t – Grid properties a b 0 Building a Discrete Model: Temporal Discretization Temporal Discretization t n 1 u u t t tn • Explicit methods u n 1 un – Solve directly for values at n+1 in terms of values at time step n u n1 u n u n O(t) t u n1 Fu n • Computationally efficient, but….. Time steplimited by condition for numerical stability: t t 1 Temporal Discretization • Implicit methods – Values at n+1 in defined implicitly terms of values at time step n u n1 u n u n1 O(t) t Aun1 Bun , or u n1 A1Bun A I t • Requires inversion of operator: • More work than explicit method, but… Unconditionally stable for any time step…..BUT: Must followtime scale of interest! Multiple Time Scales (Parasitic Waves) • MHD operator contains widely separated time scales (eigenvalues) u u t Full MHD operator Fu Su Fast time scales: Slow time scales: Alfvén waves, soundwaves, etc Resistive instabilities, island evolution, (parasitic waves) (interesting physics) • Treat only “fast” part of operator implicitly to avoid time step restriction u n1 u n Fu n1 Su n t • Precise decomposition of for complex nonlinear system is often difficult or impractical to achieve Dealing with Parasitic Waves • Original idea from André Robert (1971) • In MHD, F and are known, but an expression for S is difficult to achieve – : full MHD operator – F: linearized MHD operator • Use operator splitting: F S S F u n1 u n u n1 u n n1 n n Fu ( F)u u tF t t • Expression for S not needed Semi-Implicit Method u n1 u n u n1 u n n1 n n Fu ( F)u u tF t t • Recognize that the operator F is completely arbitrary!! (I tG )u n1 (I t)u n tGu n S. I. operator Explicit S. I. operator • G can be chosen for accuracy and ease of inversion – G should be easier to invert than F (or !) – Gshould approximate F for “modes of interest” – Some choices are better than others! • The semi-implicit method originated decades ago in climate modeling • Has proven to be very useful for resistive and extended MHD How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code c 2 k 2 t 2 4 How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code c 2 k 2 t 2 4 How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code c 2 k 2 t 2 4 Semi-implicit term How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code Semi-implicit term c(k) 2 k 2 t 2 4, c 2 k 2 t 2 4 c(k) 2 c 2 /(1 ak 2 t 2 ) How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code Semi-implicit term c(k) 2 k 2 t 2 4, c 2 k 2 t 2 4 c(k) 2 c 2 /(1 ak 2 t 2 ) ak 2 t 2 c 2 k 2 t 2 / 4 1 How SI Works U n V n a t x n 1/ 2 2 V n 1/ 2 U n 1/ 2 2 V b at 2 t t x x Old explicit code c 2 k 2 t 2 4 Semi-implicit term c(k) 2 k 2 t 2 4, c(k) 2 c 2 /(1 ak 2 t 2 ) ak 2 t 2 c 2 k 2 t 2 / 4 1 • Stabilizes by dispersion • Slows down unstable waves • k-dependent inertia Semi-Implicit Operator for MHD • Linearized, ideal MHD wave operator p pV 1 p V • Wide spectrum of normal t V modes I atG V V p J B t • Highly anisotropic spatial 0G V B 0 B 0 V Sound waves operator Alfvén waves • Basis of many implicit Challenge: find formulations optimum algorithm for • Not a simple Laplacian inverting this operator • Requires specialized prewith CFL ~ 104 conditioners B V B t Fully Implicit Approach • Semi-implicit method is efficient when stiffness comes from linearities – Can split linear terms from full operator – Fusion and coronal plasmas • Fully implicit approach required when stiffness comes from non-linearities – Turbulence, etc. – Must solve non-linear discrete equations A(U)U B , F(U) A(U)U B 0 F l l1 (U U l ) F l U • • • • Newton’s method Evaluation of Jacobian “Jacobian-free” methods “Newton-Krylov” methods Example: MHD Relaxation and the Laboratory “Dynamo” Plasma Relaxation • System attempts to minimize energy subject to constraints: p B 2 W dV 1 2 0 W K 0 , K A BdV W /K minimum • Leads to preferred (“relaxed”) configurations (Taylor) • Occursin a variety of situations – Reversed-field pinch (“dynamo”) – Tokamak (disruption) – Solar corona (CMEs?) • Underlying dynamics are MHD-like – Turbulence? – Subset of long wavelength modes? • Cyclic process Relaxed State Nonlinear Relaxation Dynamo Instabilities Diffusion Laboratory Dynamo • Toroidal Z-pinch (RFP) • Positive toroidal field in center • Negative toroidal field at edge • Cyclic relaxation Lab Dynamo Mechanism • Laboratory “dynamo” is a nonlinear driven system • Plasma is resistive • Poloidal flux (toroidal current) sustained by applied voltage • Toroidal flux is sustained by a “dynamo” • Mediating dynamics – Nonlinear behavior of long wavelength MHD instabilities – Driven by resistive evolution of mean fields – Nonlinear evolution converts poloidal flux => toroidal flux – Like differential rotation • Finite resistivity makes flux conversion irreversible • No conversion of toroidal flux => poloidal flux – Poloidal flux supplied by external circuit Is it really a dynamo?? One-way flux conversion Examples of Dynamo Results Self-reversal • • • Begins far from relaxed state Time dependence of mode energy and field at wall Dynamo sustains discharge after t ~ 0.07 • Taylor relaxation during sustainment • • Perturb by 1 part in 106 Dynamo is nonlinear and chaotic Example: Tokamak Disruption Toroidal Fusion Plasmas: Tokamak Magnetic flux surfaces, const. Toroidal angle Integrated Control Magnetic axis Current Profile Control Optimized Resistive Wall Mode Control separatrix Disruption Detection, Correction, Mitigation Poloidal angle • • • • Confine hot plasma to extract fusion energy Most promising concepts are toroidal - tokamak Magnetic field lines trace out flux surfaces Geometry is axisymmetric, dynamics are 3-D Experimental Tokamak Disruption • Increase in neutral beam power • Plasma pressure increases • Sudden termination (disruption) • Time dependence at disruption onset • Growing 3-D magnetic perturbation (n = 1) • Nonlinear evolution? • Effect on confinement? • Can this be predicted? Simulation of Disruption • Resistive MHD simulation of disruption • Experimentally measured initial conditions • Anisotropic heat conduction • Vacuum region • Ideal modes grows with finite resistivity (S = 105) • Magnetic field becomes stochastic • Non-symmetric heat load on wall and divertor • Time for crash ~ 200 sec. • Power ~ 5 GW Disruption Dynamics QuickTime™ and a YUV420 codec decompressor are needed to see this picture. Example: Dynamics of the Solar Corona Solar Coronal Dynamics • Coronal magnetic field energized by stresses (motions) at the photosphere • Approximately force-free current slowly builds • Sudden disruption – Violent relaxation? • Coronal mass ejection (CME) • Structure of heliosphere – Use observed photospheric fields • Space weather Solar Corona, Solar Wind, and Heliosphere The Heliosphere During Whole Sun Month August – September 1996 Launch and Propagation of CME • Disruptions of corona result in CMEs; propagates into heliosphere • Coronal dynamics (< 20 Rs) is an implicit problem – Large variation of Alfvén and sound speeds – Subsonic to transonic flows – Wave dominated • Inner heliosphere (> 20 Rs) is an explicit problem – – – – Supersonic and super-Alfvénic flows Advection dominated Steep gradients Shocks • Can couple implicit (Mikic & Linker) and explicit (Odstrcil) codes beyond sonic and Alfvénic points to model launch and propagation of CME into heliosphere CME Launch and Propagation Using Coupled Codes QuickTime™ and a Animation decompressor are needed to see this picture. The Next Steps Beyond MHD • MHD is not a great model for hot magnetized plasmas – Collisionality is low but not zero – Current layers width comparable to ion Larmor radius – Separate ion and electron dynamics important • Need lowest order FLR corrections – Full Ohm’s law (Hall + diamagnetic) – Gyro-viscosity (non-dissipative momentum transport) • “Extended” MHD • Implications for algorithms Extended MHD Algorithms • FLR terms admit new waves – Hall term (electrons, Ohm’s law) • Whistlers (correction to shear branch) – Gyro-viscosity (ions, momentum equation) • Corrections to compressional branch • These new waves are dispersive: – Cannot be treated explicitly Ck 2 – Require new SI operators (4th order) – Under development t Cx 2 Limits on Modeling Balance of algorithm performance and problem requirements with available cycles Na Q t 3 10 7 Algorithms Algorithms: • N - # of meshpoints for each dimension • a- # of dimensions – 1.5 - transport – 3 (spatial) fluid – 5-6 kinetic (spatial + velocity) • Q - code-algorithm requirements (Tflop / meshpoint / timestep) • t - time step (seconds) P CT Constraints Constraints: • P - peak hardware performance (Tflop/sec) • - hardware efficiency – P - delivered sustained performance • T - problem time duration (seconds) • C - # of cases / year – 1 case / week ==> C ~ 50 Implications: Need for Better Closures ???? Na Q t 3 10 7 Algorithms P CT Constraints Assumptions: • Performance is delivered • Implicit algorithm • Q ind. of t (!!) Requirements: • At least 3-D physics required • Required problem time: 1 msec 1 sec Conclusions: • 3-D (i.e., fluid) calculations for times of ~ 10 msec within reach • Longer times require next generation computers (or better algorithms) • Higher dimensional (kinetic) long time calculations unrealistic • Integrated kinetic effects must come through low dimensionality fluid closures Outlook • Interesting fluid systems have many degrees of freedom – Kolmogorov => ~ Re per spatial dimension – “Realistic” discrete model => N ~ Re3 – Small scale (kinetic or turbulent) physics affects large scale dynamics • The computers will never be big enough or fast enough for “realistic” direct simulation! • Need more work on closures; partnerships with theory; validation with experiment • Need a better idea? – Abandon traditional initial value/time marching approach? • “Equation-free multiscale” methods (Kevrikidis & Gear) • “Project” microscale dynamics onto macroscales • Perhaps these will lead to economical, realistic (predictive?) modeling