Articles

AZEuS: AN ADAPTIVE ZONE EULERIAN SCHEME FOR COMPUTATIONAL MAGNETOHYDRODYNAMICS

, , and

Published 2012 February 29 © 2012. The American Astronomical Society. All rights reserved.
, , Citation Jon P. Ramsey et al 2012 ApJS 199 13 DOI 10.1088/0067-0049/199/1/13

0067-0049/199/1/13

ABSTRACT

A new adaptive mesh refinement (AMR) version of the ZEUS-3D astrophysical magnetohydrodynamical fluid code, AZEuS, is described. The AMR module in AZEuS has been completely adapted to the staggered mesh that characterizes the ZEUS family of codes on which scalar quantities are zone-centered and vector components are face-centered. In addition, for applications using static grids, it is necessary to use higher-order interpolations for prolongation to minimize the errors caused by waves crossing from a grid of one resolution to another. Finally, solutions to test problems in one, two, and three dimensions in both Cartesian and spherical coordinates are presented.

Export citation and abstract BibTeX RIS

1. INTRODUCTION

High-resolution, multidimensional simulations have become indispensable for many complex problems in astrophysics, particularly those involving (magneto-)fluid dynamics. One of the most important innovations in this area has been the use of dynamic and variable resolution techniques. Adaptive mesh refinement (AMR), pioneered in the context of the fluid equations by Berger & Oliger (1984) and Berger & Colella (1989, hereafter BC89), is one such approach.

With AMR, a hierarchy of grids is used to provide high numerical resolution when and where the physics requires it, leaving as much of the volume at lower resolution as possible to minimize computational effort. This makes AMR an efficient means of studying problems with a very large spatial dynamic range (e.g., star formation, galaxy evolution), as borne out by the large number of codes that employ it: ORION (Klein 1999), FLASH (Fryxell et al. 2000), RIEMANN (Balsara 2001), RAMSES (Fromang et al. 2006), PLUTO (Mignone et al. 2007), NIRVANA (Ziegler 2008), AstroBEAR (Cunningham et al. 2009), and ENZO (Collins et al. 2010) to name several.

Virtually all AMR fluid codes to date are based on a zone-centered grid, with all hydrodynamical variables (density, energy, and momentum components) taken to be located at the centers of their respective zones. Indeed, AMR was originally designed specifically for zone-centered schemes. Magnetohydrodynamic (MHD) solvers are designed with either zone-centered or face-centered magnetic field components, depending in part on the mechanism used to preserve the solenoidal condition. One scheme that has enjoyed somewhat of a renaissance of late is Constrained Transport (CT; Evans & Hawley 1988), which places magnetic field components at the centers of the zone faces to which they are normal. The staggered mesh introduced in such a scheme has to be specifically accounted for in the AMR modules and in such a way that $\nabla \cdot \vec{B}$ remains zero everywhere—including within the boundaries—to machine round-off error.

The ZEUS family of codes are one of only a very few astrophysical fluid codes in use that employ a fully staggered grid (e.g., STAGGER; Kritsuk et al. 2011 and references therein), where the momentum components are also face-centered (Figure 1). While concerns have been expressed over the suitability of its MHD algorithms in certain pedagogical one-dimensional (1D) test problems (e.g., Falle 2002), the fact remains that in one form or another, ZEUS is among the best-tested, documented, and widely used fluid codes in astrophysics (Stone & Norman 1992a, 1992b; Stone et al. 1992; Clarke 1996, 2007, 2010; Hayes et al. 2006), and a proper merger with AMR is warranted. To do this, AMR has to be modified for a fully staggered grid, including the proper treatment of face-centered magnetic field and face-centered momentum.

Figure 1.

Figure 1. Depiction of a single zone on a fully staggered grid, where scalars (ρ, eT, e, p) are zone-centered, primitive vectors ($\vec{v}$, $\vec{B}$) are face-centered, and derived vectors ($\vec{E} = - \vec{v} \times \vec{B}$, $\vec{J} = \nabla \times \vec{B}$) are edge-centered.

Standard image High-resolution image

In this paper, we introduce the newest member of the ZEUS family of codes, AZEuS, whose "maiden simulations" have already appeared in Ramsey & Clarke (2011). AZEuS is a block-structured AMR version of ZEUS-3D (Clarke 1996, 2010) that preserves the modularity and structure of the underlying ZEUS module. The AMR scheme of BC89, including the changes described in Bell et al. (1994), is modified for a fully staggered grid with additional modifications made to the prolongation procedure to allow for smooth passage of all types of waves between adjacent grids of differing resolution. AZEuS is currently capable of ideal MHD in 1D, 1.5D, 2D, 2.5D, and 3D in Cartesian, cylindrical, and spherical polar coordinates using both dynamic and static grids, and with a full suite of physical boundary conditions. As with all ZEUS-type codes, its operator-split design allows for additional physics (e.g., gravity, viscosity, radiation, etc.) to be added without concern over how such additions will affect the MHD algorithm. How the non-hyperbolic additions are implemented for an adaptive grid is another matter (e.g., radiation; Wise & Abel 2011).

This paper does not attempt to give a full recount of the basic methodology in either AMR or ZEUS but focuses instead on the modifications to AMR (not so much to ZEUS) necessary for their merger. Thus, the reader should be familiar with BC89 and Clarke (1996, 2010). In Section 2, we list the MHD equations solved by AZEuS and define our conventions and notation. In Sections 3 and 4, we enumerate the modifications necessary for restriction and prolongation on a staggered grid, as well as outline the interpolation schemes used to allow the smooth passage of waves across grid boundaries. Section 5 focuses on boundary conditions, while in Section 6 we discuss how grids are created and how the proper nesting criterion must be modified for a fully staggered grid. Several of the 1D, 2D, and 3D test problems used to validate AZEuS are given in Section 7, followed by a quick summary in Section 8. Discussion of curvilinear coordinates, use of the vector potential, and a schematic overview of the code are relegated to the appendices.

2. PREAMBLE

2.1. Underlying Numerical Method

AZEuS solves the following equations of ideal MHD (with the artificial viscosity and gravity terms included):

Equation (1)

Equation (2)

Equation (3)

Equation (4)

Equation (5)

where ρ is the mass density, $\vec{v}$ is the velocity, $\vec{s} = \rho \vec{v}$ is the momentum density, p is the thermal pressure, $\vec{B}$ is the magnetic induction,4 $\mathsf {Q}$ is the von Neumann–Richtmyer artificial viscous stress tensor (von Neumann & Richtmyer 1950; Clarke 2010), ϕ is the gravitational potential and satisfies the Poisson equation (∇2ϕ = 4πGρ), $\vec{E} = - \vec{v}\times \vec{B}$ is the induced electric field, e is the internal energy density, eH = e + (1/2)ρv2 + ρϕ is the hydrodynamical energy density, and eT = eH + (1/2)B2 is the total energy density. This set of equations (in which Equation (5) can be derived from Equations (1)–(4)) is closed by the ideal gas law, p = (γ − 1)e, where γ is the ratio of specific heats. Figure 1 shows the locations of most of these variables on a fully staggered grid. Other physics terms often found in ZEUS codes such as a second fluid, physical viscosity, radiation, etc., have yet to be implemented.

AZEuS inherits the operator-split methodology of ZEUS-3D, wherein the terms on the right-hand side of Equations (1)–(5) are treated in a source step while those on the left-hand side are accounted for in a separate transport and inductive step. As such, the algorithm is not strictly conservative. However, based as it is on the version of ZEUS-3D described by Clarke (2010), AZEuS can solve either the internal energy equation or the total energy equation, where the latter choice does ensure conservation of total energy to machine round-off error, but at the cost of non-positive-definite thermal pressure. Should positive definite pressures be paramount, the internal energy equation offers a viable option with, in most cases, total energy conserved to within 1% or less (see Clarke 2010 for further discussion).

To accommodate the interpolation schemes, two boundary zones must be specified at the edges of all grids. On a staggered grid, all zone-centered quantities have just the two boundary values, while face-centered quantities have two boundary values plus a value that lies on the face separating the "active zones" from the "boundary zones," henceforth referred to as the "skin" of the grid (Figure 2). As we shall see, skin values for the magnetic field are treated just like active zones, while the momenta on the skin are treated somewhere in between active and boundary values, the difference attributed to the conservation properties of these two quantities.

Figure 2.

Figure 2. On a fully staggered grid, all variables have two boundary values. In addition, for each direction, one component of a face-centered vector and two components of an edge-centered vector have one skin value.

Standard image High-resolution image

2.2. Conventions and Notation

We adopt the following conventions and notation throughout this paper:

  • 1.  
    Quantities in coarse and fine zones are denoted with upper and lower cases, respectively: e.g., Q(I, J, K), q(i, j, k). Fluxes for a quantity Q (q) are denoted Fm, Q (fm, q), where m = 1, 2, or 3 indicates the component direction.
  • 2.  
    If a "coarse" grid or zone is considered to be at level l, its daughter "fine" grid or zone is at level l + 1. The base and coarsest grid, which covers the entire domain, is at level l = 1. The refinement ratio, ν, between level l and l + 1 must be a power of 2 and the same in all directions.
  • 3.  
    Grid volumes, areas, lengths, and time steps are ΔV, ΔAm, Δxm, and Δt for a coarse grid, and δV, δAm, δxm, and δt for a fine grid.
  • 4.  
    Indices (i, j, k) correspond to the fine zone at the (left, bottom, back) of a coarse zone with indices (I, J, K). The zone center of a particular fine zone within a coarse zone is designated (i + α, j + β, k + η), where α, β, η = 0, 1, ..., ν − 1. For the 1-face-center of a fine zone, α = 0, 1, ..., ν while β, η = 0, 1, ..., ν − 1, etc.
  • 5.  
    Similarly, grid positions for the coarse grid use uppercase indices (e.g., x1(I)), while grid positions for the fine grid use lowercase indices (e.g., x1(i)).
  • 6.  
    The current time step for the coarse grid is indicated by the uppercase superscript N, while the current fine time step is indicated by the lowercase superscript n. Typically, n = νN. To designate a fine time step within a coarse time step, we use n + τ where 0 ⩽ τ ⩽ ν − 15.
  • 7.  
    The region of influence (ROI) of a variable is defined as the area or volume over which that quantity is conserved. For zone-centered scalars on the coarse grid, this is the volume ΔV(I, J, K) (Figure 3(a)). For face-centered but volume-conserved quantities (e.g., S1), the ROI is the staggered volume (e.g., (1/2)(ΔV(I, J, K) + ΔV(I − 1, J, K))) (Figure 3(b)). Finally, for face-centered but area-conserved quantities (e.g., B1), the ROI is the area of the face at which the vector component is centered (e.g., ΔA1(I, J, K)) (Figure 3(c)).
