# High-Order Compact Implicit Difference Methods For Parabolic Equations  in Geodynamo Simulation

Authors: Don Liu; Weijia Kuang; Andrew Tangborn
Journal: Advances in Mathematical Physics
 (2009)

---

## Abstract

A series of compact implicit schemes of fourth and sixth orders are developed for solving differential equations involved in geodynamics simulations. Three illustrative examples are described to demonstrate that high-order convergence rates are achieved while good efficiency in terms of fewer grid points is maintained. This study shows that high-order
compact implicit difference methods provide high flexibility and good convergence in solving some special differential equations on nonuniform grids.


---

## Body

## 1. Introduction

As one of the earliest and most commonly used numerical methods for computing discrete solutions of differential equations, finite-difference methods are based on the Taylor series expansion on a set of grids, most commonly, a set of uniformly spaced grids. The advantages of finite-difference methods lie in two aspects. They are simple in formulation and implementation, and they are highly scalable. However, one of the disadvantages is that large stencils are usually required when high-order accuracy is stipulated. In addition, the nominal order of accuracy may not be maintained, and often it decreases when nonuniform grids are used in discretization.Much development has been achieved in finite-difference methods. A number of papers related to various finite-difference algorithms have been published over the past decades. Kreiss [1] was among the first who pioneered the research on compact implicit methods. Hirsh [2] developed and applied a fourth-order compact scheme to Burgers' equation in fluid mechanics. Adam [3] developed fourth-order compact schemes for parabolic equations on uniform grids. Hoffman [4] studied the truncation errors of the centered finite-difference method on both uniform and nonuniform grids and discussed the accuracy of these schemes after applying grid transformations. Dennis and Hudson [5] studied a fourth-order compact scheme to approximate Navier-Stokes-type operators. Rai and Moin [6] presented several finite-difference solutions for an incompressible turbulence channel flow. They also compared their solutions of high-order upwind schemes with solutions obtained from spectral methods. Their work demonstrated that finite-difference methods can be a good approach for the direct numerical simulation of turbulence. Lele [7] demonstrated the spectral-like resolution of the classical Padé schemes and the flexibility of compact finite-difference methods. He developed compact difference methods for mid-point interpolation and filtering with high-order formal accuracy. Yu et al. [8] solved an unsteady 2D Euler equation with a sixth-order compact difference scheme in space and a fourth-order Runge-Kutta scheme in time, which provide a good example of high-order (both spatial and temporal) finite-difference methods. Mahesh [9] presented high-order compact schemes with both the first and second order derivatives evaluated simultaneously. Gamet et al. [10] developed a fourth-order compact scheme for approximating the first-order derivative with a full inclusion of metrics directly on a nonuniform mesh with variable grid spacing. Using this method, a direct numerical simulation of a compressible turbulent channel flow was conducted. Dai and Nassar [11, 12] developed high-order compact difference schemes for high-order derivatives in time and space in solving a 3D heat transport problem at the microscale. Sun and Zhang [13] proposed a new high-order finite-difference discretizaion strategy based on the Richardson extrapolation technique and on an operator interpolation scheme for solving one- and two-dimensional convection-diffusion equations.There are several numerical models developed over the past 15 years to describe the origin of the geomagnetism, that is, the observed geomagnetic field is generated and maintained by (strongly turbulent) convective flow in the Earth's liquid outer core (geodynamo theory). In these models, Navier-Stokes-type partial differential equations (PDEs) for rapidly rotating, magnetohydrodynamic (MHD) systems are solved via various numerical schemes. The physical systems are in general three-dimensional. In the earliest approach, pseudospectral algorithms are used to solve the PDES in the spatial domain [14]. While this approach is efficient for shared-memory computing systems, it is not very scalable for distributive computing systems. Later, finite-difference algorithms are then employed on the grid points along the radius (of the spherical coordinate system), while spectral algorithms are used on different spherical surfaces that are defined by the radial grid points [15]. More recently, finite-elements algorithms are used to solve the dynamo problems in the spatial domain [16].However, the finite-difference algorithms in numerical geodynamo simulation need to be considered carefully due to the boundary layers developed in the fluid core. Because of the rapid rotation, the fluid viscosity in the reference frame corotating with the fluid is very small. In general, the viscous effect in the nondimensionalized equations is defined by the Ekman numberE, which can be very small E≪1 (e.g., in the Earth's core, E≈10-15). Consequently, boundary layers of the thickness δ≈E1/2 develop in the system (e.g., Greenspan [17], Kuang and Bloxham [15]). This type of boundary layers, often called the Ekman layer in rotating fluid mechanics, is common in all dynamo simulation. To resolve the boundary layers, often second-order and fourth-order finite-difference schemes are used with varying grid sizes for computational efficiency and convergence of numerical solutions [15]. Could higher order finite-difference algorithms be used to improve numerical accuracy and computational efficiency?The objective of this paper is to develop sixth-order compact implicit schemes for solving parabolic equations in geodynamo simulations as in [15, 18]. These compact implicit schemes are constructed of three piecewise nonuniform grids to achieve flexibility and efficiency in discretization. The purpose is to advance compact schemes to handle complex geometries with high-order accuracy. This will help to increase the convergence rate in geodynamo models, which are among the most computationally challenging simulations to date. The specific objective of this research is to acquire compact difference schemes of sixth-order accuracy on piecewise nonuniform grids for the differential equations involved in the geodynamo model [15, 18] in the radial direction.In this paper, we intend to develop sixth-order compact implicit schemes with both the Jacobian transformation (JTr) and the full inclusion of metrics (FIM) on nonuniform grids. We also describe a new method which combines these two approaches. These methods demonstrate high-order accuracy and fast convergence rates in the numerical solutions. In addition, we wish to show the ability of resolving a thin boundary layer with fewer grid points than the traditional finite-difference schemes with the same or a higher order of accuracy. To be efficient in spatial discretization, zeros of Chebyshev polynomials are adopted as the grid points for computation [19], although other options for nonuniform grids were also explored.The outline of this paper is as follows. We first show that compact implicit schemes combined with nonuniform grids are able to fully resolve the thin boundary layers arising in geo-dynamo simulations with fourth- and sixth-order accuracy. The differential equation here describes a boundary layer profile and is essentially a two-point boundary value problem. The computational interval is discretized via a nonuniform mesh so as to improve the efficiency in spatial resolution. Secondly, we demonstrate the reliability of these schemes subject to different boundary layers, that is, different boundary conditions. A similar order of accuracy and rate of convergence are obtained with Neumann and Robin boundary conditions. Finally, a series of parabolic equations from a geodynamo model [15, 18] is studied using the compact implicit schemes developed earlier in this paper. A combination of the full inclusion of metrics on a nonuniform grid and the Jacobian transformation is proposed and tested. The convergence rate and accuracy order are studied and compared. The full inclusion of metrics on a nonuniform grid is a good alternative approach to solving certain kinds of differential equations when a Jacobian transformation is not applicable. Based on numerical experiments in this paper, it is found that for different parameters in the governing equation, the best convergence rate is achieved with slightly different compact implicit schemes, that is, different linear combinations of neighboring values. This research demonstrates the flexibility and potential of high-order finite-difference methods on nonuniform grids.


## 2. Mathematical Problems from Geodynamo Simulation

In Kuang and Bloxham's geodynamo simulation model [15, 18], spherical coordinates are used and r is the dimensionless radius. The toroidal and poloidal components of the magnetic field B and velocity V (in the Earth's fluid outer core) are expanded in terms of spherical harmonics along the spherical surface. The coefficients of the spherical harmonic expansion for the magnetic and velocity field become functions of time and the radial distance from the center of the Earth. These coefficients, denoted by ϕ, satisfy the following generic second order parabolic partial differential equation:
(2.1)∂ϕ∂t-ϵ∂2ϕ∂r2+L(L+1)r2ϕ=f,
where L is the degree of the spherical harmonic functions, f is the source term, and r is the nondimensional distance measured from the center of the Earth (scaled by the mean radius at the core-mantle boundary). Along the radial direction, based on the structural characteristics and the electromagnetic properties, the domain is divided into three major subdomains: the inner core (r0≤r<ri), the outer core (ri≤r≤1), and the D′′ layer (1<r≤rd). The innermost radius r0 is sufficiently small such that asymptotic conditions can be employed. The dimensionless radii ri and rd are at the inner core boundary and at the top of the D′′ layer, respectively. A variety of boundary conditions, such as Dirichlet, Neumann, and Robin type, are specified at the boundaries between the subdomains. These boundaries contain large gradients of the state variables and serve as the bridges between the unknown state variables in different subdomains along the radial direction. These large gradients are the characteristics of the boundary layers. Therefore, an accurate understanding of these gradients and also the profiles of the boundary layers is vital to geodynamic simulations.Because a boundary layer is usually one or two orders of magnitude smaller than the typical length scale of the geometry under investigation, the velocity gradients in shear stress or the temperature gradients in heat flux inside a boundary layer are one or two orders of magnitude larger. Consequently the profile of the boundary layers is of great importance in fluid dynamics, heat transfer, and especially computational geodynamo simulations where large values of velocity, and temperature gradients occur at the inner-outer core boundary (dimensionless radius about 0.3) and the core-mantle boundary (dimensionless radius 1). Therefore, numerical solutions of boundary layer problems and reliable predictions of the thermal gradient and shear stress in boundary layers are vital in predicting thermal load, hydraulic pressure drop, velocity and temperature distributions. In addition, an efficient and reliable resolution of a boundary layer is central to the entire simulation since a boundary layer contains the most important information and also it propogates the information into the interior domain. Usually a boundary layer is the obstacle for high-order accuracy and numerical stability in a time-dependent problem [12, 18].


