Articles

THE PLUTO CODE FOR ADAPTIVE MESH COMPUTATIONS IN ASTROPHYSICAL FLUID DYNAMICS

, , , , , and

Published 2011 December 22 © 2012. The American Astronomical Society. All rights reserved.
, , Citation A. Mignone et al 2012 ApJS 198 7 DOI 10.1088/0067-0049/198/1/7

0067-0049/198/1/7

ABSTRACT

We present a description of the adaptive mesh refinement (AMR) implementation of the PLUTO code for solving the equations of classical and special relativistic magnetohydrodynamics (MHD and RMHD). The current release exploits, in addition to the static grid version of the code, the distributed infrastructure of the CHOMBO library for multidimensional parallel computations over block-structured, adaptively refined grids. We employ a conservative finite-volume approach where primary flow quantities are discretized at the cell center in a dimensionally unsplit fashion using the Corner Transport Upwind method. Time stepping relies on a characteristic tracing step where piecewise parabolic method, weighted essentially non-oscillatory, or slope-limited linear interpolation schemes can be handily adopted. A characteristic decomposition-free version of the scheme is also illustrated. The solenoidal condition of the magnetic field is enforced by augmenting the equations with a generalized Lagrange multiplier providing propagation and damping of divergence errors through a mixed hyperbolic/parabolic explicit cleaning step. Among the novel features, we describe an extension of the scheme to include non-ideal dissipative processes, such as viscosity, resistivity, and anisotropic thermal conduction without operator splitting. Finally, we illustrate an efficient treatment of point-local, potentially stiff source terms over hierarchical nested grids by taking advantage of the adaptivity in time. Several multidimensional benchmarks and applications to problems of astrophysical relevance assess the potentiality of the AMR version of PLUTO in resolving flow features separated by large spatial and temporal disparities.

Export citation and abstract BibTeX RIS

1. INTRODUCTION

Theoretical advances in modern astrophysics have largely benefited from computational models and techniques that have been improved over the past decades. In the field of gasdynamics, shock-capturing schemes represent the current establishment for reliable numerical simulations of high Mach number, possibly magnetized flows in Newtonian or relativistic regimes. As increasingly more sophisticated methods developed, a number of computer codes targeting complex physical aspects to various degrees have now become available to the community. In the field of magnetohydrodynamics (MHD), examples worth noticing are AstroBEAR (Cunningham et al. 2009), Athena (Stone et al. 2008; Skinner & Ostriker 2010), BATS-R-US (Tóth et al. 2011), ECHO (Del Zanna et al. 2007), FLASH (Fryxell et al. 2000), NIRVANA (Ziegler 2008), PLUTO (Mignone et al. 2007), RAMSES (Teyssier 2002; Fromang et al. 2006), and VAC (Tóth 1996; van der Holst et al. 2008). Some of these implementations provide additional capabilities that can approach the solution of the equations in the relativistic regimes: AMRVAC and PLUTO for special relativistic hydro, while the ECHO code allows the handling of general relativistic MHD with a fixed metric. Other frameworks were specifically designed for special or general relativistic purposes, e.g., the RAM code (Zhang & MacFadyen 2006), HARM (Gammie et al. 2003), and RAISHIN (Mizuno et al. 2006).

In some circumstances, adequate theoretical modeling of astrophysical scenarios may become extremely challenging since great disparities in the spatial and temporal scales may simultaneously arise in the problem of interest. In these situations a static grid approach may become quite inefficient and, in the most extreme cases, the amount of computational time can make the problem prohibitive. Typically, such conditions occur when the flow dynamics exhibit very localized features that evolve on a much shorter scale when compared to the rest of the computational domain. To overcome these limitations, one possibility is to change or adapt the computational grid dynamically in space and time so that the features of interest can be adequately captured and resolved. Adaptive mesh refinement (AMR) is one such technique and can lead, for a certain class of problems, to a considerable speed-up. Some of the aforementioned numerical codes provide AMR implementations through a variety of different approaches. Examples worth noticing are the patch-based block-structured approach of Berger & Oliger (1984) and Berger & Colella (1989) (e.g., ASTROBEAR), the fully octree approach described in Dezeeuw & Powell (1993) and Khokhlov (1998) (e.g., RAMSES), or the block-based octree of MacNeice et al. (2000) (e.g., FLASH), and Keppens et al. (2003) and van der Holst & Keppens (2007) (e.g., BATS-R-US, AMRVAC).

The present work focuses on the block-structured AMR implementation in the PLUTO code and its application to computational astrophysical gasdynamics. PLUTO is a Godunov-type code providing a flexible and versatile modular computational framework for the solution of the equations of gasdynamics under different regimes (e.g., classical/relativistic fluid dynamics, Euler/MHD). A comprehensive description of the code design and implementation may be found, for the static grid version, in (Mignone et al. 2007, henceforth Paper I). Recent additions to the code include a relativistic version of the Harten–Lax–van Leer discontinuities (HLLD) Riemann solver (Mignone et al. 2009), high-order finite-difference (FD) schemes (Mignone et al. 2010), and optically thin radiative losses with a non-equilibrium chemical network (Teşileanu et al. 2008). Here, we further extend the code description and show its performance on problems requiring significant usage of adaptively refined nested grids. PLUTO takes advantage of the CHOMBO library4, which provides a distributed infrastructure for parallel computations over block-structured adaptively refined grids. The choice of block-structured AMR (as opposed to cell-based fully octree) is justified by the need to exploit the already implemented modular skeleton introducing the minimal amount of modification and, at the same time, maximizing code re-usability.

The current AMR implementation leans on the Corner Transport Upwind (CTU; Colella 1990) method of Mignone & Tzeferacos (2010, MT henceforth), in which a conservative finite-volume (FV) discretization is adopted to evolve zone averages in time. The scheme is dimensionally unsplit, second-order accurate in space and time and can be directly applied to relativistic MHD as well. Spatial reconstruction can be carried out in primitive or characteristic variables using high-order interpolation schemes such as the piecewise parabolic method (PPM; Colella & Woodward 1984), weighted essentially non-oscillatory (WENO), or linear Total Variation Diminishing (TVD) limiting. The divergence-free constraint of the magnetic field is enforced via a mixed hyperbolic/parabolic correction of Dedner et al. (2002), which avoids the computational cost associated with an elliptic cleaning step, and the scrupulous treatment of staggered fields demanded by constrained transport (CT) algorithms (Balsara 2004). As such, this choice provides a convenient first step in porting a considerable fraction of the static grid implementation to the AMR framework. Among the novel features, we also show how to extend the time-stepping scheme to include dissipative terms describing viscous, resistive, and thermally conducting flows. Besides, we propose a novel treatment for efficiently computing the time step in the presence of cooling and/or reacting flows over hierarchical block-structured grids.

The paper is structured as follows. In Section 2, we overview the relevant equations while in Section 3 we describe the integration scheme used on the single patch. In Section 4, an overview of the block-structured AMR strategy as implemented in CHOMBO is given. Sections 5 and 6 show the code's performance on selected multidimensional test problems and astrophysical applications in classical and relativistic MHD, respectively. Finally, in Section 7 we summarize the main results of our work.

2. RELEVANT EQUATIONS

The PLUTO code has been designed for the solution of nonlinear systems of conservative partial differential equations of the mixed hyperbolic/parabolic type. In the present context, we will focus our attention on the equations of single-fluid MHD, both in the Newtonian (MHD) and special relativistic (RMHD) regimes.

2.1. MHD Equations

We consider a Newtonian fluid with density ρ, velocity v = (vx, vy, vz), and magnetic induction B = (Bx, By, Bz) and write the single-fluid MHD equations as

Equation (1)

where pt = p + B2/2 is the total (thermal+magnetic) pressure, ${\cal E}$ is the total energy density, g is the gravitational acceleration term, and Λ accounts for optically thin radiative losses or heating. Divergence terms on the right-hand side account for dissipative physical processes and are described in detail in Section 2.1.1. Proper closure is provided by choosing an equation of state (EoS) which, for an ideal gas, allows us to write the total energy density as

Equation (2)

with Γ being the specific heat ratio. Alternatively, by adopting a barotropic or an isothermal EoS, the energy equation can be discarded and one simply has, respectively, p = p(ρ) or p = c2sρ (where cs is the constant speed of sound).

Chemical species and passive scalars are advected with the fluid and are described in terms of their number fraction Xα, where α = 1, ..., Nions label the particular ion. They obey non-homogeneous transport equations of the form

Equation (3)

where the source term Sα describes the coupling between different chemical elements inside the reaction network (see, for instance, Teşileanu et al. 2008).

2.1.1. Non-ideal Effects

Non-ideal effects due to dissipative processes are described by the differential operators included on the right-hand side of Equation (1). Viscous stresses may be included through the viscosity tensor $\mathsf {$\tau$ }$ defined by

Equation (4)

where ν is the kinematic viscosity and $\mathsf{I}$ is the identity matrix. Similarly, magnetic resistivity is accounted for by prescribing the resistive η tensor (diagonal). Dissipative terms contribute to the net energy balance through the additional flux $\mathsfpi_{\cal{E}}$ appearing on the right-hand side of Equation (1):

Equation (5)

where the different terms give the energy flux contributions due to, respectively, thermal conductivity, viscous stresses, and magnetic resistivity.

The thermal conduction flux Fc smoothly varies between classical and saturated regimes and reads

Equation (6)

where q = 5ϕρc3iso is the magnitude of the saturated flux (Cowie & McKee 1977), ϕ is a parameter of order unity accounting for uncertainties in the estimate of q, ciso is the isothermal speed of sound, and

Equation (7)

is the classical heat flux with conductivity coefficients κ and κ along and across the magnetic field lines, respectively (Orlando et al. 2008). Indeed, the presence of a partially ordered magnetic field introduces a large anisotropic behavior by channeling the heat flux along the field lines while suppressing it in the transverse direction (here $\hat{{\bf b}} = {\bf B}/|{\bf B}|$ is a unit vector along the field line). We point out that, in the classical limit q, thermal conduction is described by a purely parabolic operator and flux discretization follows standard FD. In the saturated limit (|∇T| → ), on the other hand, the equation becomes hyperbolic and thus an upwind discretization of the flux is more appropriate (Balsara et al. 2008). This is discussed in more detail in Appendix A.

2.2. Relativistic MHD Equations

A (special) relativistic extension of the previous equations requires the solution of energy momentum and number density conservation. Written in divergence form we have

Equation (8)

where ρ is the rest-mass density, γ is the Lorentz factor, velocities are given in units of the speed of light (c = 1), and the fluid momentum m accounts for matter and electromagnetic terms: m = wγ2v + E × B, where E = −v × B is the electric field and w is the gas enthalpy. The total pressure and energy include thermal and magnetic contributions and can be written as

Equation (9)

Finally, the gas enthalpy w is related to ρ and p via an EoS, which can be either the ideal gas law,

Equation (10)

or the Taub-Mathews (TM, Mathews 1971) EoS

Equation (11)

which provides an analytic approximation of the Synge relativistic perfect gas (Mignone & McKinney 2007).

A relativistic formulation of the dissipative terms will not be presented here and will be discussed elsewhere.

2.3. General Quasi-Conservative Form

In the following, we adopt an orthonormal system of coordinates specified by the unit vectors $\hat{{\bf e}}_d$ (d is used to label the direction, e.g., d = {x, y, z} in Cartesian coordinates) and conveniently assume that conserved variables ${\bf U}\,{=}\,(\rho ,\rho {\bf v},{\cal E}, {\bf B}, \rho X_\alpha)$—for the MHD equations—and ${\bf U}\,{=}\,(\rho \gamma ,{\bf m},{\cal E}, {\bf B})$—for RMHD—satisfy the following hyperbolic/parabolic partial differential equations

Equation (12)

where $\mathsf{F}$ and $\mathsfpi$ are, respectively, the hyperbolic and parabolic flux tensors. The source term Sp is a point-local source term which accounts for body forces (such as gravity), cooling, chemical reactions, and the source term for the scalar multiplier (see Equation (14) below). We note that equations containing curl or gradient operators can always be cast in this form by suitable vector identities. For instance, the projection of ∇ × E in the coordinate direction given by the unit vector $\hat{{\bf e}}_d$ can be rewritten as

Equation (13)

where the second term on the right-hand side should be included as an additional source term in Equation (12) whenever different from zero (e.g., in cylindrical geometry). Similarly, one can rewrite the gradient operator as $\nabla p = \nabla \cdot (\mathsf {I}p)$.

Several algorithms employed in PLUTO are best implemented in terms of primitive variables, V  =  (ρ, v, B, p). In the following, we shall assume a one-to-one mapping between the two sets of variables, provided by appropriate conversion functions, that is, V  =  V(U) and U = U(V).

3. SINGLE PATCH NUMERICAL INTEGRATION

