S j l ij l ik l il i j k l C C i C j C k C l S i S k S l m ij m ik m il s i Roberto Lionello and Dalton D. Schnack Center for Energy and Space Science Science Applications International Corp. San Diego, CA USA ADVANCED MHD ALGORITHM FOR SOLAR AND SPACE SCIENCE
GOALS Develop an efficient 3-D representation of the resistive MHD model on an unstructured grid of tetrahedra –Truly arbitrary geometry –Use cartesian coordinates Avoids coordinate singularities and complicated metrics Apply to a variety of problems –Solar physics Structure and dynamics of active regions Coronal mass ejections Modeling of inner heliosphere –Fusion Stellarators Incorporate adaptive mesh refinement
CHALLENGES Discrete representation of differential operators Compactness (coupling of nearest neighbor points only) Self-adjointness Annihilation properties (e.g., ) Solution of implicit system Grid generation Implementation Code and data structure Parallelism Grid decomposition
RESISTIVE MHD MODEL
CURRENT AND MAGNETIC FIELD Vector potential, magnetic field, and current density Both J and B are solenoidal Current density operator is self-adjoint: Seek discrete operators that satisfy these same conditions
TETRAHEDRAL GRID S j l ij l ik l il i j k l C C i C j C k C l S i S k S l m ij m ik m il s i
FINITE VOLUME METHOD
APPLY TO MAGNETIC FIELD
DIVERGENCE OF B Apply Gauss’ theorem to dual median volume element surrounding vertex After some algebra, contributions from common sides of adjoining tetrahedra cancel!
ALTERNATE DERIVATION OF B A varies linearly within tetrahedron: Identical with finite volume result. Take the curl of this function:
CURRENT DENSITY
“CURL-CURL” IS SELF-ADJOINT
VARIATIONAL PRINCIPLE
DISCRETE VARIATION
BOUNDARY CONSTRAINT FOR B Discrete minimization makes no reference to boundary conditions Discrete expression for “curl curl” operator is 3N equations in 3N unknowns Could solve for all unknowns, including values at the M boundary vertices Absence of surface term implies that solution will satisfy the natural boundary conditions, i.e., Since A t is not fixed, this implies that Constraint on surface field and volume current: In general, we must specify A t on the boundary
PLACEMENT OF VARIABLES ON GRID i j k l A J v p B vv Vertices: A, J, v Centroids: , p, B Velocity averaged to faces or centroids, as required Apply conservation laws to control volume Equation of motion not in conservation form Use anisotropic semi-implicit operator
ADVECTION Control surfaces for upwind advection Cell centered quantity Vertex centered quantity
TIME SCALES IN RESISTIVE MHD Require implicit methods Lundquist number: Explicit time step impractical:
PARTIALLY IMPLICIT TIME DIFFERENCING MHD operator contains widely separated time scales (eigenvalues) Treat only “fast” part of operator implicitly to avoid time step restriction Precise decomposition for complex nonlinear system is often difficult or impractical to achieve
OPERATOR SPLITTING In MHD, F and are known, but an expression for S is difficult to achieve Use operator splitting: Explicit expression for S is not required
“SEMI-IMPLICIT” METHOD Recognize that the operator F is completely arbitrary!! G can be chosen for accuracy and ease of inversion –G should be easier to invert than F (or !) –G should approximate F for modes of interest –Some choices are better than others! The semi-implicit method originated decades ago in weather modeling Has proven to be very useful for resistive and extended MHD
SEMI-IMPLICIT OPERATOR FOR MHD Linearized, ideal MHD wave equation Wide spectrum of normal modes Highly anisotropic spatial operator Basis of many implicit formulations Not a simple Laplacian Requires specialized pre-conditioners Challenge: find optimum algorithm for inverting this operator with CFL ~ 1000
SEMI-IMPLICIT OPERATOR
DISCRETE SEMI-IMPLICIT OPERATOR
COMPUTING ISSUES F90 implementation –Use object-oriented features –Facilitate code modification and maintenance Use existing software implementations –MPI for parallelism –LaGrit (LaGrit Team, 1999) for mesh generation –METIS (Karypis & Kumar, 1999) for partitioning grid among processors –PETSc (Baley, et al., 2000) for preconditioned CG solver on unstructured grid –GMV (Ortega, 2000) for visualization of data on tetrahedral grid Expedited code development
EXAMPLE: GRID DECOMPOSITION Decomposition of cubic, cylindrical, and spherical domains for parallel processing using METIS
EXAMPLE: POTENTIAL CORONAL FIELD
EXAMPLE: CORONAL POTENTIAL FIELD
EXAMPLE: LINEAR SOUND WAVES
SOUND WAVES IN A BOX X-Component of velocityPressure
SOUND WAVES IN A SPHERE
NONLINEAR SHOCK PROBLEM G. A. Sod, J. Comp. Phys. 27,1 (1978) left = 1 p left = 1 right = p right = 0.1 Diaphragm Diaphragm separating left and right states of fluid Diaphragm is broken at t = 0 Expansion fan moves to left Shock and contact discontinuity move to right Well documented nonlinear solution of hydrodynamic equations
NONLINEAR SHOCK PROBLEM Temporal evolution of the density
MHD: TORSIONAL ALFVEN WAVES
Magnetic Energy Kinetic Energy Magnetic EnergyPerturbed magnetic field vectors
MHD: NON LINEAR KINK MODE nodes, cells, 16 processors
MHD: NON LINEAR KINK MODE Initial conditions: unstable Gold-Hoyle equilibrium At t=0 a random perturbation Is applied and the m=1 kink instability is triggered Magnetic energy Kinetic energy
MHD: NON LINEAR KINK MODE
MHD SHOCK IN CYLINDRICAL COORDINATES Modified from Brio, M. and Wu, C. C., J. Comp. Phys. 75, 400 (1988), and adapted to cylindrical geometry left = 1 p left = 1 right = p right = 0.1 Diaphragm Diaphragm separating left and right states of fluid Diaphragm is broken at t = 0 Fast rarefaction and slow compound waves move to left Slow shock, contact discontinuity, and fast rarefaction wave move to right.
MHD SHOCK IN CYLINDRICAL COORDINATES nodes, cells, 16 processors
MHD SHOCK IN CYLINDRICAL COORDINATES Cutlines at t= 1
MHD SHOCK IN CYLINDRICAL COORDINATES Cutplane of density at t= 1
THE SOLAR WIND FROM 30R TO 5 A.U. We simulate the propagation of the hydrodynamic solar wind in the heliosphere. The mesh consists of nodes and cells and extends from 30R to 5 A.U. At 30R we specify the boundary conditions: a 30 -degree- wide belt of dense and slow solar wind inclined of 20 degrees in respect to the rotation axis, surrounded by the fast solar wind. The angular rotation speed is 14 degrees per day. We advance the hydrodynamic equations for 30 days.
THE SOLAR WIND FROM 30R TO 5 A.U. A cut of the mesh and an enlargement showing the inner boundary
THE SOLAR WIND FROM 30R TO 5 A.U. Cutplanes of the flow speed Cutplanes of density times r 2
THE SOLAR WIND FROM 30R TO 5 A.U. Enhanced density regions near the ecliptic plane
MH4D: STATUS Formulated discrete algorithm for resistive MHD on a tetrahedral grid –Based on variational principle –Compact, self-adjoint, etc. –Implicit viscosity and resistivity Used available tools for implementation (F90, LaGrit, METIS, PETSc, GMV –Expedited development schedule Validation –Potential coronal field computed from boundary data –Linear sound waves in cubic and spherical domains –Nonlinear shock tube problem –Linear torsional Alfvén waves in a cylinder –Nonlinear MHD shock problem –Propagation of the supersonic solar wind in the heliosphere Next steps: –Optimize preconditioners –Apply to solar and heliospheric problems –Adaptive mesh refinement (AMR) –Implement web page Goal: Distribute code to user community as open source project