### 2.1. Compact Difference Methods on Nonuniform Grids

Nonuniform grids are commonly used in modeling when large gradients are expected, local details are desired, or complex geometries are encountered. Previous research work by Hirt and Ramshaw [20] and Roache [21] demonstrated that the finite-difference approximation on a nonuniform grid has lower order of formal accuracy than on a uniform grid.Generally speaking, two different approaches are commonly used to implement compact finite-difference methods on nonuniform grids. The first is called the Jacobian Transformation (JTr), which involves mapping a nonuniform grid to a uniform grid by means of a Jacobian transformation (described in Section2.2) and calculating derivatives on the uniform grid to maintain formal accuracy. finite-difference approximations are therefore constructed on the equidistant grid in the transformed space. For this reason, the overall accuracy depends strongly on the transformation, according to Hoffman [4]. One advantage of JTr is that schemes for approximating high-order derivatives are relatively easy to derive. Another advantage is that JTr promises formal accuracy provided that the transformation is continuous and smooth. The disadvantages of JTr come in two aspects. First, sometimes the transformed equations are even more complicated to solve than the original equations. Second, some transformations can give rise to loss of information at certain locations [10] and result in some computational errors.The other approach is called Fully Integrated Metrics or Fully Included Metrics (FIMs). With the FIM, discretization of a differential equation and evaluation of derivatives are performed directly on a nonuniform grid based on the Taylor series expansion (see Lele [7]). One advantage of the FIM method is that it is straightforward and does not need to transform the equation from one space to another. Another advantage is that it is a reliable alternative when the JTr does not work well. However, a major disadvantage of the FIM is that the approximations implemented on a nonuniform grid do not yield the nominal order of accuracy that can be achieved on an equidistant grid. Therefore the accuracy of the FIM is not guaranteed. Another disadvantage is that high-order schemes on a nonuniform grid are difficult to derive, especially when a large stencil is involved.


### 2.2. Benchmark Problem 1

Equation (2.1) describes the time evolution of the coefficients of the spherical harmonic expansions for both the magnetic and velocity fields. To mimic the time-stationary solutions of (2.1) on a nonuniform grid, we need to consider a steady state problem. In addition, to study the profile of a thin boundary layer and to resolve the large gradient inside it, local high resolution is necessary. To demonstrate the ability to fully resolve a boundary layer, a two-point boundary value problem as in what follows is studied,
(2.2)ϵ∂2ϕ∂r2+∂ϕ∂r=r+ϵ,r0≤r≤1,r0=0.3,
subject to the Dirichlet boundary conditions: ϕ=0 at both r=r0 and r=1. This differential equation describes the profile of a velocity boundary layer. The exact solution of this problem is available for comparison and error analysis. In this problem, r is the distance from the origin measured in a nonuniform scale. To avoid potential confusion in notation, r0 is used instead of ri for the radius at the inner-outer core boundary and ϵ is the controlling parameter for the thickness of the boundary layer. The smaller the ϵ, the thinner the boundary layer. The range of ϵ in this study is from 0.5 to 0.002.To provide enough resolution and to keep the linear system of manageable size as in the geodynamo simulation [15, 22], the zeros of Chebyshev polynomials were ultimately chosen as the grid points to discretize the interval between the inner-outer core boundary (r=r0) and the core-mantle boundary (r=1), although other options of nonuniform grids were also attempted. Using the JTr to solve this problem, a nonlinear and smooth transformation was created to map the nonuniform grid into a uniform grid on which high-order compact implicit schemes were developed. This mapping from the nonuniform grid r∈[r0,1] to a uniform grid x∈[0,π] is given as
(2.3)r=1-r02cos(x+π)+1+r02.
Via this mapping, ϕ is an indirect function of x. This is why we kept the partial differentiation symbols in (2.2). The Jacobian of this transformation is
(2.4)J=drdx=(r0-1)sin(x+π)2=(1-r0)sin(x)2.
A straightforward way of solving (2.2) is to express ∂ϕ/∂r and ∂2ϕ/∂r2 as the derivatives with respect to x via the Jacobian:
(2.5)∂ϕ∂r=1J∂ϕ∂x=2(1-r0)sin(x)∂ϕ∂x,(2.6)∂2ϕ∂r2=4(1-r0)2sin2(x)∂2ϕ∂x2-4cos(x)(1-r0)2sin3(x)∂ϕ∂x.
Then substitute (2.5), (2.6), and (2.3) into (2.2) to obtain
(2.7)∂2ϕ∂x2+ξ∂ϕ∂x=η,
where ξ and η are functions of x only. Next we use implicit Padé approximations for ∂2ϕ/∂x2 and ∂ϕ/∂x to solve for (ϕ, ∂ϕ/∂x), or alternatively, (ϕ, ∂2ϕ/∂x2).However, in geodynamo models,∂ϕ/∂r is needed in other computations. Instead of solving (ϕ, ∂ϕ/∂x), we need to solve (ϕ, ∂ϕ/∂r) in the following way. First we let u=∂ϕ/∂r, as in (2.5), and then we express ∂2ϕ/∂r2 as the first-order derivative of u with respect to x:
(2.8)∂2ϕ∂r2=1J∂u∂x=2(1-r0)sin(x)∂u∂x.
Substituting (2.8) into (2.2), the original second-order equation becomes the first-order equation:
(2.9)∂u∂x=(1-r0)sin(x)2ϵ(r+ϵ-u).
We rearrange (2.5) into
(2.10)∂ϕ∂x=(1-r0)sin(x)2u.
Therefore two first-order differential equations (2.9) and (2.10) form a linear system in terms of the state variables (ϕ, u), where u=∂ϕ/∂r. Both (2.9) and (2.10) can be approximated with the same Padé schemes. The following fourth- and sixth-order compact implicit schemes were designed to solve the aforementioned linear system.For the interior grids, a fourth-order scheme consisting of a 3-point stencil is(2.11)ϕi+1′+4ϕi′+ϕi-1′=3(ϕi+1-ϕi-1)Δx,
where the derivative ϕi′ is with respect to x at the grid point xi. An alternative choice is
(2.12)9ϕi+1′-3ϕi-1′=(2ϕi+2+9ϕi+1-18ϕi+7ϕi-1)Δx.
However, within the boundary layer, ϕ is almost 0, but ϕ′ is large, therefore it is constructive to use more information from ϕ′. For this reason, (2.11) is slightly better.Similarly, for the interior grids, a sixth-order scheme with a 5-point stencil is(2.13)-ϕi+2′+34ϕi-1′+114ϕi′+34ϕi-1′-ϕi-2′=90(ϕi+1-ϕi-1)Δx.The advantage of this scheme is that it gives rise to a diagonally dominant linear system, which is theoretically nonsingular. As to the indexing of the state variables,u and ϕ were arranged alternatily in the sequence u1,ϕ1,u2,ϕ2,…, to reduce the bandwidth of the matrix.It is a common practice to use schemes of one order lower in accuracy for the boundary points than for the interior points. However, in order to resolve the thin boundary layer with high-order accuracy, we maintain the same truncation order. At the two-end points, the following fourth-order compact schemes were used to approximate the first-order derivative:(2.14)6ϕi′+18ϕi+1′=-17ϕi+9ϕi+1+9ϕi+2-ϕi+3Δx,ϕi-2′-5ϕi-1′+19ϕi′+9ϕi+1′=-24ϕi+24ϕi+1Δx.Correspondingly, the sixth-order schemes for the end points,1,2,N, and N+1 were derived. As the spatial resolution increases, values in adjacent rows near the end points become close. This causes the matrix to be close to ill-conditioned and therefore it is difficult to invert. To avoid catastrophic cancellation in partial pivoting, different schemes were used for adjacent points near the end points. At point 1, (2.15) was used to approximate the derivative in (2.9):
(2.15)3ϕ1′+27ϕ2′+27ϕ3′+3ϕ4′=-11ϕ1-27ϕ2+27ϕ3+11ϕ4Δx.
At point 2, (2.16) was used for the derivatives in (2.9) and (2.10):
(2.16)12ϕ1′+96ϕ2′+72ϕ3′=-43ϕ1-80ϕ2+108ϕ3+16ϕ4-ϕ5Δx.
At point N, (2.17) was used for the derivatives in (2.9) and (2.10):
(2.17)72ϕN-1′+96ϕN′+12ϕN+1′=ϕN-3-16ϕN-2-108ϕN-1+80ϕN+43ϕN+1Δx.
At point N+1, (2.18) was used for the derivative in (2.9):
(2.18)3ϕN-2′+27ϕN-1′+27ϕN′+3ϕN+1′=11ϕN-2+27ϕN-1-27ϕN-11ϕN+1Δx.Figure1(a) shows three sets of solutions: the exact solution and the approximate solutions from the sixth- and fourth-order compact schemes. No visible difference is observed at this scale. On the left is a thin boundary layer with a velocity gradient about two orders of magnitude larger than the solution itself. On the right is a laminar boundary layer with a mild velocity gradient. Figure 1(b) presents the solution errors (exact solution-approximate solution) in the sixth- and fourth-order compact schemes. Even though there is a large velocity gradient inside the thin boundary layer at the left end, both schemes are able to capture the characteristics of the boundary layer, with the error in the sixth-order scheme reduced to about 1/6 of that in the fourth-order approximation.(a) Solutions of the benchmark problem 1. (b) Solution errors of the sixth- and fourth-order compact schemes. The total grid points wereN=100 and the parameter was ϵ=0.01.
(a)(b)Figure2 shows the convergence rates of the fourth-order compact scheme for ϵ=0.01 and ϵ=0.002. The convergence rate was calculated from the ratio of the logarithm of the L2 norm of an error (either in the solution or the solution's derivative) and the logarithm of the number of grid points, using the data points after an initial transient region in the plot. On the left is the logarithm of the L2 norm of the solution error versus the logarithm of the number of grid points; on the right is the logarithm of the L2 norm of the error in the derivative of the solution versus the logarithm of the number of grid points. Beyond a threshold of N=40, the convergence rates for the solution ϕ are 4.1 at ϵ=0.01 and 3.9 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 3.7 and 3.5, respectively.Comparisons of convergence rates of the fourth-order compact schemes for problem 1 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)Figure3 presents the convergence rate of the sixth-order compact scheme for ϵ=0.01 and ϵ=0.002. The left plot is the logarithm of the L2 norm of the error in solution versus the logarithm of the number of grid points. The right plot is the logarithm of the L2 norm of the error in the derivative of the solution versus the logarithm of the number of grid points. Beyond a threshold of N=40, the convergence rates for the solution ϕ are 6.5 at ϵ=0.01 and 6.0 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 5.8 and 6.0, respectively.Comparisons of convergence rates of the sixth-order compact schemes for problem 1 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)Error analysis indicates that at low-to-medium resolution, that is, about 50 to 250 grid points, as in Figure1(b), the errors for both ϕ and ∂ϕ/∂r are mainly uniformly distributed over all grids. However, at higher resolution with the number of grid points over 1000, the leading error shifts into the thin boundary layer at the left end. To enhance the local resolution for the derivative in the thin boundary layer, more points within the stencil should be included. For example, for a sixth-order scheme with a 5-point stencil, to enhance the resolution for the derivative of ϕ, it would be helpful to use up to 5 points in approximating ∂ϕ/∂r, as opposed to (2.15) and (2.16).


### 2.3. Benchmark Problem 2

The general form of a solution is determined by the governing differential equation. However, specific types of boundary conditions also influence the solution of a given problem. To explore the numerical solution of a similar problem as in the previous section, but with different boundary conditions, we modify (2.2) slightly:
(2.19)ϵ∂2ϕ∂r2+∂ϕ∂r=1+ϵ,r0≤r≤1,r0=0.3,
subject to a Dirichlet boundary condition ϕ=0 at r=r0 and a Robin boundary condition ∂ϕ/∂r+ϕ=0 at r=1. The exact solution of this problem is also available for comparison and error analysis. The Robin (also called natural) boundary condition at r=1 is numerically weaker than a Dirichlet condition because it imposes less restriction on the solution itself. Because of this change in the boundary condition, the profile of the solution changes accordingly. We use the JTr method, keep the same discretization and the compact difference schemes as in Section 2.2.Figure4(a) shows the exact solution and the sixth-order approximate solution of the problem in (2.19) with Dirichlet and Robin boundary conditions. Due to the weak boundary condition at the right end point, the solution at this point is a finite-value instead of being zero. The boundary condition is somewhat like a slip boundary condition, which causes the solution to depend on ϵ at the right end point. Figure 4(b) presents the error of the approximate solution from the sixth-order compact scheme. The leading error is still in the thin boundary layer near the left end point. Except for the left boundary layer, the error is basically uniformly distributed over the interval.(a) Solutions of the benchmark problem 2. (b) The solution error of the sixth-order compact scheme. The resolution was set atN=100 and the parameter was ϵ=0.01.
(a)(b)Figure5 presents the convergence rate of the sixth-order compact scheme for ϵ=0.01 and ϵ=0.002 in terms of the L2 norm of the error for ϕ (left panel) and ∂ϕ/∂r (right panel). After a transient region, the convergence rates for the solution ϕ are 6.8 at ϵ=0.01 and 7.2 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 5.6 and 6.0, respectively.Comparisons of convergence rates of the sixth-order compact schemes for the problem 2 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)These two examples demonstrate that the proposed compact implicit schemes are able to fully capture the characteristics of these boundary layer problems with the projected order of accuracies under strong- and weak-boundary conditions.


