The RAMSES code and related techniques 2- MHD solvers

Similar documents
The RAMSES code and related techniques I. Hydro solvers

State of the Art MHD Methods for Astrophysical Applications p.1/32

Multi-D MHD and B = 0

Numerical Solutions for Hyperbolic Systems of Conservation Laws: from Godunov Method to Adaptive Mesh Refinement

Approximate Harten-Lax-Van Leer (HLL) Riemann Solvers for Relativistic hydrodynamics and MHD

Various Hydro Solvers in FLASH3

Computational Astrophysics

A Comparative Study of Divergence-Cleaning Techniques for Multi-Dimensional MHD Schemes )

PREPRINT November 5, 2007

Part 1: Numerical Modeling for Compressible Plasma Flows

The Center for Astrophysical Thermonuclear Flashes. FLASH Hydrodynamics

Divergence- and Curl-Preserving Prolongation and Restriction Formulas

ABSTRACT. A new unsplit staggered mesh algorithm (USM) that solves multidimensional

Riemann Solvers and Numerical Methods for Fluid Dynamics

The PLUTO code for astrophysical gasdynamics

A Finite Volume Code for 1D Gas Dynamics

arxiv: v2 [math.na] 4 Mar 2014

A Divergence-Free Upwind Code for Multidimensional Magnetohydrodynamic Flows 4

arxiv: v1 [astro-ph.ep] 30 Jun 2009

Computational Astrophysics 7 Hydrodynamics with source terms

NUMERICAL SOLUTION OF HYPERBOLIC PARTIAL DIFFERENTIAL EQUATIONS

Numerical Simulations. Duncan Christie

The RAMSES code and related techniques 4. Source terms

Chp 4: Non-linear Conservation Laws; the Scalar Case. By Prof. Dinshaw S. Balsara

Comparison of Approximate Riemann Solvers

Chapter 1. Introduction

High-order Godunov schemes for global 3D MHD simulations of accretion disks. I. Testing the linear growth of the magneto-rotational instability

Hyperbolic Divergence Cleaning for the MHD Equations

An efficient implementation of the divergence free constraint in a discontinuous Galerkin method for magnetohydrodynamics on unstructured meshes

Block-Structured Adaptive Mesh Refinement

Advection / Hyperbolic PDEs. PHY 604: Computational Methods in Physics and Astrophysics II

A MULTIWAVE APPROXIMATE RIEMANN SOLVER FOR IDEAL MHD BASED ON RELAXATION II - NUMERICAL IMPLEMENTATION WITH 3 AND 5 WAVES

Numerical solutions of magnetohydrodynamic equations

HLLC solver for ideal relativistic MHD

CapSel Roe Roe solver.

Efficient Low Dissipative High Order Schemes for Multiscale MHD Flows, II: Minimization of B Numerical Error

The one-dimensional equations for the fluid dynamics of a gas can be written in conservation form as follows:

Extremum-Preserving Limiters for MUSCL and PPM

Notes: Outline. Shock formation. Notes: Notes: Shocks in traffic flow

A Central Rankine Hugoniot Solver for Hyperbolic Conservation Laws

RESEARCH HIGHLIGHTS. WAF: Weighted Average Flux Method

COMPUTATIONAL METHODS AND ALGORITHMS Vol II - Computational Methods for Compressible Flow Problems - Remi Abgrall

Outline of lectures. Adding more physics. Doing Better: source terms in CTU unsplit integrator

Finite Volume for Fusion Simulations

arxiv:astro-ph/ v1 7 Oct 2003

Computational Fluid Dynamics. PHY 688: Numerical Methods for (Astro)Physics

Divergence-free interpolation of vector fields from point values exact B = 0 in numerical simulations

CapSel Euler The Euler equations. conservation laws for 1D dynamics of compressible gas. = 0 m t + (m v + p) x

MATHEMATICAL ASPECTS OF NUMERICAL SOLUTION OF HYPERBOLIC SYSTEMS

Solving the Euler Equations!

NUMERICAL METHODS IN ASTROPHYSICS An Introduction