Figure 3.

Figure 3. Regions of influence (ROI; shaded) for (a) zone-centered variables, (b) face-centered and volume-conserved variables, and (c) face-centered and area-conserved variables. A refinement ratio of ν = 4 is shown.

Standard image High-resolution image

Finally, while AZEuS is written in the covariant fashion of ZEUS-2D (Stone & Norman 1992a), our discussion is given in terms of Cartesian-like components with uniform zone sizes within each grid for simplicity. As such, ΔVV = ν3, ΔAmAm = ν2, Δxmxm = ν, and Δtt = ν. Some of the modifications necessary for curvilinear coordinates are given in Appendix A.

3. RESTRICTION

Restriction is the process by which data on the coarse grid are replaced by an average of data from an overlying fine grid. This must be done in a fashion that locally preserves all conservation laws and the solenoidal condition to within machine round-off error. Two types of restriction are considered: the conservative overwrite of coarse values with ROIs that are entirely covered by ROIs of overlying fine zones, and flux corrections to coarse zones (sometimes called "refluxing") with ROIs that are adjacent to, or partially covered by, the ROIs of fine zones.

3.1. Conservative Overwrite

At the end of a coarse time step, fine and coarse grids are synchronized by overwriting the coarse grid with "better" values from overlying fine grids. Because of the different ROIs on a staggered mesh, the specifics of the overwriting procedure depend on which variable is being overwritten. For zone-centered, volume-conserved quantities (e.g., ρ, e, eT), the procedure is the same as in BC89:

Equation (6)

where the sum is a triple sum. By inspection, one can confirm that Equation (6) conserves Q (q) locally to within machine round-off error.

For face-centered, volume-conserved quantities such as the momentum density whose ROIs are completely covered by the ROIs of overlying fine zones, we have

Equation (7)

Equation (8)

for the 1-component of the momentum. The factor ${\cal G}(\alpha)$ takes into account that only half of the ROIs of the fine momenta at α = −ν/2, ν/2 cover the ROI of coarse momentum (Figure 3(b)).

Coarse momenta with ROIs partially covered by a fine grid are cospatial with the skin of the overlying fine grid. As skin values of momenta are considered to be boundary values (since one of the fluxes is completely determined from within the boundary), they are not taken to be more reliable than the underlying coarse values (whose fluxes are determined exclusively by interior zones), and thus the coarse values are not overwritten by the fine grid values. Instead, coarse momenta cospatial with a fine grid skin are considered to be adjacent to the fine grid and, as such, are subject to the "flux-correction" step described in the next subsection.

For magnetic field, the conserved quantity is the magnetic flux ($\int \vec{B}\cdot d\vec{A}$). Thus, coarse values of B1 are overwritten using

Equation (9)

where the sum is over all fine ROIs (areas of 1-faces) that cover the coarse ROI. One can easily show that overwritten values of $\vec{B}$ will still satisfy the solenoidal condition—even when combined with values of $\vec{B}$ that are not overwritten—so long as the overlying values of $\vec{b}$ are divergence free and adjacent values of $\vec{B}$ are properly "refluxed" (Section 3.2). In addition, since $\vec{B}$ is an area-conserved quantity, there is never partial coverage of ROIs as there is with the momenta, and thus no analog of ${\cal G}(\alpha)$ (Equation (8)) is necessary for the magnetic field.

A straightforward permutation of indices gives the analogous expressions for the other components of momentum and magnetic field.

3.2. Flux Corrections

A coarse zone adjacent to but not covered by a fine grid shares a face with the fine grid. In order that local mass, momentum, and magnetic flux remain conserved to within machine round-off error, the coarse and fine zones must agree on the fluxes passing across their common face. This is accomplished by keeping track of all coarse fluxes passing across the skin of a contained fine grid, and then subtracting from these the fine fluxes computed during the MHD updates of the fine grids. These "flux corrections" are then subtracted from the coarse zones adjacent to the fine grid during the so-called refluxing step, effectively replacing the coarse fluxes with the fine fluxes along their common face.

For zone-centered, volume-conservative quantities this procedure follows BC89. Thus, for transport in the 1-direction, we have for the flux-corrected quantity, $\widetilde{Q}$,

Equation (10)

where the quantities in square brackets are the flux corrections. For the purpose of illustration, the coarse zone (I, J, K) is taken to be immediately to the right (increasing I) of a fine grid. FN + 1/21, Q is the time-centered 1-flux of Q (with units $Q {\cal V} \Delta A \Delta t$, where ${\cal V}$ is the coarse velocity)6 passing across the 1-face cospatial with the skin of the fine grid, while fn + τ + 1/21, q are the corresponding fine fluxes (with units qvδAδt, where v is the fine velocity; Figure 4(a)). Note the sum over τ reflecting the fact that there are several fine time steps (typically ν of them) within a single coarse time step.

Figure 4.

Figure 4. Different cases for flux corrections on a staggered grid, including (a) zone-centered quantities; (b)–(d) the three different cases for face-centered, volume-conserved momenta; and (e) area-conserved magnetic field corrections via the EMFs. Shaded regions denote typical ROIs referred to in the text. Note that in this figure, all arrows correspond to components of fluxes or EMFs.

Standard image High-resolution image

When flux correcting the face-centered, volume-conserved momenta, we must depart from BC89 as the staggered mesh gives rise to four distinct cases that must be dealt with individually. The first case is when both the flux and momentum components are parallel to the fine grid skin normal. Here, the ROI at the boundary is halfway inside the fine grid. For example, consider the 1-flux of S1 in the ROI straddling the right boundary of a fine grid as shown in Figure 4(b) where the 1-flux correction takes the form

Equation (11)

Note that in the 1-direction, the coarse and fine momenta pass through the same face, but the fluxes do not. Thus, an average of the fine fluxes at i − ν/2 − 1 and i − ν/2 is needed to properly center the fine fluxes and to ensure local conservation of momentum.

The second case is when the flux is parallel and the momentum component perpendicular to the fine grid skin normal. Here, the adjacent ROI lies entirely outside the fine grid just as a zone-centered quantity. For example, consider the 1-flux of S2 in the ROI adjacent the right boundary of a fine grid as shown in Figure 4(c), where the flux correction takes the form

Equation (12)

The factor $\cal {G}(\beta)$ (Equation (8)) ensures that only half of the fine 1-fluxes of the fine ROIs at β = ±ν/2 are included, as a quick glance at Figure 4(c) will verify.

The third case is when the flux is perpendicular and the momentum component parallel to the fine grid skin normal. As with the first case, the ROI at the boundary is halfway inside the fine grid. For example, consider the 1-flux of S2 in the ROI straddling the lower boundary of a fine grid as shown in Figure 4(d), where the flux correction takes the form

Equation (13)

The fraction (ν − 1)/2ν is the area filling ratio between the fine and coarse fluxes. For example, for ν = 4, (ν − 1)/2ν = 3/8 (Figure 4(d)), and 3/8 of the coarse flux must be replaced with the overlapping fine fluxes. Note that $f_{1,s_2} (i,j,k)$ does not contribute to the fine fluxes that replace part of the coarse flux since it is determined, in part, by values from the boundary region of the fine grid, and thus not taken as reliable enough to replace part of the coarse flux determined exclusively from active zones of the coarse grid.

Equation (13) assumes that both the left and right faces of the coarse ROI need to be flux corrected. Should the fine grid in Figure 4(d) not cover coarse zones (I, J, K) and (I + 1, J, K), flux corrections need only be applied to the left side of the coarse ROI (I, J, K). In this case, the terms $F_{1, S_2}^{N+1/2}(I+1,J,K)$ and $f_{1,s_2}^{n+\tau +1/2}(i+\nu,j+\beta,k+\eta)$ are omitted. Similarly, if the fine grid does not cover coarse zones (I − 1, J, K) and (I, J, K), the terms $F_{1, S_2}^{N+1/2}(I,J,K)$ and $f_{1,s_2}^{n+\tau +1/2}(i,j+\beta,k+\eta)$ are omitted.

The fourth and final case is when both the flux and momentum components are perpendicular to the fine grid skin normal. Here, no flux corrections are required, as can be readily seen by inspection of Figure 4(c).

For the magnetic field components, the operator in the evolution equation (Equation (3)) is the curl, and not the divergence of the hydrodynamical variables. Thus, $\vec{B}$ is a surface-conserved quantity (rather than volume-conserved) and, as such, we make adjustments to the so-called EMFs (defined below) instead of the fluxes; otherwise, the procedure is the same.

Consider the coarse ROI of B3 immediately to the right of a fine grid (Figure 4(e)). Following Balsara (2001), we have

Equation (14)