## 2.1. Compact Difference Methods on Nonuniform Grids

Nonuniform grids are commonly used in modeling when large gradients are expected, local details are desired, or complex geometries are encountered. Previous research work by Hirt and Ramshaw [20] and Roache [21] demonstrated that the finite-difference approximation on a nonuniform grid has lower order of formal accuracy than on a uniform grid.Generally speaking, two different approaches are commonly used to implement compact finite-difference methods on nonuniform grids. The first is called the Jacobian Transformation (JTr), which involves mapping a nonuniform grid to a uniform grid by means of a Jacobian transformation (described in Section2.2) and calculating derivatives on the uniform grid to maintain formal accuracy. finite-difference approximations are therefore constructed on the equidistant grid in the transformed space. For this reason, the overall accuracy depends strongly on the transformation, according to Hoffman [4]. One advantage of JTr is that schemes for approximating high-order derivatives are relatively easy to derive. Another advantage is that JTr promises formal accuracy provided that the transformation is continuous and smooth. The disadvantages of JTr come in two aspects. First, sometimes the transformed equations are even more complicated to solve than the original equations. Second, some transformations can give rise to loss of information at certain locations [10] and result in some computational errors.The other approach is called Fully Integrated Metrics or Fully Included Metrics (FIMs). With the FIM, discretization of a differential equation and evaluation of derivatives are performed directly on a nonuniform grid based on the Taylor series expansion (see Lele [7]). One advantage of the FIM method is that it is straightforward and does not need to transform the equation from one space to another. Another advantage is that it is a reliable alternative when the JTr does not work well. However, a major disadvantage of the FIM is that the approximations implemented on a nonuniform grid do not yield the nominal order of accuracy that can be achieved on an equidistant grid. Therefore the accuracy of the FIM is not guaranteed. Another disadvantage is that high-order schemes on a nonuniform grid are difficult to derive, especially when a large stencil is involved.


## 2.2. Benchmark Problem 1