PLUTO approaches the solution of the previous sets of equations using either FV or FD methods both sharing a flux-conservative discretization where volume averages (for the former) or point values (for the latter) of the conserved quantities are advanced in time. The implementation is based on the well-established framework of Godunov-type, shock-capturing schemes where an upwind strategy (usually a Riemann solver) is employed to compute fluxes at zone faces. For the present purposes, we shall focus on the FV approach where volume-averaged primary flow quantities (e.g., density, momentum, and energy) retain a zone-centered discretization. However, depending on the strategy chosen to control the solenoidal constraint, the magnetic field can evolve either as a cell-average or as a face-average quantity (using the Stokes' theorem). As described in Paper I, both approaches are possible in PLUTO by choosing between Powell's eight-wave formulation or the CT method, respectively.

A third, cell-centered approach based on the generalized Lagrange multiplier (GLM) formulation of Dedner et al. (2002) has recently been introduced in PLUTO, and a thorough discussion as well as a direct comparison with CT schemes can be found in the recent work by MT. The GLM formulation easily builds in the context of MHD and RMHD equations by introducing an additional scalar field ψ, which couples the divergence constraint to Faraday's law according to

Equation (14)

where ch is the (constant) speed at which divergence errors are propagated, while cp is a constant controlling the rate at which monopoles are damped. The remaining equations are not changed and the conservative character is not lost. Owing to its ease of implementation, we adopt the GLM formulation as a convenient choice in the development of a robust AMR framework for Newtonian and relativistic MHD flows.

3.1. Fully Unsplit Time Stepping

The system of conservation laws is advanced in time using the CTU (Colella 1990) method recently described by MT. Here, we outline the algorithm in a more concise manner and extend its applicability in the presence of parabolic (diffusion) terms and higher order reconstruction. Although the algorithms illustrated here are explicit in time, we will also consider the description of more sophisticated and effective approaches for the treatment of parabolic operators in a forthcoming paper.

We shall assume hereafter an equally-spaced grid with computational cells centered in (xi, yj, zk) having size Δx×  Δy×  Δz. For the sake of exposition, we omit the integer subscripts i, j, or k when referring to the cell center and only keep the half-increment notation in denoting face values, e.g., Fd, ±Fy, i, j + 1/2, k when d = y. Following Mignone et al. (2007), we use $\Delta {\cal V}$ and Ad, ± to denote, respectively, the cell volume and areas of the lower and upper interfaces orthogonal to $\hat{{\bf e}}_d$.

An explicit second-order accurate discretization of Equation (12), based on a time-centered flux computation, reads

Equation (15)

where $\bar{{\bf U}}$ is the volume-averaged array of conserved values inside the cell (i, j, k), Δtn is the explicit time step, whereas ${\bf{\cal L}}_{H,d}$ and ${\bf{\cal L}}_{P,d}$ are the increment operators corresponding to the hyperbolic and parabolic flux terms, respectively,

Equation (16)

Equation (17)

In the previous expression, Fd, ± and $\boldsymbol{\Pi }_{d,\pm }$ are, respectively, right (+) and left (−) face- and time-centered approximations to the hyperbolic and parabolic flux components in the direction of $\hat{{\bf e}}_d$. The source term $\hat{{\bf S}}_d$ represents the directional contribution to the total source vector $\sum \hat{{\bf S}}_d\equiv \hat{{\bf S}}_{\rm body}+\hat{{\bf S}}_{\rm geo}$ including body forces and geometrical terms implicitly arising when differentiating the tensor flux on a curvilinear grid. Cooling, chemical reaction terms, and the source term in Equation (14) (namely, (c2h/cp2)ψ) are treated separately in an operator-split fashion.

The computation of Fd, ± requires solving, at cell interfaces, a Riemann problem between time-centered adjacent discontinuous states, i.e.,

Equation (18)

where ${\cal R}(\cdot ,\cdot)$ is the numerical flux resulting from the solution of the Riemann problem. With PLUTO, different Riemann solvers may be chosen at runtime depending on the selected physical module (see Paper I): Rusanov (Lax-Friedrichs), HLL, HLLC (contact), and HLLD are common to both classical and relativistic MHD modules while the Roe solver is available for hydro and MHD. The input states in Equation (18) are obtained by first carrying an evolution step in the normal direction, followed by correcting the resulting values with a transverse flux gradient. This yields the corner-coupled states which, in the absence of parabolic terms (i.e., when ${\mathsfpi}=\mathsf{0}$), are constructed exactly as illustrated by MT. For this reason, we will not repeat it here.

When $\mathsfpi\,{\ne}\, 0$, on the other hand, we adopt a slightly different formulation that does not require any change in the computational stencil. At constant x-faces, for instance, we modify the corner-coupled states to

Equation (19)

where, using Godunov's first-order method, we compute, for example,

Equation (20)

i.e., by solving a Riemann problem between cell-centered states. States at constant y- and z-faces are constructed in a similar manner. The normal predictors U*± can be obtained either in characteristic or primitive variables as outlined in Sections 3.2 and 3.3, respectively. Parabolic (dissipative) terms are discretized in a flux-conservative form using standard central FD approximations to the derivatives. For any term in the form Π = g(U)∂xf(U), for instance, we evaluate the right interface flux appearing in Equation (17) with the second-order accurate expression

Equation (21)

and similarly for the other directions (a similar approach is used by Tóth et al. 2008). We take the solution available at the cell center at t = tn in Equation (19) and at the half time step n + 1/2 in Equation (15). For this latter update, time- and cell-centered conserved quantities may be readily obtained as

Equation (22)

The algorithm requires a total of six solutions to the Riemann problem per zone per step and it is stable under the Courant–Friedrichs–Levy (CFL) condition Ca ⩽ 1 (in two dimensions) or Ca ⩽ 1/2 (in three dimensions), where

Equation (23)

is the CFL number, λmax d and ${\cal D}^{\max }_d$ are the (local) largest signal speed and diffusion coefficient in the direction given by d = {x, y, z}, respectively. Equation (23) is used to retrieve the time step Δtn + 1 for the next time level if no cooling or reaction terms are present. Otherwise we further limit the time step so that the relative change in pressure and chemical species remains below a certain threshold epsilonc:

Equation (24)

where δp/p and δXκ are the maximum fractional variations during the source step (Teşileanu et al. 2008). We note that the time step limitation given by Equation (24) does not depend on the mesh size and can be estimated on unrefined cells only. This allows to take full advantage of the adaptivity in time as explained in Section 4.2.

3.2. Normal Predictors in Characteristic Variables

The computation of the normal predictor states can be carried out in characteristic variables by projecting the vector V of primitive variables onto the left eigenvectors lκilκ(Vi) of the primitive system. Specializing to the x-direction,

Equation (25)

where κ = 1, ..., Nwave labels the characteristic wave with speed λκ and the projection extends to all neighboring zones required by the interpolation stencil of width 2S + 1. The employment of characteristic fields rather than primitive variables requires the additional computational cost associated with the full spectral decomposition of the primitive form of the equations. Nevertheless, it has shown to produce better-behaved solutions for highly nonlinear problems, notably for higher-order methods.

For each zone i and characteristic field κ, we first interpolate wκi, l to obtain wκi, ±, that is, the rightmost (+) and leftmost (−) interface values from within the cell. The interpolation can be carried out using either fourth-, third- or second-order piecewise reconstruction as outlined later in this section.

Extrapolation in time to tn + Δtn/2 is then carried out by using an upwind selection rule that discards waves not reaching a given interface in Δt/2. The result of this construction, omitting the κ index for the sake of exposition, reads

Equation (26)

Equation (27)

where ν ≡ λΔtx is the Courant number of the κth wave, β± = (1 ± sign(ν))/2, whereas δwi and δ2wi are defined by

Equation (28)

The choice of the reference state wrefi, ± is somewhat arbitrary and one can simply set wrefi, ± = wi, 0 (Rider et al. 2007), which has been found to work well for flows containing strong discontinuities. Alternatively, one can use the original prescription (Colella & Woodward 1984)

Equation (29)

Equation (30)

where νmax  = max (0, max κκ)) and νmin  = min (0, min κκ)) are chosen so as to minimize the size of the term susceptible to characteristic limiting (Colella & Woodward 1984; Miller & Colella 2002; Mignone et al. 2005). However, we note that, in the presence of smooth flows, both choices may reduce the formal second-order accuracy of the scheme since, in the limit of small Δt, contributions carried by waves not reaching a zone edge are not included when reconstructing the corresponding interface value (Stone et al. 2008). In these situations, a better choice is to construct the normal predictors without introducing a specific reference state or, equivalently, by assigning wrefi, ± = wi, ± in Equations (26) and (27).

The time-centered interface values obtained in characteristic variables through Equations (26) and (27) are finally used as coefficients in the right-eigenvector expansion to recover the primitive variables:

Equation (31)

where rκ is the right eigenvector associated with the κth wave, Sg is a source term accounting for body forces and geometrical factors, while ${\bf S}_{\rm B_x}$ and Sψ arise from calculating the interface states in primitive variables rather than conservative ones and are essential for the accuracy of the scheme in multiple dimensions. See MT for a detailed discussion on the implementation of these terms.

As mentioned, the construction of the left and right interface values can be carried out using different interpolation techniques. Although some of the available options have already been presented in the original paper (Mignone et al. 2007), here we briefly outline the implementation details for three selected schemes providing (respectively) fourth-, third-, and second-order spatially accurate interface values in the limit of vanishing time step. Throughout this section we will make frequent usage of the undivided differences of characteristic variables (Equation (25)) such as

Equation (32)

for the ith zone.

Piecewise Parabolic Method. The original PPM reconstruction by Colella & Woodward (1984; see also Miller & Colella 2002) can be directly applied to characteristic variables giving the following fourth-order limited interface values:

Equation (33)

where slope limiting is used to ensure that wi, ± are bounded between wi and wi ± 1:

Equation (34)

and

Equation (35)

is the MinMod function. The original interface values defined by Equation (33) must then be corrected to avoid the appearance of local extrema. By defining δ± = wi, ±wi, 0, we further apply the following parabolic limiter

Equation (36)

where the first condition flattens the distribution when wi, 0 is a local maximum or minimum whereas the second condition prevents the appearance of an extremum in the parabolic profile. Once limiting has been applied, the final interface values are obtained as

Equation (37)

In some circumstances, we have found that further application of the parabolic limiter (Equation (36)) to primitive variables may reduce oscillations.

Third-order-improved WENO. As an alternative to the popular TVD limiters, the third-order-improved WENO reconstruction proposed by Yamaleev & Carpenter (2009; see also Mignone et al. 2010) may be used. The interpolation still employs a three-point stencil but provides a piecewise parabolic profile that preserves the accuracy at smooth extrema, thus avoiding the well-known clipping of classical second-order TVD limiters. Left and right states are recovered by a convex combination of second-order interpolants into a weighted average of the order of three. The nonlinear weights are adjusted by the local smoothness of the solution so that essentially zero weights are given to non-smooth stencils while optimal weights are prescribed in smooth regions. In compact notation

Equation (38)

where

Equation (39)

As one can see, an attractive feature of WENO reconstruction consists in completely avoiding the usage of conditional statements. The improved WENO scheme has enhanced accuracy with respect to the traditional third-order scheme of Jiang & Shu (1996) in regions where the solution is smooth and provides oscillation-free profiles near strong discontinuities.

Linear reconstruction. Second-order TVD limiting is provided by

Equation (40)

where $\overline{\Delta w}_{i,0}$ is a standard limiter function such as the monotonized-central (MC) limiter (Equation (34)). Other, less steep forms of limiting are the harmonic mean (van Leer 1974):

Equation (41)

the Van Albada limiter (van Albada et al. 1982):

Equation (42)

or the MinMod limiter, Equation (35).

Linear reconstruction may also be locally employed in place of a higher-order method whenever a strong shock is detected. This is part of a built-in hybrid mechanism that selectively identifies zones within a strong shock in order to introduce additional dissipation by simultaneously switching to the HLL Riemann solver. Even if the occurrence of such situations is usually limited to very few grid zones, this fail-safe mechanism does not sacrifice the second-order accuracy of the scheme and has been found to noticeably improve the robustness of the algorithm avoiding the occurrence of unphysical states. This is described in more detail in Appendix B. However, in order to assess the robustness and limits of applicability of the present algorithm, it will not be employed for the test problems presented here unless otherwise stated.

3.3. Normal Predictors in Primitive Variables

The normal predictor states can also be directly computed in primitive variables using a simpler formulation that avoids the characteristic projection step. In this case, one-dimensional (1D) left and right states are obtained at tn + 1/2 using

Equation (43)

where β+ = (1 + sgn(λmax ))/2 and β = (1 − sgn(λmin ))/2 may be used to introduce a weak form of upwind limiting, in a similar fashion to Section 3.2. Time-centered conservative variables U*i follow from a simple conservative MUSCL-Hancock step:

Equation (44)

where Ax, ± and $\Delta {\cal V_x}$ are the area and volume elements in the x direction, respectively, and Vni, ± are obtained using linear reconstruction (Equation (40)) of the primitive variables. This approach offers an ease of implementation over the characteristic tracing step as it does not require the eigenvector decomposition of the equations or their primitive form. Notice that, since this step is performed in conservative variables, the multidimensional terms proportional to ∂Bx/∂x do not need to be included.

4. AMR STRATEGY—CHOMBO