where ${\cal E}_2^{N+1/2}(I,J,K) = E_2 \Delta x_2 \Delta t$ is the time-centered coarse 2-EMF7 ("electro-motive force") located along the 2-edge, and where εn + τ + 1/22(i, j + β, k) is the time-centered fine 2-EMF, located along the same 2-edge as the coarse 2-EMF. Here, the quantities in square brackets are the "EMF corrections," analogous to the flux corrections for the hydrodynamical variables. In ZEUS-3D, the EMFs can be evaluated using various algorithms. In our case, we use the Consistent Method of Characteristics (CMoC) described by Clarke (1996).

Because the magnetic field is an area-conserved quantity, there is no situation where the coarse ROI of a magnetic field component is partially covered by fine ROIs as can happen for the volume-conserved, face-centered momentum. Thus, Equation (14) and its permutations are sufficient to cover all EMF corrections for all field components in all directions. Note, for example, that there are no corrections to be made in the 1-direction for the 1-field, again because of the surface conservative nature of the magnetic field.

Further, induction of magnetic field components penetrating the skin of a fine grid is affected by EMFs computed from quantities taken entirely from within the active portion of the grid. This is in contrast to a momentum component penetrating the skin, half of whose fluxes are computed from boundary values. Thus, we take the skin values of the EMFs and the magnetic components they induce to be just as reliable as those evaluated from within the grid, and it is appropriate to restrict the coarse magnetic field values on the skin of a fine grid with the overlying fine values (e.g., Equation (9)).

Finally, flux-correction equations for coarse zones adjacent to other sides of a fine grid can be obtained by a suitable permutation of indices and subscripts.

4. PROLONGATION

Prolongation is the process by which fine grid zones are filled using the best information available. This could be by either interpolating values from the underlying coarse grid in a way to ensure local conservation and local monotonicity or taking them from adjacent or overlapping fine grids. As with restriction, prolongation can be divided into two types. First, when a fine grid is created or extended, the new fine zones must be filled. Second, at the beginning of a fine grid time step, fine boundary zones must be set. Both types require interpolation methods, some of which have been introduced here specifically for static grid refinement.

4.1. Spatial Interpolation

In an effort to minimize the errors caused by waves traveling across boundaries between fine and coarse grids, we have introduced higher-order interpolation schemes (e.g., piecewise parabolic interpolation, PPI; Colella & Woodward 1984) to the prolongation step. This improves the results for adaptive refinement and has proven important for static refinement where strong waves are required to cross grid boundaries. By design, these interpolation schemes honor conservation laws and monotonicity.

In all cases and for all variables, we begin by estimating the interface values QL, R(I) from cubic fits to the coarse grid data (Section 1 of Colella & Woodward 1984) without the monotonization or steepening steps. Now, to fit a parabolic interpolation function, q*1(x), across the coarse ROI for zone I, we need three constraints. Two come from requiring that q*1(x) passes through QL, R(I), while the third comes from requiring that the zone-average value Q(I, J, K) times the zone volume equals the volume integral of q*1(x). For the original PPI scheme, this final constraint is written as

For our purposes, we need to interpolate fine zone averages from the coarse ones and, as such, the conserved quantity is the Riemann sum and not the integral. Thus, in the 1-direction, our final constraint is

Equation (15)

Equation (16)

for constant Δx, δx. With this, our parabolic interpolation function is (cf. Equation (1.4) in Colella & Woodward 1984)

Equation (17)

where

Equation (18)

With q*1(i + α) determined, we set the differences between the fine and coarse zones:

Equation (19)

For zone-centered quantities, we determine the fine-zone differences in the manner of Equation (19) in each of the three directions and set the interpolated fine zone averages to be

Equation (20)

Given Equation (16) and analogous expressions in the 2- and 3-directions, it is easy to show that this prescription is conservative, that is,

Equation (21)

for uniform grids (ΔV = ν3δV).

For face-centered quantities, we determine the fine-zone differences in the manner of Equation (19) in each of the two orthogonal directions (e.g., in the 2- and 3-directions for S1) and set the interpolated fine zone averages along each coarse face to be

Equation (22)

Exactly the same procedure is used to interpolate B1 across each coarse 1-face. As with the zone-centered quantities, it is easy to show that this procedure conserves momentum (magnetic) flux on the face:

Equation (23)

The next step is to interpolate the face-centered quantities into the interior of the zone, and it is here where the procedure for momentum and magnetic components diverge.

For the volume-conserved momenta, we perform a linear interpolation between the fine momenta on opposing coarse faces. For example, between s1(i, j + β, k + η) and s1(i + ν, j + β, k + η) we set

Equation (24)

where α = 1, ..., ν − 1 and ζ = αδxx. This prescription guarantees that over a zone-centered volume, the prolongation of the 1-momentum is conservative. The fact that conservation is over the zone-centered volume and not specifically the 1-momentum ROI is required for Equations (23) and (24) to be consistent with the restriction procedure of Equation (11).

For the area-conserved magnetic field, a simple linear interpolation between opposing coarse faces does not preserve the solenoidal condition. Thus, we turn to a generalized, directionally unsplit version of the algorithm described by Li & Li (2004) in which $\nabla \cdot \vec{b}=0$ so long as $\nabla \cdot \vec{B} = 0$ holds on the underlying coarse grid.

In this approach, we take the coarse and recently interpolated fine values of magnetic field (Equation (22)) and apply the solenoidal condition to determine "intermediate" coarse field values (e.g., B*1; Figure 5), which are cospatial with fine zone faces. For example, the intermediate values for B1 are given by

Equation (25)

where

Equation (26)

and 0 ⩽ α ⩽ ν − 2. Given B*1(i + α + 1), and the differences between fine and coarse values at the coarse faces (δb1, l, l = 2, 3; Equation (19)), we then calculate the fine magnetic field at i + α + 1:

Equation (27)

where

Equation (28)

and ζ = αδxx.

Figure 5.

Figure 5. Schematic representation of the directionally unsplit Li & Li algorithm for calculating fine values of $\vec{b}$ between coarse grid faces when ν = 4.

Standard image High-resolution image

Proceeding incrementally from i + 1 to i + ν − 1 provides all of the values of b1(i, j, k) between the coarse faces (I, J, K) and (I + 1, J, K). Values for the other magnetic field components are given by a straightforward permutation of indices. In aggregate, these yield a third-order interpolation of fine magnetic field components that preserve the divergence of the underlying coarse magnetic field to machine round-off error.

Finally, a note on the use of vector potentials. Igumenshchev & Narayan (2002) have demonstrated that the vector potential, $\vec{A}$, may be used in the CT algorithm (Evans & Hawley 1988) instead of the magnetic field with results identical to machine round-off error. Thus, one may be tempted to adopt this approach so that prolongation methods simpler than the Li & Li algorithm may be used on $\vec{A}$ as a way to guarantee that the fine grid satisfies the solenoidal condition. Reasons for not taking this approach are given in Appendix B.

4.2. Temporal Interpolation

Fine grids require prolonged boundary values at the beginning of each fine time step, and thus we also need to perform temporal interpolations on the coarse values. Following BC89, we perform a linear interpolation on the coarse hydrodynamic variables in time and then spatially interpolate them as described above to obtain the necessary boundary information for each fine time step.

For the magnetic field, the fine components penetrating the skins of the fine grid are retained; only those values completely within the boundary region are prolonged from the coarse grid. For this, we require coarse grid EMFs on the fine grid skin and within the boundary region that are time-centered on the current fine time step.

The coarse EMFs coincident with the fine grid skin are replaced with the spatial and temporal sum of the overlying fine EMFs, where the sum over time is necessary since the time step is embedded in our definition (footnote 7). Thus and for example, for ${\cal E}_2$ we set

Equation (29)

where ψ = (2τ' + 1)/2ν, and where 0 ⩽ τ' ⩽ ν − 2 designates the last completed fine time step. This yields values on the fine grid skin that are time-centered between the beginnings of the coarse time step and the current fine time step and take into account the superior quality of the fine grid data.

The coarse EMFs residing entirely within the fine grid boundary region are retained. However, these are time-centered for the coarse grid and, as such, have embedded in them a factor Δt. To render them coeval with fine time step τ' and thus the coarse skin EMFs computed in Equation (29), we must multiply them by (2τ' + 1)/ν = 2ψ to correct the embedded time step factor.

With coarse EMFs on the fine skin and inside the fine boundary region properly time-centered, the coarse magnetic field components are updated to the beginning of the current fine time step using Equation (3), and it is these values that are used in the prolongation methods described in Section 4.1 to create the fine grid magnetic field boundary values.

One might ask why a linear temporal interpolation of the divergence-free coarse magnetic field components is not enough to preserve the solenoidal condition within the boundary region. Indeed, such an approach does guarantee $\nabla \cdot \vec{B}=0$ within the region interpolated, but not in the layer between the interpolated region and its immediate non-interpolated neighbors. The method outlined above based on the coarse EMFs allows interpolations to be performed locally and only where they are needed, while still preserving the solenoidal condition globally to machine round-off error.

4.3. Monotonicity

We have found it necessary to maintain a certain monotonicity in our prolongations. Failure to do so can lead to negative pressures (even when solving the internal energy equation) and violations of the CFL condition. For example, if the current time step is governed by the sound speed, and the prolongation process leads to an interpolated density less than the surrounding zones, the sound speed in a fine zone could be greater than that which was used in determining the CFL time step, possibly leading to numerical oscillations and loss of stability.

Sequentially stringing together two (or three) 1D PPIs as we do for prolongation of zone-centered quantities (e.g., Equation (20)) can lead to non-monotonic behavior even if each 1D interpolation is separately monotonic. If a PPI-determined value q(i + α, j + β, k + η) is found to lie outside the range set by neighboring coarse zones,

