CONSTRAINED-TRANSPORT MAGNETOHYDRODYNAMICS WITH ADAPTIVE MESH REFINEMENT IN CHARM

and

Published 2011 June 23 © 2011. The American Astronomical Society. All rights reserved.
, , Citation Francesco Miniati and Daniel F. Martin 2011 ApJS 195 5 DOI 10.1088/0067-0049/195/1/5

0067-0049/195/1/5

ABSTRACT

We present the implementation of a three-dimensional, second-order accurate Godunov-type algorithm for magnetohydrodynamics (MHD) in the adaptive-mesh-refinement (AMR) cosmological code CHARM. The algorithm is based on the full 12-solve spatially unsplit corner-transport-upwind (CTU) scheme. The fluid quantities are cell-centered and are updated using the piecewise-parabolic method (PPM), while the magnetic field variables are face-centered and are evolved through application of the Stokes theorem on cell edges via a constrained-transport (CT) method. The so-called multidimensional MHD source terms required in the predictor step for high-order accuracy are applied in a simplified form which reduces their complexity in three dimensions without loss of accuracy or robustness. The algorithm is implemented on an AMR framework which requires specific synchronization steps across refinement levels. These include face-centered restriction and prolongation operations and a reflux-curl operation, which maintains a solenoidal magnetic field across refinement boundaries. The code is tested against a large suite of test problems, including convergence tests in smooth flows, shock-tube tests, classical two- and three-dimensional MHD tests, a three-dimensional shock–cloud interaction problem, and the formation of a cluster of galaxies in a fully cosmological context. The magnetic field divergence is shown to remain negligible throughout.

Export citation and abstract BibTeX RIS

1. INTRODUCTION