The support for AMR calculations in PLUTO is provided by the CHOMBO library. CHOMBO is a software package aimed at providing a distributed infrastructure for serial and parallel calculations over block-structured, adaptively refined grids in multiple dimensions. It is written in a combination of C++ and Fortran77 with Message Passing Interface (MPI) and is developed and distributed by the Applied Numerical Algorithms Group of Lawrence Berkeley National Laboratory (https://seesar.lbl.gov/anag/chombo/).

In the block-structured AMR approach, once the solution has been computed over a rectangular grid which discretizes the entire computational domain, it is possible to identify the cells which require additional resolution and cover them with a set of rectangular grids (also referred to as blocks or patches), characterized by a finer mesh spacing. CHOMBO follows the Berger & Rigoutsos (1991) strategy to determine the most efficient patch layout to cover the cells that have been tagged for refinement. This process can be repeated recursively to define the solution over a hierarchy of ℓ = 0, ..., ℓmax levels of refinement whose spatial resolutions satisfy the relation Δxd = r Δxdℓ + 1, where the integer r is the refinement ratio between level ℓ and level ℓ + 1. A level of refinement is composed by a union of rectangular grids, which must be: disjointed, i.e., two blocks of the same level can be adjacent without overlapping; properly nested, i.e., a cell of level ℓ cannot be only partially covered by cells of level ℓ + 1, and cells of level ℓ + 1 must be separated from cells of level ℓ − 1 at least by a row of cells of level ℓ. A simple example of a bidimensional adaptive grid distributed over a hierarchy of three levels of refinement is depicted in Figure 1.

Figure 1.

Figure 1. Two-dimensional example of a three-level AMR hierarchy, with the base level (ℓ = 0) covering the entire computational domain. Solid lines are representative of the level resolution. Dashed lines contour the ghost zones of two patches of level ℓ = 1. Colors indicate different filling methods: physical outer boundaries (red), boundaries filled by exchanging values with adjacent patches on the same level (blue), and boundaries filled by interpolating from the next coarser level (yellow).

Standard image High-resolution image

Following the notation of Pember et al. (1996), a global mapping is employed on all levels: in three dimensions, cells on level ℓ are identified with global indexes i, j, k (0 ⩽ i < N1, 0 ⩽ j < N2, 0 ⩽ k < N3, with N1, 2, 3 being the equivalent global resolution of level ℓ in the three directions). Correspondingly, the cell i, j, k of level ℓ is covered by (r)3 cells of level ℓ + 1 identified by global indexes l, m, n satisfying the conditions rilr(i + 1) − 1, rjmr(j + 1) − 1, rknr(k + 1) − 1. Taking direction 1 as an example, the expressions, x1, − = iΔx1, x1 = (i + 1/2)Δx1, x1, + = (i + 1)Δx1, define the physical coordinates of the left edge, center, and right edge of a cell, respectively.

If the adaptive grid is employed to evolve time-dependent hyperbolic partial differential equations, the CFL stability condition allows to apply refinement in time as well as in space, as first proposed by Berger & Oliger (1984) and further developed in Berger & Colella (1989). In fact, each level ℓ advances in time with a time step Δt = Δtℓ − 1/rℓ − 1, which is rℓ − 1 times smaller than the time step of the next coarser level ℓ − 1. Starting the integration at the same instant, two adjacent levels synchronize every r time steps, as schematically illustrated in Figure 2 for a refinement ratio r = 2. Even though in the following discussion we will assume that level ℓ + 1 completes r time steps to synchronize with level ℓ, CHOMBO allows the finer level ℓ + 1 to advance with smaller substeps if the stability condition requires it. Anyway, the additional substeps must guarantee that levels ℓ and ℓ + 1 are synchronized again at time t + Δt.

Figure 2.

Figure 2. Schematic representation of the time evolution of an AMR hierarchy composed of three levels with a refinement ratio r  =  2. The length of the horizontal black arrows is proportional to the time step size Δt. Curved vertical arrows indicate interlevel communications. Red arrows represent fine-to-coarse communications between synchronized adjacent levels, including conservative averaging (Equation (47)) and refluxing (Equations (48) and (49)). Green arrows represent coarse-to-fine communications, including the conservative interpolation (Equation (45)) needed to fill ghost zones and to define the solution on newly generated cells of the finer level.

Standard image High-resolution image

The time evolution of single patches is handled by PLUTO, as illustrated in Section 3. Before starting the time evolution, the ghost cells surrounding the patches must be filled according to one of these three possibilities: (1) assigning "physical" boundary conditions to the ghost cells which lie outside the computational domain (e.g., the red area in Figure 1); (2) exchanging boundary conditions with the adjacent patches of the same level (e.g., the blue area in Figure 1); and (3) interpolating values from the parent coarser level for ghost cells which cover cells of a coarser patch (e.g., the yellow area in Figure 1).

As schematically illustrated in Figure 3 in two dimensions, the coarse-to-fine prolongation needed in case (3) (green dashed lines) is based on a piecewise linear interpolation at points marked by crosses using the linear slopes computed from the surrounding coarse cells. In three dimensions the interpolant has the general form

Equation (45)

where ${\cal V}_{d}^{\ell }$ is the volume coordinate of cell centers of level ℓ in direction d and ${\cal V}_{d,\pm }^{\ell }$ is its value on the right and left faces of the cell, respectively (see Table 1 for definitions). The linear slopes ΔdUi, j, k are calculated as central differences, except for cells touching the domain boundary, where one-sided differences are employed. The MC limiter (Equation (34)) is applied to the linear slopes so that no new local extrema are introduced.

Figure 3.

Figure 3. Illustrative bidimensional example of prolongation and restriction operations between two levels with a refinement ratio r = 2. Cells on level ℓ + 1 can be filled by linearly interpolating the coarse values on level ℓ (empty circles) at cross-marked points (prolongation, green dashed lines, Equation (45)). Cells on level ℓ can be filled by averaging down values from level ℓ + 1 in a conservative way (restriction, red dotted lines, Equation (47)).

Standard image High-resolution image

Notice that, since two contiguous levels are not always synchronized (see Figure 2), coarse values at an intermediate time are needed to prolong the solution from a coarse level to the ghost zones of a finer level. Coarse values of level ℓ are therefore linearly interpolated between time t and time t + Δt and the piecewise linear interpolant (Equation (45)) is applied to the coarse solution:

Equation (46)

where α = (tℓ + 1t)/Δt. This requires that, everytime level ℓ and level ℓ + 1 are synchronized, a time step on level ℓ must be completed before starting the time integration of level ℓ + 1. Therefore, the time evolution of the entire level hierarchy is performed recursively from level ℓ = 0 up to ℓ = ℓmax , as schematically illustrated by the pseudocode in Figure 4.

Figure 4.

Figure 4. Pseudocode for the recursive level integration in the block-structured AMR.

Standard image High-resolution image

When two adjacent levels are synchronized, some corrections to the solution are performed to enforce the conservation condition on the entire level hierarchy. To maintain consistency between levels, the solution on the finer level ℓ + 1 is restricted to the lower level ℓ by averaging down the finer solution in a conservative way (red dotted lines in Figure 3)

Equation (47)

where ${\cal V}_{i,j,k}^{\ell }$ is the volume of cell i, j, k of level ℓ.

Moreover, the flux through an edge which is shared between a cell of level ℓ and (r)2 cells of level ℓ + 1 must be corrected to maintain the conservative form of the equations. For example, if the cell i, j, k on level ℓ shares its left boundary with (r)2 cells of level ℓ + 1 (see Figure 5), the flux calculated during the coarse integration must be replaced with the average in time and space of the fluxes crossing the (r)2 faces of the finer level cells. In this particular example, the flux correction is defined as

Equation (48)

where the index q sums over the time steps of level ℓ + 1, while m and n are the indexes transverse to direction d. The flux correction is added to the solution on level ℓ after the time integration of level ℓ and ℓ + 1 has been completed:

Equation (49)
Figure 5.

Figure 5. Schematic visualization of the refluxing operation needed at fine–coarse interfaces to preserve the conservative properties of the solution. One cell on the coarser level ℓ and the cells of level ℓ + 1 adjacent to one side are represented, assuming a refinement ratio r = 2. Whenever level ℓ and ℓ + 1 are synchronized, the coarse flux (red arrow) must be replaced by the spatial and temporal average of the finer fluxes crossing the fine–coarse interface (blue arrows, Equation (48)) and the solution must be corrected accordingly (Equation (49)).

Standard image High-resolution image

Finally, when levels from ℓ up to ℓmax are synchronized, it is possible to tag the cells which need refinement and generate a new hierarchy of grids on levels from ℓ + 1 up to ℓmax, which covers the tags at each level. Whenever new cells are created on level ℓ + 1 it is possible to fill them interpolating from level ℓ according to Equation (45). It is important to notice that this interpolant preserves the conservative properties of the solution.

4.1. Refinement Criteria

In PLUTO-CHOMBO, zones are tagged for refinement whenever a prescribed function χ(U) of the conserved variables and of its derivatives exceeds a prescribed threshold, i.e., χ(U) > χr. Generally speaking, the refinement criterion may be problem dependent, thus requiring the user to provide an appropriate definition of χ(U). The default choice adopts a criterion based on the second derivative error norm (Löhner 1987), where

Equation (50)

where σ ≡ σ(U) is a function of the conserved variables, $\Delta _{d,\pm \frac{1}{2}}\sigma$ are the undivided forward and backward differences in the direction d, e.g., $\Delta _{x,\pm \frac{1}{2}}\sigma = \pm (\sigma _{i\pm 1} - \sigma _i)$. The last term appearing in the denominator, σd, ref, prevents regions of small ripples from being refined (Fryxell et al. 2000) and it is defined by

Equation (51)

Similar expressions hold when d = y or d = z. In the computations reported in this paper we use epsilon = 0.01 as the default value.

4.2. Time Step Limitation of Point-local Source Terms

In the usual AMR strategy, grids belonging to level ℓ are advanced in time by a sequence of steps with typical size

Equation (52)

where we assume, for simplicity, a grid jump of 2. Here, Δt0min  is chosen by collecting and re-scaling to the base grid the time steps from all levels available from the previous integration step n:

Equation (53)

where Δtℓ, n is computed using Equation (24). However, this procedure may become inefficient in the presence of source terms whose timescale does not depend on the grid size. As an illustrative example, consider a strong radiative shock propagating through a static cold medium. In the optically thin limit, radiative losses are assumed to be local functions of the state vector, but they do not involve spatial derivatives. If the fastest timescale in the problem is dictated by the cooling process, the time step estimate should then become approximately the same on all levels, Δt ≈ Δtrad ≈ Δt0rad, regardless of the mesh size. However from the previous equations, one can see that finer levels with ℓ > 0 will advance with a time step (2) smaller than required by the single grid estimate. Equation (52) is nevertheless essential for proper synchronization between nested levels.

Simple considerations show that this deficiency may be cured by treating split and leaf cells differently. Split zones in a given level ℓ are, in fact, overwritten during the projection step using the more accurate solution computed on children cells belonging to level ℓ + 1. Thus, accurate integration of the source term is not important for these cells and could even be skipped. From these considerations, one may as well evaluate the source-term-related time step on leaf cells only, where the accuracy and stability of the computed solution is essential. This simple expedient should speed up the computations by a factor of approximately (2), thus allowing us to take full advantage of the refinement offered by the AMR algorithm without the time step restriction. Besides, this should not alter or degrade the solution computed during this single hierarchical integration step as long as the projection step precedes the regrid process.

The proposed modification is expected to be particularly efficient in those problems where radiative losses are stronger in proximity of steep gradients.

4.3. Parallelization and Load Balancing

Both PLUTO and PLUTO-CHOMBO support calculations in parallel computing environments through the MPI library. Since the time evolution of the AMR hierarchy is performed recursively, from lower to upper levels, each level of refinement is parallelized independently by distributing its boxes to the set of processors. The computation on a single box has no internal parallelization. Boxes are assigned to processors by balancing the computational load on each processor. Currently, the workload of a single box is estimated by the number of grid points of the box, considering that the integration requires approximately the same amount of flops per grid point. This is not strictly true in some specific case, e.g., in the presence of optically thin radiative losses, and a strategy to improve the load balance in such situations is currently under development. On the basis of the box workloads, CHOMBO's load balancer uses the Kernighan–Lin algorithm for solving knapsack problems.

CHOMBO weak scaling performance has been thoroughly benchmarked: defining the initial setup by spatially replicating a 3D hydrodynamical problem proportionally to the number of CPUs employed, the execution time stays constant with excellent approximation (see Van Straalen et al. 2009 for more details).

To test the parallel performance of PLUTO-CHOMBO in real applications, we performed a number of strong scaling tests by computing the execution time as a function of the number of processors for a given setup. While this is a usual benchmark for static grid calculations, in the case of AMR computations this diagnostic is strongly problem dependent and difficult to interpret.

In order to find some practical rule to improve the scaling of AMR calculations, we investigated the dependency of the parallel performance on some parameters characterizing the adaptive grid structure: the maximum box size allowed and the number of levels of refinement employed using different refinement ratios. As a general rule, the parallel performance deteriorates when the number of blocks per level becomes comparable to the number of processors or, alternatively, when the ideal workload per processor (i.e., the number of grid cells of a level divided by the number of CPUs) becomes comparable to the maximum box size. As we will show, decreasing the maximum possible block size can sensibly increase the number of boxes of a level and therefore improves the parallel performance. On the other hand, using less refinement levels with larger refinement ratios to achieve the same maximum resolution can lower the execution time, reducing the parallel communication volume and avoiding the integration of intermediate levels.

In Sections 5 and 6, we present several parallel scaling tests and their dependence on the aforementioned grid parameters.

5. MHD TESTS

In this section, we consider a suite of test problems specifically designed to assess the performance of PLUTO-CHOMBO for classical MHD flows. The selection includes 1D, 2D, and 3D standard numerical benchmarks already presented elsewhere in the literature as well as applications of astrophysical relevance. The single patch integrator adopts the characteristic tracing step described in Section 3.2 with either PPM, WENO, or linear interpolations carried out in characteristic variables. The ideal EOS with Γ = 5/3 is used throughout this section.

5.1. Shock Tube Problems

The shock tube test problem is a common benchmark for an accurate description of both continuous and discontinuous flow features. In the following, we consider 1D and 3D configurations of standard shock tubes proposed by Torrilhon (2003) and Ryu & Jones (1995).

5.1.1. One-dimensional Shock Tube

Following Torrilhon (2003), we address the capability of the AMR scheme to handle and refine discontinuous features as well as to correctly resolve the non-uniqueness issue of MHD Riemann problems in FV schemes (Torrilhon 2003; Torrilhon & Balsara 2004, and references therein). Left and right states are given by

Equation (54)

where V = (ρ, vx, vy, vz, Bx, By, Bz, p) is the vector of primitive variables. As discussed by Torrilhon (2003), for a wide range of initial conditions MHD Riemann problems have unique solutions, consisting of Lax shocks, contact discontinuities, or rarefaction waves. Nevertheless, certain sets of initial values exist that can result in non-unique solutions. When this occurs, along with the regular solution arises one that allows for irregular MHD waves, for example, a compound wave. A special case where the latter appears is when the initial transverse velocity components are zero and the magnetic field vectors on either side of the interface are anti-parallel. Such a case was noted by Brio & Wu (1988) and can be reproduced by simply choosing α = π in our initial condition.

A 1D non-unique solution is calculated using a static grid with 400 zones, x ∈ [ − 1, 1.5]. Left and right boundaries are set to outflow and the evolution stops at time t = 0.4, before the fast waves reach the borders. The resulting density profile is shown in Figure 6. The solid lines denote the two admissible exact solutions: the regular (red) and the one containing a compound wave (black), the latter situated at x ∼ − 0.24. It is clear that the solution obtained with the Godunov-type code is the one with the compound wave (symbols).

Figure 6.

Figure 6. Density profiles for the 1D shock tube problem at t = 0.4 with α = π. Solid lines correspond to admissible analytic solutions with (black) and without (red) a compound wave. The numerical solution (symbols) is obtained with 400 grid points.

Standard image High-resolution image

The crucial problematic of this test occurs when α is close to but not exactly equal to π. Torrilhon (2003) has proven that regardless of scheme, the numerical solution will erroneously tend to converge to an "irregular" one similar to α = π (pseudoconvergence), even if the initial conditions should have a unique, regular solution. This pathology can be cured either with high-order schemes (Torrilhon & Balsara 2004) or with a dramatic increase in resolution on the region of interest, proving AMR to be a useful tool. To demonstrate this we choose α = 3 for the field's twist.

Starting from a coarse grid of 512 computational zones, we vary the number of refinement levels, with a consecutive jump ratio of 2. The 10 level run (solid red line) incorporates also a single jump ratio of 4 between the sixth and seventh refinement levels, reaching a maximum equivalent resolution of 1,048,576 zones (see Figure 7). The refinement criterion is set upon the variable σ = (B2x + By2 + B2z)/ρ using Equation (50) with a threshold χr = 0.03, whereas integration is performed using PPM with a Roe Riemann solver and a Courant number Ca = 0.9. As resolution increases the compound wave disentangles and the solution converges to the expected regular form (Torrilhon 2003; Fromang et al. 2006). In Table 2, we compare the CPU running time of the AMR runs versus static uniform grid computations at the same effective resolution. With 5 and 10 levels of refinement (effective resolutions 16,384 and 1,048,576 zones, respectively) the AMR approach is ∼32 and ∼1978 times faster than the uniform mesh computation, respectively.

Figure 7.

Figure 7. Density profiles for the 1D shock tube problem at t = 0.4 inproximity of the compound wave, with α = 3. The AMR levels vary from 0 to 10 as reported in the legend, exploring cases of equivalent resolution of 512 (solid), 1024 (dot), 2048 (dash), 4096 (dot-dash), 8192 (three-dot-dashed), 16,384 (long dash), and 1,048,576 (solid red) points. At high resolution the solution converges to the regular one. This figure is analogous to Figure 3 of Fromang et al. (2006).

Standard image High-resolution image

Table 1. Systems of Coordinates Adopted in PLUTO-CHOMBO

Label Cartesian Cylindrical
x1 x r
x2 y z
x3 z /
V1 x r2/2
V2 y z
V3 z /
A1, + ΔyΔz r+Δz
A2, + ΔzΔx rΔr
A3, + ΔxΔy /
${\cal V}$ ΔxΔyΔz rΔrΔz

Download table as:  ASCIITypeset image

Table 2. CPU Running Time for the 1D MHD Shock Tube Using Both Static and AMR Computations

Static Run AMR Run Gain
Nx Time Level Ref Ratio Time  
  (s)     (s)  
512 0.5 0 2 0.5 1
1024 1.9 1 2 1.1 1.7
2048 7.5 2 2 2.3 3.3
4096 31.6 3 2 4.5 7.0
8192 138.0 4 2 8.7 15.9
16384 546.1 5 2 16.9 32.3
1048576 2.237 × 106a 10 2 (4) 1131.1 1977.8

Notes. The first and second columns give the number of points Nx and corresponding CPU for the static grid run (no AMR). The third, fourth, and fifth columns give, respectively, the number of levels, the refinement ratio, and CPU time for the AMR run at the equivalent resolution. The last row refers to the solid red line of Figure 7, where a jump ratio of four was introduced between levels six and seven to reach an equivalent of ∼106 grid points. The last column shows the corresponding gain factor calculated as the ratio between static and AMR execution time. aCPU time has been inferred from ideal scaling.

Download table as:  ASCIITypeset image

5.1.2. Three-dimensional Shock Tube

The second Riemann problem was proposed by Ryu & Jones (1995) and later considered also by Tóth (2000), Balsara & Shu (2000), Gardiner & Stone (2008), Mignone & Tzeferacos (2010), and Mignone et al. (2010). An initial discontinuity is described in terms of primitive variables as

Equation (55)

where V = (ρ, v1, v2, v3, B1, B2, B3, p) is the vector of primitive variables. The subscript "1" gives the direction perpendicular to the initial surface of discontinuity whereas "2" and "3" correspond to the transverse directions. We first obtain a 1D solution on the domain x ∈ [ − 0.75, 0.75] using 6144 grid points, stopping the computations at t = 0.2.

In order to test the ability of the AMR scheme to maintain the translational invariance and properly refine the flow discontinuities, the shock tube is rotated in a 3D Cartesian domain. The coarse level of the computational domain consists of [384 × 4 × 4] zones and spans [ − 0.75, 0.75] in the x-direction while y, z ∈ [0, 0.015625]. The rotation angles, γ around the y-axis and α around the z-axis, are chosen so that the planar symmetry is satisfied by an integer shift of cells (nx, ny, nz). The rotation matrix can be found in Mignone et al. (2010). By choosing tan α = −r1/r2 and tan β = tan γ/cos α = r1/r3, one can show (Gardiner & Stone 2008) that the three integer shifts nx, ny, nz must obey

Equation (56)

where cubed cells have been assumed and (r1, r2, r3) = (1, 2, 4) will be used. Computations stop at t = 0.2cos αcos γ, once again before the fast waves reach the boundaries. We employ four refinement levels with consecutive jumps of 2, corresponding to an equivalent resolution of 6144 × 64 × 64 zones. The refinement criterion is based on the normalized second derivative of (|Bx| + |By|)ρ with a threshold value χr = 0.1. Integration is done with PPM reconstruction, a Roe Riemann solver, and a Courant number of Ca = 0.4.

The primitive variable profiles (symbols) are displayed in Figure 8 along the x-direction,5 together with the 1D reference solution in the x ∈ [ − 0.25, 0.55] region. In agreement with the solution of Ryu & Jones (1995), the wave pattern produced consists of a contact discontinuity that separates two fast shocks, two slow shocks, and a pair of rotational discontinuities. A 3D close-up of the top-hat feature in the density profile is shown in Figure 9, along with AMR levels and mesh. The discontinuities are captured correctly, and the AMR grid structure respects the plane symmetry. Our results favorably compare with those of Gardiner & Stone (2008), Mignone & Tzeferacos (2010), Mignone et al. (2010), and previous similar 2D configurations.

Figure 8.

Figure 8. Primitive variable profiles for the 3D shock tube problem at t = 0.02cos αcos γ, along the x-direction. Density and thermal pressure are plotted in the top panels while vector field components normal ("1") and transverse ("2" and "3") to the initial surface of discontinuity are shown in the middle and bottom panels. We show a smaller portion of the domain, x ∈ [ − 0.25, 0.55], in order to emphasize the change of resolution by symbol density.

Standard image High-resolution image
Figure 9.

Figure 9. Close-up of the top-hat feature in the density profile for the 3D shock tube problem, along with AMR level structure and the mesh. Different colors are used to distinguish grid levels.

Standard image High-resolution image

The AMR computation took approximately 3 hr and 53 minutes on two 2.26 GHz quad-core Intel Xeon processors (eight cores in total). For the sake of comparison, we repeated the same computation on a uniform mesh of 768 × 8 × 8 zones (1/8 of the effective resolution) with the static grid version of PLUTO employing ≈79 s. Thus, extrapolating from ideal scaling, the computational cost of the fixed grid calculation is expected to increase (at least) by a factor 212 giving an overall gain of the AMR over the uniform grid approach of ∼23.

5.2. Advection of a Magnetic Field Loop

The next test problem considers the 2D advection of a magnetic field loop. This test, proposed by Gardiner & Stone (2005), aims to benchmark the scheme's dissipative properties and the correct discretization balance of multidimensional terms through monitoring the preservation of the initial circular shape of the loop.

As in Gardiner & Stone (2005) and Fromang et al. (2006), we define the computational domain by x ∈ [ − 1, 1] and y ∈ [ − 0.5, 0.5] discretized on a coarse grid of 64 × 32 grid cells. In the initial condition, both density and pressure are uniform and equal to 1, while the velocity of the flow is given by ${\bf v} = V_0\cos \alpha \hat{{\bf e}}_x + V_0\sin \alpha \hat{{\bf e}}_y$ with $V_0 = \sqrt{5}$, $\sin \alpha = 1/\sqrt{5}$, and $\cos \alpha = 2/\sqrt{5}$. The magnetic field is then defined through the magnetic vector potential as

Equation (57)

where A0 = 10−3, R = 0.3, and $r=\sqrt{x^2 + y^2}$. The simulation evolves until t = 2, when the loop has thus performed two crossings through the periodic boundaries. The test is repeated with two, three, and four levels of refinement (jump ratio of 2), resulting to equivalent resolutions of [256 × 128], [512 × 256], and [1024 × 512], respectively. Refinement is triggered whenever the second derivative error norm of (B2x + By2) × 106, computed via Equation (50), exceeds the threshold χr = 0.1. The integration is carried out utilizing WENO reconstruction and the Roe Riemann solver, with Ca = 0.4.

The temporal evolution of magnetic energy density is seen in Figure 10, with four levels of refinement. As the field loop is transported inside the computational domain, the grid structure changes to follow the evolution and the field lines retain the initial circular form. An efficient way to quantitatively measure the diffusive properties of the scheme is to monitor the dissipation of the magnetic energy. In the top panel of Figure 11, we plot the normalized mean magnetic energy as a function of time. By increasing the levels of refinement the dissipation of magnetic energy decreases, with 〈B2〉 ranging from ∼94% to ∼98% of the initial value. In order to quantify the computational gain of the AMR scheme, we repeat the simulations with a uniform grid resolved onto as many points as the equivalent resolution, without changing the employed numerical method. The speed-up is reported in the bottom panel of Figure 11.

Figure 10.

Figure 10. Magnetic energy density for the 2D field loop problem at t = 0, 0.7, 1.4, 2. Overplotted are the refinement levels.

Standard image High-resolution image
Figure 11.

Figure 11. Upper panel: normalized magnetic energy for the field loop advection problem as a function of time. Lower panel: computational time as a function of equivalent resolution.

Standard image High-resolution image

5.3. Resistive Reconnection

Magnetic reconnection refers to a topological rearrangement of magnetic field lines with opposite directions, accompanied with a conversion of magnetic energy into kinetic and thermal energy of the plasma. This is believed to be the basic mechanism behind energy release during solar flares. The first solution to the problem was given independently by Sweet (1958) and Parker (1957), treating it as a 2D boundary layer problem in the laminar limit.

According to the Sweet–Parker model, the magnetic field's convective inflow is balanced by ohmic diffusion. Along with the assumption of continuity, this yields a relation between reconnection and plasma parameters. If L and δ are the boundary layer's half length and width, respectively, we can write the reconnection rate ${\cal E}$ as

Equation (58)

With uin and uout we denote the inflow and outflow speeds, into and out of the boundary layer, respectively. The Lundquist number for the boundary layer is defined as S = uAL/η, with uA being the Alfvén velocity directly upstream of the layer, η the magnetic resistivity, and L the layer's half-length. This dependency of the reconnection rate with the square root of magnetic resistivity is called the Sweet–Parker scaling and has been verified both numerically (Biskamp 1986; Uzdensky & Kulsrud 2000) and experimentally (Ji et al. 1998).

Following the guidelines of the Geospace Environment Modeling (GEM) Magnetic Reconnection Challenge (Birn et al. 2001), the computational domain is a 2D Cartesian box, with x ∈ [ − Lx/2, Lx/2] and y ∈ [ − Ly/2, Ly/2] where we choose Lx = 25.6 and Ly = 12.8. The initial condition consists of a Harris current sheet: the magnetic field configuration is described by Bx(y) = B0tanh (y/λ) whereas the flow's density is ρ = ρ0sech2(y/λ) + ρ, where λ = 0.5, ρ0 = 1, and ρ = 0.2. The flow's thermal pressure is deduced assuming equilibrium with magnetic pressure, P = B20/2 = 0.5. The initial magnetic field components are perturbed via

Equation (59)

where Ψ0 = 0.1. The coarse grid consists of [64  ×  32] points, and additional levels of refinement are triggered using the following criterion based on the current density:

Equation (60)

where ΔxBy and ΔyBx are the undivided central differences of By and Bx in the x- and y-direction, respectively, and ξ = Δx0x ⩾ 1 is the ratio of grid spacings between the base (0) and current level (l). The threshold values χmin  = 0.2 and χmax  = 0.37 are chosen in such a way that refinement becomes increasingly harder for higher levels. We perform test cases using either five levels of refinement with a consecutive jump ratio of 2, or three levels with a jump ratio of 2:4:4 reaching, in both cases, an equivalent resolution of 2048 × 1024 mesh points. Boundaries are periodic in the x-direction, whereas perfectly conducting boundary walls are set at y = ±Ly/2. We follow the computations until t = 100 using PPM reconstruction with a Roe Riemann solver and a Courant number Ca = 0.8. In Figure 12, we display the temporal evolution of the current density for a case where the uniform resistivity is set to η = 8 × 10−3. A reconnection layer is created in the center of the domain, which predisposes resistive reconnection (Biskamp 1986). In agreement with Reynolds et al. (2006) the maximum value of the current density decreases with time (Figure 4 of that study). As seen in the first two panels (t = 0, 50), the refinement criterion is adequate to capture correctly both the boundary layer and the borders of the magnetic island structure. In the rightmost panel (t = 100), we also draw sample magnetic field lines to better visualize the reconnection region.

Figure 12.

Figure 12. Upper row: temporal evolution of the current density and magnetic field lines for the resistive reconnection problem, with η = 8 × 10−3. Snapshots refer to t = 0, 50, 100. Lower row: pressure profiles for various values of resistivity η, along with the AMR level structure at t = 50. The refinement strategy consists of three levels with jump ratios of 2:4:4 (equivalent resolution of 2048 × 1024 mesh points).

Standard image High-resolution image

In order to compare our numerical results with theory, we repeated the computation, varying the value of the magnetic resistivity η. For small values of resistivity (large Lundquist numbers S), the boundary layer is elongated and presents large aspect ratios of AL/δ. Biskamp (1986) reports that for A beyond the critical value of Acrit ≃ 100 the boundary layer is tearing unstable, limiting the resistivity range in which the Sweet–Parker reconnection model operates. Since in the Sun's corona S can reach values of ∼1014Smax , secondary island formation must be taken into account (Cassak & Drake 2009). In this context, ensuring that we respect Biskamp's stability criterion, we calculate the temporal average of δ/L, analogous to the reconnection rate ${\cal E}$, for various η and reproduce the Sweet–Parker scaling (Figure 13). The boundary layer's half -width (δ) and half-length (L) are estimated from the e-folding distance of the peak of the electric current, while the AMR scheme allows us to economically resolve the layer's thickness with enough grid points.

Figure 13.

Figure 13. Time average of δ/L, analogous to the magnetic reconnection rate ${\cal E}$, as a function of resistivity. Symbols represent the actual data, whereas overplotted (dashed line) is the Sweet–Parker scaling ${\sim}\sqrt{\eta }$, along with a best fit (solid line). The numerical results are in agreement with the theoretical scaling.

Standard image High-resolution image

Parallel performance for this problem is shown in Figure 14, where we plot the speed-up $S=T_1/T_{N_{\rm CPU}}$ as a function of the number of processors NCPU for the three- and five-level AMR computations as well as for fixed uniform grid runs carried out at the equivalent resolution of 2048 × 1024 zones. Here, T1 is the same reference constant for all calculations and is equal to the (inferred) running time of the single processor static mesh computation while $T_{N_{\rm CPU}}$ is the execution time measured with NCPU processors. The scaling reveals an efficiency (defined as S/NCPU) larger than 0.8 for less than 256 processors with the three- and five-level computations being, respectively, eight to nine and four to five times faster than the fixed grid approach. The number of blocks on the finest level is maximum at the end of integration and is slightly larger for the three-level run (1058 versus 835). This result indicates that using fewer levels of refinement with larger grid ratios can be more efficient than introducing more levels with consecutive jumps of 2, most likely because of the reduced integration cost due to the missing intermediate levels and the decreased overhead associated with coarse-fine level communication and grid generation process. Efficiency quickly drops when the number of CPU tends to become, within a factor of between two and three, comparable to the number of blocks.

Figure 14.

Figure 14. Parallel speed-up at t = 50 as a function of the number of processors (NCPU) for the resistive reconnection problem. The different lines refer to the execution times obtained with five levels of refinement with consecutive jumps of 2 (red squares), three levels with jump ratios of 2:4:4 (green crosses), and a fixed uniform grid with 2048 × 1024 zones (black plus signs). The dotted line gives the ideal scaling whereas the number of blocks on the finest level at the end of integration is reported above each curve.

Standard image High-resolution image

5.4. Current Sheet

The current sheet problem proposed by Gardiner & Stone (2005) and later considered by Fromang et al. (2006) in the AMR context is particularly sensitive to numerical diffusion. The test problem follows the evolution of two current sheets, initialized through a discontinuous magnetic field configuration. Driven solely by numerical resistivity, reconnection processes take place, making the resulting solution highly susceptible to grid resolution.

The initial condition is discretized onto a Cartesian 2D grid x, y ∈ [0, 2], with 64 × 64 zones at the coarse level. The fluid has uniform density ρ = 1 and thermal pressure P = 0.1. Its bulk flow velocity v is set to zero, allowing only for a small perturbation in vx = v0 sin (π y), where v0 = 0.1. The initial magnetic field has only one non-vanishing component in the vertical direction,

Equation (61)

where B0 = 1, resulting in a magnetically dominated configuration. Boundaries are periodic and the integration terminates at t = 4. We activate refinement whenever the maximum between the two error norms (given by Equation (50)) computed with the specific internal energy and the y-component of the magnetic field exceeds the threshold value χr = 0.2. In order to filter out noise between magnetic island we set epsilon = 0.05. We allow for four levels of refinement and carry out integration with the Roe Riemann solver, the improved WENO reconstruction, and a CFL number of 0.6.

In Figure 15, we show temporal snapshots of pressure profiles for t = 0.5, 1.0, 1.5, 2, 3.5, and 4.0, along with sample magnetic field lines. Since no resistivity has been specified, the elongated current sheets are prone to tearing instability as numerical resistivity is small with respect to Biskamp's criterion (Biskamp 1986). Secondary islands, "plasmoids," promptly form and propagate parallel to the field in the y-direction. As reconnection occurs, the field is dissipated and its magnetic energy is transformed into thermal energy, driving Alfvén and compressional waves which further seed reconnection (Gardiner & Stone 2005; Lee & Deane 2009). Due to the dependency of numerical resistivity on the field topology, reconnection events are most probable at the nodal points of vx. At the later stages of evolution, the plasmoids eventually merge in proximity of the anti-nodes of the transverse speed, forming four larger islands, in agreement with the results presented in Gardiner & Stone (2005). A close-up on the bottom left island is shown in Figure 16, at the end of integration. The refinement criterion on the second derivative of thermal pressure, as suggested by Fromang et al. (2006), efficiently captures the island features of the solution.

Figure 15.

Figure 15. Time evolution of the pressure profiles along with sample magnetic field lines, for the current sheet problem. Temporal snapshots refer to t = 0.5, 1, 1.5, 2 (upper four) and t = 2.5, 3, 3.5, 4 (lower four).

Standard image High-resolution image
Figure 16.

Figure 16. Close-up of the bottom left island at t = 4 for the current sheet problem. Pressure contours along with the refinement levels and grid are shown.

Standard image High-resolution image

5.5. Three-dimensional Rayleigh–Taylor Instability

In this example, we consider the dynamical evolution of two fluids of different densities initially in hydrostatic equilibrium. If the lighter fluid is supporting the heavier fluid against gravity, the configuration is known to be subject to the Rayleigh–Taylor instability. Our computational domain is the box spanned by x, z ∈ [ − 1/2, 1/2], y ∈ [ − 3/2, 1/2] with gravity pointing in the negative y-direction, i.e., g = (0, −1, 0). The two fluids are separated by an interface initially lying in the xz-plane at y = 0, with the heavy fluid ρ = ρh at y > 0 and ρ = ρl at y < 0. In the current example we employ ρh = 4, ρl = 1 and specify the pressure from the hydrostatic equilibrium condition:

Equation (62)

so that the sound crossing time in the light fluid is 0.1. The seed for instability is set by perturbing the velocity field at the center of the interface:

Equation (63)

where $r=\sqrt{x^2+z^2}$. We assume a constant magnetic field B = (Bx, 0, 0) parallel to the interface and oriented in the x-direction with different field strengths, Bx = 0 (hydro limit), Bx = 0.2Bc (moderate field), and Bx = 0.6Bc (strong field). Here, $B_c = \sqrt{(\rho _h - \rho _l)gL}$ is the critical field value above which instabilities are suppressed (Stone & Gardiner 2007). We use the PPM method with the Roe Riemann solver and a Courant number Ca = 0.45. The base grid has 16 × 32 × 16 cells and we perform two sets of computations using (1) four refinement levels with a grid spacing ratio of 2 and (2) two refinement levels with a grid jump of 4, in both cases achieving the same effective resolution (256 × 512 × 256). Refinement is triggered using the second derivative error norm of density and a threshold value χref = 0.5. Periodic boundary conditions are imposed at the x- and z-boundaries while fixed boundaries are set at y = −3/2 and y = 1/2.

Results for the unmagnetized, weakly, and strongly magnetized cases are shown at t = 3 in Figure 17. In all cases, we observe the development of a central mushroom-shaped finger. Secondary instabilities due to Kelvin–Helmholtz modes develop on the side and small-scale structures are gradually suppressed in the direction of the field as the strength is increased. Indeed, as pointed out by Stone & Gardiner (2007), the presence of a uniform magnetic field has the effects of reducing the growth rate of modes parallel to it, although the interface still remains Rayleigh–Taylor unstable in the perpendicular direction due to interchange modes. As a net effect, the evolution becomes increasingly anisotropic as the field strengthens.

Figure 17.

Figure 17. Three-dimensional view of the Rayleigh–Taylor instability problem showing density at t = 3 for the unmagnetized (left panel), weakly magnetized (middle panel), and strongly magnetized case (right panel) using four levels of refinement. In each panel, we also show a sliced box emphasizing the grid refinement ratios.

Standard image High-resolution image

Parallel performance is plotted, for the moderate field case, in Figure 18 where we measure the speed-up factors of the four- and two-level computations versus the number of CPUs. Here, the speed-up is defined by $S=T_1/T_{N_{\rm CPU}}$, where T1 is the inferred running time relative to the four-level computation on a single processor. The two-level case shows improved performance over the four-level calculation both in terms of CPU cost as well as parallel efficiency S/NCPU. Indeed the relative gain between the two cases approaches a factor of two for an increasing number of CPUs. Likewise, the efficiency of the fewer level case remains above ≳ 0.8 up to 512 processors and drops to ∼0.61 (versus ∼0.44 for the four-level case) at the largest number of employed cores (1024), which is less than the number of blocks on the finest grid.

Figure 18.

Figure 18. Parallel speed-up vs. number of processors NCPU for the 3D Rayleigh–Taylor problem computed with two (green crosses) and four (red squares) refinement levels between t = 2 and t = 2.25. The dotted line gives the ideal scaling. The number of blocks on the finest level at t = 2 is printed above and below the corresponding curves.

Standard image High-resolution image

5.6. Two-dimensional Shock–Cloud Interaction

The shock–cloud interaction problem has been extensively studied and used as a standard benchmark for the validation of MHD schemes and intercode comparisons (see Dai & Woodward 1994; Balsara 2001a; Lee & Deane 2009, and references therein). In an astrophysical context, it addresses the fundamental issue of the complex morphology of supernova remnants as well as their interaction with the interstellar medium. Energy, mass, and momentum exchange leading to cloud crushing strongly depends on the orientation of the magnetic field and the resulting anisotropy of thermal conduction.

Following Orlando et al. (2008), we consider the 2D Cartesian domain x ∈ [ − 4, 4], y ∈ [ − 1.4 × 6.6] (in parsecs) with the shock front propagating in the positive y-direction and initially located at y = −1. Ahead of the shock, for y > −1, the hydrogen number density n1 has a radial distribution of the form:

Equation (64)

where nc = 1 cm−3 is the hydrogen number density at the cloud's center, na = 0.1nc is the ambient number density, rcl = 1 pc is the cloud's radius (σ = 10), and r is the radial distance from the center of the cloud. The ambient medium has a uniform temperature Ta = 104 K in pressure equilibrium with the cloud, with a thermal pressure of p1 = 2kBnaTa where kB is the Boltzmann constant (we assume a fully ionized gas). Downstream of the shock, density, and transverse components of the magnetic field are compressed by a factor of n2/n1 = (Γ + 1)/(Γ − 1) while pressure and normal velocity are given by

Equation (65)

where X = 1/1.26 is the hydrogen mass fraction and Ts = 4.7 × 106 K is the post-shock temperature. The normal component of the magnetic field (By) remains continuous through the shock front.

We perform two sets of simulations with a magnetic field strength of |B|  =  1.31 μG, initially parallel (case Bx4) or perpendicular (case By4) to the shock front. Adopting the same notations as Orlando et al. (2008), we solve in each case the MHD equations with (TN) and without (NN) thermal conduction effects for a total of four cases. Thermal conductivity coefficients along and across the magnetic field lines (see Equation (6)) are given, in cgs units, by

Equation (66)

The resolution of the base grid is set to 322 points and five levels of refinement are employed, yielding an equivalent resolution of 1024 × 1024. Upwind characteristic tracing (Section 3.2) together with PPM reconstruction (Equation (33)) and the HLLD Riemann solver are chosen to advance the equations in time. Open boundary conditions are applied on all sides, except at the lower y-boundary where we keep constant inflow values. The CFL number is Ca = 0.8. Refinement is triggered upon density with a threshold of χref = 0.15.

In Figures 19 and 20, we show the cloud evolution for the four different cases at three different times t = 1, 2, 3 (in units of the cloud crushing time τcc = 5.4 × 103 yr). Our results are in excellent agreement with those of Orlando et al. (2008), confirming the efficiency of thermal conduction in suppressing the development of hydrodynamic instabilities at the cloud borders. The topology of the magnetic field can be quite effective in reducing the efficiency of thermal conduction. For a field parallel to the shock front (TN-Bx4), the cloud's expansion and evaporation are strongly limited by the confining effect of the enveloping magnetic field. In the case of a perpendicular field (TN-By4), on the contrary, thermal exchange between the cloud and its surroundings becomes more efficient in the upwind direction of the cloud and promotes the gradual heating of the core and the consequent evaporation in a few dynamical timescales. In this case, heat conduction is strongly suppressed laterally by the presence of a predominantly vertical magnetic field.

Figure 19.

Figure 19. Top panel: density maps (gr cm−3 in log scale) for the shock–cloud interaction at t = 1, 2, 3 for a magnetic field initially parallel to the shock interface (Bx4). Here, the time unit is defined as the cloud crushing time and is equal to 5400 yr. Bottom panel: magnetic field strength (in units of 10−6 G) with the distribution of patches at levels three and four superimposed. The left and right half of each panel shows the results computed with the PPM method without (NN) and with (TN) thermal conduction, respectively. The resolution of the base grid is 322 and five levels of refinement are used.

Standard image High-resolution image
Figure 20.

Figure 20. Same as Figure 19 but for a field initially pointing in the y-direction (that is, perpendicular to the shock front).

Standard image High-resolution image

5.7. Radiative Shocks in Stellar Jets

Radiative jet models with a variable ejection velocity are commonly adopted to reproduce the knotty structure observed in collimated outflows from young stellar objects. The time variability leads to the formation of a chain of perturbations that eventually steepen into pairs of forward/reverse shocks (the "internal working surfaces"; see, for instance, de Colle & Raga 2006; Raga et al. 2007; Teşileanu et al. 2009) which are held responsible for the typical spectral signature of these objects. While these internal working surfaces travel down the jet, the emission from post-shocked regions occurs on a much smaller spatial and temporal scale, thus posing a considerable challenge even for AMR codes.

As an example application, we solve the MHD equations coupled to the chemical network described in Teşileanu et al. (2008), evolving the time-dependent ionization and collisionally excited radiative losses of the most important atomic/ionic species: H, He, C, N, O, Ne, and S. While hydrogen and helium can be at most singly ionized, we only consider the first three (instead of five) ionization stages of the other elements, which suffice for the range of temperatures and densities considered here. This amounts to a total of 19 additional non-homogeneous continuity/rate equations, such as Equation (3).

The initial condition consists of an axisymmetric supersonic collimated beam in cylindrical coordinates (r, z) in equilibrium with a stationary ambient medium. Density and axial velocity can be freely prescribed as

Equation (67)

where ρj and ρa = ρj/5 are the jet and ambient mass density, vj = 200 km s−1 is the jet velocity, and rj = 2 × 1015 cm is the radius. The jet density is given by ρj = njμjma, where nj = 103 is the total particle number density, μj is the mean molecular weight, and ma is the atomic mass unit. Both the initial jet cross section and the environment are neutral with the exception of C and S, which are singly ionized. The steady state results from a radial balance between the Lorentz and pressure forces and has to satisfy the time-independent momentum equation:

Equation (68)

where, for simplicity, we neglect rotations and assume a purely azimuthal magnetic field of the form

Equation (69)

Here, a = 0.9rj is the magnetization radius and Bm is a constant that depends on the jet and ambient temperatures. Direct integration of Equation (68) yields the equilibrium profile

Equation (70)

where pj = ρjkBTj/(μjma) is the jet pressure on the axis, μj is the mean molecular weight, ma is the atomic mass unit, kB is the Boltzmann constant, and Tj is the jet temperature. The value of Bm is recovered by solving Equation (70) in the r limit given the jet and ambient temperatures Tj = 5 × 103 K and Ta = 103 K, respectively. Our choice of parameters is similar to the one adopted by Raga et al. (2007).

The computational domain is defined by r/rj ∈ [0, 12.5], z/rj ∈ [0, 25] with axisymmetric boundary conditions holding at r = 0. At z = 0 we keep the flow variables constant and equal to the equilibrium solution and add a sinusoidal time variability of the jet velocity with a period of 20 yr and an amplitude of 40 km s−1 around the mean value. Free outflow is assumed on the remaining sides. We integrate the equations using linear reconstruction with the MC limiter, Equation (34), and the HLLC Riemann solver. The time step is computed from Equations (23) and (24) using a Courant number Ca = 0.6, a relative tolerance epsilonc = 0.02 and following the considerations given in Section 4.2. Shock-adaptive hybrid integration is used by locally switching to the more diffusive MinMod limiter (Equation (35)) and the HLL Riemann solver, according to the mechanism outlined in Appendix B.

The base grid consists of 128 × 256 zones, and five additional levels with grid refinement jumps of 2:2:2:4:4 are used. At the effective resolution of 16,384 × 32,768 zones the minimum length scale that can be resolved corresponds to 1.526 × 1012 cm (≈0.1 AU), the same as model M3 of Raga et al. (2007). Zones are tagged for refinement when the second derivative error norm of density exceeds the threshold value χref = 0.15. In order to enhance the resolution of strongly emitting shocked regions, we prevent levels higher than two from being created if the temperature does not exceed 5 × 103 × ℓ, where ℓ is the level number.

The results are shown, after ≈63.4 yr, in Figure 21 where the steepening of the perturbations leads to the formation of forward/reverse shock pairs. Radiative losses become strongly enhanced behind the shock fronts where temperature attains larger values and the compression is large. This is best illustrated in the close-up views of Figure 21 where we display density, temperature, hydrogen fraction, and magnetization for the second (upper panel) and third shocks (lower panel), respectively, located at z ≈ 14.2 and z ≈ 7.34 (in units of the jet radius). Owing to a much shorter cooling length, tcp/Λ, a thin radiative layer forms the size of which, depending on local temperature and density values, becomes much smaller than the typical advection scale. An extremely narrow 1D cut shows, in Figure 22, the profiles of temperature, density, and ionization fractions across the central radiative shock, resolved at the largest refinement level. Immediately behind the shock wave, a flat transition region with constant density and temperature is captured on ∼6 grid points and has a very small thickness ∼0.005rj. A radiatively cooled layer follows behind where temperature drops and the gas reaches the largest ionization degree. Once the gas cools below 104 K, radiative losses become negligible and the gas is accumulated in a cold dense adiabatic layer. A proper resolution of the thin emission layers is thus crucial for correct and accurate predictions of emission lines and intensity ratios in stellar jet models (Teşileanu et al. 2011). Such a challenging computational problem can be tackled only by means of adaptive grid techniques.

Figure 21.

Figure 21. Radiative jet structure at t ≈ 63.4 yr. On the left we display a full view of the temperature distribution (right) and AMR block structure (left). The smaller panels to the right show close-up views of number density (left half, in cm−3), temperature (right half, in 104 K), neutral hydrogen (left half), and magnetization B2ϕ/(2p) (right half) for the second (top panels) and third (bottom panels) shock, respectively. The AMR block structure is overplotted in the right half of each panel.

Standard image High-resolution image
Figure 22.

Figure 22. One-dimensional enlarged cuts at r ≈ 0.1133rj across the middle shock in the radiative jet model at t = 63.4 yr. Temperature density distributions are plotted in the top panel while the first ionization stage of O, H, N, and neutral sulphur are plotted in the bottom panel.

Standard image High-resolution image

6. RELATIVISTIC MHD TESTS

In this section, we apply PLUTO-CHOMBO to test problems involving relativistic magnetized flows in one, two, and three dimensions. Both standard numerical benchmarks and applications will be considered. By default, the conservative MUSCL-Hancock predictor scheme (Equation (43)) together with linear reconstruction on primitive variables are used during the computation of the normal predictors.

6.1. One-dimensional Shock Tube

Our first test consists of an initial discontinuity located at x = 0.5 separating two regions of fluids characterized by

Equation (71)

(see Balsara 2001b; Mignone & Bodo 2006; van der Holst et al. 2008, and references therein). The fluid is initially at rest with uniform density ρ = 1 and the longitudinal magnetic field is Bx = 10.

We solve the equations of relativistic MHD with the ideal gas law (Γ = 5/3) using the five-wave HLLD Riemann solver of Mignone et al. (2009) and Ca = 0.6. The computational domain [0, 1] is discretized using five levels of refinement with consecutive grid jump ratios of 4:2:2:2:2 starting from a base grid (level zero) of 400 grid zones (yielding an effective resolution of 25, 600 zones). Refinement is triggered upon the variable σ = (B2y + Bz2)/(ργ) using Equation (50) with a threshold χr = 0.1. At t = 0.4 the resulting wave pattern (Figure 23) is comprised of two left-going rarefaction fans (fast and slow) and two right-going slow and fast shocks. The presence of magnetic fields makes the problem particularly challenging since the contact wave, slow, and fast shocks propagate very close to each other, resulting in a thin relativistic blast shell between x ≈ 0.88 and x ≈ 0.9.

Figure 23.

Figure 23. Density (top left), longitudinal velocity (top right), the y-components of magnetic field, and velocity (bottom left and right) for the 1D relativistic magnetized shock tube problem at t = 0.4. We employ a base grid of 400 cells with five levels of refinement with consecutive jump ratios of 4:2:2:2:2, yielding an equivalent resolution of 25, 600 zones. The grid hierarchy is shown in the top left panel (dashed red line) while magnifications of the thin shell are plotted, for each quantity, using symbols in the interior plot windows.

Standard image High-resolution image

In Table 3, we compare, for different resolutions, the CPU timing obtained with the static grid version of the code versus the AMR implementation at the same effective resolution, starting from a base grid of 400 zones. In the unigrid computations, halving the mesh size implies approximately a factor of four in the total running time whereas it implies only a factor of two in the AMR approach. At the largest resolution employed here, the overall gain is approximately 50. This example confirms that the resolution of complex wave patterns in RMHD can largely benefit from the use of adaptively refined grids.

Table 3. CPU Performance for the 1D RMHD Shock Tube

Static Run AMR Run Speed-up
Nx Time Level Ref Ratio Time  
  (s)     (s)  
1600 6.1 1 4 1.8 3.4
3200 29.9 2 2 3.8 7.9
6400 124.5 3 2 8.2 15.2
12800 502.3 4 2 18.1 27.8
25600 2076.1 5 2 41.2 50.4

Notes. The first and second columns give the number of points Nx and corresponding CPU for the static grid run (no AMR). The third, fourth, and fifth columns give, respectively, the number of levels, the refinement ratio, and CPU time for the AMR run at the equivalent resolution. The last column shows the corresponding speed-up factor.

Download table as:  ASCIITypeset image

6.2. Inclined Generic Alfvén Test

The generic Alfvén test (Giacomazzo & Rezzolla 2006; Mignone et al. 2009) consists of the following non-planar initial discontinuity:

Equation (72)

where, as in Section 5.1.1, V = (ρ, v1, v2, v3, B1, B2, B3, p) is given in the frame of reference aligned with the direction of motion x1. The ideal EoS (Equation (10)) with Γ = 5/3 is adopted.

Here, we consider a 2D version by rotating the discontinuity front by π/4 with respect to the mesh and following the evolution until t = 0.4cos π/4. The test is run on a coarse grid of 64 × 4 zones covering the domain x ∈ [0, 1], y ∈ [ − 1/32, 1/32] with six additional levels of refinement resulting in an effective resolution of 4096 × 256 zones (a factor of two in resolution is used between levels). In order to trigger refinement across jumps of a different nature, we define the quantity σ  =  B2/(ργ) together with Equation (50) and a threshold value χr = 0.03. The Courant number is Ca = 0.6 and the HLLD Riemann solver is used throughout the computation. Boundary conditions assume zero gradients at the x-boundaries while translational invariance is imposed at the top and bottom boundaries where, for any flow quantity q, we set q(i, j) = q(i ± 1, j∓1).

The breaking of the discontinuity, shown in Figure 24, leads to the formation of seven waves including a left-going fast rarefaction, a left-going Alfvén discontinuity, a left-going slow shock, a tangential discontinuity, a right-going slow shock, a right-going Alfvén discontinuity, and a right-going fast shock. Our results indicate that refined regions are created across discontinuous fronts which are correctly followed and resolved, in excellent agreement with the reference solution (obtained on a fine 1D grid). Note also that the longitudinal component of the magnetic field, B1, does not present spurious jumps (Figure 24) and shows very small departures from the expected constant value. In the central region, for 0.4 ≲ x ≲ 0.6, rotational discontinuities and slow shocks are moving slowly and very adjacent to each other, thus demanding relatively high resolution to be correctly captured. With the given prescription, grid adaptation efficiently provides adequate resolution where needed. This is best shown in the close-up of the central region, Figure 25, showing σ together with the AMR block structure.

Figure 24.

Figure 24. Horizontal cuts for the rotated inclined Alfvén test at $t=0.4/\sqrt{2}$ (symbols) and for the 1D reference solution at t = 0.4 (solid line). The top row shows, from left to right, proper density, gas pressure, and Lorentz factor. In the middle and bottom rows, we plot the components of velocity and magnetic field normal (v1 and B1) and transverse (v2, v3 and B2, B3) to the surface of discontinuity.

Standard image High-resolution image
Figure 25.

Figure 25. Close-up of the central region in the inclined Alfvén test at $t=0.4/\sqrt{2}$ showing σ = B2/(ργ) with the overplotted block distribution. The base grid has 64 × 4 zones and five levels of refinement are used.

Standard image High-resolution image

A comparison of the performance between static and adaptive grid computations is reported in Table 4 using different resolutions and mesh refinements. At the resolution employed here, the gain is approximately a factor of eight.

Table 4. CPU Performance for the 2D Inclined Generic Alfvén Test

Static Run AMR Run Speed-up
Nx Time Level Ref Ratio No. of Blocks Time  
  (s)       (s)  
128 1.8 1 2 4 1.1 1.6
256 10.8 2 2 14 6.1 1.8
512 75.2 3 2 44 33.0 2.3
1024 557.8 4 2 126 185.9 3.0
2048 4390.5 5 2 306 900.0 4.9
4096 35250.0 6 2 761 4346.9 8.1

Note. The base grid for the AMR computation is 64 × 4 zones.

Download table as:  ASCIITypeset image

6.3. Relativistic Rotor Problem

The 2D rotor problem (Del Zanna et al. 2003; van der Holst et al. 2008; Dumbser et al. 2008) consists of a rapidly spinning disk embedded in a uniform background medium (ρ = p = 1) threaded by a constant magnetic field B = (1, 0, 0). Inside the disk, centered at the origin with radius R = 0.1, the density is ρ = 10 and the velocity is prescribed as v = ω(− y, x, 0), where ω = 9.95 is the angular frequency of rotation. The computational domain is the square x, y ∈ [ − 1/2, 1/2] with outflow (i.e., zero gradient) boundary conditions. The ideal EoS with Γ = 5/3 is used. Computations are performed on a base grid with 642 grid points and six levels of refinement using the HLL Riemann solver and a CFL number Ca = 0.5. Zones are tagged for refinement whenever the second derivative error norm of ${\cal E}/(\rho \gamma)$, computed with Equation (50), exceeds χr = 0.15. The effective resolution amounts therefore to 40962 zones, the largest employed so far (to the extent of our knowledge) for this particular problem.

Results are shown at t = 0.4 in Figure 26 where one can see an emerging flow structure enclosed by a circular fast forward shock (r  ≈  0.425) traveling into the surrounding medium. An inward fast shock bounds the innermost oval region where density has been depleted to lower values. The presence of the magnetic field slows down the rotor, and the maximum Lorentz factor decreases from 10 to ≈2.2. The numerical solution preserves the initial point symmetry and density corrugations, present in lower resolution runs, seem drastically reduced at this resolution, in accordance with the findings of van der Holst et al. (2008). Divergence errors are mostly generated in proximity of the outer fast shock and are damped while being transported out of the domain at the speed of light in the GLM formulation. We monitor the growth of such errors by plotting the volume average of |∇ · B| as a function of time, showing (bottom panel in Figure 26) that the growth of monopole errors is limited to the same values of van der Holst et al. (2008; the factor of four comes from the fact that our computational domain is two times smaller).

Figure 26.

Figure 26. Relativistic rotor problem at t = 0.4 using six levels of refinement on a base grid with 642 zones. From left to right, top to bottom: density, gas pressure, magnetic field density, Lorentz factor (magnetic field lines are overplotted), block distribution, and domain average of |∇ · B|.

Standard image High-resolution image

Parallel performance for this particular test is shown in Figure 27 plotting the speed-up, defined as $S=8T^{\rm u}_{8}/T_{N_{\rm CPU}}$, where Tu8 is the execution time of the uniform grid run performed at the same effective resolution (40962) on eight processors while $T_{N_{\rm CPU}}$ is the running time measured with NCPU processors. AMR scaling has been quantified for computations using maximum patch sizes of 16 and 32 grid points resulting, respectively, in 11, 921 and 6735 total number of blocks at the end of integration. Approximately half of it belongs to the finest level, as reported in Figure 27. In general, the AMR approach offers a 5–10 speed-up gain in terms of execution time over the uniform, static grid approach. For NCPU < 256 the parallel efficiency, measured as S/NCPU, is larger than 0.7 while it tends to be reduced for more processors. Computations carried with fewer blocks (i.e., larger block sizes) tend to be more efficient when fewer CPUs are in use since inter-processor communications are reduced. However, this cost obviously becomes larger at 512 (or more) processors resulting in a loss of efficiency.

Figure 27.

Figure 27. Parallel scalings for the 2D relativistic rotor from 8 to 512 CPUs. The red and green lines (squares and crosses, respectively) give the speed-up factors corresponding to computations with maximum block sizes of 16 and 32 zones, respectively. The number of blocks on the finest level (ℓ = 6) at the end of integration is reported above and below the corresponding curve. The dotted black line gives the perfect scaling, while the solid black line corresponds to computations carried out with the static grid version of the code at the same effective resolution (40962 zones).

Standard image High-resolution image

6.4. Cylindrical Blast Wave

Strong symmetric explosions in highly magnetized environments can become rather arduous benchmarks probing the code's ability to evolve strongly magnetized shocks (see, for instance, Komissarov 1999; Leismann et al. 2005; Mignone & Bodo 2006; Del Zanna et al. 2003; Beckwith & Stone 2011). Failures may lead to unphysical densities or pressures whenever the scheme does not introduce adequate dissipation across oblique discontinuities and/or if the divergence-free condition is not properly controlled.

The 2D setup considered here consists of the Cartesian square [ − 6, 6] × [ − 6, 6] initially filled with constant density and pressure values ρ = 10−4 and p = 5 × 10−3 and threaded by a constant horizontal magnetic field with strength B0 = 1. A cylinder with radius r = 0.8 and centered at the origin delimits a higher density and pressure region where ρ = 10−2, p = 1. The ideal EoS with Γ = 4/3 is used. Our choice of parameters results in a low β plasma (2p/B2 = 10−2) and corresponds to the strongly magnetized cylindrical explosion discussed by Beckwith & Stone (2011). We point out that this configuration differs from the one discussed in Komissarov (1999) and Mignone & Bodo (2006) by having the ambient pressure be 10 times larger. This allows to run the computation without having to introduce any specific change or modification in the algorithm, such as shock flattening or redefinition of the total energy. We adopt a base grid of 48 zones in each direction with outflow boundary conditions holding on all sides. Integration proceeds until t = 4 using the HLLC Riemann solver (Mignone & Bodo 2006) using five levels of refinement, reaching an effective resolution of 15362 zones. Total energy triggers refinement with a threshold of χref = 0.025.

The overpressurized region, Figure 28, sets an anisotropic blast wave delimited by a weak fast forward shock propagating almost radially. The explosion is strongly confined along the x-direction by the magnetic field where plasma is accelerated to γmax  ≈ 1.76. The inner structure is delimited by an elongated structure enclosed by a slow shock adjacent to a contact discontinuity. The two fronts blend together as the propagation becomes perpendicular to the field line. Since the problem is purely 2D, rotational discontinuties are absent. The block distribution, shown in the lower panel of Figure 28, shows that refinement clusters around the outer discontinuous wave as well as the multiple fronts delimiting the extended inner region. The total number of blocks is 2258 with the finest level giving a relative contribution of ∼0.55 and a corresponding volume filling factor of ∼0.12. The numerical solution retains the expected degree of symmetry and the agreement with earlier results demonstrate that the code can robustly handle strongly magnetized relativistic environments within the GLM-MHD formalism. Results obtained with four processors show that calculation done with AMR is faster than the static grid runs by a factor of ∼4.5.

Figure 28.

Figure 28. Cylindrical relativistic blast wave at t = 4. The base level grid has 482 zones and five levels of refinement are used. On the top panels: logarithmic scale maps of density (left), pressure (middle) and magnetic field (right). On the bottom panels: Energy density (left), Lorentz factor (middle, magnetic field lines are overplotted) and block structure showing levels 3 to 5 (right).

Standard image High-resolution image

6.5. Spherical Blast Wave

In the next example, we consider a 3D extension of the cylindrical blast wave problem presented in Del Zanna et al. (2007). The initial condition consists of a sphere with radius r = 0.8 centered at the origin filled with hot gas having ρ = 10−2, p = 1 (the ideal EoS with Γ = 4/3 is used). Outside this region, density and pressure decrease linearly reaching the constant ambient values ρ = 10−4, p = 5 × 10−3 for r ⩾ 1. The plasma is at rest everywhere and a constant magnetic field is set oblique to the mesh, i.e., ${\bf B}=B_0(\hat{{\bf e}}_x + \hat{{\bf e}}_y)/\sqrt{2}$ with B0 = 0.1. The computational domain is the Cartesian box [ − 6, 6]3 covered by a base grid of 40 zones in each direction with outflow boundary conditions holding on all sides. Using the HLLD Riemann solver, we follow integration until t = 4 using four levels of refinement (effective resolution 6403) and a CFL number Ca = 0.4. Zones are tagged for refinement upon density fluctuations with a threshold value of χref = 0.15.

Results shown in Figure 29 reveal an oval-shaped explosion enclosed by an outer fast shock propagating almost radially. A strong reverse shock confines a prolate spheroidal region where the magnetic field has been drained and inside which expansion takes place radially. The largest Lorentz factor ∼6.3 is attained in the direction of magnetic field lines close to the ellipsoid poles.

Figure 29.

Figure 29. Density, Lorentz factor, gas, and magnetic pressures slice cuts for the relativistic magnetized blast wave in three dimensions at t = 4. Four levels of refinement are used to achieve an effective resolution of 6403. The box in the lower half-semispace emphasizes jump ratios across levels. Oblique magnetic field lines are overplotted.

Standard image High-resolution image

In order to measure parallel performance on a fixed number of blocks, we have integrated the solution array starting from t = 3.5 for a fixed number of steps by enforcing zero interface flux. Results are shown in Figure 30 where we compare two sets of "frozen-flux" computations with maximum block sizes of 20 and 40 mesh points corresponding, respectively, to 27,661 (22,598 on the finest level) and 11,229 (9462 on the finest level) total number of blocks. In the former case, the larger number of patches allows us to reach a better efficiency (more than 0.75) whereas the latter case performs worse for increasing number of processors. Even if the finest level has a number of blocks still larger than the maximum number of CPUs employed, many boxes are much smaller than the maximum block size allowed. The ideal workload per processor (i.e., the number of cells of the finest level divided by the number of processors) is comparable to the maximum block size in the 1024 CPUs run and becomes smaller in the 2048 CPUs run. In this latter case, the workload of the processors integrating the larger blocks is therefore larger than the ideal one and most of the CPUs must wait for these processors to complete the integration. This could explain the poor parallel performance of this test problem.

Figure 30.

Figure 30. Parallel scalings for the 3D relativistic blast wave problem from 32 to 2048 processors. The red and green lines (squares and crosses, respectively) give the speed-up factors corresponding to "frozen-flux" computations with maximum block sizes of 20 and 40 zones, respectively. The number of blocks on the finest level, reported above and below each line, stays constant in time. Ideal scaling is given by the dotted black line.

Standard image High-resolution image

6.6. Kelvin–Helmholtz Flow

In the next example (Bucciantini & Del Zanna 2006; Mignone et al. 2009), we consider a 2D planar domain with x ∈ [0, 1], y ∈ [ − 1, 1] initially filled with a (relativistically) hot gas with constant density ρ = 1 and pressure p = 20. An initially perturbed shear velocity profile of the form

Equation (73)

is set across the domain, where V0 = 1/4 is the nominal flow velocity, epsilon = V0/100 is the amplitude of the perturbation while α = 0.01, β = 0.1. The TM EoS, Equation (11), is used during the evolution to recover the gas enthalpy from density and pressure. The magnetic field is initially uniform and prescribed in terms of the components parallel and perpendicular to the plane of integration:

Equation (74)

where σpol = 0.01, σtor = 1. We perform the integration on a base grid of 32 × 64 cells with six additional levels of refinement, reaching an effective resolution of 2048 × 4096 zones. The Courant number is set to Ca = 0.8 and refinement is triggered whenever Equation (50) computed with the total energy density exceeds χr = 0.14. Open boundary conditions hold at the lower and upper y-boundaries while periodicity is imposed in the x-direction.

Figure 31 shows density and magnetic field distributions at t = 5, which approximately marks the transition from the linear phase to the nonlinear evolution (see the discussion in Mignone et al. 2009). Both density and magnetic field are organized into filaments that wrap around, forming a number of vortices arranged symmetrically with respect to the central point. Refined levels concentrate mainly around the location of the fluid interface and accurately follow the formation of the central vortex and the more elongated adjacent ones. The computation preserves the initial point symmetry even if the grid generation algorithm does not necessarily do so. The lower resolution outside this region contributes to damp acoustic waves as they travel toward the outer boundaries and eventually reduces the amount of spurious reflections.

Figure 31.

Figure 31. Relativistic Kelvin–Helmholtz instability at t = 5 using six additional levels of refinement starting from a base grid of 32 × 64 zones. The panel on the left shows density (upper half) and the quantity $(B_x^2+B_y^2)^{\frac{1}{2}}/B_z$ (lower half) on the whole computational domain. Selected regions are enlarged in the two panels on the right.

Standard image High-resolution image

In Figure 32, we compare the parallel speed-up between a number of adaptive grid calculations using either six levels (grid jump of 2) or three levels (grid jump of 4) and the equivalent uniform grid run with 2048 × 4096 zones. Generally, the AMR approach is ≈40 faster than the fixed grid run. In addition, the three-level computation seems to perform somewhat better than the six-level run although the number of blocks on the finest levels is essentially the same at the end of computation (1085 and 1021, respectively). Parallel scaling sensibly deteriorates when the number of blocks per processor becomes less than three or four, in accordance with the results of previous tests.

Figure 32.

Figure 32. Parallel speed-up up to 512 processors for the 2D relativistic Kelvin–Helmholtz instability problem. Speed-up is computed as the ratio 8Tu8/TNCPU between the execution time of the static uniform grid run at the same effective resolution (2048 × 4096) on eight processors and the running time measured with NCPU processors. Red lines corresponds to the three-level run using max grid sizes of 16 (squares) and 32 (crosses). Green lines correspond to the six-level computations.

Standard image High-resolution image

6.7. Three-dimensional Shock–Cloud Interaction

In the next example, we consider a 3D extension of the planar relativistic shock–cloud interaction originally presented in Mignone & Bodo (2006). The initial condition consists of a high-density (ρ = 10) spherical clump (radius 0.15) centered at (0.8, 0, 0) adjacent to a shock wave located at x = 0 with downstream and upstream values given by (ρ, vx, Bz, p) = (39.5052, 0, 1.9753, 129.72386) for x < 0 and $(\rho ,v_x,B_z,p)=(1,\, -\sqrt{0.99},\, 0.5,\, 10^{-3})$ for x ⩾ 0. The remaining quantities are set to zero. The computational domain is the box x ∈ [0, 2], y, z ∈ [ − 1/2, 1/2]. At the base level we fix the resolution to 64  ×  32  ×  32 zones and employ four levels of refinement equivalent to an effective resolution of 1024  ×  512  ×  512. The refinement criterion (Equation (50)) uses the conserved density for zone tagging with a threshold χr = 0.2. The equations of relativistic MHD are solved using the TM EoS (Mignone & McKinney 2007), the HLLD Riemann solver, and linear reconstruction with the harmonic limiter (Equation (41)). Shock-adaptive hybrid integration provides additional numerical dissipation in proximity of strong shock waves by switching the integration scheme to the HLL Riemann solver and the MinMod limiter (Equation (35)), according to the strategy described in Appendix B. For efficiency purposes, we take advantage of the symmetry across the xy- and xz-planes to reduce the computation to one quadrant only.

Figure 33 shows a 3D rendering of density and magnetic pressure through a cross-sectional view of the xy- and xz-planes at t = 1. The collision generates a fast, forward bow shock propagating ahead and a backward reverse shock transmitted back into the cloud. The cloud becomes gradually wrapped by the incident shock into a mushroom-shaped shell reaching a large compression (ρmax  ≈ 121, B2/2 ≈ 157). Grid refinement concentrates mainly around the incident and forward shocks and the tangential discontinuities bordering the edge of the cloud.

Figure 33.

Figure 33. The interaction of a magnetized relativistic shock with a density cloud at t = 1. Density and magnetic pressure B2/2 are shown in the left and right panels, respectively. For each quantity, a volumetric rendering is shown in the upper half whereas an intensity color map in the middle vertical and horizontal planes is displayed below. The base grid corresponds to 64 × 322 and four levels of refinement are employed (effective resolution 1024 × 5122).

Standard image High-resolution image

6.8. Propagation of Three-dimensional Relativistic Magnetized Jet

As a final application, we discuss the 3D propagation of a relativistic magnetized jet carrying an initially purely azimuthal magnetic field. Indeed, the presence of a substantial toroidal component of the field is commonly invoked and held responsible for the acceleration and collimation of jets from active galactic nuclei. From an astrophysical point of view, relativistic jets appear to be quite stable although cylindrical MHD configurations are expected to be unstable to reflection, Kelvin–Helmholtz and current driven modes thus posing an unsolved issue, see Mignone et al. (2010), and reference therein.

Following Mignone et al. (2009), we set the box x, y ∈ [ − 12.5, 12.5], z ∈ [0, 50] as our computational domain, initially filled with constant uniform density and pressure ρa and pa. The beam is injected at the lower boundary for z ⩽ 0, $r=\sqrt{x^2+y^2} \le 1$ with a density ρj, a longitudinal velocity corresponding to a Lorentz factor γj, and an azimuthal magnetic field given by

Equation (75)

where bm is the magnetic field strength in the fluid's frame and a = 0.5 is the magnetization radius. The pressure profile is found by imposing radial momentum balance across the beam giving

Equation (76)

where pa is the ambient pressure defined in terms of the sonic Mach number M:

Equation (77)

with Γ = 5/3 although the TM EoS (Equation (11)) is used during the evolution. The actual value of bm may be found by prescribing the magnetization parameter σϕ defined as the ratio between beam-averaged magnetic energy density and thermal pressure. The final result yields (Mignone et al. 2009)

Equation (78)

For the present simulation, we adopt γj = 7, M = 3, σϕ = 1.3, ρj = 1, and ρa = 103, thus corresponding to a magnetically dominated, underdense relativistic jet.

We follow the simulation up to t = 130 (in units of the speed of light crossing of the jet radius), starting with a base grid of 32 × 32 × 64 with four levels of refinement. The refinement ratio between consecutive levels is 2 so that, at the finest resolution, we have ≈20 points per beam radius. Zones belonging to levels zero, one, and two are tagged for refinement using the normalized second derivative Equation (50) of the total energy density with a threshold χr = 0.25. Zones at the finest level grid are instead created by using B2/(γρ) in place of the total energy density. The rationale for choosing this selective rule is to provide the largest resolution on the jet material only, still being able to track the sideway expansion of the cocoon at lower resolution. We use the HLLD Riemann solver with the harmonic limiter (Equation (41)) except at strong shocks where we employ the multidimensional shock dissipation switch outlined in Appendix B. The Courant number is Ca = 0.3.

The jet structure, Figure 34, shows that the flow maintains a highly relativistic central spine running through multiple recollimation shocks where jet pinching occurs. At the jet head the beam decelerates to sub-relativistic velocities favoring the formation of a strongly magnetized termination shock where B2 ≈ 26γ2ρ. Here, the presence of a predominant toroidal magnetic field induces CD kink instabilities which are responsible for the observed jet wiggling and symmetry breaking (see Mignone et al. 2010). This test shows that PLUTO-CHOMBO can be effectively used in simulations involving relativistic velocities, highly supersonic flows, and strongly magnetized environments.

Figure 34.

Figure 34. Three-dimensional visualization of the relativistic magnetically dominated jet at t = 130 using four levels of refinement. In the top panels, we show the distribution of the Lorentz factor (left) and magnetic to kinetic energy ratio |B|2/(γ2ρ) (right). In the bottom panels, we show the thermal pressure distribution (left) and a slice cut of density together with the grid structure (right).

Standard image High-resolution image

At t = 130 the finest level grid has a volume filling factor of ≈11% with 10,761 blocks while level three occupies ≈41% of the total volume with 5311 blocks. For this particular application, the benefits offered by grid adaptivity are more evident at the beginning of the computation when most of the computational zones in the domain are unrefined. In this respect, we have found that the CPU time increases (for t ⩽ 130) with the number of steps n approximately as a + bn + cn2 + dn3, where a ≈ 1.46, b ≈ 0.079, c ≈ 5.03 × 10−4, and d ≈ 2.38 × 10−6. This suggests that, as long as the filling factor remains well below 1, the AMR calculation with the proposed refinement criterion should be at least ∼2.5 times faster than an equivalent computation using static mesh refinement and considerably larger if compared to a uniform grid run at the effective resolution.

7. SUMMARY

In this paper, we have presented a cell-centered implementation of the PLUTO code for multidimensional AMR computations targeting Newtonian and relativistic magnetized flows. A block-structured approach has been pursued by taking full advantage of the high-level parallel-distributed infrastructure available in the CHOMBO library. This choice provides the necessary level of abstraction in delivering AMR functionality to the code, allowing, at the same time, full compatibility with most of the modular implementations already available with the static grid version. This eases up the process of adding or replacing physics modules as long as they comply with the interface requirements.

A novel extension to incorporate diffusion terms, such as viscosity, resistivity, and heat conduction without the need for operator splitting, has been illustrated in the context of the dimensionally unsplit CTU time-stepping scheme. In addition, the scheme has also been extended to the realm of relativistic MHD (RMHD) using a characteristic projection-free, MUSCL-Hancock normal predictor step. The integration scheme retains second-order spatial and temporal accuracy requiring six Riemann solvers per cell per step. Interface states are calculated using the PPM integration although alternatives based on WENO, or linear slope-limited schemes are also available. The proposed cell-centered version of PLUTO-CHOMBO enforces the divergence-free condition by augmenting the system of equations with a GLM (see Dedner et al. 2002), in the implementation outlined by Mignone & Tzeferacos (2010). The choice of the GLM-MHD formalism has proven to be a convenient starting point in porting a significant fraction of the static grid code implementations to the AMR framework. Although future extensions will also consider other strategies to enforce the ∇ · B = 0 condition, the proposed formulation offers substantial ease of implementation and a viable robust alternative to a CT approach which typically requires additional care for prolongation and restriction operations at fine–coarse interfaces (see, for instance, Balsara 2001a, 2004; Cunningham et al. 2009).

A suite of several test problems including standard numerical benchmarks and astrophysical applications for MHD and RMHD has been selected to assess the efficiency of PLUTO-CHOMBO in resolving complex flow patterns viable through an adaptive grid approach in one, two, and three dimensions. Examples include simple shock tube problems, resistive sheets, radiative and thermally conducting flows, fluid instabilities, and blast wave explosions in highly magnetized environments. The computational saving offered by an adaptive grid technique has been shown, for many of the selected test, to be several times or even order of magnitudes faster than a static grid integration. Parallel performance, evaluated for some of the proposed tests, suggests good scalability properties for 2D and 3D problems as long as the number of grids per processor is larger than a factor between two and three.

Both the static and AMR version of PLUTO are distributed as a single software package publicly available at http://plutocode.ph.unito.it while the CHOMBO library can be freely downloaded from https://seesar.lbl.gov/anag/chombo/. The AMR version of PLUTO has been designed to retain salient features characterizing the static grid version (Mignone et al. 2007) such as modularity—the possibility of easily combining different numerical schemes to treat different physics-, portability-, and user-friendliness. While stable code releases along with extensive documentation and benchmarks are made available on the Web, the code is being actively developed and future development will address additional new physical aspects as well as improved numerical algorithms.

This work has been supported by the PRIN-INAF 2009 grant. We acknowledge the CINECA Awards N. HP10CJ1J54 and N. HP10BHHHEJ, 2010 under ISCRA initiative for the availability of high performance computing resources and support. Intensive parallel computations were performed on the 4.7 GHz IBM Power 6 p575 cluster running AIX 6 or the 0.85 GHz IBM BlueGene/P cluster running CNL. A.M. wishes to thank S. Orlando for helpful discussions on the inclusion of thermal conduction and for kindly making available the MHD shock cloud initial configuration.

APPENDIX A: DISCRETIZATION OF THE THERMAL CONDUCTION FLUX

The discretization of the heat conduction flux, Equation (6), reflects the mixed parabolic/hyperbolic mathematical nature of the underlying differential operators, as anticipated in Section 2.1.1. From the diffusion limit, |Fclass|/q → 0, we compute Fclass at cell interfaces using second-order accurate central difference expressions for ∇T, e.g., at constant x-faces,

Equation (A1)

and similarly at constant y- and z-faces. In the purely hyperbolic limit, |Fclass|/q, we see that ${\bf F}_c \rightarrow q \hat{{\bf t}}$ where $\hat{{\bf t}} = {\bf F}_{\rm class}/|{\bf F}_{\rm class}|$ is a unit vector in the direction of the heat flux. To gain more insights, we rewrite the 1D energy equation in this limit by keeping only pressure-related terms, that is,

Equation (A2)

where $c_{\rm iso} = \sqrt{p/\rho }$ is the isothermal speed of sound and $t_x = \hat{{\bf e}}_x\cdot \hat{{\bf t}}$. Equation (A2) is a nonlinear advection equation of the form ∂tu + ∂xf = 0, where u = p/(γ − 1) and f = −qtx is the hyperbolic saturated flux. A stable discretization is therefore provided by adopting an upwind scheme (Balsara et al. 2008) such as

Equation (A3)

In the previous equation ρi + 1/2 = (ρL + ρR)/2, pL and pR are computed from the left/right input states for the Riemann problem. Finally, we define the thermal conduction flux at constant x-faces (for instance) as the harmonic mean between the two regimes,

Equation (A4)

where qi + 1/2 is computed from Equation (A3).

APPENDIX B: MULTIDIMENSIONAL SHOCK DETECTION AND ADAPTIVE HYBRID INTEGRATION

In regions of strong shocks or gradients spurious numerical oscillations may arise and quickly lead to the occurrence of unphysical states characterized, for example, by negative pressures, energies, densities, or, in the case of relativistic flows, superluminal speeds. Such episodes are usually limited to very few grid zones and are originated by either insufficient numerical diffusion or lack of a physical solution of the Riemann problem.

To circumvent this potential hitch, PLUTO provides a safeguard built-in mechanism that (1) flag zones that may potentially reside inside a strong shock wave and (2) introduces additional numerical dissipation by locally replacing the integration scheme with a more diffusive one. For these reasons, most of the interpolation schemes and Riemann solvers available with PLUTO embody a hybrid selective mechanism that allows to switch, if required, to a more dissipative choice. This process is controlled by a 3D array of integers where each element represents a set of flags that can be individually turned on or off by simple bitwise operations. Zones are flagged according to a flexible shock-detection criterion,

Equation (B1)

where Δd is a standard central difference operator, q is the thermal (default) or magnetic pressure, v is the velocity, and epsilonq is a free adjustable parameter (default is 5). The first condition detects zones within a strong gradient while the second one is switched on where compressive motion takes place. When both conditions are met, we flag the zone {i, j, k} to be updated with the HLL Riemann solver. At the same time we also flag all neighboring zones whose interpolation stencil includes the shocked zone to be interpolated using slope-limited reconstruction with the MinMod limiter. We note that both flags may be selected and combined independently and, in any case, preserve the second-order accuracy of the scheme.

Footnotes

Please wait… references are loading.
10.1088/0067-0049/198/1/7