then we "fall back" to piecewise linear interpolations (PLI; van Leer 1977, Appendix A). In rare cases where the PLI-determined value is also non-monotonic (possible only in 3D), we revert to piecewise constant interpolations (PCI, a.k.a. "direct injection" or "donor cell"):

Where PPI yields non-monotonic results, we note that transmission of strong waves across changes in resolution (e.g., static grids) is significantly improved if one first tries PLI rather than falling back directly to PCI or limiting the interpolated value to lie between Qmin  and Qmax .

5. BOUNDARY CONDITIONS

Boundary conditions are applied directly to the hydrodynamical variables (ρ, e, $\vec{v}$) and indirectly to the magnetic field via the EMFs. Attempting to apply boundary conditions directly to $\vec{B}$ often generates monopoles in the boundary regions, which can have significant effects on the dynamics in the active grid, as illustrated in Appendix C.

In addition to the usual boundary conditions applied by the ZEUS module during each MHD cycle, the AMR module must also set boundary conditions on two occasions. After restriction and before prolongation, boundary values are set on the coarse grid. Then, after prolongation and before the ZEUS module is called for the next MHD cycle, boundary values for the fine grid are set using the results of the prolongation step. These additional applications of boundary conditions are necessary to maintain the imposed physical boundaries after restriction and prolongation have altered some of the values on the active grid and to reconcile boundaries of grids that may be contained within or adjacent to other grids (henceforth referred to as adjacent boundaries).

Because of their nature, physical boundaries (inflow, outflow, reflecting; those traditionally applied by single-grid MHD codes) and adjacent boundaries must be treated differently, and each is discussed in turn.

5.1. Physical Boundaries

Generally, a fine grid is completely embedded within a coarse grid. The single exception is when both grids share a physical boundary and two items of note must be borne in mind when adapting the physical boundary condition routines in ZEUS-3D to AZEuS.

First, since each grid has only two boundary zones, only part of the coarse boundary region is covered by fine boundary zones. Thus, coarse boundary zones cannot be included in the restriction step, a particular concern when setting magnetic boundary conditions. In AZEuS, we extend the EMF correction scheme of Section 3.2 by retaining three layers of transverse EMF corrections and two layers of longitudinal EMF corrections,8 including the skin layer plus two additional layers interior and adjacent to the skin. Immediately before the restriction step, physical boundary conditions are applied to the EMF corrections, which are then used to update the boundary values of the magnetic field components in the coarse grid according to Equation (14). Done in this fashion, there is no risk of introducing monopoles to the coarse boundary zones during the restriction step when two or more grids overlap a physical boundary.

Second, not handled properly, inflow boundary conditions can introduce unexpected violations of conservation laws that can cause unwanted discontinuities in the boundary. In particular, if a boundary variable is to be set according to an analytical function of the coordinates, that variable should be set to the zone average of that function, and not simply to the function value at the location of the variable. While this is good advice for a single-grid application, it is critical for AMR.

For example, suppose the density profile,

Equation (30)

is to be maintained in cylindrical coordinates along the z = 0 boundary. Let ρ(J) be the density in the coarse zone of dimension (Δz, Δr) centered at r(J) = r, and let ρ(j) and ρ(j + 1) be the densities in the fine zones of dimension (δz, δr) centered at r(j) and r(j + 1) (Figure 6). For a refinement ratio of 2, Δr = 2δr, Δz = 2δz, r(j) = r − (1/2)δr, and r(j + 1) = r + (1/2)δr.

Figure 6.

Figure 6. Single coarse zone in the z = 0 boundary with zone center at r(J) = r and with refinement ratio of ν = 2.

Standard image High-resolution image

If we naively set ρ(J) using Equation (30), the mass of zone J (with volume ΔV = rΔrΔz) is

Similarly, for the fine zones,

Adding the masses in the four fine zones contained by the coarse zone, we find

and the physical boundary conditions violate mass conservation.

Instead, ρ(J) should be set to the zone average, determined by

where the mass function, m(J), is given by

Equation (31)

where ρ(r) is the given density profile (e.g., Equation (30)). Similar expressions apply for m(j) and m(j + 1). Done in this fashion, it is easy to show that

and both grids agree on the mass contained within coarse boundary zone J to within machine round-off error. With a little bit of algebra, this can be confirmed analytically for the specific case of Equation (30). For more complicated profiles, a numerical integrator can be employed to perform the necessary integrations in Equation (31).

5.2. Adjacent Boundaries

Unlike Godunov methods, which typically require a single application of boundary conditions at the end of each MHD cycle, the operator-split nature of ZEUS requires boundary conditions to be set several times. For physical boundaries, this is not an issue; physical boundary conditions may be set whenever needed based on data from a single grid. However, adjacent boundaries pose a unique challenge in AZEuS since the ZEUS module is aware only of the grid being updated, and other grids cannot be accessed in the middle of an MHD cycle to update these boundaries.

We have introduced into AZEuS the concept of "self-computing" boundary conditions for adjacent boundaries. In this approach, boundary zones are set at the beginning of each time step using the best information available (either from an adjacent grid of the same resolution or from the prolongation of an underlying coarse grid possibly interpolated in time), and then the full set of operator-split MHD equations are applied to both the boundary and active zones; no adjacent boundary zones are reset to any predetermined quantity inside a single MHD time step. Further, self-computed boundary zones are included in the calculation of the CFL time step, which we find critical (for an operator-split code such as AZEuS) in minimizing transmission errors when waves of any significant amplitude cross adjacent boundaries.

Of course, assumptions about missing data beyond the outermost edge of the grid must be made, and "pollution" from these missing data necessarily propagates inward. For example, consider the left 1-boundary where v1(i = 1) and v1(i = 2) represent the boundary values of v1, v1(i = 3) the skin value (treated as a boundary value), and v1(i = 4) the first active value. The pressure gradient at v1(1) is proportional to p(1) − p(0), yet p(0) is completely unknown (p(1) and p(2) are the only boundary values available). The best we can do for a missing datum such as this is to extrapolate assuming a zero gradient, in which case p(0) = p(1) and no pressure gradient is applied to v1(1). In this manner, v1(1) is polluted by the missing datum at the very beginning of the source step.

Additional steps inside a single MHD cycle include the application of artificial viscosity, adiabatic expansion/compression for the internal energy equation, the transport steps, and the induction step. All but the latter contribute to propagating pollution from missing data toward the active portion of the grid. Ideally, one would carry enough boundary zones to prevent pollution from reaching the active grid within a single MHD step, so that the AMR module (with knowledge of all grids) can reset all boundary values to new and unpolluted values before their effects ever reach the active zones. However, for van Leer (1977) interpolation in the transport step and within a single MHD cycle, pollution from missing data reaches the skin and first active zone center on the grid, as well as the first active face and second active zone center if the local velocity points away from the boundary (true regardless of which energy equation is used). Thus, to completely prevent pollution from reaching the active grid, we would have to double the number of boundary zones from two to four.

We have investigated this effect thoroughly and have found no test problem that demonstrates anything but the slightest quantitative effect from pollution by missing data at adjacent boundaries between fine and coarse grids. For adjacent boundaries between grids of like resolution, we have elected to force these grids to overlap (for reasons explained in Section 6) by an amount sufficient to eliminate the problem of missing data pollution altogether.

6. GRID CREATION AND ADAPTATION

Creation or modification of adaptive grids in AZEuS proceeds in a manner similar to Bell et al. (1994) including the suggestions of Berger & Rigoutsos (1991) with two important differences. First, we have had to modify the proper nesting criterion of BC89 by increasing from one to three the number of zones at level l − 1 separating an active zone at level l from level l − 2. This is because prolongation of boundary values for level l from level l − 1 requires one zone from level l − 1 beyond the edge of a grid at level l, plus two additional zones at level l − 1 on either side to satisfy the five-zone molecule needed by PPI.

Second, BC89 allow grids of the same resolution to abut without overlapping, whereas we have found it advantageous for at least two reasons to extend abutting grids so that they overlap by a minimum of one coarse zone (Figure 7). For one, since the momenta penetrating a grid skin are no more reliable than boundary values, two abutting grids would, in general, disagree on the values of the momentum penetrating their common skin. This turns out to pose an intolerable ambiguity in the solution. Second, the problem of pollution propagating from missing data onto the active grid (Section 5.2) is completely averted by overlapping two abutting grids by one coarse zone.

Figure 7.

Figure 7. Two grids that originally abut (panel (a)) are made to overlap by at least one coarse zone (panel (b)).

Standard image High-resolution image

By forcing abutting grids to overlap, there is always a clear choice of which value to use at a given location. Where the boundary and skin values of one grid overlap the active zone values of another, the active zone values prevail and are used by the other grid for its boundary values.

Grids that are abutting at the end of the grid generation and modification process, but before they are prolonged, are made to overlap by one coarse zone. Numerous situations arise in which more than one grid may overlap at the same location (e.g., the test problems in Sections 7.2.1 and 7.2.2), and this can result in overlaps that are greater than one coarse zone. Further, the possibility of a complex distribution of AMR grids opens up a whole host of pedagogical cases that one must consider, particularly when looking to maintain the solenoidal condition. During the development of AZEuS, we have carefully examined each case involving multiple levels with numerous grids overlapping each other to ensure that where grids overlap, they all agree on the flow variables and all conservation laws are preserved to machine round-off error.

In this regard, the EMFs turn out to be a very sensitive discriminator. Any mismatches between overlapping grids in the conserved variables at the beginning of a time step will first generate mismatched velocities, followed by disagreements in cospatial EMFs before ν time steps have passed. These can be detected, for example, as monopoles arising in either the boundary or active zones in either or both of the overlapping grids. Even if such monopoles are restricted entirely to the boundary zones, their unphysical forces can affect neighboring active zones whose effects propagate rapidly throughout the grid (e.g., Appendix C). Preserving agreement between overlapping zones including boundary zones to machine round-off is, therefore, of paramount importance.