Equation (2.1) describes the time evolution of the coefficients of the spherical harmonic expansions for both the magnetic and velocity fields. To mimic the time-stationary solutions of (2.1) on a nonuniform grid, we need to consider a steady state problem. In addition, to study the profile of a thin boundary layer and to resolve the large gradient inside it, local high resolution is necessary. To demonstrate the ability to fully resolve a boundary layer, a two-point boundary value problem as in what follows is studied,
(2.2)ϵ∂2ϕ∂r2+∂ϕ∂r=r+ϵ,r0≤r≤1,r0=0.3,
subject to the Dirichlet boundary conditions: ϕ=0 at both r=r0 and r=1. This differential equation describes the profile of a velocity boundary layer. The exact solution of this problem is available for comparison and error analysis. In this problem, r is the distance from the origin measured in a nonuniform scale. To avoid potential confusion in notation, r0 is used instead of ri for the radius at the inner-outer core boundary and ϵ is the controlling parameter for the thickness of the boundary layer. The smaller the ϵ, the thinner the boundary layer. The range of ϵ in this study is from 0.5 to 0.002.To provide enough resolution and to keep the linear system of manageable size as in the geodynamo simulation [15, 22], the zeros of Chebyshev polynomials were ultimately chosen as the grid points to discretize the interval between the inner-outer core boundary (r=r0) and the core-mantle boundary (r=1), although other options of nonuniform grids were also attempted. Using the JTr to solve this problem, a nonlinear and smooth transformation was created to map the nonuniform grid into a uniform grid on which high-order compact implicit schemes were developed. This mapping from the nonuniform grid r∈[r0,1] to a uniform grid x∈[0,π] is given as
(2.3)r=1-r02cos(x+π)+1+r02.
Via this mapping, ϕ is an indirect function of x. This is why we kept the partial differentiation symbols in (2.2). The Jacobian of this transformation is
(2.4)J=drdx=(r0-1)sin(x+π)2=(1-r0)sin(x)2.
A straightforward way of solving (2.2) is to express ∂ϕ/∂r and ∂2ϕ/∂r2 as the derivatives with respect to x via the Jacobian:
(2.5)∂ϕ∂r=1J∂ϕ∂x=2(1-r0)sin(x)∂ϕ∂x,(2.6)∂2ϕ∂r2=4(1-r0)2sin2(x)∂2ϕ∂x2-4cos(x)(1-r0)2sin3(x)∂ϕ∂x.
Then substitute (2.5), (2.6), and (2.3) into (2.2) to obtain
(2.7)∂2ϕ∂x2+ξ∂ϕ∂x=η,
where ξ and η are functions of x only. Next we use implicit Padé approximations for ∂2ϕ/∂x2 and ∂ϕ/∂x to solve for (ϕ, ∂ϕ/∂x), or alternatively, (ϕ, ∂2ϕ/∂x2).However, in geodynamo models,∂ϕ/∂r is needed in other computations. Instead of solving (ϕ, ∂ϕ/∂x), we need to solve (ϕ, ∂ϕ/∂r) in the following way. First we let u=∂ϕ/∂r, as in (2.5), and then we express ∂2ϕ/∂r2 as the first-order derivative of u with respect to x:
(2.8)∂2ϕ∂r2=1J∂u∂x=2(1-r0)sin(x)∂u∂x.
Substituting (2.8) into (2.2), the original second-order equation becomes the first-order equation:
(2.9)∂u∂x=(1-r0)sin(x)2ϵ(r+ϵ-u).
We rearrange (2.5) into
(2.10)∂ϕ∂x=(1-r0)sin(x)2u.
Therefore two first-order differential equations (2.9) and (2.10) form a linear system in terms of the state variables (ϕ, u), where u=∂ϕ/∂r. Both (2.9) and (2.10) can be approximated with the same Padé schemes. The following fourth- and sixth-order compact implicit schemes were designed to solve the aforementioned linear system.For the interior grids, a fourth-order scheme consisting of a 3-point stencil is(2.11)ϕi+1′+4ϕi′+ϕi-1′=3(ϕi+1-ϕi-1)Δx,
where the derivative ϕi′ is with respect to x at the grid point xi. An alternative choice is
(2.12)9ϕi+1′-3ϕi-1′=(2ϕi+2+9ϕi+1-18ϕi+7ϕi-1)Δx.
However, within the boundary layer, ϕ is almost 0, but ϕ′ is large, therefore it is constructive to use more information from ϕ′. For this reason, (2.11) is slightly better.Similarly, for the interior grids, a sixth-order scheme with a 5-point stencil is(2.13)-ϕi+2′+34ϕi-1′+114ϕi′+34ϕi-1′-ϕi-2′=90(ϕi+1-ϕi-1)Δx.The advantage of this scheme is that it gives rise to a diagonally dominant linear system, which is theoretically nonsingular. As to the indexing of the state variables,u and ϕ were arranged alternatily in the sequence u1,ϕ1,u2,ϕ2,…, to reduce the bandwidth of the matrix.It is a common practice to use schemes of one order lower in accuracy for the boundary points than for the interior points. However, in order to resolve the thin boundary layer with high-order accuracy, we maintain the same truncation order. At the two-end points, the following fourth-order compact schemes were used to approximate the first-order derivative:(2.14)6ϕi′+18ϕi+1′=-17ϕi+9ϕi+1+9ϕi+2-ϕi+3Δx,ϕi-2′-5ϕi-1′+19ϕi′+9ϕi+1′=-24ϕi+24ϕi+1Δx.Correspondingly, the sixth-order schemes for the end points,1,2,N, and N+1 were derived. As the spatial resolution increases, values in adjacent rows near the end points become close. This causes the matrix to be close to ill-conditioned and therefore it is difficult to invert. To avoid catastrophic cancellation in partial pivoting, different schemes were used for adjacent points near the end points. At point 1, (2.15) was used to approximate the derivative in (2.9):
(2.15)3ϕ1′+27ϕ2′+27ϕ3′+3ϕ4′=-11ϕ1-27ϕ2+27ϕ3+11ϕ4Δx.
At point 2, (2.16) was used for the derivatives in (2.9) and (2.10):
(2.16)12ϕ1′+96ϕ2′+72ϕ3′=-43ϕ1-80ϕ2+108ϕ3+16ϕ4-ϕ5Δx.
At point N, (2.17) was used for the derivatives in (2.9) and (2.10):
(2.17)72ϕN-1′+96ϕN′+12ϕN+1′=ϕN-3-16ϕN-2-108ϕN-1+80ϕN+43ϕN+1Δx.
At point N+1, (2.18) was used for the derivative in (2.9):
(2.18)3ϕN-2′+27ϕN-1′+27ϕN′+3ϕN+1′=11ϕN-2+27ϕN-1-27ϕN-11ϕN+1Δx.Figure1(a) shows three sets of solutions: the exact solution and the approximate solutions from the sixth- and fourth-order compact schemes. No visible difference is observed at this scale. On the left is a thin boundary layer with a velocity gradient about two orders of magnitude larger than the solution itself. On the right is a laminar boundary layer with a mild velocity gradient. Figure 1(b) presents the solution errors (exact solution-approximate solution) in the sixth- and fourth-order compact schemes. Even though there is a large velocity gradient inside the thin boundary layer at the left end, both schemes are able to capture the characteristics of the boundary layer, with the error in the sixth-order scheme reduced to about 1/6 of that in the fourth-order approximation.(a) Solutions of the benchmark problem 1. (b) Solution errors of the sixth- and fourth-order compact schemes. The total grid points wereN=100 and the parameter was ϵ=0.01.
(a)(b)Figure2 shows the convergence rates of the fourth-order compact scheme for ϵ=0.01 and ϵ=0.002. The convergence rate was calculated from the ratio of the logarithm of the L2 norm of an error (either in the solution or the solution's derivative) and the logarithm of the number of grid points, using the data points after an initial transient region in the plot. On the left is the logarithm of the L2 norm of the solution error versus the logarithm of the number of grid points; on the right is the logarithm of the L2 norm of the error in the derivative of the solution versus the logarithm of the number of grid points. Beyond a threshold of N=40, the convergence rates for the solution ϕ are 4.1 at ϵ=0.01 and 3.9 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 3.7 and 3.5, respectively.Comparisons of convergence rates of the fourth-order compact schemes for problem 1 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)Figure3 presents the convergence rate of the sixth-order compact scheme for ϵ=0.01 and ϵ=0.002. The left plot is the logarithm of the L2 norm of the error in solution versus the logarithm of the number of grid points. The right plot is the logarithm of the L2 norm of the error in the derivative of the solution versus the logarithm of the number of grid points. Beyond a threshold of N=40, the convergence rates for the solution ϕ are 6.5 at ϵ=0.01 and 6.0 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 5.8 and 6.0, respectively.Comparisons of convergence rates of the sixth-order compact schemes for problem 1 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)Error analysis indicates that at low-to-medium resolution, that is, about 50 to 250 grid points, as in Figure1(b), the errors for both ϕ and ∂ϕ/∂r are mainly uniformly distributed over all grids. However, at higher resolution with the number of grid points over 1000, the leading error shifts into the thin boundary layer at the left end. To enhance the local resolution for the derivative in the thin boundary layer, more points within the stencil should be included. For example, for a sixth-order scheme with a 5-point stencil, to enhance the resolution for the derivative of ϕ, it would be helpful to use up to 5 points in approximating ∂ϕ/∂r, as opposed to (2.15) and (2.16).


## 2.3. Benchmark Problem 2

The general form of a solution is determined by the governing differential equation. However, specific types of boundary conditions also influence the solution of a given problem. To explore the numerical solution of a similar problem as in the previous section, but with different boundary conditions, we modify (2.2) slightly:
(2.19)ϵ∂2ϕ∂r2+∂ϕ∂r=1+ϵ,r0≤r≤1,r0=0.3,
subject to a Dirichlet boundary condition ϕ=0 at r=r0 and a Robin boundary condition ∂ϕ/∂r+ϕ=0 at r=1. The exact solution of this problem is also available for comparison and error analysis. The Robin (also called natural) boundary condition at r=1 is numerically weaker than a Dirichlet condition because it imposes less restriction on the solution itself. Because of this change in the boundary condition, the profile of the solution changes accordingly. We use the JTr method, keep the same discretization and the compact difference schemes as in Section 2.2.Figure4(a) shows the exact solution and the sixth-order approximate solution of the problem in (2.19) with Dirichlet and Robin boundary conditions. Due to the weak boundary condition at the right end point, the solution at this point is a finite-value instead of being zero. The boundary condition is somewhat like a slip boundary condition, which causes the solution to depend on ϵ at the right end point. Figure 4(b) presents the error of the approximate solution from the sixth-order compact scheme. The leading error is still in the thin boundary layer near the left end point. Except for the left boundary layer, the error is basically uniformly distributed over the interval.(a) Solutions of the benchmark problem 2. (b) The solution error of the sixth-order compact scheme. The resolution was set atN=100 and the parameter was ϵ=0.01.
(a)(b)Figure5 presents the convergence rate of the sixth-order compact scheme for ϵ=0.01 and ϵ=0.002 in terms of the L2 norm of the error for ϕ (left panel) and ∂ϕ/∂r (right panel). After a transient region, the convergence rates for the solution ϕ are 6.8 at ϵ=0.01 and 7.2 at ϵ=0.002. The convergence rates for ∂ϕ/∂r are 5.6 and 6.0, respectively.Comparisons of convergence rates of the sixth-order compact schemes for the problem 2 at different values ofϵ: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)These two examples demonstrate that the proposed compact implicit schemes are able to fully capture the characteristics of these boundary layer problems with the projected order of accuracies under strong- and weak-boundary conditions.