Shock-capturing Schemes for a Collisionless Two-fluid Plasma Model

An Intercomparison Between Divergence-Cleaning and Staggered Mesh Formulations for Numerical Magnetohydrodynamics

Constrained Transport Method for the Finite Volume Evolution Galerkin Schemes with Application in Astrophysics

arxiv: v1 [astro-ph.im] 23 Feb 2011

Finite Volume Schemes: an introduction

Applying Asymptotic Approximations to the Full Two-Fluid Plasma System to Study Reduced Fluid Models

An efficient shock-capturing central-type scheme for multidimensional relativistic flows. II. Magnetohydrodynamics

arxiv:astro-ph/ v1 27 Jan 2006

On divergence-free reconstruction schemes for CED and MHD

Projection Dynamics in Godunov-Type Schemes

Investigation of an implicit solver for the simulation of bubble oscillations using Basilisk

A constrained-transport magnetohydrodynamics algorithm with near-spectral resolution.

Locally Divergence-Free Central Discontinuous Galerkin Methods for Ideal MHD Equations

International Engineering Research Journal

arxiv: v2 [astro-ph.im] 7 Jul 2017

Math 660-Lecture 23: Gudonov s method and some theories for FVM schemes

A constrained transport scheme for MHD on unstructured static and moving meshes

Chapter 1 Direct Modeling for Computational Fluid Dynamics

Computational Astrophysics 1 Particle Mesh methods

Godunov methods in GANDALF

arxiv: v3 [physics.comp-ph] 22 Mar 2018

A Central Compact-Reconstruction WENO Method for Hyperbolic Conservation Laws

AMath 574 February 11, 2011

Anomalous wave structure in magnetized materials described by non-convex equations of state

A switch to reduce resistivity in smoothed particle magnetohydrodynamics

X i t react. ~min i max i. R ij smallest. X j. Physical processes by characteristic timescale. largest. t diff ~ L2 D. t sound. ~ L a. t flow.

arxiv: v1 [physics.comp-ph] 16 Nov 2017

arxiv: v4 [astro-ph.im] 27 Apr 2011

Fluid Dynamics. Part 2. Massimo Ricotti. University of Maryland. Fluid Dynamics p.1/17

How can jets survive MHD instabilities?

arxiv: v2 [physics.comp-ph] 29 May 2013

A 5-wave relaxation solver for the shallow water MHD system

Diffusion / Parabolic Equations. PHY 688: Numerical Methods for (Astro)Physics

Journal of Computational Physics

Numerical Hydrodynamics in Special Relativity

(Numerical) study of the collapse and of the fragmentation of prestellar dense core

Affordable, entropy-consistent, Euler flux functions

AA214B: NUMERICAL METHODS FOR COMPRESSIBLE FLOWS

Numerical Methods for Conservation Laws WPI, January 2006 C. Ringhofer C2 b 2

Constrained hyperbolic divergence cleaning in smoothed particle magnetohydrodynamics with variable cleaning speeds

A numerical study of SSP time integration methods for hyperbolic conservation laws

Positivity-preserving high order schemes for convection dominated equations

Recent Progress in FLASH: High-Energy- Density Physics Applications

The ECHO code: from classical MHD to GRMHD in dynamical spacetimes

PHYS 643 Week 4: Compressible fluids Sound waves and shocks

SW103: Lecture 2. Magnetohydrodynamics and MHD models

Collapse of magnetized dense cores. Is there a fragmentation crisis?

Art Checklist. Journal Code: Article No: 6959

Transcription:

The RAMSES code and related techniques 2- MHD solvers

Outline - The ideal MHD equations - Godunov method for 1D MHD equations - Ideal MHD in multiple dimensions - Cell-centered variables: divergence B cleaning - Face-centered variables: the CT approach - A few MHD numerical tests

The ideal MHD equations Mass conservation Momentum conservation Energy equation Induction equation Ampère s law No magnetic monopoles

The ideal MHD equations in conservative forms Mass conservation Momentum conservation Total energy conservation Magnetic flux conservation Total energy Total pressure No magnetic monopoles