7. NUMERICAL TESTS

We have verified AZEuS against a number of standard test problems, some of which are presented in this section. Further results will be posted to http://www.ica.smu.ca/azeus, as they become available. Additional and similar test problems for ZEUS-3D (without AMR) are found in Clarke (2010) and online at http://www.ica.smu.ca/zeus3d.

7.1. 1D Shock Tubes

While most AMR applications rely exclusively on dynamic grids, certain applications, particularly those that exhibit some degree of self-similarity, can benefit enormously from the use of a base of nested, static grids (e.g., Ramsey & Clarke 2011). As such solutions evolve, waves of all types—including strong shocks—must pass sequentially from one grid to another, and it is here where our higher-order prolongation algorithms for adjacent boundaries are critical.

AZEuS has been tested with all 1D shock tube problems from Ryu & Jones (1995, hereafter RJ95) for both static and dynamic grids, and we show the results from two to highlight these features of the code. Both tests use the total energy equation with γ = 5/3, ${\cal C} = 0.75$ (Courant number), and artificial viscosity parameters qcon = 1.0 and qlin = 0.2.

For static grids, Figure 8 shows two solutions for ρ, eT, v2, and B2 from problem (4a) of RJ95 over a domain of x1 ∈ [ − 0.5, 2.5] (three times larger than RJ95) for a time t = 0.45 (three times longer). The initial discontinuity is placed at x1 = 0.5, with the left and right states given in the figure caption. The left panels show the domain resolved with 1200 zones and no AMR, while the central panels show the AMR solution with a base resolution of 600 zones and fine static grids with a refinement ratio of 2 placed at x1 ∈ [ − 0.2, 0.1] and x1 ∈ [0.7, 1.245] (gray). These locations allow all the physical features, with the exception of the sluggish slow rarefaction, to suffer at least one change in resolution. The right panels show the percent differences between the two solutions.

Figure 8.

Figure 8. Static grid solution to problem (4a) of RJ95 at time t = 0.45. The initial left and right states are (ρ, v1, v2, v3, B2, B3, p) = (1, 0, 0, 0, 1, 0, 1) and (0.2, 0, 0, 0, 0, 0, 0.1), with B1 = 1. From left to right, the physical features are (1) fast rarefaction, (2) slow rarefaction, (3) contact discontinuity, (4) slow shock, and (5) "switch-on" shock. Left panels: uniform "fine" grid solution; middle panels: same solution with two fine, static grids (gray) overlying the coarse grid; right panel: percent difference between the uniform and static grid solutions. Solid lines are the analytical solutions from the Riemann solver described in RJ95.

Standard image High-resolution image

Discounting all zones trapped within a discontinuity (which, even without AMR, are already in error by as much as 100% since discontinuities are supposed to be infinitely sharp), the maximum error one can attribute to the use of static grids in any of the variables is less than 1%. As further evidence of the ability of AZEuS to pass waves of all types across adjacent boundaries, Ramsey & Clarke (2011) find almost no sign of reflection, refraction, or distortion of any type of wave across any of the static grid boundaries in their 2D axisymmetric simulations of protostellar jets in cylindrical coordinates.

For dynamic grids, Figure 9 illustrates the results of test problem (2a) of RJ95. We employ four levels of refinement (sequentially darker shades of gray) above the base grid with a resolution of 40 zones over the domain x1 ∈ [0.0, 1.0]. The initial discontinuity is located at x1 = 0.5, with the left and right states given in the figure caption. To track the developing features, refinements are based on three criteria (Khokhlov 1998): contact discontinuities (CD), shocks, and gradients in certain variables, each requiring a threshold value to be set above which a zone is flagged for refinement. Here, we set parameters tolcd = tolshk = 0.1 for CDs and shocks, respectively, and check v2 for gradients above tolgrad = 0.1. For this problem, the gradient detector is needed to refine both the discontinuity of the initial conditions and rotational discontinuities (x1 ≃ 0.53 and x1 ≃ 0.71 in Figure 9), neither of which are detectable as a CD or shock.

Figure 9.

Figure 9. AZEuS solution to problem (2a) of RJ95 at t = 0.20. The initial left and right states are $(\rho, v_1, v_2, v_3, B_2, B_3, p) = (1.08, 1.2, 0.01, 0.5, 3.6/\sqrt{4\pi }, 2/\sqrt{4\pi }, 0.95)$ and $(1, 0, 0, 0, 4/\sqrt{4\pi }, 2/\sqrt{4\pi }, 1)$, with $B_1 = 2/\sqrt{4\pi }$. The physical features, from left to right, are (1) fast shock, (2) rotational discontinuity, (3) slow shock, (4) contact discontinuity, (5) slow shock, (6) rotational discontinuity, and (7) fast shock. Shaded regions indicate the location of finer grids, with the level of shading indicating the level of refinement. Ψ = tan −1(B3/B2) is the angle between the transverse field components. The solid lines are the analytical solution from the Riemann solver described in RJ95.

Standard image High-resolution image

Additional parameters used to obtain this solution include kcheck = 5 (the number of cycles between successive grid modifications), geffcy = 0.95 (the minimum allowed grid efficiency, defined as the ratio of zones flagged for refinement to the number of zones actually present in a new grid), and ibuff = 2 (the number of buffer zones added around flagged zones). These parameters, in addition to the non-AMR parameters, are summarized in Table 1.

Table 1. Summary and Description of the Significant User-set Parameters in AZEuS

Parameter Description
${\cal C}$ The Courant number
qcon Quadratic artificial viscosity parametera
qlin Linear artificial viscosity parametera
tolcd Threshold value for the CD detector (range 0–1)
tolshk Threshold value for the shock detector (range 0–1)
tolgrad Threshold value(s) for the gradient detector(s) (range 0–1)
kcheck Number of cycles between successive grid modifications
geffcy The minimum allowed fractional grid efficiency for creation of new grids (range 0–1)
ibuff The number of buffer zones added around zones flagged for refinement

Note.a See Clarke (2010) for a more detailed description of the artificial viscosity parameters.

Download table as:  ASCIITypeset image

7.2. 2D Tests

7.2.1. MHD Blast

The MHD blast problem of Londrillo & Del Zanna (2000) and Gardiner & Stone (2005) has proven to be a very valuable test of our AMR algorithms and for rooting out problems in the code. It is also a good test of directional biases and the ability of a code to handle the evolution of strong MHD waves. We initialize the problem in the same manner as Clarke (2010) with domain x ∈ [ − 0.5, 0.5], y ∈ [ − 0.5, 0.5], and $(\rho, \vec{v}, B_1, B_2, B_3) = (1, 0, 5\sqrt{2}, 5\sqrt{2}, 0)$ everywhere. Within radius r = 0.125 of the origin, we set the gas pressure to p = 100, and p = 1 elsewhere.

Figure 10 presents our results for the 2D blast problem at t = 0.02 for a base grid of 2002 zones and one additional level of refinement with ratio ν = 2. For this test, we have purposely chosen a high grid efficiency of geffcy = 0.92 to strenuously test the ability of AZEuS to handle a large number of grids in a complicated pattern and refine on features that are not preferentially aligned with a coordinate axis. Typically, a lower value for the grid efficiency is used (e.g., geffcy ≃ 0.7) to try to balance minimizing the number of refined zones with the overhead associated with managing an increasing number of small grids.

Figure 10.

Figure 10. AZEuS solution for the 2D MHD blast problem at t = 0.02 using two levels of refinement. Top left: gas pressure; bottom left: magnetic pressure (pB = |B|2/2); top right: gas density; and bottom right: distribution of AMR grids at t = 0.02.

Standard image High-resolution image

Evidently, AZEuS is able to follow the blast wave closely, regardless of its orientation. Table 2 compares the extrema of the plotted variables between the AMR calculation and uniform grid solutions with 2002 and 4002 zones. With the exception of the pressure, which exhibits differences between the uniform 4002 and AMR solutions of ≲0.5%, the uniform grid results bracket the AMR solution.

Table 2. Extrema for Density, ρ, Gas Pressure, p, and Magnetic Pressure, pB, in AMR and Uniform Grid Solutions of the 2D MHD Blast Problem at t = 0.02

  AMR Uniform, 2002 Uniform, 4002
  Min Max Min Max Min Max
ρ 0.199 3.36 0.200 3.22 0.189 3.40
p 0.712 32.3 0.771 32.0 0.714 32.1
pB 24.3 75.7 24.9 76.0 23.6 75.6

Download table as:  ASCIITypeset image

For this test, we set tolshk = tolcd = 0.2 and apply tolgrad = 0.2 to eT. While the gradient detector is useful in refining the initial pressure jump, most (∼99.9%) of the zones flagged for refinement soon thereafter are detected by the CD and shock detectors. Additional parameter settings include kcheck = 10, ibuff = 3, γ = 5/3, ${\cal C} = 0.5$, qcon = 1.0, and qlin = 0.1. All boundaries are set to outflow conditions.

7.2.2. Orszag–Tang MHD Vortex

The 2D vortex problem of Orszag & Tang (1979) has become a standard test for astrophysical MHD codes, and as it has not previously been performed using our version of ZEUS-3D, we present both non-AMR and AMR results here. It is important to note that the same code was used to produce both sets of results: AZEuS is designed to be modular, and by deselecting the "AMR" option at the precompilation step, the code reverts to ZEUS-3D.

For this test, we follow Stone et al. (2008) by initializing a periodic, Cartesian box of size x, y ∈ [0, 1] with initially constant pressure and density, P = 5/12π and ρ = γP = 25/36π, for γ = 5/3. The velocity is initialized to (vx, vy, vz) = (− sin  (2πy), sin  (2πx), 0), and the magnetic field is set through the vector potential Az = (B0/4π)cos  (4πx) + (B0/2π)cos  (2πy), where $B_0 = 1/\sqrt{4\pi }$.