Magnetic fields are a common feature of cosmic plasmas, from the interplanetary medium and the atmospheres of stars, to the interstellar medium of galaxies and the baryonic gas in the largest structures of the universe such as clusters and voids of galaxies (e.g., Zel'dovich et al. 1983; Bernet et al. 2008; Clarke et al. 2001; Neronov & Vovk 2010).

Their origin is discussed in several papers and different processes are likely responsible for the magnetization of different environments (see, e.g., Miniati & Bell 2011, and references therein). In general weak rotational electrostatic fields are required, which are normally suppressed by the high conductivity of astrophysical plasmas, but which can nevertheless arise under special conditions. The magnetic field can then evolve considerably and amplification of an initially weak seed by many orders of magnitude is plausible, particularly when the flow is highly turbulent (Zel'dovich et al. 1983). Magnetic fields affect the dynamics of a system directly through the Lorentz force and indirectly through their impact on the plasma microscopic properties, e.g., the thermal conductivity or electric resistivity (Spitzer 1965), or the transport of high-energy particles (Schlickeiser 2002), both with conspicuous macroscopic effects. Thus, magnetic fields are a crucial component of astrophysical plasmas although perhaps due to the complexity they introduce, progress in characterizing their role has been relatively slow, particularly in certain areas of astrophysics. Due to such complexities, particularly during highly nonlinear regimes, accurate and efficient numerical methods are valuable for studying the evolution of magnetized systems.

A simplified description of a magnetized fluid is provided by the equations of ideal magnetohydrodynamics (MHD). This approximation is valid when the following hierarchy of scales is satisfied: ℓmfp ≪ λ ≪ L, where ℓmfp is the mean free path of the fluid particles, λ is the characteristic scale of the problem of interest, and L is the size of the system (Ginzburg 1979). The fluid approximation is generally guaranteed by small particle gyro-radii in the direction perpendicular to the magnetic field lines, and either by collisions, a tangled magnetic field component, or microscopic instabilities along the mean magnetic field lines.

When dissipative terms can be neglected, the MHD equations are in ideal form and read (Landau & Lifshitz 1984)

Equation (1)

Equation (2)

Equation (3)

Here, ρ is the gas density, ui and Bi are the components of the velocity and magnetic field vectors, respectively, $p=p_g+\frac{1}{2}B^2$ is the total sum of the gas and magnetic pressures, $e=\frac{1}{2}u^2+ e_{{\rm th}}+\frac{1}{2}\frac{B^2}{\rho }$ is the total specific energy density, δij is Kronecker's delta, and summation over repeated indices is assumed. The thermal energy is related to the pressure through a γ-law equation of state, eth = pg/ρ(γ − 1). The magnetic field evolution is described by Faraday's equation, with the electric field given by Ohm's law. In the limit of negligible resistivity, the only electric fields are those induced by motions of the magnetized fluid and the induction equation reads (Landau & Lifshitz 1984)

Equation (4)

where εijk is the fully antisymmetric tensor of rank 3 and ε012 = 1.

The resistive terms neglected in Equations (1)–(4), which are responsible for the diffusion of the magnetic field, can be readily recovered (Samtaney et al. 2005), although for most purposes their neglect is safe in astrophysical plasmas.

There are various approaches to solve numerically the equations of MHD. The one we follow in this paper is based on the extension to MHD of conservative methods for hyperbolic systems of equations, particularly Godunov's methods for hydrodynamics. This approach is met with two difficulties, however. First, care must be taken because the system of MHD equations is not strictly hyperbolic. This can be dealt with by "renormalizing" the eigenvalues and eigenvectors of the system (Brio & Wu 1988). Second, and most importantly, the solenoidal constraint, ∇ · B = 0, must be enforced or else the solution will contain artifacts (Brackbill & Barnes 1980). Unfortunately, numerical schemes designed for pure hydrodynamics do not fulfill such a requirement and the above constraint must be enforced separately. Different ways to do so have been proposed. In one approach the magnetic field is defined together with all other fluid variables at cell centers and the non-solenoidal component is removed through a Hodge–Helmholtz projection method, typically once per time step (Brackbill & Barnes 1980; Zachary et al. 1994; Ryu et al. 1995). In a variation of this approach, the projection operation is performed on the magnetic field variables extrapolated to the cell faces that are used to define the MHD fluxes (Crockett et al. 2005). It is argued in Crockett et al. (2005) that this type of projection is mathematically more consistent with the solenoidal requirement because it is the fluxes defined on the cell faces that get differentiated to compute the flux updates. In a second approach, the MHD equations are cast in a special eight-wave non-conservative formulation. This allows for the non-solenoidal component of the magnetic field to be explicitly tracked and suitably damped as it is advected by the flow (Powell et al. 1999; Dedner et al. 2002).

Finally in the constrained-transport (CT) approach, the discretization strategy originally proposed by Yee (1966) in the context of Maxwell equations is used, in which the magnetic field is defined at face centers, the electric field used to update the latter is defined at cell edges, and the other fluid variables are defined at cell centers as in ordinary hydrodynamics (Evans & Hawley 1988; Dai & Woodward 1998; Ryu et al. 1998; Balsara & Spicer 1999; Tóth 2000; Londrillo & del Zanna 2004; Fromang et al. 2006; Cunningham et al. 2009). In this approach, the rate of change of the magnetic flux at cell faces is given by the circulation of the electric field along the cell edges which define the boundary of the corresponding face. Thus, the solenoidal character of the magnetic field is ensured by Stokes' theorem down to machine precision. Recently, Gardiner & Stone (2005, 2008) have developed an unsplit version of the CT algorithm, extending to the case of MHD the corner-transport-upwind (CTU) method for directionally unsplit hydrodynamics proposed in Colella (1990) and Saltzman (1994). The use of a directionally unsplit algorithm has proven quite attractive, particularly because it appears to be better suited for modeling turbulent flows (Almgren et al. 2010) and in the presence of source terms (Leveque 1998). Most importantly, due to the solenoidal constraint, the MHD equations contain intrinsically multidimensional terms which require a directionally unsplit formulation if one is to achieve high-order accuracy in multidimensional problems (Gardiner & Stone 2005). Thus, the extension of CTU to MHD has also attracted considerable interest in the astrophysical community (e.g., Teyssier et al. 2006; Fromang et al. 2006; Lee & Deane 2009; Mignone & Tzeferacos 2010).

In this paper, we describe the implementation of a version of the CTU + CT scheme that closely resembles the one of Gardiner & Stone (2008) and Stone et al. (2008). Our scheme differs from theirs, however, in two respects. First, we have chosen to use the full 12-solve CTU scheme instead of the simpler 6-solve scheme. The reason for this choice is due to the larger CFL number that the full CTU scheme can afford (CFL = 1), as compared with the simplified version (CFL = 0.5). As indicated by Gardiner & Stone (2008) the computational cost of the two versions of the CTU scheme is roughly the same for pure MHD calculations, because the factor of two fewer Riemann solvers comes with twice as many steps to achieve the same solution time. However, for multiphysics applications that we have in mind other expensive solvers are executed each time step, whose cost grows with the number of time steps. Note that Teyssier et al. (2006) use also a simpler version of the CTU scheme, although in their case a slightly less restrictive condition on the time step is nominally allowed, i.e., CFL ⩽0.7. On the other hand, Lee & Deane (2009) have introduced a different approach for computing the transverse flux updates of the fluid variables in their directionally unsplit method, which relies on characteristic tracing alone and does not require intermediate Riemann solvers (except for the magnetic field intermediate updates). For this reason and since the stability constraint only requires CFL ⩽1 this approach can potentially be quite efficient.

Second, we take into account the multidimensional corrections required to balance the ∇ · B terms in a form that is simpler than originally proposed by Gardiner & Stone (2008), and analogous to Crockett et al. (2005). Our tests suggest that the accuracy and robustness of the algorithm are not affected by this simplification.

Finally, using in particular the ideas in Berger & Colella (1989) for adaptive mesh refinement (AMR) and Balsara (2001) for the divergence-free coarse–fine interpolation of the magnetic field in newly refined grid patches, we have implemented an AMR version of our CTU + CT MHD scheme. The code in which the implementation is carried out is CHARM (Miniati & Colella 2007a). It includes various other physical modules, namely self-gravity, collisionless dark matter particles and cosmic expansion for cosmological applications, radiative cooling (Miniati & Colella 2007b), cosmic-rays (Miniati 2001, 2007), and dust particles (Miniati 2010).

The remainder of this paper is organized as follows. The algorithm is discussed in detail in Section 2. In Section 3, we present results for an extensive set of problems that test the accuracy and robustness of the code. These tests include a convergence study in smooth flows, a suite of Riemann problems in one and two dimensions (1D and 2D, respectively), the Orszag–Tang vortex as well as the rotor problem, carried out on a uniform grid. Finally, extension to AMR and to the case of cosmological applications are described in Sections 4 and 5, respectively. We have tested these extensions with a problem involving the interaction of a magnetized interstellar cloud with a strong shock, and the formation of a galaxy cluster in a fully cosmological simulation. The paper concludes with a brief summary in Section 6.

2. NUMERICAL SCHEME

In this section, we first provide an overall description of the full CTU + CT algorithm and, following that, discuss the implementation details. We begin by a description of the space discretization, data structure, and notation.

2.1. Preliminaries

2.1.1. Discretization, Variables, and Operators

The algorithmic operations are carried out on a discrete representation of the continuous D-dimensional space given by the cubic lattice, ${{\boldsymbol{i}}}\equiv (i_0, \ldots, i_{{\mathbf {D}}- 1}) \in \mathbb {Z}^{\mathbf {D}}$. The computational domain, referred to as a grid Γ, is a bound subset of $\mathbb {Z}^{\mathbf {D}}$ and provides a finite-volume discretization of the continuous space into a collection of control volumes, faces, and edges. Each control volume is identified by an index ${{\boldsymbol{i}}}\equiv (i_0, \ldots, i_{{\mathbf {D}}- 1}) \in \Gamma$ and corresponds to a region of space,

Equation (5)

where h is the mesh spacing and ${\boldsymbol{v}}\equiv (1,\ldots,1)$ is the vector whose components are all equal to one. The face-centered discretization of space based on the same control volumes is $\Gamma _{\rm f}^{{{\boldsymbol{e}}^{d}}} = \lbrace {\boldsymbol{i}}\pm \frac{1}{2}{{\boldsymbol{e}}^{d}}: {\boldsymbol{i}}\in \Gamma \rbrace $, where ${{\boldsymbol{e}}^{d}}$ is the unit vector in the d direction. $\Gamma _{\rm f}^{{{\boldsymbol{e}}^{d}}}$ indexes the cell faces of Γ normal to ${{\boldsymbol{e}}^{d}}$ representing the areas

Equation (6)

Finally, the edge-centered discretization of space is $\Gamma _{\rm e}^{{{\boldsymbol{e}}^{d}}} = \lbrace {\boldsymbol{i}}\pm \frac{1}{2}{{\boldsymbol{e}}^{d_1}}\pm \frac{1}{2}{{\boldsymbol{e}}^{d_2}}: {\boldsymbol{i}}\in \Gamma,\,d\ne d_1\ne d_2\rbrace $. $\Gamma _{\rm e}^{{{\boldsymbol{e}}^{d}}}$ indexes the edges of the cells in Γ aligned with ${{\boldsymbol{e}}^{d}}$ representing the lengths

Equation (7)

Figure 1 illustrates a control volume with the various types of discretization.

Figure 1.

Figure 1. Control volume and discrete representation of physical quantities.

Standard image High-resolution image

Given the above discretization, we define cell-centered discrete variables on Γ as

and denote by $\phi _{\boldsymbol{i}}\in {\mathbb {R}}^m$ the value of ϕ at cell ${\boldsymbol{i}}\in \Gamma$. Similarly, we define face-centered vector fields on $\Gamma _{\rm f}^{{{\boldsymbol{e}}^{d}}}$ as

and denote by $F_{d,{\boldsymbol{i}}+ \frac{1}{2}{{\boldsymbol{e}}^{d}}} \in {\mathbb {R}}^m$ the value of Fd at ${\boldsymbol{i}}+ \frac{1}{2}{{\boldsymbol{e}}^{d}}\in \Gamma _{\rm f}^{{{\boldsymbol{e}}^{d}}}$, and also define edge-centered vector fields on $\Gamma _{\rm e}^{{{\boldsymbol{e}}^{d}}}$ as

and denote by $E_{d,{\boldsymbol{i}}+ \frac{1}{2}({{\boldsymbol{e}}^{d_1}}+{{\boldsymbol{e}}^{d_2}})} \in {\mathbb {R}}^m$ the value of Ed at $ {\boldsymbol{i}}+ \frac{1}{2}({{\boldsymbol{e}}^{d_1}}+{{\boldsymbol{e}}^{d_2}}) \in \Gamma _{\rm e}^{{{\boldsymbol{e}}^{d}}}.$ Finally, for face-centered fields we introduce the discretized divergence operator

Equation (8)

and for edge-centered fields the discretized curl operator

Equation (9)

Time is also discretized into a number of finite intervals of variable size. In particular, we write tn + 1 = tn + Δtn, where t indicates the solution time, n indicates the integration step, and Δtn indicates the time-step interval.

2.1.2. Time Integration

The coupled system of Equations (1)–(4), with the allowance for a non-zero source term S(U), can be cast in the following compact form:

Equation (10)

where the conservative variables, U, and the associated fluxes along the direction d, Fd, are defined as

Equation (11)

Following Godunov's approach and its higher-order extensions, we can conveniently formulate a numerical integration scheme based on the conservative properties of the system (10). In this approach one follows the evolution of cell-centered volume-averaged conservative variables, defined as

Equation (12)

The evolution equation is obtained upon suitable manipulation of the original continuous Equation (10), and reads (Leveque 1998)

Equation (13)

where the face-centered time-averaged fluxes along the direction d are defined as

Equation (14)

If the source term is non-stiff, we can obtain a second-order estimate for it by the simple time average, $S^{n+\frac{1}{2}}\simeq \frac{1}{2}(S^n+S^{n+1})$.

Note that given the flux along a direction d1, $F_{d_1,{\boldsymbol{i}}+\frac{1}{2}{{\boldsymbol{e}}^{d_1}}}$, the component corresponding to the magnetic field along the direction d2d1, defines a face-centered electric field along d according to

Equation (15)

where we use subscripts to indicate directions and centering, and superscripts for components. Indeed, Godunov's scheme also updates in time the cell-centered magnetic field variables. As already pointed out, however, the updated magnetic field in general does not remain solenoidal. Therefore, we adopt instead a CT discretization strategy in which the primary description of the magnetic field we will be using face-centered area-averaged variables defined as

Equation (16)

Note that an estimate of the cell-centered magnetic field variables is still needed in order to construct the fluxes in Equation (14). We will return to this point shortly. The evolution equation for the face-centered magnetic field variables is obtained again from a manipulation of Faraday's law and reads

Equation (17)

with dd1d2, 0 ⩽ d, d1, d2 < D. The edge-centered time-averaged electric field is formally defined as

Equation (18)

and, as above, the time-centered estimate of the non-stiff source term for the face-centered magnetic field components is obtained by simple arithmetic averaging. The cell-centered magnetic field variables are then defined in terms of the primary face-centered values using the following second-order accurate reconstruction scheme (Ryu et al. 1998; Balsara 2001; Gardiner & Stone 2005):

Equation (19)

An important part of CT schemes concerns the calculation of the time-averaged, edge-centered electric fields entering the time update (Equation (17)). For example, one can employ some type of bilinear interpolation. Dai & Woodward (1998) interpolate in space and time the cell-centered velocity and magnetic field at time tn with the solution from the Godunov scheme at time tn + 1 to obtain time- and corner-centered electric fields. On the other hand, Ryu et al. (1998) and Balsara (2001) take advantage of Equation (15) and interpolate the face-centered variables that allow reconstruction of electric fields at cell edges. The interpolation scheme proposed in Ryu et al. (1998) has the property that for plane-parallel configurations their multidimensional scheme reduces to the 1D scheme. This same property is shared by the upwind scheme proposed in Gardiner & Stone (2005) which is adopted here and is described in more detail in Section 2.2.6. This property is important because it guarantees self-consistency between (1) the electric fields used for the time update of face-centered magnetic variables, (2) the MHD fluxes used for the time update of the cell-centered variables, and (3) the synchronization step of the magnetic variables given in Equation (19) (Gardiner & Stone 2005). In the most general case, the electric field is obtained by solving a 2D Riemann problem (Londrillo & Del Zanna 2000; Londrillo & del Zanna 2004; Teyssier et al. 2006; Fromang et al. 2006), of which the upwind scheme mentioned above is a special case.

Note that by applying the divergence operator in Equation (8) to the face-centered magnetic field evolved according to Equation (17), one finds that the divergence of the field does not change in time. So the magnetic field remains solenoidal if initially so. This is the property of the CT scheme.

The accuracy and stability of the numerical solution depend principally on how the time-averaged fluxes and electric fields entering Equations (13) and (17), respectively, are computed. In the following sections, we shall describe the algorithmic details characterizing such calculation.

2.2. Algorithm

The algorithm described in this section computes second-order accurate face-centered fluxes and edge-centered electric fields required for the update of the cell-centered fluid variables and face-centered magnetic field variables in Equations (13) and (17), respectively. It uses a combination of the CTU algorithm (Colella 1990; Saltzman 1994), and the CT scheme, as in Gardiner & Stone (2008). Unlike these authors, though, for the reasons indicated in the Introduction we will employ the full CTU scheme with 12-solve per cells (in three dimensions, 3D).

Assuming the solution at time tn, $U^n_{\boldsymbol{i}}$ to be known, the outline of the algorithm is as follows.

  • 1.  
    Compute primitive from conservative variables, $W^n_{\boldsymbol{i}}=W^n_{\boldsymbol{i}}(U^n_{\boldsymbol{i}})$, and synchronize cell-centered and face-centered magnetic field values.
  • 2.  
    Compute limited slopes along the coordinate directions, $\delta W^n_{{\boldsymbol{i}}, d}$.
  • 3.  
    Do characteristic tracing to extrapolate in space and time primitive variables from cell centers to cell faces, $W_{{\boldsymbol{i}}, \pm, d}$. Also include effects of source term here.
  • 4.  
    Compute face-centered conservative variables $U_{{\boldsymbol{i}}, \pm, d}=U_{{\boldsymbol{i}}, \pm, d}(W_{{\boldsymbol{i}}, \pm, d})$.
  • 5.  
    Apply corrections to $U_{{\boldsymbol{i}}, \pm, d}$ due to transverse gradients and obtain multidimensionally correct time-averaged fluxes $F_{{\boldsymbol{i}}+\frac{1}{2}{{\boldsymbol{e}}^{d}}}^{n+\frac{1}{2}}$ and electric fields $E_{{\boldsymbol{i}}+\frac{1}{2}{{\boldsymbol{e}}^{d_1}}+\frac{1}{2}{{\boldsymbol{e}}^{d_2}}}^{n+\frac{1}{2}}$.
  • 6.  
    Update primary variables, $U_{\boldsymbol{i}}^n\leftarrow U_{\boldsymbol{i}}^{n+1}$ and $B_{{\boldsymbol{i}}+\frac{1}{2}{{\boldsymbol{e}}^{d}}}^n\leftarrow B_{{\boldsymbol{i}}+\frac{1}{2}{{\boldsymbol{e}}^{d}}}^{n+1}$ and synchronize cell-centered and face-centered magnetic field values.
  • 7.  
    Update solution time tntn + Δtn and compute new time step according to the Courant–Friedrichs–Lewy (CFL) condition for stability,
    Equation (20)
    where the CFL number is CCFL < 1, ud is the d-component of the velocity field, cf is the fast magnetosonic wave speed, and the maximum value is computed over all directions d and over all cells in the computational domain.

In the following subsections, we provide additional details about the algorithm.

2.2.1. Primitive Variables

The first part of the algorithm consists in reconstructing the numerical solution within the spatial domain of the mesh. This requires estimating gradients and eventually extrapolating state variables in time and space from cell centers to cell faces with the use of characteristic tracing. Such operations are usually done in primitive space, where the variables are defined as

Equation (21)

as it simplifies the characteristic analysis of the system. The evolution of the system in terms of primitive variables is given by a system of equations in non-conservative form,

Equation (22)

where SW = ∇UW · S and Ad = ∇UW · ∇UFd · ∇WU, and ∇UW and ∇UW are the Jacobian of the transformation from primitive to conserved variables and vice versa. Given their importance for the construction of a sound numerical scheme, the properties of the operators Ad have been studied in great detail in the literature (e.g., Brio & Wu 1988; Roe & Balsara 1996). Here it suffices to make the following observations. In 1D, d = 0, the parallel component of the magnetic field is constant, B0 = const., and A0 effectively becomes a 7 × 7 matrix. In general the operator A0 is characterized by seven eigenvalues, and associated left and right eigenvectors, with values u, u ± cs, u ± cA, and u ± cf obeying the hierarchy: cscAcf. The first eigenvalue listed above corresponds to the usual entropy wave, and the other six to the three pairs of MHD waves (slow magnetosonic, Alfvén, and fast magnetosonic) propagating downstream (+) or upstream (−) in the flow, respectively. Because up to five of the eigenvalues may actually coincide, the system is not strictly hyperbolic, so care must be taken to avoid singularities with expressions involving the eigenvectors (Brio & Wu 1988; Roe & Balsara 1996). Finally, in more than 1D, because Bd is not affected by gradients in the d direction, it has been customary to use the 1D analysis when formulating the predictor step for higher-order Godunov-like MHD algorithms. However, that leads to neglect of terms ∝∂Bd/∂xd, which are not necessarily null in multidimensions. In fact, it is important to include these terms to avoid degrading the solution accuracy, as recently pointed out by Gardiner & Stone (2005).

2.2.2. Slopes

After the computing primitive from conservative variables, $ W^n_{\boldsymbol{i}}=W^n_{\boldsymbol{i}}(U^n_{\boldsymbol{i}})$ and the synchronization of cell-centered and face-centered magnetic fields according to Equation (19), we proceed to the calculation of the slopes along each direction d as follows. First, central and side slopes are estimated, respectively, as

Equation (23)

Equation (24)

Equation (25)

and then limiting is applied component-wise either in primitive or in characteristic space. We use van Leer's (also known as Monotonized Central) limiter defined as

In the case of primitive limiting the limiter is applied directly to each component k of the primitive slopes (23)–(25), i.e.,

Equation (26)

In the case of characteristic limiting the limiter is applied to the components of the primitive slopes in characteristic space, namely,

Equation (27)

Equation (28)

Equation (29)

where $l^k= l^k(W^n_{\boldsymbol{i}})$ and $r^k = r^k(W^n_{\boldsymbol{i}})$ are the left and right eigenvectors of the operator $A_{{\boldsymbol{i}},d}$.

2.2.3. Normal Predictor

Next we extrapolate the primitive variables from cell centers to face centers along each coordinate direction, d, by taking into account the time-averaged effect due to the slopes just computed. This is done most conveniently by using the 1D versions of the MHD equations in primitive form. There is no evolution in the d-component of the magnetic field due to derivatives along the d-direction, so the normal components of the magnetic field on cell faces are straightforwardly provided by the face-centered component of the magnetic field, without need for even geometrical extrapolation. On the other hand, as pointed out by Gardiner & Stone (2005) in multidimensional MHD the reconstruction step must include terms proportional to ∂Bd/∂xd terms (no summation over repeated indices is implied here). These terms arise from the requirement to balance the divergence terms in more than 1D and their neglect can cause serious degradation of the numerical solution. However, here the source terms are added only during the normal predictor step and are omitted during the corrections associated with transverse flux gradients. Our tests suggest that neither the accuracy nor the robustness of the code is affected by this choice. The reconstruction of the primitive variables onto cell faces can be done with various degrees of accuracy. Typically, one uses a piecewise-linear (PLM) or piecewise-parabolic (PPM) reconstruction scheme (Colella & Woodward 1984). Although we mostly use a PPM algorithm for the tests presented here, for simplicity we illustrate the case of PLM reconstruction. So in this case the extrapolation of the primitive variables in space and time from cell centers to faces along the direction d takes the form

Equation (30)

where we have explicitly separated out the reconstruction of the normal component of the magnetic field (the hat symbol in the notation indicates that the components corresponding to the normal magnetic field are omitted). In addition, we have used the projector operator defined as

Equation (31)

where λk are eigenvalues of $A_{{\boldsymbol{i}},d}$. This projector operator filters out the components of the gradients that propagate away from the cell interface. However, when a Riemann solver of the Harten–Lax–van Leer (HLL) family (Harten et al. 1983) is employed, in order to obtain second-order accuracy the filter is switched off and both in the PPM and PLM cases, and the summation is carried over all waves, irrespective of their sign (this is further discussed in Section 2.2.5). Finally, Sd, MHD represents the MHD source term required in multidimensional MHD which we implement in the form (Crockett et al. 2005)

Equation (32)

where

Equation (33)

and, as usual, dd1d2 and, in this particular case, 0 ⩽ d1 < d2 < D. The normal predictor step is completed by the final corrections for a non-stiff source term according to

Equation (34)

2.2.4. CT Extended Corner Transport Upwind

After the primitive variables have been extrapolated to cell faces, we add corrections due to gradients parallel to the cell faces. We find it convenient at this point to convert back to a conservative representation, thus we compute $U^{n}_{{\boldsymbol{i}},\pm,d}=U^{n}_{{\boldsymbol{i}},\pm,d}(W^{n}_{{\boldsymbol{i}},\pm,d})$. Following the CTU scheme the corrections are expressed in terms of transverse flux gradients, with fluxes obtained from a Riemann solver, ${\cal R}$. In accord with the CT scheme, however, for the update of magnetic field variables we use gradients of edge-centered electric fields suitably interpolated in space and time from their face- and cell-centered values. Both the interpolation procedure, ${\cal I}_E$, and the Riemann solver, ${\cal R}$, will be specified at the end of this section. It suffices here to say that the time centering and interpolation accuracy of the interpolated edge-centered electric fields is consistent with that of the MHD fluxes returned by the Riemann solver. Note that no additional "multidimensional MHD source term," as required by a straightforward 3D extension of Gardiner & Stone (2005), appears in this part of the algorithm, which considerably simplifies it.

The steps involved in the modified CTU update can then be summarized as follows.

  • 1.  
    Use a Riemann solver, ${\cal R}(U^{\rm Left},U^{\rm Right},d)$, to obtain a first estimate of the fluxes across cell faces along each direction, d
    Equation (35)
    where the "1D" notation loosely indicates face-centered quantities corrected for the one-dimensional gradients during the normal predictor step.
  • 2.  
    Use the newly obtained fluxes with the primitive solution at time tn to interpolate the electric fields from cell faces and cell centers to cell edges
    Equation (36)
    where the "*" symbol indicates that the interpolation requires values of the arguments at various cell centers and faces.
  • 3.  
    As part of the CTU prescription to obtain (1, 1, 1) diagonal coupling, apply corrections to density, momentum, and energy components of $U_{{\boldsymbol{i}}, \pm, d_1}$, due to one set of transverse flux derivatives along d2. For each face d1, there will be D  −  1 such corrected states, one for each direction perpendicular to d1. We indicate these states with a "2D" notation and write
    Equation (37)
    where the 1D notation loosely indicates face-centered quantities corrected for the one-dimensional gradients during the normal predictor step.
  • 4.  
    Likewise, use the CT scheme to correct magnetic field components affected by the same set of transverse flux derivatives. There are D − 1 magnetic field components of $U^n_{{\boldsymbol{i}}, \pm, d_1}$ on the face d1 which are affected by the transverse flux along d2. First, the component along d1, which we indicate with $U_{B_{d_1}}$, is corrected as
    Equation (38)
    Second, the magnetic field component, $U_{B_{d_3}}$, along the remaining direction d3d2d1. This component is cell-centered with respect to d3, so its correction is given by the average of the relevant face-centered contributions at ${\boldsymbol{i}}+\frac{1}{2}{\boldsymbol{e}}^{d_3}$ and ${\boldsymbol{i}}-\frac{1}{2}{\boldsymbol{e}}^{d_3}$ (Gardiner & Stone 2008), namely,
    Equation (39)
  • 5.  
    Next use a Riemann solver to obtain fluxes for each pair of states corrected for transverse fluxes. This provides D − 1 fluxes per cell face:
    Equation (40)
  • 6.  
    Obtain new interpolated values of the electric field from the averages of the above computed fluxes
    Equation (41)
    where
    Equation (42)
    Equation (43)
  • 7.  
    Compute final corrections to the density, momentum, and energy components of $U_{{\boldsymbol{i}}, \pm, d}$ due to transverse fluxes using the above Riemann solutions, and obtain sought second-order accurate time-centered cell-interface values according to
    Equation (44)
  • 8.  
    Likewise, use the CT scheme to apply final corrections to magnetic field components. In analogy to Equation (38) in step 4 we write
    Equation (45)
    and, in analogy to Equation (39), for the magnetic field components parallel to the cell face we write
    Equation (46)
  • 9.  
    Compute the final second-order estimate of time-averaged fluxes
    Equation (47)
  • 10.  
    Compute the final estimate of the electric field using the above fluxes and an updated value for the cell-centered conservative variables using the averaged fluxes in Equation (42), namely,
    Equation (48)
    where
    and the operator ∇UW symbolizes the transformation from conservative to primitive variables.
  • 11.  
    Finally update cell-centered conservative variables using Equation (13) with the fluxes in Equation (47) and the face-centered magnetic field variables using Equation (17) with the electric field in Equation (48) and synchronize the magnetic variables using Equation (19).

Note that Gardiner & Stone (2008) use the 2D fluxes, F2D, and electric fields, E2D, to construct the time-centered states at cell faces. This simplifies considerably the complexity of their algorithm with respect to the original CTU scheme, requiring only 6 Riemann solves instead of 12. The associated CFL stability condition, however, requires a time-step size half the usual value, so that for pure fluid application the total computational cost remains rather unaffected.

2.2.5. Riemann Solver

For the purpose of this paper, we have implemented the HLLD solver recently developed by Miyoshi & Kusano (2005). This is an extended version of the original HLL solver for the MHD, which includes the entropy, Alfvén, and fast magnetosonic waves. The solver appears quite accurate and robust and relatively inexpensive. Unlike traditional solvers (e.g., exact, linear, Roe's type, etc.), HLL-type solvers directly compute the hyperbolic fluxes, not the Riemann state, at cell interfaces. Furthermore, the flux solution is built upon the full spatially reconstructed state to the left and right sides of the cell interface. These states must also include the characteristic components that are not transmitted through the cell interface. For this reason, in order for the fluxes returned by HLL-type solvers to be second-order accurate, the projector P is modified in such a way that the summation is carried over all waves, irrespective of their sign. The solver is extensively documented in the original paper and its description will not be repeated here.

2.2.6. Interpolation Scheme for the Edge-centered Electric Field

In this section, we describe the scheme used to interpolate the face-centered electric fields returned by the Riemann solver onto cell edges. In Section 2.2.4, this was indicated with the notation, ${\cal I}_E$. It is important for the stability of the overall algorithm to choose this interpolation scheme in such a way that there is consistency between the time update of the face-centered magnetic field, the cell-centered variables, and the synchronization step of the magnetic variables, Equation (19). For this purpose, we have adopted the upwind scheme described in Gardiner & Stone (2005, 2008). This will be described next, for the case of 3D. In this case each cell edge is shared by four adjacent faces from which the electric field can be interpolated. Hence, these four interpolated values will be arithmetically averaged. The scheme for ${\cal I}_E()$ uses three arguments,

where the "*" symbol indicates that the interpolation requires values of the arguments at different cells and faces. The face-centered fluxes define the face-centered electric fields according to Equation (15), and the cell-centered primitive state variable, $W_{\boldsymbol{i}}$, is used to define a cell-centered electric field according to the usual formula

with the velocity and magnetic field variables given by the components of $W_{\boldsymbol{i}}$. The cell-centered electric field is used together with face-centered electric fields (15) to define the following transverse quasi-cell-centered gradients

Equation (49)

In turn, these gradients are used to define quasi-face-centered gradients of the electric field by the upwind scheme (Gardiner & Stone 2005)

where the sign of the velocity at the cell interface is given by the sign of the mass flux returned by the Riemann solver. So, the upwinding character of the interpolation scheme is based on the contact mode alone, which may raise stability concerns. However, no signs of unstable behavior appeared during the testing of the code. A more accurate edge interpolation scheme can be obtained at the higher cost of a 2D Riemann solver (Londrillo & Del Zanna 2000; Fromang et al. 2006). With the above definitions, the interpolated edge-centered electric field is defined as

Equation (50)

3. TESTS

3.1. Convergence Rates in Smooth Flows

In this section, we test the correctness of our implementation by measuring the convergence rate of the numerical solution returned by the code. The test is based on the propagation of Alfvén, fast, and slow MHD waves. The waves have small amplitude, δ = 10−5, so that we expect to observe the nominal second-order convergence rate predicted by numerical analysis.

In the following tests the initial conditions are provided for the primitive variables by defining the unperturbed state, W, and the superposed perturbation, δW, corresponding to the wave. The size of the computational box is L = 1, the geometry is 1D or 2D, and the boundary conditions are periodic. The adiabatic index is γ = 5/3. While we have experimented with different choices of orientation of the wave vector with respect to the grid, namely ${\bf k} / 2\pi = (1,0), (0,1), (1/\sqrt{2},1/\sqrt{2}), (2/\sqrt{5},1/\sqrt{5})$, we find the same convergence rates in all cases. Thus, we simply report the results for the few representative tests listed in Table 1.

Table 1. Run Set

Run δ k/2π Type
A 10−5 $(2/\sqrt{5},1/\sqrt{5})$ Alfvén
B 10−5 $(2/\sqrt{5},1/\sqrt{5})$ Fast
C 10−5 $(2/\sqrt{5},1/\sqrt{5})$ Slow

Download table as:  ASCIITypeset image

In order to measure the rate at which the numerical solution converges, for each problem we carry out a set of 5 simulation runs employing Ncell = 16, 32, 64, 128, 256 for a total range of 16. For each run the time-step size is fixed, scales inversely with Ncell, and corresponds roughly to a CFL number 0.8. The convergence rate is measured using Richardson extrapolation. Given the numerical solution qr at resolution r we first estimate the error at a given point (i, j), as

Equation (51)

where $\bar{q}_{r+1}$ is the solution at the next finer resolution, spatially averaged onto the coarser grid. We then take the n-norm of the error

Equation (52)

where vi, j = Δx2 is the cell volume and estimate the convergence rate as

Equation (53)

For each case listed in Table 1, we produce a corresponding Tables 24 reporting the L1, L2, and L norms of the error and the corresponding convergence rates, R1, R2, and R, as defined above.

Table 2. Case A: Convergence Rates for Alfvén Waves

Ncells L1 R1 L2 R2 L R L1 R1 L2 R2 L R
  z-velocity z-magnetic
16 7.6E−08  ⋅⋅⋅ 1.2E−07  ⋅⋅⋅ 2.4E−07  ⋅⋅⋅ 7.8E−08  ⋅⋅⋅ 1.2E−07  ⋅⋅⋅ 2.3E−07  ⋅⋅⋅
32 2.0E−08 1.9 3.1E−08 2.0 6.2E−08 1.9 2.0E−08 2.0 3.1E−08 2.0 6.2E−08 1.9
64 4.9E−09 2.0 7.8E−09 2.0 1.5E−08 2.0 5.0E−09 2.0 7.8E−09 2.0 1.6E−08 2.0
128 1.2E−09 2.0 1.9E−09 2.0 4.0E−09 2.0 1.2E−09 2.0 2.0E−09 2.0 4.0E−09 2.0

Note. $\delta = 10^{-5}, {\bf k}=2\pi (2,1)/\sqrt{5}$.

Download table as:  ASCIITypeset image

Table 3. Case B: Convergence Rates for Fast MHD Waves

Ncells L1 R1 L2 R2 L R L1 R1 L2 R2 L R
  Density-gas x-vel-gas
16 7.7E−08  ⋅⋅⋅ 1.2E−07  ⋅⋅⋅ 2.4E−07  ⋅⋅⋅ 9.2E−08  ⋅⋅⋅ 1.4E−07  ⋅⋅⋅ 2.9E−07  ⋅⋅⋅
32 2.1E−08 1.8 3.4E−08 1.8 6.8E−08 1.8 2.6E−08 1.8 4.1E−08 1.8 8.2E−08 1.9
64 5.6E−09 1.9 8.7E−09 1.9 1.7E−08 2.0 6.7E−09 1.9 1.1E−08 1.9 2.1E−08 1.9
128 1.4E−09 2.0 2.2E−09 2.0 4.4E−09 2.0 1.7E−09 2.0 2.7E−09 2.0 5.4E−09 2.0
 
  y-vel-gas Pressure
16 2.3E−08  ⋅⋅⋅ 3.7E−08  ⋅⋅⋅ 7.8E−08  ⋅⋅⋅ 1.0E−07  ⋅⋅⋅ 1.6E−07  ⋅⋅⋅ 3.5E−07  ⋅⋅⋅
32 5.6E−09 2.0 8.8E−09 2.1 1.7E−08 2.2 3.0E−08 1.8 4.7E−08 1.8 9.7E−08 1.9
64 1.3E−09 2.1 2.1E−09 2.1 4.1E−09 2.1 7.8E−09 1.9 1.2E−08 1.9 2.5E−08 2.0
128 3.2E−10 2.1 5.0E−10 2.1 1.0E−09 2.0 2.0E−09 2.0 3.1E−09 2.0 6.2E−09 2.0
 
  x-magnetic y-magnetic
16 3.9E−08  ⋅⋅⋅ 6.3E−08  ⋅⋅⋅ 1.6E−07  ⋅⋅⋅ 4.7E−08  ⋅⋅⋅ 8.2E−08  ⋅⋅⋅ 1.9E−07  ⋅⋅⋅
32 9.0E−09 2.1 1.4E−08 2.2 3.3E−08 2.3 1.2E−08 2.0 1.9E−08 2.1 4.4E−08 2.1
64 2.1E−09 2.1 3.3E−09 2.1 7.3E−09 2.2 2.9E−09 2.0 4.6E−09 2.1 1.0E−08 2.1
128 5.2E−10 2.0 8.1E−10 2.0 1.7E−09 2.1 7.3E−10 2.0 1.1E−09 2.0 2.4E−09 2.1

Note. $\delta = 10^{-5}, {\bf k}=2\pi (2,1)/\sqrt{5}$.

Download table as:  ASCIITypeset image

Table 4. Case C: Convergence Rates for Slow MHD Waves

Ncells L1 R1 L2 R2 L R L1 R1 L2 R2 L R
  Density-gas x-vel-gas
16 6.1E−08  ⋅⋅⋅ 9.5E−08  ⋅⋅⋅ 1.9E−07  ⋅⋅⋅ 5.7E−08  ⋅⋅⋅ 8.9E−08  ⋅⋅⋅ 1.8E−07  ⋅⋅⋅
32 1.6E−08 2.0 2.4E−08 2.0 4.9E−08 2.0 1.4E−08 2.0 2.3E−08 2.0 4.7E−08 1.9
64 3.9E−09 2.0 6.2E−09 2.0 1.2E−08 2.0 3.7E−09 2.0 5.8E−09 2.0 1.2E−08 2.0
128 9.9E−10 2.0 1.6E−09 2.0 3.1E−09 2.0 9.2E−10 2.0 1.4E−09 2.0 2.9E−09 2.0
 
  y-vel-gas Pressure
16 1.4E−07  ⋅⋅⋅ 2.2E−07  ⋅⋅⋅ 4.4E−07  ⋅⋅⋅ 8.5E−08  ⋅⋅⋅ 1.3E−07  ⋅⋅⋅ 2.8E−07  ⋅⋅⋅
32 3.6E−08 2.0 5.7E−08 2.0 1.1E−07 1.9 2.2E−08 2.0 3.5E−08 2.0 7.0E−08 2.0
64 9.1E−09 2.0 1.4E−08 2.0 2.9E−08 2.0 5.6E−09 2.0 8.7E−09 2.0 1.8E−08 2.0
128 2.3E−09 2.0 3.6E−09 2.0 7.2E−09 2.0 1.4E−09 2.0 2.2E−09 2.0 4.4E−09 2.0
 
  x-magnetic y-magnetic
16 6.1E−08  ⋅⋅⋅ 9.6E−08  ⋅⋅⋅ 2.0E−07  ⋅⋅⋅ 6.3E−08  ⋅⋅⋅ 9.9E−08  ⋅⋅⋅ 2.2E−07  ⋅⋅⋅
32 1.5E−08 2.0 2.4E−08 2.0 5.0E−08 2.0 1.6E−08 1.9 2.6E−08 1.9 5.5E−08 2.0
64 3.9E−09 2.0 6.1E−09 2.0 1.2E−08 2.0 4.1E−09 2.0 6.5E−09 2.0 1.3E−08 2.0
128 9.8E−10 2.0 1.5E−09 2.0 3.1E−09 2.0 1.0E−09 2.0 1.6E−09 2.0 3.3E−09 2.0

Note. $\delta = 10^{-5}, {\bf k}=2\pi (2,1)/\sqrt{5}$.

Download table as:  ASCIITypeset image

3.1.1. Alfvén Waves

The test based on the propagation of the Alfvén wave is characterized by the following unperturbed state and superposed perturbation (Crockett et al. 2005):

Equation (54)

where ρ0 = P0 = B0 = 1 and ux = uy = uz = 0, $c_A=B_0/\sqrt{\rho _0}=1$, is the Alfvén speed, and k and x are the wave vector and position vector, respectively. The convergence rates for the perturbed quantities are summarized in Table 2. The velocity and magnetic field converge with second-order accuracy. The error on the unperturbed variables (not reported) is much smaller and converges at the same rate as the perturbed variables until dominated by the machine roundoff error. As already pointed out, tests with different orientation of $\bf k$ show the same convergence rates.

3.1.2. Fast and Slow Magnetosonic Waves

For fast and slow magnetosonic waves, the unperturbed state and the superposed perturbations read (Crockett et al. 2005)

Equation (55)

where $\hat{b}$ is the unit vector along the magnetic field vector and is at π/4 radians with respect to the unit vector $\hat{k}\equiv {\bf k}/k$, $c_g=\sqrt{\gamma P_0/\rho _0}$ is the gas sound speed, cw is the speed of fast or slow MHD waves, and all other symbols take the meaning and values as in the previous section.

The convergence rates are reported in Tables 3 and 4 for fast and slow waves, respectively. As with Alfvén waves, the errors in the perturbed variables converge with second-order accuracy, while the error in the unperturbed variables are much smaller and converge at the same rate until they are affected by machine precision.

3.2. Riemann Problem

We next consider a set of Riemann problems from the literature which are standard tests for MHD algorithms. The Riemann problem is described in general by the following initial-value problem:

Equation (56)

where Wleft/right represents the primitive variables to the left/right of the initial discontinuity. The set of problems and corresponding initial conditions are summarized in Table 5, except for the value of the x-component of the magnetic field which will be specified for each problem explicitly. In all cases we use a CFL number CCFL = 0.8, third-order PPM reconstruction scheme and characteristic limiting. The domain size is L = 1 and the boundary conditions are simply W(x0 = 0, t) = Wleft and W(x0 = 1, t) = Wright.

Table 5. Riemann Problem Set

Test Left-state Right-state
  ρ ux uy uz p By Bz ρ ux uy uz p By Bz
Brio–Wu 1 0 0 0 1 1 0 0.128 0 0 0 0.1 −1 0
Dai–Woodward 1.08 1.2 0.01 0.5 0.95 $\frac{3.6}{\sqrt{4\pi }}$ $\frac{2}{\sqrt{4\pi }}$ 1 0 0 0 1 $\frac{4}{\sqrt{4\pi }}$ $\frac{2}{\sqrt{4\pi }}$
Fast Raref. 1 −2 0 0 0.45 0.5 0 1 2 0 0 0.45 0.5 0

Download table as:  ASCIITypeset image

We should point out that Miyoshi & Kusano (2005) have carried out extensive tests of their HLLD solver, which we employ in our code, particularly to compare its performance with that of Roe and other solvers of the HLLC family. We shall repeat some of those tests here. Note that while in most cases Miyoshi & Kusano (2005) used a first-order accurate piecewise-constant reconstruction scheme, we have used the third-order accurate PPM method, so the solution profiles in our plots appear sharper. The tests that we will perform below involve the full set of MHD waves, including those associated with the slow mode, which is not included explicitly in the HLLD solver. However, in accord with Miyoshi & Kusano (2005), we find that in these tests the full MHD structure of the solution, including features associated with the slow mode, is correctly reproduced.

3.2.1. Brio & Wu

We begin with the Riemann problem presented in Brio & Wu (1988), listed at the top of Table 5. The x-component of the magnetic field is Bx = 0.75 and the adiabatic index γ = 2 as in the original paper. Following common practice, the problem is solved on a grid with 800 points along the x-axis and the solution is computed until time t = 0.1. The results are shown in Figure 2. All the solution features are well reproduced, including, from left to right, a fast rarefaction followed by a slow compound wave, moving to the left, and a contact discontinuity, slow shock and fast rarefaction moving to the right (Brio & Wu 1988). As usual with shock-capturing methods, shocks are resolved with a couple of zones throughout the duration of the calculation, while the contact discontinuities, captured here within a few zones, tend to spread out over time. There are some oscillations in the x-component of the velocity field. These are not present if we adopt a PLM reconstruction scheme, but worsen if we switch from a characteristic to a primitive limiting scheme.

Figure 2.

Figure 2. Brio & Wu (1988) shock-tube problem: solution for t = 0.1 solved on a grid using 800 zones. See Table 5 for the initial conditions. From left to right and top to bottom shown are, respectively, density, pressure, velocity components along the x- and y-axis, magnetic field component along the y-axis, and temperature.

Standard image High-resolution image

3.2.2. Dai & Woodward

The second Riemann problem listed in Table 5 is taken from Dai & Woodward (1998). In this case, the x-component of the magnetic field is $B_x=4/\sqrt{4\pi }$ and the adiabatic index γ = 5/3. The problem is solved on a grid with 512 points along the x-axis and the solution is computed until time t = 0.2. The results are shown in Figure 3. The initial conditions for this problem expose the full eigenstructure of the MHD system, as they produce three pairs of MHD waves traveling in opposite directions with respect to the initial discontinuity, in addition to the contact wave. The waves include fast and slow shocks responsible, among others, for the jumps in the pressure and velocity fields, the contact wave which appears in the density field alone, and the rotational discontinuity which affects the magnetic field components alone. As in the previous case, while all discontinuities are well reproduced, shocks are the sharpest features captured with about two zones.

Figure 3.

Figure 3. Dai & Woodward (1998) shock-tube problem: solution for t = 0.2 solved on a grid using 512 zones. See Table 5 for the initial conditions. From left to right and top to bottom shown are, respectively, density, pressure, energy, three velocity components magnetic field components, along the y- and z-axis, and θ = tan −1(Bz/By).

Standard image High-resolution image

3.2.3. Fast Rarefaction

The last 1D Riemann problem listed in Table 5 is similar to the ones presented in Einfeldt et al. (1991). Its purpose is to test the method/code robustness in the case of flows in which the energy is dominated by the kinetic component and unphysical states with negative density or internal energy can arise. This problem is solved using a grid with 256 grid points. The solution at time t = 0.1 is shown in Figure 4. The results in Figure 4 show a stable solution which correctly reproduces the two rarefaction waves propagating away from the grid midpoint. A very similar test has also been performed by Stone et al. (2008), with similar results, and Miyoshi & Kusano (2005). The latter authors actually use a faster expansion velocity, namely $u_{x,\frac{L}{R}}=\mp 3$, in their initial conditions and show that when used with a (first-order) Godunov's method the numerical solution remains stable. While we are able to reproduce their result we find that at high resolution some spurious oscillations can be generated when a higher-order Godunov's method is used. This may suggest the need for artificial viscosity in the case of highly supersonic expansions with higher-order Godunov's methods.

Figure 4.

Figure 4. Fast rarefaction: solution for t = 0.16 solved on a grid using 512 zones. See Table 5 for the initial conditions. From left to right and top to bottom shown are, respectively, density, gas pressure, x-component of the velocity, and y-component of the magnetic field.

Standard image High-resolution image

3.2.4. Inclined Dai & Woodward Shock-tube Problem

We have repeated the problem in Section 3.2.2 with the initial discontinuity inclined with respect to the grid such that its normal has components $\vec{n}=(2,1)/\sqrt{5}$. This problem tests the ability of the code to reproduce 1D solutions when they are not aligned with the grid. Besides the numerical tests, there are a few other complications related with the numerical set-up of this problem. First, the boundary conditions need revision. To avoid the implementation of "shift-periodic" boundary conditions (Tóth 2000), we use a domain with size $(2L,L)\,2/\sqrt{5}$. This allows us to accommodate two adjacent identical problems along the direction, $\vec{n}=(2,1)/\sqrt{5}$, and apply periodic boundary conditions to the domain.4 In addition, since the magnetic field rotates across the discontinuity, the initialization is non-trivial and, unless a special precaution is taken, e.g., by deriving the magnetic field from a vector potential, the initial magnetic field will not be divergence-free (this is not an issue in the special case in which $\vec{n}$ is along the diagonal and there is symmetry among the coordinate axis). In our case no such precaution is taken and we just remap the initial conditions onto the rotated grid. As a result there is a jump in the normal component of the magnetic field across the discontinuity. This causes some minor artifacts with respect to the 1D solution. This is acceptable since we are interested in making sure that the structure of the 1D solution is reproduced with fidelity and the waves propagate at the correct speed.

In order to solve the problem, we have covered the domain with a grid of 1144 × 572 cells. This corresponds to 512 cells along the direction perpendicular to $\vec{n}$, which is equivalent to the resolution used in Section 3.2.2. The results are shown in Figure 5 where we plot the values of the solution along the first row of the computational domain, starting from $\frac{1}{2}L+\delta _L$ to $\frac{3}{2}L+\delta _L$. The starting point is shifted by δL ∼ 0.2 to the left, to hide the perturbation of Wleft due to the interaction with the state to its left (which is Wright). The vectorial components (u, v, w) are the equivalent of (x, y, z) in the rotated system.

Figure 5.

Figure 5. Inclined version of Dai & Woodward (1998) shock-tube problem: solution for t = 0.2 solved on a grid using 512 zones. See Table 5 for the initial conditions. From left to right and top to bottom shown are, respectively, density, pressure, energy, three velocity components, and three magnetic field components.

Standard image High-resolution image

Figure 5 shows that the 1D solution is correctly recovered when the plane of the discontinuity is inclined with respect to the grid. We notice some oscillation at the fast magnetosonic shocks, which to some extent are also present in Figure 7 of Gardiner & Stone (2008). These are probably associated with the oscillations in the normal component of the magnetic field, also reported in the last panel of Figure 5. These can perhaps be suppressed with more aggressive limiters (Londrillo & del Zanna 2004). There is also a spurious feature, ahead of the left-moving rotational discontinuity, which is probably due to the non-solenoidal character of the initial magnetic field. However, none of these features affect either the jump conditions or the wave speeds, as attested to by the very good correspondence between the solution in Figure 5 and the 1D counterpart in Figure 3.

3.3. Multidimensional Tests

We now turn to a series of classical multidimensional tests for MHD codes. The first two tests, the Orszag–Tang vortex and the rotor problem, are performed in order to test the code robustness in relatively complex flow patterns and can be compared with results from previous authors. They have a 2D geometry. Therefore, besides implementation details, the algorithmic components that are at work are the same as in Gardiner & Stone (2005), except for the "multidimensional MHD source terms" which, however, these two tests are not particularly sensitive to. A correct accounting of the "multidimensional MHD source terms" becomes of crucial importance in the following test, the advection of a magnetic loop, which is performed both in a 2D and 3D geometry. In the latter case, also the full CTU scheme comes into play, which makes a more interesting case for comparison with Gardiner & Stone (2008).

3.3.1. Orszag–Tang Vortex

The first test is the compressible Orszag–Tang vortex problem (Orszag & Tang 1979). We solve this problem on a computational domain of size L = 1 with periodic boundary conditions and a rectangular grid of 200 × 200 cells. We use an adiabatic index γ = 5/3. We present results obtained using the PPM reconstruction scheme and primitive limiting, but very similar results are produced using characteristic limiting. The initial conditions in terms of the primitive variables are as follows:

Equation (57)

where ρ0 = 25/36π, P0 = 5/12π, and u0 and B0 are defined in terms of the sonic Mach number, ${\cal M}=1$, and plasma beta, β = 10/3, respectively. Although the initial conditions are smooth, eventually the flow develops a complex structure with sharp features and discontinuities. In Figure 6 we show the contours of the numerical solution for density, gas pressure, kinetic energy, and magnetic pressure at time t = 0.5. 1D cuts along the line y = 0.4277 for the thermal pressure (top) and magnetic pressure (bottom) are also shown in Figure 7. The code maintains the symmetry of the solution with respect to the central point. In addition, Figure 7 shows that discontinuous features are captured within a few zones. Finally, the solution can be compared with similar plots at the same solution time produced by other authors (e.g., Ryu et al. 1998; Tóth 2000; Stone et al. 2008), from which it appears that the code produces the correct flow structures.

Figure 6.

Figure 6. Orszag–Tang vortex: 30 equally spaced contour levels between the maximum and minimum values of the numerical solution at t = 0.5, respectively, for density (top left), gas pressure (top right), specific kinetic energy (bottom left), and magnetic pressure (bottom right).

Standard image High-resolution image
Figure 7.

Figure 7. Orszag–Tang vortex: 1D cuts along the x-axis at y = 0.4277 for the thermal pressure (top) and magnetic pressure (bottom).

Standard image High-resolution image

3.3.2. Rotor Problem

Another 2D problem commonly used as a test for multidimensional MHD codes is the rotor problem described in Balsara & Spicer (1999). It consists of a rotating disk of dense material, threaded by a magnetic field initially directed along the x-axis, and embedded in a tenuous ambient medium at rest. As the rotor spins, it winds up the magnetic field lines, generating Alfvén waves which propagate into the ambient medium. The problem is solved on a computational domain of size L = 1 with periodic boundary conditions and covered with a rectangular grid of 400 × 400 cells. The adiabatic index is γ = 1.4. We use the PPM reconstruction scheme and primitive limiting, although the use of characteristic limiting produces very similar results. The setup of the initial conditions corresponds to the first rotor problem discussed in Tóth (2000), i.e.,

Equation (58)

where $W_{{\rm disk}}\,{=}\,[\rho _{{\rm disk}},-\frac{u_0}{r_0}(y-0.5),\frac{u_0}{r_0}(x-0.5),0, P_0,B_0,0,0]^T$, Wamb = (ρ0, 0, 0, 0, P0, B0, 0, 0)T, $r\equiv \sqrt{x^2+y^2}$, rdisk defines the disk radius, and ramb delimits the ambient medium. In the transition region between the ambient medium and the rotor the density and velocity fields are interpolated according to ρ = (ρdisk − ρ0)f(r) + ρ0, ux = −f(r)u0(y − 0.5)/r, and uy = f(r)u0(x − 0.5)/r, with f(r) = (rambr)/(rambrdisk), whereas density and pressure remain uniform. The results for this test are presented in Figure 8, which effectively reproduces Figure 18 of Tóth (2000). The numerical solution appears very well behaved and the code seems to pass this test as well.

Figure 8.

Figure 8. Rotor problem: 30 equally spaced contour levels between the maximum and minimum values of the numerical solution at t = 0.15, respectively, for density (top left), gas pressure (top right), Mach number (bottom left), and magnetic pressure (bottom right).

Standard image High-resolution image

3.3.3. Magnetic Loop Advection

In this section, we test the ability of the code to follow the advection of a loop of weak magnetic field frozen in a background flow. This problem is non-trivial for conservative schemes and Gardiner & Stone (2005, 2008) emphasize that spurious results will be produced as a result of improper account of the multidimensional MHD source terms entering the predictor step, as discussed in Section 2.2.3. The initial conditions are detailed in Gardiner & Stone (2008). The loop is basically a tube of magnetic flux frozen in a medium with unit density and pressure, ρ = pgas = 1 and uniform advection velocity, uloop, to be specified below.

We carry out the test both in a 2D or a 3D geometry. For the 2D case, we align the loop axis with the x2 coordinate axis of the computational domain. The vector potential from which the magnetic field is initialized is then given by, A = (0, 0, A2), with

Equation (59)

where B0 = 10−3, $r=\sqrt{\vphantom{A^A}\smash{\hbox{${x_0^2+x_1^2}$}}}$, and R = 0.3 is the radius of the tube. The computational domain itself consists of a rectangular box of dimensions (2N, N) with periodic boundaries, and the loop advection velocity is uloop = (2, 1).

For the 3D configuration, the axis of the tube is tilted around the x1-axis by $\theta =\arctan 2$ radians (clockwise) and the tube is advected with velocity uloop = (1, 1, 2). The domain is still periodic but has dimensions (N, N, 2N). The vector potential is still defined as in Equation (59) but with respect to the new coordinates:

Equation (60)

The results of this test are first illustrated in Figures 9 and 10 which show the magnetic pressure at t = 2 for the 2D and 3D cases, respectively. In the former case N = 64, while in the latter case N = 128. The results are comparable to other MHD implementations, in particular Gardiner & Stone (2005, 2008). As pointed out by those authors, the magnetic pressure suffers dissipation mostly close to the loop center (where the curl of $\vec{B}$ is singular) and boundary. However, both in the 2D and 3D cases, the loop retains to a good extent its initial symmetry and energy. This latter point is further illustrated in Figure 11, which shows the evolution of the normalized magnetic pressure up to t = 2 for three different resolutions. One important aspect of the 3D version of this test is to check the ability of the scheme to keep the magnetic field component along the loop axis, B3, close to zero. This is important here because we have not strictly followed the recommendation of Gardiner & Stone (2008) when implementing the multidimensional MHD source terms in the predictor step. The evolution of B3 is reported in Figure 12, again for three different values of the resolution, up to t = 2. Due to the simpler form of the employed multidimensional MHD source terms, 〈|B3|〉 is larger than found in Gardiner & Stone (2008) at the same time (t = 1), but only slightly so and B3 remains negligible compared to the total magnetic field.

Figure 9.

Figure 9. Loop advection in 2D: magnetic pressure at t = 2 from a calculation using N = 64, and corresponding color bar (top left).

Standard image High-resolution image
Figure 10.

Figure 10. Loop advection in 3D: cut of the magnetic pressure at z = 0.5 of the magnetic pressure at t = 2 from a calculation using N = 128, and corresponding color bar (top left).

Standard image High-resolution image
Figure 11.

Figure 11. Loop advection: time evolution of the magnetic energy for the 2D (top) and 3D (bottom) cases, for three different resolutions and for a 3D AMR run with effective N = 128.

Standard image High-resolution image
Figure 12.

Figure 12. Loop advection in 3D: time evolution of B3, the magnetic field component aligned with the loop axis, for three different resolutions and for a 3D AMR run with effective N = 128.

Standard image High-resolution image

4. EXTENSION TO ADAPTIVE MESH REFINEMENT

Following Berger & Colella (1989) and Balsara (2001), we employ block-structured local refinement to increase the computational resolution where the accuracy of the solution needs to be improved. Our implementation is basically an extension of the MHD case of Miniati & Colella (2007a).

Generalizing the case discussed in Section 2.1.1, the problem domain is discretized on a hierarchy of grids, $\Gamma ^{\,0}\dots \Gamma ^{\ell _{{\rm max}}}$, each with its own spacing h and refinement ratio nrefh/hℓ + 1. We assume that refinement ratio is always even.

Calculations are performed on a hierarchy of meshes {Ω}ℓ = ℓmaxℓ = 0 such that for each ℓ, Ω⊂Γ. The base-level uniform rectangular mesh spans the domain, so Ω0 = Γ0. Cells for which improved resolution is desired are marked for refinement, grouped together into logically rectangular regions, and refined by a factor of n0ref to create the level 1 domain Ω1. Further refinement levels, Ω, may then be created as needed in the same way starting from a refinement level Ωℓ − 1, with refinement ratio nℓ − 1ref. The set of generated meshes Ω is assumed to be properly nested, meaning that (1) any control volume ${\boldsymbol{i}}^l\in \Omega ^\ell$ is either completely covered by (nref)D finer control volumes or by none and (2) for any given pair of meshes Ωℓ − 1 and Ωℓ + 1 there is always a layer of cells of Ω separating the two. By analogy with the single grid case we can construct the set $\Omega _f^{\ell,{{\boldsymbol{e}}^{d}}}$ corresponding to the faces in Ω, and likewise the set $\Omega _e^{\ell,{{\boldsymbol{e}}^{d}}}$ for the corresponding edges. Similarly, for each level, we can define a divergence and curl operators for face- and edge-centered vectors, respectively.

The part of an AMR level which is "covered" by refinement is denoted as the covered region, while the valid region of a given level ℓ is the part of Ω not covered by refinement. For computational convenience, solution values are maintained in covered regions as well as valid regions, but only the solution in valid regions is considered to be valid. The composite solution spans the computational domain and is the union of the valid-region solutions on each level. The coarse–fine interface between levels ℓ and ℓ − 1 is denoted by ∂Ω.

As in Berger & Colella (1989), we refine in time as well as space, with Δtℓ + 1 = Δt/nref. The update of the solution on the hierarchy of AMR levels can be described recursively as the update of a single AMR level ℓ from time t to time t + Δt (Figure 13).

Figure 13.

Figure 13. Recursive AMR time step.

Standard image High-resolution image

Extending the CT scheme described in this paper requires some additions to the standard set of algorithmic tools generally used for fully cell-centered discretizations of hyperbolic conservation laws like that in Berger & Colella (1989). Most of the additional algorithmic pieces result from the addition of the solenoidal face-centered $\vec{B}$ field.

4.1. Filling Ghost Cells

Before each single-level update from time t to time t + Δt, a ring of "ghost" cells sufficiently large to complete the stencils required to update valid-region data on each grid-patch is filled in. For the scheme described here, we require six and four ghost cells for PPM and PLM reconstruction methods, respectively. Where possible, ghost values are filled by copying valid-region data from other grids on the same level ℓ or possibly by a discrete representation of physical domain boundary conditions. Where neither of these are possible, values must be interpolated from the coarser level ℓ − 1 solution. Cell-centered quantities are interpolated using a limited piecewise-linear scheme. The face-centered $\vec{B}$ field is likewise interpolated using a piecewise-linear scheme as follows.

  • 1.  
    First, $\vec{B}^{\ell -1}$ is linearly interpolated in time to t. (Recall that level ℓ − 1 has already been updated from tℓ − 1 to (tℓ − 1 + Δtℓ − 1), and tℓ − 1t < (tℓ − 1 + Δtℓ − 1).
  • 2.  
    Then, fine-level faces which overlie coarse-mesh faces are filled using piecewise-linear interpolation of coplanar coarse-mesh faces.
  • 3.  
    Finally, values for fine-level faces which do not overlie coarse-mesh faces are linearly interpolated between the two surrounding co-directional faces for which there are already values (either fine-level faces on the coarse–fine boundary or fine-level values interpolated in step 1).

Note that we have found it neither practical nor necessary to use a divergence-free interpolation scheme to fill in values for ghost faces. In fact, such interpolation schemes (Balsara 2001; Tóth & Roe 2002) maintain the solenoidal character of the interpolated magnetic field when the latter is already divergence-free. While the multilevel magnetic field is divergence-free when the coarse and fine solutions are synchronized in time, it is only approximately so when the fine level is at an intermediate time with respect to the coarse level, tℓ − 1 < t < (tℓ − 1 + Δtℓ − 1). This is because the coarse-level magnetic field (as the other fluid quantities in general) is only a first-order accurate time interpolation of the coarse solution at tℓ − 1 and tℓ − 1  +  Δtℓ − 1, so the matching of the magnetic flux across coarse–fine boundaries will also be only first-order accurate. This degrades the performance of the above schemes to the level of an ordinary interpolation scheme defying their purpose. Note, however, that the solenoidal character of the field is lost only in fine ghost cells abutting the coarse level, not in the valid region, and we have found no need to amend this issue from our tests.

4.2. Synchronization

After the sub-cycled advance of level ℓ + 1, the solutions on levels ℓ and ℓ + 1 have reached the same solution time (t = tℓ + 1), and are then synchronized. For cell-centered conserved variables, synchronization is identical to that used in Berger & Colella (1989).

  • 1.  
    Replace level ℓ solution with the averaged level ℓ + 1 solution in covered regions.
  • 2.  
    Because the fluxes used to update the fine-level solution were computed independently of those used to compute coarse-level updates, conservation will not be maintained at coarse–fine interfaces. In Berger & Colella (1989) and Martin & Colella (2000), flux registers are defined along the coarse–fine interface between levels ℓ and ℓ + 1, in which the fluxes used to compute coarse- and fine-level updates are stored. Since we consider the fine-level fluxes to be more accurate, we update the solution in the coarse cells adjoining the coarse–fine interface with the "reflux-divergence" of the difference of the fluxes:
    Equation (61)
    where U is the vector of conserved quantities, DR is the "reflux divergence" operator, F is the vector of fluxes used to update U, 〈Fℓ + 1〉 is the average of the level (ℓ + 1) fluxes on the underlying level ℓ faces, and the sum is over sub-cycled ℓ + 1 time steps.

Synchronization for the face-centered magnetic field looks similar, and takes the same form as described in Balsara (2001).

  • 1.  
    Replace level ℓ magnetic field $\vec{B}^\ell$ with the averaged level ℓ + 1 solution on covered faces.
  • 2.  
    Because the edge-centered electric fields on each level are computed independently, the composite $\vec{B}$ field will no longer be solenoidal. We treat this using an analogue to the face-centered flux registers used for cell-centered data, as presented in Balsara (2001). We store the edge-centered electric fields along coarse–fine interfaces, then increment the coarse-level magnetic field at faces bordering the coarse–fine interface with a reflux-curl operator applied to the coarse–fine mismatch in the edge-centered electric fields.

4.3. Regridding

It is often desirable for refined regions to periodically adapt as the solution evolves in time. When newly refined regions are created, cell-centered fields are also interpolated from coarse-level data using limited piecewise-linear interpolation. For $\vec{B}$ field values of newly refined faces, we use the divergence-free interpolation scheme described in Balsara (2001). The scheme is defined for refinement ratios nref = 2, but it can be applied recursively for larger values of the refinement ratio.

4.4. Tests with AMR

4.4.1. Magnetic Loop Advection

Our first test involving AMR will be concerned with the advection of a loop of weak magnetic field, the same problem that was already addressed in Section 3.3.3. Here we focus on the 3D version of the problem, although analogous results are obtained in 2D. Thus, we use exactly the same initial conditions as for the 3D problem in Section 3.3.3. The domain is again periodic with dimensions (N, N, 2N), N = 64. We allow for one level of refinement with refinement ratio nref = 2. We refine regions where the magnetic field energy density is above a threshold Bthreshold = 10−4 in code units. Effectively the magnetic loop is always refined (the same result is obtained if one refines regions where the magnetic field has a normalized gradient above a minimal threshold). Thus, we expect to obtain the same results as for the case in which N = 128. In Figures 11 and 12, we plot the time evolution of the normalized magnetic pressure and of the B3 magnetic field component using open circles. In both cases, the open circles sit right on top of the solid line which indeed corresponds to the uniform box with AMR equivalent resolution, N = 128.

4.4.2. Shock–Cloud Interaction

As a second example of an AMR–MHD application we compute the interaction of a cloud with a strong shock wave. This problem is fully 3D and it also employs the full CTU scheme. It mostly tests the code robustness in conditions of high Mach number shocks, high magnetic to thermal pressure ratio, strong shear flows, all of which are recurrent in astrophysical applications.

This process of shock–cloud interaction is common in the interstellar medium where shocks produced by supernova explosions interact with the surrounding multiphase medium (Klein et al. 1994; Mac Low et al. 1994). Related processes, characterized by similar hydrodynamic structures, are the supersonic motion of an over-dense cloud through a thin magnetized medium (Schiano et al. 1995; Jones et al. 1996; Vietri et al. 1997; Miniati et al. 1999b; Gregori et al. 1999, 2000), or supersonic clouds collisions (Lattanzio et al. 1985; Klein et al. 1995; Miniati et al. 1997, 1999a).

The initial conditions for our problem are as follows: the background gas has unit density and thermal pressure, and is at rest; a cloud with the same pressure but 10 times higher density, moves through the thin gas with a velocity vc = −3.47871373 along the x direction. A plane-parallel shock with Mach number ${\cal M}=10$ propagates along the same axis but in the opposite direction to the cloud. The initial magnetic field is uniform, of unit strength and aligned with the x-axis. The computational box has dimensions [0, 1] × [0, 0.5] × [0, 0.5]. The boundary conditions correspond to supersonic inflow and outflow for the lower and upper boundaries of the x-axis, and are periodic otherwise. The calculation is carried out in 3D on a base grid of 64 × 32 × 32 cells. Two additional levels of refinement, with refinement ratio 4, are generated dynamically in regions where the normalized undivided density gradient |Δρ|/ρ > 0.1, and/or in the presence of shocks according to the criteria |ΔP|/P > 0.1 and ∇ · v < 0.

Figure 14 shows from top to bottom the solution for the density, gas pressure, magnetic field magnitude, and plasma beta parameter (β = Pgas/PB), at time t = 0.021251, corresponding to 160 cycles on the finest level. The main features, discussed at length in the above papers, are correctly reproduced. The plane shock front moving from the left crushes the cloud. As the cloud moves to the left, it creates a bow shock in front of it, where the pressure has its highest value. The cloud motion also generates a low-pressure region at its rear, where the magnetic pressure dominates the gas pressure and the beta plasma is much less then unity. In addition, as the fluid flows past the cloud, the magnetic field lines entrained in the cloud body fold on themselves creating a current sheet (Jones et al. 1996).

Figure 14.

Figure 14. Shock–cloud interaction: from top to bottom, solution for density, gas pressure, magnetic field magnitude, and plasma beta parameter, at time t = 0.021251.

Standard image High-resolution image

Note that the maximum value of the normalized divergence of the magnetic field |Δx∇ · B|/|B|, is a few × 10−13. This is completely negligible with respect to the solution value and demonstrates that our implementation of the above operators for the coarse–fine magnetic field interpolation and refluxing operations is correct.

5. EXTENSION TO COSMOLOGY

We now describe the extension of our MHD algorithm to the case of cosmological applications. This will include only a basic description of the cosmological code, for it is presented in detail elsewhere (Miniati & Colella 2007a).

For cosmological simulations it is preferable to transform away the expansion of the universe through the use of a comoving frame of reference. Thus, we operate the transformation

Equation (62)

from lab to comoving coordinates, where a(t) is a function of time that defines the physical size of spatial scales and $\dot{a}/a$ is the expansion rate of the universe. In addition we subtract out the velocity component due to the expansion of the universe, and retain the peculiar proper velocity, i.e.,

Equation (63)

Finally, it is convenient to use comoving density and pressure, i.e., those expressed in terms of the comoving volume ${\boldsymbol{x}}^3$ as opposed to the proper volume $a^3 {\boldsymbol{x}}^3$,

Equation (64)

Equation (65)

Similarly, although the magnetic flux naturally scales with a2(t), we transform it to a pseudo-comoving variable

Equation (66)

The above transformations allow writing the conservation and induction equations in a form that, except for the appearance of source terms, closely resembles the original ones. This similarity allows us not only to solve for the MHD system of equations in the cosmological framework with the same algorithm described in Section 2 but also to apply the same menagerie of AMR tools described in Section 4 with virtually no modification.

In fact, in the comoving frame, ${\boldsymbol{x}}$, the conservation equations read

Equation (67)

where U and F are defined exactly as in Equation (11) but are now expressed in terms of peculiar velocity, comoving density, comoving pressure and pseudo-comoving magnetic field. The source term on the right-hand side is

Equation (68)

where the first term, $\propto \dot{a}/a$, accounts for adiabatic losses of momentum, energy, and magnetic field, and the second term, ${\propto \bf g}$, is due to gravity. Similarly, we rewrite Faraday's law in the comoving frame in terms of the peculiar velocity and pseudo-comoving magnetic field, i.e.,

Equation (69)

Based on Equations (67) and (69) the time update of U and B is then done according to

Equation (70)

Equation (71)

where the time-centered fluxes and electric fields, as well as the synchronization between face- and cell-centered magnetic field variables, are computed using the algorithm defined in Section 2. A second-order estimate of the source term can be obtained by the simple time average $S^{n+\frac{1}{2}}\simeq \frac{1}{2}(S^n+S^{n+1})$. In reality, the source terms associated with gravity and expansion are implemented using a slightly more sophisticated method that estimates the change in kinetic energy due to the work by gravity, directly from the change in the momentum components. This is described in detail in Miniati & Colella (2007a). Similarly, after the face-centered magnetic field variables have been updated in time, the cell-centered values are synchronized, and the change in magnetic field energy due to cosmic expansion is computed from the corresponding change in the magnetic field components.

5.1. MHD Santa Barbara Test

In this final test, we present an MHD version of the "Santa Barbara Cluster Comparison Project." The tests consist of the formation of a massive cluster of galaxies in a 64 Mpc volume. The cosmological model is an Einstein–De Sitter universe (i.e., with critical total matter density) with 10% of the total matter density in baryons, and an expansion rate given by a Hubble parameter, H0 = 50 km s−1 Mpc−1 (see additional details in Frenk et al. 1999). The purpose of this calculation is to test our MHD solver in a realistic cosmological application. Such applications are computationally quite demanding as they are characterized by hypersonic motions and high Mach number shocks, large dynamic range in terms of matter density and spatial scales, and, typically, a broad range of physical processes. As already pointed out in the introduction, the possibility offered by the full CTU scheme to use the usual CFL number (⩽1) allows us to keep to a minimum the number of "solves" associated with non-MHD physics, particularly gravity, which improves the code performance.

Our test is performed using AMR and involves both the MHD and the gravity solver. To compare with previously published results, the dynamic role of the magnetic field remains negligible throughout the calculation, which we ensure by adopting a sufficiently small initial magnetic seed. The geometry of such fields is immaterial, and is chosen to be uniform for convenience.

The calculation is performed basically as in Miniati & Colella (2007a), except for the initial redshift which is z = 30 (instead of 40). So, two initial grids are in place at simulation start: a base grid covering the entire 64 Mpc3 domain with 643 cells and 643 particles; and a second grid, also with 643 cells and 643 particles, but only 32 Mpc on a side and placed in the central region of the base grid, thus yielding an initial cell size of 0.5 Mpc. Refinement is applied only within the latter higher resolution region to cells with a total mass larger than 6.4 × 1010 M. We allowed for five additional levels of refinement (for a total six-level hierarchy), with a constant refinement ratio nref = 2. The size of the finest mesh is about 15 comoving kpc. The time step is limited by the most stringent among the following three conditions: the CFL condition on the MHD waves, with coefficient CCFL = 0.8, an analogous CFL condition based on the speed of the collision-less particles, with coefficient Cpart = 0.5, and the requirement that the expansion of the universe during a time step is less than 2%. The calculation was performed using the PPM reconstruction scheme and the HLLD Riemann solver.

The results of the calculation are summarized by the radial plots in Figure 15, where in analogy to Miniati & Colella (2007a) we show results from two other simulation codes. As expected, the MHD solver (in the limit of vanishing magnetic field) produces virtually the same results as the hydro solver in Miniati & Colella (2007a), attesting therefore to the same reliability for highly nonlinear calculations, involving high Mach number flows and large dynamic range in the fluid quantities. Inspection of the simulation results reveals no spurious effect at coarse/fine boundaries, suggesting that our choice of interpolation algorithm for ghost cells abutting refinement boundaries is viable. Figure 16 shows properties of the magnetic field in the simulated galaxy cluster. The left panel is a 2D slice passing through the cluster center of the magnetic field magnitude (in arbitrary units). The magnetic field is stronger in the core region where it also shows substantial spatial structure down to the smallest resolvable scales. The radial profile of the magnetic field pressure is presented in the top section of the right panel of the same figure. The magnetic pressure has a profile similar to the baryonic density (see Figure 15), although it has definitely a more extended core. This is in agreement with previous calculations using similar techniques. In particular Dubois & Teyssier (2008), using a much higher resolution, find for their adiabatic case that the magnetic field strength decreases by a factor of three or so from the cluster core to a radius of a Mpc or so, which is consistent with factor ten in the magnetic pressure reported in our plot. The lower section of the right panel shows the magnetic pressure after scaling out the amplification due to adiabatic compression (symbolically represented with ρ4/3). This quantity shows the amount of magnetic field amplification that is not due to adiabatic compression, but rather stretching of the magnetic field lines and the like. The plot shows that these non-adiabatic processes are more important in the outer regions of a galaxy clusters, which is expected given the more vigorous turbulent motions there.

Figure 15.

Figure 15. Radial profile of dark matter (top left), baryonic gas (top right) temperature (middle left), baryonic fraction (middle right), radial velocity for dark matter (bottom left), and gas (bottom right). In addition to the results from CHARM (open circles), for comparison we also show those from the ENZO AMR code (filled triangles) Bryan & Norman (1997) as well as those from the HYDRA smoothed particle hydrodynamics code (open stars) Couchman et al. (1995).

Standard image High-resolution image
Figure 16.

Figure 16. Left: distribution of the magnetic field magnitude on a plane across the center of the simulated cluster. Right: radial profile of magnetic pressure (top) and magnetic field amplification not due to adiabatic compression (bottom).

Standard image High-resolution image

Finally, a comment about the normalized magnetic field divergence, |(Δx/B)∇B|. The bulk of its distribution is at the level of 10−15 or so, and the maximum value is around 10−11. Again, this value is completely negligible with respect to the solution value. While larger than the value obtained in the previous test example, this is expected given the much larger number of integration steps (about 104) in the current case.

6. SUMMARY

We have presented the implementation of a 3D scheme for MHD in the AMR code CHARM. The scheme uses a hybrid discretization, in the sense that fluid quantities are cell-centered, and magnetic field variables are face-centered. The algorithm is based on the full 12-solve spatially unsplit CTU scheme (Colella 1990). The fluid quantities are updated using the PPM method, while the magnetic field evolution is computed through a CT method. The edge-centered electric fields necessary for the CT step are computed as in Gardiner & Stone (2005). We employ a simplified version of the multidimensional MHD source terms required in the predictor step for high-order accuracy (Gardiner & Stone 2005, 2008), which is as in Crockett et al. (2005). This greatly simplifies the 3D version of the algorithm with respect to the original form, without compromising the accuracy and robustness of the solutions.

The algorithm is implemented in an AMR framework. This requires synchronization operations across refinement levels, including face-centered restriction and prolongation operations and a reflux-curl operation, which is necessary to maintain a divergence-free magnetic field solution Balsara (2001). The code works with any even refinement ratio, although values above 4 are unusual. Our tests demonstrate that the code converges at the expected rate, is robust in problems involving strong shocks, maintains the magnetic field divergence at a negligible value, and is suitable for astrophysical and cosmological applications.

Footnotes

  • Obviously, since the sequence of states will be Wleft, Wright, Wleft, Wright, the interaction at the second interface will produce a similar Riemann problem with inverted initial conditions. However, we will present only part of the solution, selected for proper comparison with the analogous 1D problem in Section 3.2.2.

Please wait… references are loading.
10.1088/0067-0049/195/1/5