## 3. Sample Problems from Geodynamo Simulation

Next we study a set of sample problems that arose in geodynamo simulation. This section is arranged as follows. First, the problem is set up mathematically and its exact solution is derived. Then the numerical solutions of these geodynamo sample problems are presented using two different methods—Jacobian transformation and fully integrated metrics. After that, a combined method is proposed and tested for its performance in solving the same problems. Numerical results showing the sixth-order accuracy from both methods are presented and comparisons are made afterward.


### 3.1. Problem Setup

After demonstrating the accuracy and flexibility of high-order compact schemes on nonuniform grids in the previous benchmark problems, we turn our attention back to the geodynamo differential equation (2.1). The Crank-Nicolson method was used in the temporal discretization to maintain second-order accuracy in time while the forcing term was treated explicitly. After applying some spatial discretization to be discussed, (2.1) becomes a set of algebraic equations with the parameter L involved, as shown in the following linear system:
(3.1)Aϕ⃗n+1=Bϕ⃗n+Fn,
where A and B are matrices resulting from the temporal and spatial discretization with the Crank-Nicolson scheme and compact implicit schemes; F is the corresponding forcing vector and ϕ⃗ represents the unknown state variables. The solution at the time level n+1 can be computed recursively from the previous time level n as
(3.2)ϕ⃗n+1=Gϕ⃗n+A-1Fn,
where G is the amplification matrix:
(3.3)G=A-1B.
Based on von Neumann stability analysis, the spectral radius of G is no more than one due to the Crank-Nicolson method. Therefore an unconditional stability in time integrations is guaranteed. As long as the data ϕ⃗0 and F0 are explicitly given in the initial condition, we are able to acquire the values for the unknown state variables at any time via time marching with a temporal error on the order of the square of the time step (Δt2). So far we have addressed the stability issue for (2.1). If we have the property of consistency for this problem, based on the Lax Equivalence theorem, we will be able to find convergent solutions.Now we discuss the consistency, that is, we address the question how to form the matricesA and B, including the boundary conditions. To this end, we eliminate time and consider an equivalent steady-state (time-independent) problem for (2.1):
(3.4)∂2ϕ∂r2-L(L+1)r2ϕ=f(r),
in which the forcing term f(r) is defined by
(3.5)f(r)={0,r0<r<ri,1-r1-ri,ri≤r≤1,0,1<r≤rd,
where r0=0.034286, ri=0.34286, and rd=1.0057143. The aforementioned three intervals in (3.5) correspond to the inner core (IC), the outer core (OC), and the D′′ layer (D′′). L is the degree of the spherical harmonic expansion. Because the magnetic monopole does not exist in nature, the magnetic flux starts from the dipole component and L ranges from 2 to 33 in [15, 22].The boundary conditions for (3.4) are two Robin conditions:
(3.6)∂ϕ∂r-L+1rϕ=0,atr=r0;and∂ϕ∂r+Lrϕ=0,atr=rd.Equations (3.4), (3.5), and (3.6) define a series of problems of the energy spectrum in the spectral space in terms of the parameter L. Exact solutions can be obtained analytically so as to perform error analysis and detailed comparison. The details of the derivation of the exact solutions of the series of problems is described in the appendix.


### 3.2. Sixth-Order Approximations With JTr Method

As in Section2.2, the zeros of Chebyshev polynomials are used to discretize the inner core, the outer core, and the D′′ layer. A general transformation between the uniform grid x∈[0,π] and the nonuniform grid r∈[a1,a2] is given as
(3.7)IC:a1=r0,a2=ri,OC:a1=ri,a2=1,D′′:a1=1,a2=rd,r=a2-a12cos(x+π)+a2+a12.
The associated Jacobian of this transformation is
(3.8)J=drdx=(a1-a2)sin(x+π)2=(a2-a1)sin(x)2.
Since ∂ϕ/∂r is of special interest in geodynamo models [15, 22], we would like to keep this quantity as a state variable. Based on the Chain Rule, after introducing u=∂ϕ/∂r=(1/J)(∂ϕ/∂x), we split (3.4) into two first-order differential equations as in what follows in terms of ϕ and u:
(3.9)∂ϕ∂x=Ju,∂u∂x=L(L+1)Jr2ϕ+Jf(r).
Both equations in (3.9) can be approximated with the same scheme at a guaranteed order of accuracy in the transformed space.The boundary conditions do not need to be transformed since we solve forϕ and u=∂ϕ/∂r here, and ϕ and u appear naturally in the boundary conditions. The state variables u and ϕ were arranged alternately in the sequence u1,ϕ1,u2,ϕ2,…, in the state variable index to reduce the bandwidth of the matrix as in Section 2.2.In terms of the approximation schemes, one approach, similar to Section2.2, is described in what follows. For the interior points, we used (2.13) to approximate the first derivative. This numerical scheme leads to a symmetric matrix since the stencil is centered. For the two end points near a1, we used
(3.10)3ϕi′+27ϕi+1′+27ϕi+2′+3ϕi+3′=-11ϕi-27ϕi+1+27ϕi+2+11ϕi+3Δx,
and for the two end points near a2, we used
(3.11)3ϕi-3′+27ϕi-2′+27ϕi-1′+3ϕi′=11ϕi-3+27ϕi-2-27ϕi-1-11ϕiΔx.
Results from this approach show stable and consistent sixth-order convergence as anticipated.Consideringu and ϕ are arranged alternately, an asymmetric approximation could also perform well if used properly. In the second approach, (3.10) with indices shifted backward by one was used for interior points. For the two end points near a1, we used
(3.12)12ϕi′+96ϕi+1′+72ϕi+2′=-43ϕi-80ϕi+1+108ϕi+2+16ϕi+3-ϕi+4Δx.
For the two end points near a2, we used
(3.13)72ϕi-2′+96ϕi-1′+12ϕi′=ϕi-4-16ϕi-3-108ϕi-2+80ϕi-1+43ϕiΔx.The second approach turns out to be slightly better than the first one in decreasing theL2 norms of the solution error and the derivative error, called the overall error in this paper, by a factor of about 2 to 4. Therefore, the numerical results based on the JTr are obtained by the second approach. Since there are three intervals from r0 to rd, the number of grid points in each interval affects the overall error. Therefore, the simulation result with the smallest overall error is obtained when the errors in these three intervals are approximately the same order. In fact, there are many different combinations of the way that grid points are distributed in these three intervals at a given total number of grid points. The subsequent results are given at the smallest overall error. The numerical results indicate that at different total numbers of grid points, the minimum overall error is achieved at slightly different grid point distributions among these three intervals.


### 3.3. Sixth-Order Approximations with Combined Method

We have demonstrated the fourth and sixth-order accuarcy and consistency in convergence for using the JTr in two benchmark problems. A proper combination of the JTr and FIM is expected to give more flexibility and maintain the same order of accuracy. This combined method is believed to be especially suitable for the unique problems in geodynamo modeling with three nonuniform discretization regions and the radiusr being close to zero on the left end point in (3.9). We demonstrate that this combined method is capable of generating reliable numerical solutions for the geodynamo sample problems as in (3.4).Technically, this combined method integrates the JTr and the FIM, then it applies to different grid points. For the same geodynamo sample problem, the JTr was used at most of the grid points except the two adjacent points near the endr=r0. This will provide good formal accuracy because of the high-order compact schemes developed in the previous sections. For these two adjacent points near the end r=r0, where r0 is close to zero and 1/r02 is very large, the FIM was used to reduce the local truncation error, since the JTr may introduce a relatively large error in case of low resolution. It is unnecessary to use the FIM for other points including the end point on the other side of the inner core, the end points of both the outer core, and the D′′ layer. Our study showed that at these points, the FIM does not noticeably help to reduce the discretization error.Next we give the details of the combined method for all points in three intervals. For the end point in the inner core closest tori and the end points in the D′′ layer, the combined method uses (3.10) and (3.11). For the interior points in both the inner core and the D′′ layer, it uses (2.13). For the end points in the outer core, it uses (3.12) and (3.13). For the interior points in the outer core, it uses (3.10).For the two grid points nearest tor0, we develop the following numerical schemes based on the FIM. First, by introducing ∂ϕ/∂r=u, (3.4) can be reduced into two first order differential equations:
(3.14)∂ϕ∂r=u,∂u∂r=L(L+1)r2ϕ+f(r).
To approximate the first-order derivative near r=r0, a 3-point stencil difference approximation based on the FIM is
(3.15)γϕi′+βϕi+1′+αϕi+2′=ζϕi+ηϕi+1+ξϕi+2.
We define the radii at the grid points i, i+1, and i+2 as ri, ri+1, and ri+2, respectively. Then we expand every term at the point i with the Taylor series expansion and combine terms of the same order. By matching terms of the same order on each side, we obtain
(3.16)ξ+η+ζ=0,(order0)ξ(ri+2-ri)+η(ri+1-ri)=α+β+γ,(order1)ξ(ri+2-ri)2+η(ri+1-ri)2=2!1![α(ri+2-ri)+β(ri+1-ri)],(order2)ξ(ri+2-ri)3+η(ri+1-ri)3=3!2![α(ri+2-ri)2+β(ri+1-ri)2],(order3)ξ(ri+2-ri)4+η(ri+1-ri)4=4!3![α(ri+2-ri)3+β(ri+1-ri)3],(order4)ξ(ri+2-ri)5+η(ri+1-ri)5=5!4![α(ri+2-ri)4+β(ri+1-ri)4].(order5)Since the grid spacing is much smaller near the end point than in the middle, that is,ri+1-ri is smaller than ri+2-ri+1, the truncation error will actually be smaller than the corresponding error in a uniform grid at the same number of grid points. Therefore a fourth-order scheme will yield slightly higher than fourth-order norminal accuracy. We chose a fourth-order scheme with a 3-point stencil such that the first five equations in (3.17) are satisfied exactly. The leading order of the truncation error is
(3.17)δ5=(ξ(ri+2-ri)5+η(ri+1-ri)5-5!4![α(ri+2-ri)4+β(ri+1-ri)4])ϕi(5)5!.
The first five equations in (3.17) form a closed linear system for five unknowns out of the six unknown coefficients in (3.15), with one degree of freedom. For point 1, we choose η=0 so that (3.15) becomes
(3.18)γϕ1′+βϕ2′+αϕ3′=ζϕ1+ξϕ3,
After we define d1=r2-r3, d2=r1-r3, and d3=r1-r2, the coefficients are
(3.19)α=2d13+3d12d3-d336d1d2,β=d34+4d33d1+6d32d12+4d3d13+d146d1d2d3,γ=2d33+3d1d32-d136d2d3,ξ=-ζ=-1.
For point 2, we choose ξ=0, and (3.15) becomes
(3.20)γϕ1′+βϕ2′+αϕ3′=ζϕ1+ηϕ2,
where the coefficients are
(3.21)α=1,β=d2(2d3-3d2)d32,γ=4d2d3-d32-3d22d32,ζ=-η=-6d1d2d33.We obtained numerical results from purely JTr for all grid points in three sections, and also results from the combined method. Although the two methods are not completely different, numerical results show dramatic differences.Figure6 presents a series of numerical solutions of the sample geodynamo problem (3.4) with the JTr method. The left plot is the solution ϕ; the right plot is the derivative of the solution ∂ϕ/∂r. It is observed from the left plot that the dipole component (L=2) is dominant; it contains over 90% of the total energy of ϕ. Therefore the magnetic field of the Earth behaves like a giant magnet with two opposite polarities although it is actually a superposition of magnetic multipoles. As L becomes larger, the magnitude of ϕ decreases rapidly. For example, at L=10, ϕ reduces to less than 10% of the value at L=2. When L=28, this magnitude drops to less than 1%. There is a saddle point at the inner-outer core boundary near r=0.34 where the derivative decreases on the left side and increases on the other for all the L values. Therefore ∂ϕ/∂r is not smooth and ∂2ϕ/∂r2 is discontinuous at this point. This is also why we solve the first derivative directly instead of the second derivative in the formulation.Comparisons of the solutionϕ (a) and the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained from the sixth-order compact schemes with the Jacobian transformation at different values of L.
(a)(b)Figure7 shows the local error distribution across the entire region for L=2 from the results with the JTr and the combined method. The state variable ϕ is on the left and the derivative of the state variable ∂ϕ/∂r is on the right. The resolution was set at 100 grid points. The magnitude of the error for both ϕ and ∂ϕ/∂r are about 7 orders of magnitude less than the magnitude of the variables themselves. Therefore there is no visual difference between the numerical solution and the exact solution, and the solution plots were omitted. However, in the left plot, the leading error for ϕ is located around the inflection point near r=0.34. Errors at the left boundary within the inner core and at the right boundary in the D′′ layer are also slightly larger than the neighboring points. In general, the JTr and the combined method produced comparable orders of accuracy. In the right plot, the leading error for ∂ϕ/∂r is at the left boundary in the inner core. The JTr produces a slightly higher error than the combined method.Comparisons of the error in solutionϕ (a) and the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained separately from the sixth-order compact schemes with the Jacobian transformation and the combined method at L=2. The total number of grid points in three subdomains is 100.
(a)(b)Figure8 demonstrates the local error distribution for L=28 from the results obtained with the JTr and the combined method. The error in solution variable ϕ (a) is on the left and the error in the derivative of the solution variable ∂ϕ/∂r (b) is on the right. The resolution was set at 190 grid points. The leading errors for both ϕ and ∂ϕ/∂r have shifted to the location around the inflection point. Additionally, the leading errors increased slightly with increased resolution. This is because as L increases by one unit, the coefficient of ϕ, L(L+1)/r2, which is called the stiffness of (3.4), almost doubles its value. As r2 is much less than one in most grid points, this will make the stiffness increase very fast. Therefore (3.4) becomes very stiff, and the discretization matrix equation (3.3) becomes close to ill-conditioned, and even close to singular as the grid points increase over 1000. However at current CPU capacities, it is still difficult to use 1000 grid points in the radial direction in the MoSST model [15, 18]. Both plots in Figure 8 show that the results from the combined method have larger leading error than the result from the JTr around the inflection point with r approximately 0.34. This is because the FIM schemes developed in this paper are nominally of fourth-order accuracy, which is two orders lower than the sixth-order accuracy schemes based on the JTr used for the rest of the points. It is very difficult to develop a sixth-order compact scheme based on the FIM since for the full stencil of 5 points, 10 unknown coefficients will be involved in a general notation and 7 equations will be solved with 3 degrees of freedom.Comparisons of the error in solutionϕ (a) and in the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained separately from the sixth-order compact schemes with the Jacobian transformation at L=28 on a nonuniform grid with 190 points.
(a)(b)AsL becomes large, both methods become less efficient although they are still able to provide accurate numerical solutions. The convergence properties of both methods deteriorate, especially the combined method since it uses fourth-order schemes on the left end. Figure 9 demonstrates the convergence properties of both methods at L=2. Since the value of L is small, the stiffness of (3.4) is very small and both the JTr and the combined method provide excellent convergence rates of above 6, as listed in Table 1. As the spatial resolution becomes higher than 250 grid points, the coefficients in the approximation schemes at adjacent points based on the combined method tend to be close in value. Therefore the matrix generated from the combined method tends to be close to ill-conditioned earlier than that from the JTr.Table 1
A summary of the convergence rates for the state variableϕ and its derivative ∂ϕ/∂r at different values of L.
Lϕ (JTr)ϕ (Combined)∂ϕ/∂r (JTr)∂ϕ/∂r (Combined)27.686.947.566.75256.186.056.246.01286.014.345.994.54Comparisons of convergence rates of the sixth-order compact schemes for the sample geodynamo problem. Results were obtained separately from the Jacobian transformation and the combined method atL=2: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)AsL  becomes even larger, the stiffness of (3.4) becomes more than the square of L. This large stiffness makes (3.4) hard to solve and the discretized linear system close to singular. Therefore, the convergence rate drops noticeably, especially for the combined method. For example, when L=25, the combined method has a convergence rate 6.05 for ϕ and 6.01 for ∂ϕ/∂r. But when L=28, the convergence rates for the combined method become 4.34 and 4.54, respectively, as shown in Figure 10. As the number of grid points increases beyond 250, the error in the combined method starts to grow as shown in Figure 10. This is because the schemes developed from the FIM with the nominal fourth-order accuracy are becoming incompatible with the sixth-order schemes developed from the JTr. On the other hand, the results from purely JTr demonstrate to be robust and maintain the expected order of convergence.Comparisons of convergence rates of the sixth-order compact schemes for the sample geodynamo problem. Results were obtained separately from the Jacobian transformation and the combined method atL=28: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)