The results for uniform grids with 2562 and 5122 zones at t = 1/2, as well as the AMR results for a base grid of 1282 zones and two levels of refinement (effective resolution of 5122 zones), are presented in Figure 11. The bottom right panel shows the distribution of AMR grids at t = 1/2. For clarity, we have only plotted the grids at level 3 (i.e., two levels higher resolution than the base grid). Even then, the filling factor of level l = 2 grids at this time is ≳ 95%. Examining the first three panels of Figure 11 closely, features are noticeably sharper in the 5122 solution relative to the 2562 results, while the AMR and 5122 solutions are indistinguishable.

Figure 11.

Figure 11. Uniform and adaptive grid solutions for the Orszag–Tang MHD vortex at t = 1/2. Plotted are 20 evenly spaced contours of the gas pressure with range [0.03, 0.50]. Top left: uniform grid solution with 2562 zones; top right: uniform grid solution with 5122 zones; bottom left: AMR solution with a base grid resolution of 1282 and two levels of refinement; and bottom right: distribution of grids at level 3 in the AMR solution.

Standard image High-resolution image

Figure 12 shows slices of the gas pressure as a function of x at t = 1/2 and y = 0.4277, which once again demonstrate that the AMR and 5122 uniform grid solutions are virtually identical. Quantitatively, these solutions compare favorably with those from higher-order codes such as ATHENA (Stone et al. 2008), with the discontinuities in the AZEuS solutions being slightly broader.

Figure 12.

Figure 12. 1D slices of the gas pressure at t = 1/2 and y = 0.4277 in the Orszag–Tang MHD vortex problem. From top to bottom, uniform 2562 grid, uniform 5122 grid, AMR solution with two levels of refinement and an effective resolution of 5122 zones.

Standard image High-resolution image

For this problem, we set ${\cal C} = 0.5$, qcon = 1.0, and qlin = 0.1 for both uniform and adaptive grids. For the AMR results, kcheck = 10, geffcy = 0.9, ibuff = 2, and tolshk = 0.2. Neither the CD nor gradient detector was engaged.

7.2.3. Magnetized Accretion Torus

This test is based on the simulations of Hawley (2000) and Mignone et al. (2007) for a magnetized, constant angular momentum torus in axisymmetric spherical (r, ϑ) coordinates and highlights the use of curvilinear coordinates in AZEuS.

The torus structure is described by the equilibrium condition:

Equation (32)

where C is a constant of integration, ϕ = −1/(r − 1) is the pseudo-Newtonian gravitational potential, and lKep is the Keplerian angular momentum at the pressure maximum. The pressure p is initially related to the density via the polytropic relation, p = κργ, with γ = 5/3. By specifying the location of the pressure maximum (rmax = 4.7) and the inner edge of the torus (rmin = 3), we can determine the value of C and the (hydrodynamic) structure of the torus.

A poloidal magnetic field is initialized in the torus from the φ-component of the vector potential:

where B20 = 2κργmm, βm and ρm are, respectively, the plasma-beta and density at rmax, κ is determined by Equation (32) evaluated at rmax , and ρc = ρm/2 determines the surface of the last vector equipotential. For the simulations presented here, βm = 350 and ρm = 10. The toroidal velocity (vφ) in the torus is initialized to the local Keplerian speed, while the poloidal velocity is set to zero everywhere.

Outside the torus, the magnetic field is zero and we initialize a hydrostatic atmosphere with density and temperature contrasts of ρatmm = 10−4 and Tatm/Tm = 100, respectively, where Tm is the temperature at rmax.

The domain of the grid is r ∈ [1.5, 20] and ϑ ∈ [0, π/2]. We impose reflecting boundary conditions suitable for a rotation axis at ϑ = 0, reflecting/conducting boundary conditions at the equatorial plane (ϑ = π/2), and outflow boundary conditions at r = 20. At r = rin = 1.5, we impose "sink" boundary conditions in an attempt to absorb any material reaching the inner boundary. This involves maintaining the density and pressure at their initial values and setting vr = vϑ = vφ = 0 within the boundary. On the inner skin (r = rin), vr is set to the minimum of zero and a linear extrapolation from the grid. Finally, outflow boundary conditions are applied to the EMFs:

Equation (33)

Values of ${\cal E}_2(r_{\rm in})$ and ${\cal E}_3(r_{\rm in})$ are determined by the CMoC algorithm in AZEuS.

Both the uniform grid and AMR solutions are presented here. For the single-grid calculation, we use 592 uniform radial zones and 256 uniform meridional zones. For the AMR solution, we use a base grid of 296 × 128 zones and allow one level of refinement with a refinement ratio ν = 2, giving the same effective resolution as the uniform grid calculation.

For both calculations, ${\cal C}$ = 0.5, qcon = 1.0, and qlin = 0.1. For AMR, kcheck = 50, geffcy = 0.8, ibuff = 2, tolshk = tolcd = 0.2, and tolgrad = 0.2 is applied to Bϑ. We use the gradient detector to refine on the initial magnetic field configuration (contained entirely within the torus) and the complex field structure that develops later on from the magnetorotational instability (MRI; Balbus & Hawley 1991), since neither is well tracked by the shock and CD detectors.

Following Hawley (2000), we enforce a density floor of 10−3ρ(rin) to prevent the time step from becoming prohibitively small, and we use the internal energy equation to avoid negative pressures. Unlike Hawley (2000), we do not introduce any perturbations on the initial conditions, which slows but does not prevent the onset of MRI.

Figure 13 presents the results of our simulations at t = 300. Evidently and very much unlike the Orszag–Tang vortex, the AMR and uniform grid solutions are visually different, even though they have the same effective resolution. For a pseudo-turbulent, "irreversible" problem such as this, small differences between values in the coarse and fine grids grow exponentially during the simulation and lead to visually different solutions. This is quite unlike the behavior of a "reversible" problem such as the Orszag–Tang vortex, for which small fluctuations grow at worse linearly in time and never manifest as visual differences in the plots. On the other hand, integrated quantities tend to be in better agreement than their detailed distributions. For example, between the uniform grid and AMR solutions, the integrated mass and kinetic energy at t = 300 differ by only 0.9% and 6.5%, respectively. Furthermore, our results are qualitatively similar to Mignone et al. (2007); Figure 13 could easily fit in with their Figure 8 for different Riemann solvers and interpolation schemes.

Figure 13.

Figure 13. "Beard of AZEuS": results of MHD accretion torus simulations in (r, ϑ) coordinates at t = 300, where the vertical axis is the rotation axis. Plotted are contours of poloidal magnetic field (left) and logarithmic density (right). Top panels are for the uniform grid, bottom panels for the AMR solution with one level of refinement. Borders of the adaptive grids are shown with white lines.

Standard image High-resolution image

Figure 14 shows the normalized magnetic field divergence, $ |\nabla \cdot \vec{B} |\, \Delta x / |\vec{B}|$, at the simulation end time, where the maximum value is 1.34 × 10−15, including both physical and adjacent boundary zones. Indeed, the minimum and maximum values for the divergence throughout the simulation lifetime reach −7.392 × 10−15 and 7.396 × 10−15, respectively, demonstrating that the algorithms employed for prolongation and restriction of the magnetic field in AZEuS are capable of maintaining the solenoidal condition to machine round-off, assuming that the initial conditions are also divergence free. It is also worthwhile to note the absence of grid boundary effects in Figure 14, which one might expect if monopoles existed within the boundaries of the fine grids.

Figure 14.

Figure 14. AZEuS results for the normalized magnetic field divergence, $ |\nabla \cdot \vec{B} |\, \Delta x / |\vec{B}|$, in the MHD accretion torus simulation at t = 300. The maximum value of the normalized divergence at this time, including both physical and adjacent boundary zones, is 1.34 × 10−15. Borders of the adaptive grids are shown with white lines.

Standard image High-resolution image

7.3. A 3D Test: Self-gravitational Hydrodynamical Collapse

The last test is the self-gravitational hydrodynamical collapse calculation first presented by Truelove et al. (1997) and Truelove et al. (1998, hereafter T98). At the time of this writing, self-gravity had not been fully implemented in AZEuS, and so we used the successive over-relaxation (SOR) method (Press et al. 1992) as an easy-to-program, albeit slow, stop-gap measure. Since SOR is incompatible with periodic boundary conditions, we apply inflow boundary conditions instead. This results in some subtle differences from T98, which we discuss below.

A rotating, uniform cloud of mass M = 1 M and radius R = 5 × 1016 cm is initialized in the center of a 3D Cartesian box with side length 4R. We use a nearly isothermal equation of state (p = κργ, γ = 1.001), initially uniform rotation Ω = 7.14 × 10−13 rad s−1 with angular momentum axis in the positive x3-direction, and energy ratios of

Equation (34)

where ρ0 and cs are, respectively, the initial density and sound speed of the uniform cloud (T98). The remainder of the computational volume is initialized with uniform density and pressure given by ρatm = 100ρcloud and patm = 10pcloud. Upon the initial uniform density distribution, we apply an azimuthal m = 2 perturbation of the form ρcloud(1 + Acos (2φ)), where A = 10% is the perturbation amplitude and φ is the azimuthal angle relative to the cloud center.

Figure 15.

Figure 15. AZEuS results for the Truelove problem with a 10% amplitude perturbation at t = 0.59808 = 1.2152tff, where tff is the free-fall time. Left: equatorial x1x2 slice of logarithmic density with velocity vectors superposed. The highest resolution shown here is R8192, five levels of refinement above the base grid. Right: equatorial x1x2 slice of logarithmic density of the upper fragment. The highest resolution in this plot is R32768 (six levels) with one additional level of refinement not shown. White lines denote the borders of AMR grids, and the units of density are g cm−3. For each panel, 20 evenly spaced contours are plotted with ranges log ρ = [ − 16.10, −9.905] (left) and [ − 14.30, −9.604] (right).