The ideal MHD equations in 1D For 1D (plane symetric flow), one has The vector of conservative variables writes Ideal MHD in conservative form: Flux function

MHD waves Compute the Jacobian matrix It has 7 real eigenvalues (ideal MHD equations are hyperbolic), one for each wave: 2 fast magnetosonic waves: 2 Alfven waves: 2 slow magnetosonic waves: 1 entropy waves: Fast magnetosonic waves are longitudinal waves with variations in pressure and density (correlated with magnetic field) Slow magnetosonic waves are longitudinal waves with variations in pressure and density (anti-correlated with magnetic field) Alfven waves are transverse waves with no variation in pressure and density. Entropy wave is a contact discontinuity with no variation in pressure and velocity.

MHD wave speed Sound speed: Alfven speed: Fast magnetosonic speed: Slow magnetosonic speed: In some special cases, some wave speeds can be equal: The ideal MHD system is not strictly hyperbolic. This can lead to exotic features such as compound waves (for example a mixture of Alfven wave and shock)

Godunov method for 1D MHD flows Godunov methodology applies to any hyperbolic system of conservation laws Stability is ensured by proper upwinding of the flux function with respect to the 7 MHD waves. Second order accuracy is obtained by a predictor-corrector approach (the MUSCL scheme). MHD equations are solved in conservative form: this ensures that Rankine- Hugoniot relations are satisfied (proper shock jump conditions). Step 1: predictor step use the Jacobian use slope limiters Step 2: compute flux Riemann solver Step 3: conservative update

The Roe Riemann solver for MHD It belongs to the more general class of linear Riemann solvers. Generalise the Euler 3 wave Roe solver to a seven wave MHD Roe solver (Brio & Wu 1988; Cargo & Gallice 1989) Define the Roe average state: Compute the Jacobian matrix for this reference state The Roe average is computed in order to get Property (C): Eigenvector decomposition of the Roe matrix: The Roe flux is defined as: The Roe solver is the only 7 waves Riemann solver to date. It is a bit slow and features one problem: formation of rarefaction shocks.

The HLL Riemann solvers for MHD HLL-type Riemann solvers rely only on computing the fastest wave speed. Define a as the fast magnetosonic speed and the left and right going waves as Use generic Rankine-Hugoniot relations with one single intermediate state U* and corresponding flux F*, we get the HLL flux: The Lax-Friedrich flux is obtained as a particular case with

Generalise Euler HLLC to MHD (Linde 2002; Gurski 2004) Define the Lagrangian sound speed as: The HLLC Riemann solver Define Ptot* and u* as: Thermal + magnetic pressure This defines the 3rd contact wave Left and right density jumps: For transverse velocity and magnetic field, we get: Finally, compute fluxes using Rankine-Hugoniot relations on the 3 discontinuities. Jump conditions are not correct (especially at the contact discontinuity). Valid only for Bx=0. Otherwise, HLLC can lead to numerical instability or excessive smoothing of Alfven waves.

The HLLD Riemann solver 5 wave Riemann solver with 4 intermediate (star) states (Miyoshi & Kusano 2005) t S L S * L S * R S R U * L U ** L S ** U * U ** R R U L U R x Normal velocity and pressure are uniform across 4 states (HLLC values). Density jumps across fast waves but is uniform across Alfven waves (HLLC values) Define the two new wave speeds as the star state Alfven speed: Given the 5 wave speed, we can compute the intermediate states using Rankine- Hugoniot relations.

The HLLD Riemann solver RH relations after the fast magnetosonic wave give jumps in transverse v and B Conservation laws across the 2 Alfven waves give the following uniform values (only density varies across the contact waves) Note that these relations are HLL states applied to the 2 Alfven waves.

The HLLD Riemann solver Flux for each conservative variable are computed using RH relations across each waves. As for HLLC in the case of the Euler equations, it can be shown that HLLD is a positivity preserving scheme. It resolves exactly fast magnetosonic and Alfven (rotational) waves, as well as contact discontinuities. Slow magnetosonic waves are excessively smoothed. Fast and robust Riemann solver, now widely used (RAMSES, ATHENA, ENZO). A good strategy: 1- try first HLLD 2- if it doesn t work, try then HLL 3- if it doesn t work, try Lax-Friedrich (it should work!!!)