## 3.1. Problem Setup

After demonstrating the accuracy and flexibility of high-order compact schemes on nonuniform grids in the previous benchmark problems, we turn our attention back to the geodynamo differential equation (2.1). The Crank-Nicolson method was used in the temporal discretization to maintain second-order accuracy in time while the forcing term was treated explicitly. After applying some spatial discretization to be discussed, (2.1) becomes a set of algebraic equations with the parameter L involved, as shown in the following linear system:
(3.1)Aϕ⃗n+1=Bϕ⃗n+Fn,
where A and B are matrices resulting from the temporal and spatial discretization with the Crank-Nicolson scheme and compact implicit schemes; F is the corresponding forcing vector and ϕ⃗ represents the unknown state variables. The solution at the time level n+1 can be computed recursively from the previous time level n as
(3.2)ϕ⃗n+1=Gϕ⃗n+A-1Fn,
where G is the amplification matrix:
(3.3)G=A-1B.
Based on von Neumann stability analysis, the spectral radius of G is no more than one due to the Crank-Nicolson method. Therefore an unconditional stability in time integrations is guaranteed. As long as the data ϕ⃗0 and F0 are explicitly given in the initial condition, we are able to acquire the values for the unknown state variables at any time via time marching with a temporal error on the order of the square of the time step (Δt2). So far we have addressed the stability issue for (2.1). If we have the property of consistency for this problem, based on the Lax Equivalence theorem, we will be able to find convergent solutions.Now we discuss the consistency, that is, we address the question how to form the matricesA and B, including the boundary conditions. To this end, we eliminate time and consider an equivalent steady-state (time-independent) problem for (2.1):
(3.4)∂2ϕ∂r2-L(L+1)r2ϕ=f(r),
in which the forcing term f(r) is defined by
(3.5)f(r)={0,r0<r<ri,1-r1-ri,ri≤r≤1,0,1<r≤rd,
where r0=0.034286, ri=0.34286, and rd=1.0057143. The aforementioned three intervals in (3.5) correspond to the inner core (IC), the outer core (OC), and the D′′ layer (D′′). L is the degree of the spherical harmonic expansion. Because the magnetic monopole does not exist in nature, the magnetic flux starts from the dipole component and L ranges from 2 to 33 in [15, 22].The boundary conditions for (3.4) are two Robin conditions:
(3.6)∂ϕ∂r-L+1rϕ=0,atr=r0;and∂ϕ∂r+Lrϕ=0,atr=rd.Equations (3.4), (3.5), and (3.6) define a series of problems of the energy spectrum in the spectral space in terms of the parameter L. Exact solutions can be obtained analytically so as to perform error analysis and detailed comparison. The details of the derivation of the exact solutions of the series of problems is described in the appendix.


## 3.2. Sixth-Order Approximations With JTr Method

As in Section2.2, the zeros of Chebyshev polynomials are used to discretize the inner core, the outer core, and the D′′ layer. A general transformation between the uniform grid x∈[0,π] and the nonuniform grid r∈[a1,a2] is given as
(3.7)IC:a1=r0,a2=ri,OC:a1=ri,a2=1,D′′:a1=1,a2=rd,r=a2-a12cos(x+π)+a2+a12.
The associated Jacobian of this transformation is
(3.8)J=drdx=(a1-a2)sin(x+π)2=(a2-a1)sin(x)2.
Since ∂ϕ/∂r is of special interest in geodynamo models [15, 22], we would like to keep this quantity as a state variable. Based on the Chain Rule, after introducing u=∂ϕ/∂r=(1/J)(∂ϕ/∂x), we split (3.4) into two first-order differential equations as in what follows in terms of ϕ and u:
(3.9)∂ϕ∂x=Ju,∂u∂x=L(L+1)Jr2ϕ+Jf(r).
Both equations in (3.9) can be approximated with the same scheme at a guaranteed order of accuracy in the transformed space.The boundary conditions do not need to be transformed since we solve forϕ and u=∂ϕ/∂r here, and ϕ and u appear naturally in the boundary conditions. The state variables u and ϕ were arranged alternately in the sequence u1,ϕ1,u2,ϕ2,…, in the state variable index to reduce the bandwidth of the matrix as in Section 2.2.In terms of the approximation schemes, one approach, similar to Section2.2, is described in what follows. For the interior points, we used (2.13) to approximate the first derivative. This numerical scheme leads to a symmetric matrix since the stencil is centered. For the two end points near a1, we used
(3.10)3ϕi′+27ϕi+1′+27ϕi+2′+3ϕi+3′=-11ϕi-27ϕi+1+27ϕi+2+11ϕi+3Δx,
and for the two end points near a2, we used
(3.11)3ϕi-3′+27ϕi-2′+27ϕi-1′+3ϕi′=11ϕi-3+27ϕi-2-27ϕi-1-11ϕiΔx.
Results from this approach show stable and consistent sixth-order convergence as anticipated.Consideringu and ϕ are arranged alternately, an asymmetric approximation could also perform well if used properly. In the second approach, (3.10) with indices shifted backward by one was used for interior points. For the two end points near a1, we used
(3.12)12ϕi′+96ϕi+1′+72ϕi+2′=-43ϕi-80ϕi+1+108ϕi+2+16ϕi+3-ϕi+4Δx.
For the two end points near a2, we used
(3.13)72ϕi-2′+96ϕi-1′+12ϕi′=ϕi-4-16ϕi-3-108ϕi-2+80ϕi-1+43ϕiΔx.The second approach turns out to be slightly better than the first one in decreasing theL2 norms of the solution error and the derivative error, called the overall error in this paper, by a factor of about 2 to 4. Therefore, the numerical results based on the JTr are obtained by the second approach. Since there are three intervals from r0 to rd, the number of grid points in each interval affects the overall error. Therefore, the simulation result with the smallest overall error is obtained when the errors in these three intervals are approximately the same order. In fact, there are many different combinations of the way that grid points are distributed in these three intervals at a given total number of grid points. The subsequent results are given at the smallest overall error. The numerical results indicate that at different total numbers of grid points, the minimum overall error is achieved at slightly different grid point distributions among these three intervals.


## 3.3. Sixth-Order Approximations with Combined Method

We have demonstrated the fourth and sixth-order accuarcy and consistency in convergence for using the JTr in two benchmark problems. A proper combination of the JTr and FIM is expected to give more flexibility and maintain the same order of accuracy. This combined method is believed to be especially suitable for the unique problems in geodynamo modeling with three nonuniform discretization regions and the radiusr being close to zero on the left end point in (3.9). We demonstrate that this combined method is capable of generating reliable numerical solutions for the geodynamo sample problems as in (3.4).Technically, this combined method integrates the JTr and the FIM, then it applies to different grid points. For the same geodynamo sample problem, the JTr was used at most of the grid points except the two adjacent points near the endr=r0. This will provide good formal accuracy because of the high-order compact schemes developed in the previous sections. For these two adjacent points near the end r=r0, where r0 is close to zero and 1/r02 is very large, the FIM was used to reduce the local truncation error, since the JTr may introduce a relatively large error in case of low resolution. It is unnecessary to use the FIM for other points including the end point on the other side of the inner core, the end points of both the outer core, and the D′′ layer. Our study showed that at these points, the FIM does not noticeably help to reduce the discretization error.Next we give the details of the combined method for all points in three intervals. For the end point in the inner core closest tori and the end points in the D′′ layer, the combined method uses (3.10) and (3.11). For the interior points in both the inner core and the D′′ layer, it uses (2.13). For the end points in the outer core, it uses (3.12) and (3.13). For the interior points in the outer core, it uses (3.10).For the two grid points nearest tor0, we develop the following numerical schemes based on the FIM. First, by introducing ∂ϕ/∂r=u, (3.4) can be reduced into two first order differential equations:
(3.14)∂ϕ∂r=u,∂u∂r=L(L+1)r2ϕ+f(r).
To approximate the first-order derivative near r=r0, a 3-point stencil difference approximation based on the FIM is
(3.15)γϕi′+βϕi+1′+αϕi+2′=ζϕi+ηϕi+1+ξϕi+2.
We define the radii at the grid points i, i+1, and i+2 as ri, ri+1, and ri+2, respectively. Then we expand every term at the point i with the Taylor series expansion and combine terms of the same order. By matching terms of the same order on each side, we obtain
(3.16)ξ+η+ζ=0,(order0)ξ(ri+2-ri)+η(ri+1-ri)=α+β+γ,(order1)ξ(ri+2-ri)2+η(ri+1-ri)2=2!1![α(ri+2-ri)+β(ri+1-ri)],(order2)ξ(ri+2-ri)3+η(ri+1-ri)3=3!2![α(ri+2-ri)2+β(ri+1-ri)2],(order3)ξ(ri+2-ri)4+η(ri+1-ri)4=4!3![α(ri+2-ri)3+β(ri+1-ri)3],(order4)ξ(ri+2-ri)5+η(ri+1-ri)5=5!4![α(ri+2-ri)4+β(ri+1-ri)4].(order5)Since the grid spacing is much smaller near the end point than in the middle, that is,ri+1-ri is smaller than ri+2-ri+1, the truncation error will actually be smaller than the corresponding error in a uniform grid at the same number of grid points. Therefore a fourth-order scheme will yield slightly higher than fourth-order norminal accuracy. We chose a fourth-order scheme with a 3-point stencil such that the first five equations in (3.17) are satisfied exactly. The leading order of the truncation error is
(3.17)δ5=(ξ(ri+2-ri)5+η(ri+1-ri)5-5!4![α(ri+2-ri)4+β(ri+1-ri)4])ϕi(5)5!.
The first five equations in (3.17) form a closed linear system for five unknowns out of the six unknown coefficients in (3.15), with one degree of freedom. For point 1, we choose η=0 so that (3.15) becomes
(3.18)γϕ1′+βϕ2′+αϕ3′=ζϕ1+ξϕ3,
After we define d1=r2-r3, d2=r1-r3, and d3=r1-r2, the coefficients are
(3.19)α=2d13+3d12d3-d336d1d2,β=d34+4d33d1+6d32d12+4d3d13+d146d1d2d3,γ=2d33+3d1d32-d136d2d3,ξ=-ζ=-1.
For point 2, we choose ξ=0, and (3.15) becomes
(3.20)γϕ1′+βϕ2′+αϕ3′=ζϕ1+ηϕ2,
where the coefficients are
(3.21)α=1,β=d2(2d3-3d2)d32,γ=4d2d3-d32-3d22d32,ζ=-η=-6d1d2d33.We obtained numerical results from purely JTr for all grid points in three sections, and also results from the combined method. Although the two methods are not completely different, numerical results show dramatic differences.Figure6 presents a series of numerical solutions of the sample geodynamo problem (3.4) with the JTr method. The left plot is the solution ϕ; the right plot is the derivative of the solution ∂ϕ/∂r. It is observed from the left plot that the dipole component (L=2) is dominant; it contains over 90% of the total energy of ϕ. Therefore the magnetic field of the Earth behaves like a giant magnet with two opposite polarities although it is actually a superposition of magnetic multipoles. As L becomes larger, the magnitude of ϕ decreases rapidly. For example, at L=10, ϕ reduces to less than 10% of the value at L=2. When L=28, this magnitude drops to less than 1%. There is a saddle point at the inner-outer core boundary near r=0.34 where the derivative decreases on the left side and increases on the other for all the L values. Therefore ∂ϕ/∂r is not smooth and ∂2ϕ/∂r2 is discontinuous at this point. This is also why we solve the first derivative directly instead of the second derivative in the formulation.Comparisons of the solutionϕ (a) and the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained from the sixth-order compact schemes with the Jacobian transformation at different values of L.
(a)(b)Figure7 shows the local error distribution across the entire region for L=2 from the results with the JTr and the combined method. The state variable ϕ is on the left and the derivative of the state variable ∂ϕ/∂r is on the right. The resolution was set at 100 grid points. The magnitude of the error for both ϕ and ∂ϕ/∂r are about 7 orders of magnitude less than the magnitude of the variables themselves. Therefore there is no visual difference between the numerical solution and the exact solution, and the solution plots were omitted. However, in the left plot, the leading error for ϕ is located around the inflection point near r=0.34. Errors at the left boundary within the inner core and at the right boundary in the D′′ layer are also slightly larger than the neighboring points. In general, the JTr and the combined method produced comparable orders of accuracy. In the right plot, the leading error for ∂ϕ/∂r is at the left boundary in the inner core. The JTr produces a slightly higher error than the combined method.Comparisons of the error in solutionϕ (a) and the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained separately from the sixth-order compact schemes with the Jacobian transformation and the combined method at L=2. The total number of grid points in three subdomains is 100.
(a)(b)Figure8 demonstrates the local error distribution for L=28 from the results obtained with the JTr and the combined method. The error in solution variable ϕ (a) is on the left and the error in the derivative of the solution variable ∂ϕ/∂r (b) is on the right. The resolution was set at 190 grid points. The leading errors for both ϕ and ∂ϕ/∂r have shifted to the location around the inflection point. Additionally, the leading errors increased slightly with increased resolution. This is because as L increases by one unit, the coefficient of ϕ, L(L+1)/r2, which is called the stiffness of (3.4), almost doubles its value. As r2 is much less than one in most grid points, this will make the stiffness increase very fast. Therefore (3.4) becomes very stiff, and the discretization matrix equation (3.3) becomes close to ill-conditioned, and even close to singular as the grid points increase over 1000. However at current CPU capacities, it is still difficult to use 1000 grid points in the radial direction in the MoSST model [15, 18]. Both plots in Figure 8 show that the results from the combined method have larger leading error than the result from the JTr around the inflection point with r approximately 0.34. This is because the FIM schemes developed in this paper are nominally of fourth-order accuracy, which is two orders lower than the sixth-order accuracy schemes based on the JTr used for the rest of the points. It is very difficult to develop a sixth-order compact scheme based on the FIM since for the full stencil of 5 points, 10 unknown coefficients will be involved in a general notation and 7 equations will be solved with 3 degrees of freedom.Comparisons of the error in solutionϕ (a) and in the derivative of the solution ∂ϕ/∂r (b) for the sample geodynamo problem. Results were obtained separately from the sixth-order compact schemes with the Jacobian transformation at L=28 on a nonuniform grid with 190 points.
(a)(b)AsL becomes large, both methods become less efficient although they are still able to provide accurate numerical solutions. The convergence properties of both methods deteriorate, especially the combined method since it uses fourth-order schemes on the left end. Figure 9 demonstrates the convergence properties of both methods at L=2. Since the value of L is small, the stiffness of (3.4) is very small and both the JTr and the combined method provide excellent convergence rates of above 6, as listed in Table 1. As the spatial resolution becomes higher than 250 grid points, the coefficients in the approximation schemes at adjacent points based on the combined method tend to be close in value. Therefore the matrix generated from the combined method tends to be close to ill-conditioned earlier than that from the JTr.Table 1
A summary of the convergence rates for the state variableϕ and its derivative ∂ϕ/∂r at different values of L.
Lϕ (JTr)ϕ (Combined)∂ϕ/∂r (JTr)∂ϕ/∂r (Combined)27.686.947.566.75256.186.056.246.01286.014.345.994.54Comparisons of convergence rates of the sixth-order compact schemes for the sample geodynamo problem. Results were obtained separately from the Jacobian transformation and the combined method atL=2: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)AsL  becomes even larger, the stiffness of (3.4) becomes more than the square of L. This large stiffness makes (3.4) hard to solve and the discretized linear system close to singular. Therefore, the convergence rate drops noticeably, especially for the combined method. For example, when L=25, the combined method has a convergence rate 6.05 for ϕ and 6.01 for ∂ϕ/∂r. But when L=28, the convergence rates for the combined method become 4.34 and 4.54, respectively, as shown in Figure 10. As the number of grid points increases beyond 250, the error in the combined method starts to grow as shown in Figure 10. This is because the schemes developed from the FIM with the nominal fourth-order accuracy are becoming incompatible with the sixth-order schemes developed from the JTr. On the other hand, the results from purely JTr demonstrate to be robust and maintain the expected order of convergence.Comparisons of convergence rates of the sixth-order compact schemes for the sample geodynamo problem. Results were obtained separately from the Jacobian transformation and the combined method atL=28: solution error ϕ (a); derivative error ∂ϕ/∂r (b).
(a)(b)