Standard image High-resolution image

Following T98, we set the coarsest grid to 323 zones and designate it as R8 (meaning that the cloud radius is resolved with eight zones). We immediately add one level of refinement by flagging all zones that have density ρ > ρcloud (for a refinement ratio of 4, this gives 32 zones per cloud radius, or R32). Beyond this, we enforce the so-called Truelove criterion:

Equation (35)

refining zones that have Jeans numbers J larger than critical value Jmax = 0.25. Additional run-time parameters for this test include ${\cal C} = 0.33$, qcon = 1.0, qlin = 0.1, kcheck = 20, geffcy = 0.7, ibuff = 2, and refinement ratio ν = 4.

Figure 15 shows our results at t = 0.59808 = 1.2152tff. At this time, there are seven levels of refinement above the base grid (R131072). Our maximum density at this time is log ρmax = −9.347399, with density measured in g cm−3, an increase over ρ0 of more than eight orders of magnitude. While our simulation collapses more quickly than T98 and our Figure 15 does not correspond exactly with their Figures 12 and 13, we also reach a somewhat lower maximum density.

The differences between our results and T98 are most likely caused by the differing boundary conditions (ours inflow, theirs periodic). Indeed, T98 allude to this possibility, suggesting that non-periodic boundary conditions could slightly increase the rate of collapse, which we observe.

8. SUMMARY

We have described a method for block-based AMR on a fully staggered mesh and implemented this method in a new version of ZEUS-3D called AZEuS. In addition to describing the modifications required to AMR to account for the fully staggered grid, we also describe higher-order interpolation methods for the prolongation step that we found necessary to allow for static grids. Static grids are important for problems that, at first order, have a self-similar character and expand over the course of the simulation to ever larger scale lengths. Such a simulation by AZEuS has already appeared in the literature (Ramsey & Clarke 2011), which showcases the ability of the code to transmit waves of all types and strengths across grid boundaries, and to do so in cylindrical coordinates. The higher-order prolongation operator is designed to maintain the conservation of all important physical quantities such as mass, momentum, energy, and magnetic flux.

Numerous test problems were also presented in 1D, 2D, and 3D, and in both Cartesian and spherical polar coordinates. These tests demonstrate the ability of the code to produce essentially identical results in "reversible" (non-turbulent) problems whether using a single grid or AMR and give an example of the differences that can occur in "irreversible" (turbulent) problems as minute differences caused by the insertion or deletion of a grid amplify.

Finally, the AZEuS Web site http://www.ica.smu.ca/azeus was introduced on which test problems and simulations will be posted as they become available, and from which the code can be downloaded in the near future.

We thank the referee for a careful reading of the manuscript and for pointing out an oversight in the algorithm as described in the original draft. We also thank Marsha Berger for providing her AMR subroutines. This work is supported, in part, by the Natural Sciences and Engineering Research Council (NSERC). Computing resources were provided by ACEnet, which is funded by CFI, ACOA, and the provinces of Nova Scotia, Newfoundland & Labrador, and New Brunswick.

APPENDIX A: CURVILINEAR COORDINATES

Like other codes in the ZEUS family, AZEuS uses the "covariant" (coordinate independent) form of the MHD equations (Stone & Norman 1992a). Supported geometries in AZEuS include Cartesian (x, y, z), cylindrical (z, r, φ), and spherical polar (r, ϑ, φ) coordinates, while other orthogonal curvilinear coordinate systems may be easily implemented as needed. For simplicity, the equations presented in the main body of the paper were all written assuming Cartesian-like coordinates. In this Appendix, we show how these may be rewritten in a covariant fashion.

The distance differential in an orthogonal coordinate system, (x1, x2, x3), is given by

Equation (A1)

where gi, i = 1, 2, 3, are the usual metric scaling factors, all functions of the coordinates. If the scaling factors are separable and independent of their own direction, we can write

Equation (A2)

listed in Table 3 for Cartesian, cylindrical, and spherical polar coordinates.

Table 3. Metric Scaling Factors in AZEuS for Cartesian, Cylindrical, and Polar Coordinates

(x1, x2, x3) g12(j) g13(k) g23(k) g21(i) g31(i) g32(j)
(x, y, z) 1 1 1 1 1 1
(z, r, φ) 1 1 1 1 1 x2(j)
(r, ϑ, φ) 1 1 1 x1(i) x1(i) sin x2(j)

Download table as:  ASCIITypeset image

Face areas and zone volumes important for the calculation of fluxes and conserved quantities are written as

Equation (A3)

Equation (A4)

Equation (A5)

Equation (A6)

Equation (A7)

where metric scaling factors equal to 1 in Table 3 have been and will continue to be dropped.

Finally, ZEUS has traditionally defined the momentum densities, $\vec{s}$, as

Equation (A8)

where the half indices in the density indicate two-point averages. Defining the momentum components with the metric scaling factors simplifies the momentum equation somewhat by eliminating all "Coriolis-like" fictitious forces, leaving only the "centrifugal-like" terms.

A.1. Restriction

A.1.1. Conservative Overwrite

When applying the conservative overwriting procedure on a curvilinear grid, the equations of Section 3.1 must be modified to account for the non-constant volumes of zones. For example, Equation (6) for zone-centered quantities becomes

Equation (A9)

and Equation (7) for face-centered momenta generalizes to

Equation (A10)

where

Equation (A11)

and where

Equation (A12)

While it is still true that the fine zones at α = ±ν/2 are halfway outside the coarse ROI in position space (Figure 3(b)), this is not generally true in volume space. As an example, consider spherical coordinates where the 1-volume differential is dV1(i) = g21(i)g31(i) dx1(i) = x21(i) dx1(i). Clearly, dV1(i) in spherical coordinates is not a linear function of position, and it cannot be assumed that exactly 1/2 of the fine momentum volume is outside the coarse ROI. To correct for this, we calculate the ratio of the half-volume inside the coarse ROI to the actual volume element (Equation (A12)), which is then used as a weighting factor in ${\cal G}^{\prime }(\alpha)$. For reasonable grid parameters, these weighting factors are small corrections (<a few %) relative to the Cartesian factor of 1/2 but nonetheless are included for accuracy.

Suitable expressions for the 2-direction are obtained by a permutation of indices. No corrections are necessary for the 3-direction, since dV3(k) = dx3(k) for the curvilinear coordinates discussed here.

For the magnetic field, Equation (9) changes to account for non-uniform areas:

Equation (A13)

A.1.2. Flux Corrections

Fluxes and EMFs as stored by ZEUS-3D already include the appropriate area and length elements, so the required changes for flux corrections in curvilinear coordinates are not substantial. As with the conservative overwrite, the corrections (e.g., Equation (12)) need to be adjusted by replacing occurrences of ${\cal G}$ (Equation (8)) with ${\cal G}^{\prime }$ (Equation (A11)). Similar to Equation (A10), Equation (11) for the flux corrections of momentum components normal to the boundary must also be modified to account for non-constant volumes:

Equation (A14)

By the same argument, Equation (13) for coarse momenta with flux components parallel to a grid boundary also needs to be modified, as the original factor of $(\nu - 1) / 2\nu \equiv {\cal R}$ is not correct for curvilinear coordinates:

Equation (A15)

Here, ${\cal L}(J,\nu) = W_{2,L}(J,\nu)$ if S2(I, J, K) is at the upper edge of the fine grid (high j), and ${\cal L}(J,\nu) = W_{2,R}(J,\nu)$ if S2(I, J, K) is at the lower edge of the fine grid (low j), with

Like the function ${\cal G}^{\prime }$, ${\cal L}$ accounts for the portion of the coarse zone flux in volume space that is being replaced by fine fluxes. As before, expressions for the 2-direction are obtained by a suitable permutation of indices.

A.2. Prolongation

The changes required for prolongation on curvilinear grids deal entirely with making the interpolations conservative for curvilinear volumes and areas. In the case of 1D PPI, Equation (16) summarizing the conservation constraint is modified to

Equation (A16)

which then affects the rest of the scheme (Equations (17) and (18)):

Equation (A17)

where

As for PLI, the original 1D scheme in the 1-direction takes the form (van Leer 1977)

Equation (A18)

where

and where

Equation (A18) will not generally conserve mass, momentum, or magnetic flux on a curvilinear grid. To correct this, we relax the constraint that the linear interpolation profile must pass through Q(I) at the zone center. This releases one degree of freedom that can then be used with Equation (A16), resulting in

Equation (A19)

where

The additional term in Equation (A19) can be viewed either as a shift in the zone-centered intercept or as choosing a modified value of ζ corresponding to the volume-centered rather than the spatial-centered coordinate.

Unfortunately, this "shift" can push q*1(i + α) beyond neighboring values of Q(I) at the edges of the interpolation profile, resulting in a loss of monotonicity. However, since ζ = 0 or 1 at the left or right side of the interpolation profile, we can write

Equation (A20)

where ${\cal K}_1^{\prime } = f_3^{\prime }(\nu,i)\, / \, \Delta V_1(I)$. If we limit the slope of the interpolation profile to

Equation (A21)

and, because of the properties of the PLI slope ΔQ', the first two cases of Equation (A21) will never occur simultaneously. Thus, the equation for conservative, monotonic, 1D PLI in curvilinear coordinates is

Equation (A22)

The previous discussion applies to interpolation of momenta in the directions perpendicular to the component normal (e.g., s1 in the 2- and 3-directions). The covariant procedure for linear interpolation in between coarse faces (e.g., s1 in the 1-direction; Equation (24)) is as follows:

Equation (A23)

Finally, the generalized Li & Li (2004) algorithm is adapted to curvilinear coordinates simply by replacing $\vec{B}$ (and $\vec{b}$) in Equations (25)–(28) with the magnetic "flux functions":

Equation (A24)

With this modification, the solenoidal condition can be written in "Cartesian-like" form, regardless of the geometry:

and the prolongation of magnetic field in curvilinear coordinates proceeds exactly as described in Section 4.1.

APPENDIX B: THE VECTOR POTENTIAL

Writing $\vec{B} = \nabla \times \vec{A}$ and assuming 3-symmetry with an appropriate gauge, one can easily show from the induction equation (Equation (3)) that A3 obeys an "advection equation":

Equation (B1)

from which the poloidal components of the magnetic field are given by

Equation (B2)

Further, one can show that B3 is given by

Equation (B3)

Since Equation (B3) has exactly the same form as the internal energy equation (Equation (4)), and since Equation (B1) is a simple advection equation, the induction step in the original ZEUS code (zeus04; Clarke 1988) was based on solving these equations using the hydrodynamical algorithms already in the code and then calculating B1 and B2 from Equations (B2). Evidently, the solenoid condition is strictly satisfied. Regardless of the initial magnetic field configuration, it is easy to show that a face-centered $\vec{B}$ and a corner-centered (edge-centered in 3D) A3 guarantee $\nabla \cdot \vec{B}=0$ everywhere and at all times to machine round-off error.

However, Clarke (1988) points out that a second-order accurate A3 means first-order accurate poloidal magnetic field components and a zeroth-order accurate current density J3 (each differentiation reduces the order of accuracy by one), and this was found to have catastrophic consequences in computing the $\vec{J} \times \vec{B}$ source terms in the momentum equation (Equation (2)). Thus, the vector potential algorithm in zeus04 was abandoned, and the first publicly released version of ZEUS-2D (Stone & Norman 1992a, 1992b) and later ZEUS-3D (Clarke 1996) were based on the CT algorithm of Evans & Hawley (1988) in which the magnetic field is updated directly. Note that the CT scheme conditionally satisfies the solenoidal condition, requiring that the magnetic field be initialized such that $\nabla \cdot \vec{B}=0$.

Still, the failure of the vector potential algorithm in zeus04 is not a complete indictment of $\vec{A}$ for use in numerical MHD algorithms. Indeed, Londrillo & Del Zanna (2000) and Igumenshchev & Narayan (2002) have successfully demonstrated the use of $\vec{A}$ as the primary magnetic variable in their MHD codes. By substituting $\vec{B} = \nabla \times \vec{A}$ into Equation (3) and with an appropriate gauge, we can write

Equation (B4)

Thus, CT can be used as originally designed in which $\nabla \times \vec{E}$ is used to update $\vec{B}$, or easily modified to use $\vec{E}$ to update $\vec{A}$ directly and then update $\vec{B}$ by taking a curl of the updated $\vec{A}$. Either way, a curl must be taken and the algorithms are interchangeable to machine round-off error. Based as they are on such a modified CT scheme, the vector potential algorithms used by Londrillo & Del Zanna (2000) and Igumenshchev & Narayan (2002) are very different from the failed algorithm described for zeus04, showing none of the effects of the inaccurate current density.

Based on this observation, preliminary versions of AZEuS used the vector potential as the primary magnetic variable so that prolongation could be accomplished by interpolating $\vec{A}$ (rather than $\vec{B}$), thus guaranteeing preservation of the solenoidal condition on a newly created fine grid or in a fine boundary region. Furthermore, because the vector potential conserves magnetic flux via a path integral ($\oint \vec{A}\cdot d\vec{l} = \int \vec{B}\cdot d\vec{\sigma }$), restricting $\vec{A}$ and then calculating $\vec{B}$ means that no EMF corrections are required at adjacent boundaries. This approach, however, was found to be unsatisfactory since the parabolic interpolation function generated by PPI on $\vec{A}$ produces piecewise linear profiles for $\vec{B}$ and piecewise constant profiles for $\vec{J}$, recovering the problem that doomed the original zeus04 algorithm.

In addition, having to match gauges on overlapping grids poses a significant problem, and one that we never solved. In order to arrive at Equation (B4), one implicitly assumes a specific gauge. For a single grid, this is not a problem since there is never a need to specify this gauge. For multiple grids, however, each grid may have its own gauge (especially for grids whose origins are not coincident), and leaving them unspecified gives rise to discontinuities in the perpendicular components of the magnetic field at adjacent boundaries. While a solution to this problem likely exists, we abandoned vector potentials in AZEuS before finding one because of the insurmountable problem of the lack of accuracy in the current densities.

As an illustration, Figure 16 shows early results of the simulations in Ramsey & Clarke (2011) in which the vector potential is used as the primary magnetic variable. The left panel shows the solution immediately before a grid modification, and the right panel shows the solution a few time steps after and after the fine grid was extended from x1 = 160 to x1 = 166. The errors committed by the piecewise constant current densities take a while to dissipate and, in this particular example, result in particularly egregious defects in the velocity divergence distribution within the new portion of the grid. Conversely, the Li & Li (2004) algorithm we currently employ renders adjacent boundaries virtually invisible in the distributions of all variables.

Figure 16.

Figure 16. Effects of differencing a parabolic interpolation of $\vec{A}$ twice to calculate $\vec{J}\times \vec{B}$ forces. Left panel: the solution immediately before a grid adaptation step. Right panel: the solution a few time steps after. Plotted are 20 evenly spaced contours of the toroidal magnetic field (top) and velocity divergence (bottom) with ranges Bφ = [ − 0.035, 0.0] and $\nabla \cdot \vec{v} = [-0.15, 0.15]$, respectively.

Standard image High-resolution image

APPENDIX C: THE EFFECTS OF A MONOPOLE IN THE BOUNDARY

Since AZEuS is vulnerable to boundary pollution (Section 5), we must take care that values in the self-computed boundaries of AMR grids are as free from non-physical phenomena (e.g., monopoles) as the grid itself. To demonstrate this, Figure 17 presents the results from a simulation with initially uniform and quiescent conditions $(\rho, p, \vec{v}, B_1, B_2, B_3) = (1, 0.6, 0, 0, 1, 0)$, where a static grid with corners [ ± 0.2, ±0.2] is positioned in the center of a Cartesian domain (x1, x2) ∈ [ − 0.5, 0.5]. A single "field defect" ($\vec{B} = 2B_{2}\hat{x}_2; \nabla \cdot \vec{B}\, \Delta x_2/B_2= \pm 1$) is deliberately placed in the left boundary of the static grid at x2 = 0 and t = 0. This field defect persists only for a single fine time step before the boundaries are replaced by data prolonged from the underlying coarse values in the manner described in Section 4. Other parameters used in this simulation include a refinement ratio of ν = 2, γ = 5/3, ${\cal C} = 0.5$, qcon = 1.0, and qlin = 0.1 (as defined in Table 1). The base grid has a resolution of 200 × 200 zones, and all physical boundaries are set to outflow conditions.

Figure 17.

Figure 17. Results of placing a "field defect" at x2 = 0 in the left boundary of a static grid for a single fine time step. Plotted are contours of velocity divergence (left) and normalized magnetic field divergence (right). The static grid boundaries are shown as a solid white line, and the simulation is depicted at t = 0.17.

Standard image High-resolution image

Although the field defect is only present for a single fine time step, a fast magnetosonic wave is still launched from the boundary of the fine grid, propagating into both fine and coarse grids. All deviations from quiescence result from the momentary presence of the monopole in the boundary, leading to what is clearly an unacceptable result. And yet, $\nabla \cdot \vec{B} = 0$ to within machine round-off error everywhere on the active grid at all times (e.g., Figure 17, right), and additionally within the boundaries after the first fine time step. Therefore, the magnetic field prolongation and restriction operators in AZEuS are designed to preserve magnetic divergence to machine round-off error in both the active grid and the boundaries at all times.

APPENDIX D: SCHEMATIC OVERVIEW OF THE AMR MODULE

This Appendix is designed mainly for programmers and those who may wish to use and/or modify AZEuS. It is meant as an overview to illustrate how the main ideas covered in this paper have been implemented in the code.

Step 0.Initialise computational domain and all variables for the current run. Set level lvl = 1, ntogo(lvl) = 1. MAIN LOOP:
Step 1.For level lvl, call REGRID(lvl) if kcheck cycles have transpired at level lvl since the last call to REGRID, or if t = 0. For l = maxlevel - 1, lvl, -1:
Step 2.For level lvl, call ADVANCE(lvl, dt).
Step 3.One time step at level lvl is complete; check for levels > lvl. Set ntogo(lvl) = ntogo(lvl) - 1.
Step 4.For level lvl, call UPDATE(lvl). For each grid m at level lvl:
Step 5.One entire AMR cycle is complete. Reconcile time steps across all grids and levels.
Step 6.Perform any required input/output.
Step 7.If t < tlimit, go to the top of the main loop, else exit.

Footnotes

  • In units where μ0 = 1.

  • While a coarse zone is always divided in each direction into ν fine zones, a coarse time step is not necessarily divided into ν fine time steps; additional fine time steps are taken if local CFL conditions demand it. For simplicity of description, however, we shall proceed as though n = νN, though the reader should be aware that this may not always be true.

  • Strictly speaking, this is not a flux because of the factor Δt. However, for the purposes of accounting, we find it advantageous to define the fluxes with the time steps embedded.

  • Similar to the hydrodynamical fluxes, we define the EMFs with the factor Δt embedded to simplify the accounting.

  • For example, the transverse (longitudinal) EMFs for the 1-boundary are ε2 and ε31).

Please wait… references are loading.
10.1088/0067-0049/199/1/13