MHD shock tube test Left and right states defined by Compile RAMSES with directives SOLVER=mhd and NDIM=1 Note Bx=constant in the initial conditions. Test various Riemann solvers llf for Local Lax-Friedrich hll for 2-wave (fast magnetosonic) HLL hlld for 5-wave HLL-like solver roe for the 7-wave MHD Roe solver. Test adapted from Miyoshi & Kusano (2005) It features a stationary slow magnetosonic shock!

The MHD Lax-Friedrich Riemann solver riemann= llf

The MHD HLL solver riemann= hll

The HLLD solver riemann= hlld

The MHD Roe solver riemann= roe

Why bother with a Godunov scheme? Proper upwinding of the numerical flux with respect to all 7 waves ensures stability of the solution. Using a strict conservative update ensures proper jump conditions/shock velocities. Falle (2000)

Godunov method for MHD in multiple dimensions The main difficulty is to keep a vanishing divergence for B. Why is there a problem? From the relation: We derive the conservative form of the momentum equation with a spurious force: On the other hand, we know from Faraday s law that If magnetic monopoles are forming due to numerical truncation errors, the induction equation doesn t remove them. Non-zero divergence accumulates, giving rise to a spurious force parallel to the field lines. In some cases, div B will grow without bounds (numerical instability). For long time integration, this lead to inconsistent results and quite often to code crashes. The goal of computational MHD is to design div B preserving schemes.

Cell-centered Godunov method for MHD Natural extension of finite-volume Godunov schemes to MHD equations. Define a volume-average magnetic field B in a cell V as: with Divergence cleaning methods - Powell s 8-wave scheme (Powell 1999) - Projection scheme (Brackbil & Barnes 1980) - Dedner s diffuson scheme (Dedner et al. 2002) A little bit of everything (Crockett et al. 2005)

div B cleaning schemes Powell (1999) explicitly introduces magnetic monopole and magnetic current Add source terms to the momentum equation and to the induction equation magnetic current Pros: magnetic monopoles are advected away. Powell s system is still hyperbolic. Cons: the resulting scheme is not conservative. Jump relations are incorrect. In 1D, Bx is not constant anymore (it is advected at the flow velocity). We now have 8 conservative variables with 8 waves (the div B wave). Modify all Riemann solvers to account for this additional degree of freedom. For and for In particular, at the interface, one get the upwind state for the normal component: if if

div B cleaning by the projection method The previous step gives a normal magnetic flux with non-zero divergence. Brackbill & Barnes (1980) proposed to remove explicitly magnetic monopoles using the Projection Method (also used in incompressible fluids) Compute the monopole (magnetic charge) for each cell Solve for the potential with the Poisson equation Correct the normal magnetic field with Use this corrected field in the final conservative update. It can be shown that this corrected field is the zero-divergence field closest (using the L2 norm) to the original one. Problems: Poisson equation is non-local (elliptic) and time consuming. Corrections in the magnetic field can result in large truncation errors in the gas pressure. Dedner et al. (2002) develops a variant of the scheme, with an hyperbolic div B cleaning step that works also close to stagnation points.

Godunov method with Constrained Transport The induction equation in integral form suggests a surface-average form: (Stokes theorem) The magnetic field is face-centred while Euler-type variables are cell-centred (staggered mesh approach). Similar to potential vector methods (Yee 1966; Dorfi 1986; Evans & Hawley 1988).

CT: exact div B preserving scheme Surface-averaged magnetic fields are updated conservatively: using time-averaged electric fields defined at cell edge centres: The total flux (div B) across each cell bounding surface vanishes exactly.

The induction equation in 2D We write Faraday s law using now the EMF vector We use a finite-surface approximation for the magnetic field Integral form of the induction equation using Stoke s theorem By construction, div B vanishes exactly: For piece-wise initial constant data, the flux function is self-similar at corner points. For pure induction, the exact Riemann solution is: Induction Riemann problem