## 4. Conclusions

The benchmark differential equations involved in this paper describe parametrically adjustable boundary layer profiles. These problems are essentially similar to a two-point boundary value problem. In addition, a series of parabolic differential equations that arise from the spectral discretization of a geodynamo model is studied with the compact implicit schemes developed in this paper.The sixth-order compact implicit schemes with both Jacobian transformation and full inclusion of metrics on nonuniform grids for better efficiency are developed. Additionally, a new method which integrates these two approaches is developed and tested. These methods demonstrate high-order accuracy, fast convergence rate, and robust adaptibility to Dirichlet, Neumann, and Robin boundary conditions. In addition, it is demonstrated in the numerical results that high-order compact methods with the JTr and FIM techniques are capable of resolving a thin boundary layer with relatively fewer grids than the traditional finite-difference schemes with the same order of accuracy. Convergence rate and accuracy order are studied and compared in detail.The reason that the result from the JTr is slightly better than that from the FIM is because asr approaches r0, where r0≈0, the Jacobian (J) is close to zero as in (2.4). Therefore, J/r2 is one magnitude smaller than 1/r2 although both are much larger than one at r≈r0. Consequently, the stiffness in (3.9) is about one order less than that in (3.14). However, the combined method which uses the FIM directly on a nonuniform grid is always a good backup and alternative approach in solving certain kind of differential equations when the JTr is not applicable or results in loss of information.Based on these numerical experiments, it is found that for different numbers of total grid points in the inner core, the outer core, and theD′′ layer, the best convergence rate is obtained with slightly different combinations of the numbers of grid points in all intervals. This also demonstrates the high flexibility and potential of the sixth-order compact finite-difference schemes developed in this paper. These methods provide some reference for improving the ongoing development of the geodynamo model.



---

*Source: 568296-2009-06-17.xml*