Londrillo & Del Zana 2004, Gardiner & Stone 2005, Teyssier et al. 2006; Fromang et al. 2006, Balsara 2010 1- Linear 2D Riemann solvers: For a 1D Riemann solver (e.g. Roe): F(U(0)) = 1 2 (F L + F R ) + 1 2 2D Riemann solvers for MHD i=1,m λ i ( β i α i ) K i The 2D flux is given by: riemann2d= llf riemann2d= roe 2- The HLL solver in 2D: F(U(0)) = 1 4 (F LL + F RL + F LR + F RR ) + 1 2 λ x,i ( β x,i α x,i ) K i i=1,m x 1 2 riemann2d= hll λ y,i ( β y,i α y,i ) K i i=1,m y 3- The HLLD solver in 2D: riemann2d= hlld

Higher-order schemes and AMR «Divergence-free preserving» restriction and prolongation operators Balsara (2001) Toth & Roe (2002)???? Flux conserving interpolation and averaging within cell faces using TVD slopes in 2 dimensions EMF correction for conservative update at coarse-fine boundaries For a fully second-order MUSCL scheme for MHD, see Teyssier et al. 2006; Fromang et al. 2006. In particular, the predictor step requires MHD states to be Taylor expanded at cell faces but also at cell corners.

The current sheet test Magnetic reconnection occurs because of numerical diffusion Time sequence of field lines (Fromang et al. 2006)

The current sheet test Different Riemann solvers converge towards different solutions!

Collapse of a molecular core and star formation 2 main effects of magnetic fields on the collapse: - magnetic breaking (remove angular momentum in escaping Alfven waves) - build-up of a magnetic tower and launch of a conical jet Fromang et al. 2006: Hennebelle & Teyssier 2007 LLF Rieman solver Roe Riemann solver

Conclusion - Ideal MHD equations in 1D can be modeled using fully cell-centered Godunov schemes - We have designed several MHD Riemann solvers (they are all present in RAMSES) - In 2D and 3D, MHD equations are more problematic: numerical buildup of magnetic monopoles: instabilities and spurious forces - Fully cell-centered schemes can be developed using div B cleaning (non-conservative, non-local) - Face-centered schemes are more natural (exact magnetic flux conservation and vanishing divergence are easy to obtain) - Constrained Transport approach requires proper 2D upwinding of MHD waves to compute the electric field: 2D Riemann solvers and 2D slope limiters.

References Balsara, D., 2010, JCP, 229, 6 Brackbill, J., Barnes, D., 1980, JCP, 35, 426 Brio, M., Wu, C., 1988, JCP, 75, 400 Cargo, P., Gallice, G., 1997, JCP, 136, 446 Crockett, R., Collela, P., Fisher, R., Klein, R., McKee, C., JCP, 203, 422 Dai, W., Woodwards, P., 1998, ApJ, 494, 317 Dedner, A., Kemm, F., Kroner, D., et al. 2002, JCP, 175, 645 Dorfi, E., JCP, 43, 1 Evans, C., Hawley, J., 1988, ApJ, 33, 659 Fromang, S., Hennebelle, P., Teyssier, R., 2006, A&A, 457, 371 Gardiner, T., Stone, J., 2005, JCP, 205, 509 Gurski, K, 2004, SIAM J., SCI Comput, 25, 2165 Londrillo, P., Del Zanna, L., 2000, JCP, 195, 17 Miyoshi, T., Kusano, K, 2005, JCP, 208, 315 Powell, K., Roe, P., Linde T. et al., 1999, JCP, 154, 284 Roe, P., 1981, JCP, 53, 357 Ryu, D., Miniati, F., Jones, T., Franck, A., 1998, ApJ, 509, 244 Stone, J., Norman, M., 1992, ApJS, 80, 791 Teyssier, R., Dormy, E. Fromang, S., 2006, JCP, 218, 44 Toth, G., 2000, JCP, 161, 605