Azimuthal averaging–reconstruction filtering techniques for finite-difference general circulation models in spherical geometry

When solving hydrodynamic equations in spherical or cylindrical geometry using explicit finite-difference schemes, a major difficulty is that the time step is greatly restricted by the clustering of azimuthal cells near the pole due to the Courant–Friedrichs–Lewy condition. This paper adapts the azimuthal averaging–reconstruction (ring average) technique to finite-difference schemes in order to mitigate the time step constraint in spherical and cylindrical coordinates. The finite-difference ring average technique averages physical quantities based on an effective grid and then reconstructs the solution back to the original grid in a piecewise, monotonic way. The algorithm is implemented in a community upper-atmospheric model, the Thermosphere–Ionosphere Electrodynamics General Circulation Model (TIEGCM), with a horizontal resolution up to 0.625× 0.625 in geographic longitude–latitude coordinates, which enables the capability of resolving critical mesoscale structures within the TIEGCM. Numerical experiments have shown that the ring average technique introduces minimal artifacts in the polar region of general circulation model (GCM) solutions, which is a significant improvement compared to commonly used low-pass filtering techniques such as the fast Fourier transform method. Since the finite-difference adaption of the ring average technique is a post-solver type of algorithm, which requires no changes to the original computational grid and numerical algorithms, it has also been implemented in much more complicated models with extended physical–chemical modules such as the Coupled Magnetosphere–Ionosphere– Thermosphere (CMIT) model and the Whole Atmosphere Community Climate Model with thermosphere and ionosphere eXtension (WACCM-X). The implementation of ring average techniques in both models enables CMIT and WACCM-X to perform global simulations with a much higher resolution than that used in the community versions. The new technique is not only a significant improvement in space weather modeling capability, but it can also be adapted to more general finite-difference solvers for hyperbolic equations in spherical and polar geometries.

Abstract. When solving hydrodynamic equations in spherical or cylindrical geometry using explicit finite-difference schemes, a major difficulty is that the time step is greatly restricted by the clustering of azimuthal cells near the pole due to the Courant-Friedrichs-Lewy condition. This paper adapts the azimuthal averaging-reconstruction (ring average) technique to finite-difference schemes in order to mitigate the time step constraint in spherical and cylindrical coordinates. The finite-difference ring average technique averages physical quantities based on an effective grid and then reconstructs the solution back to the original grid in a piecewise, monotonic way. The algorithm is implemented in a community upper-atmospheric model, the Thermosphere-Ionosphere Electrodynamics General Circulation Model (TIEGCM), with a horizontal resolution up to 0.625 • × 0.625 • in geographic longitude-latitude coordinates, which enables the capability of resolving critical mesoscale structures within the TIEGCM. Numerical experiments have shown that the ring average technique introduces minimal artifacts in the polar region of general circulation model (GCM) solutions, which is a significant improvement compared to commonly used low-pass filtering techniques such as the fast Fourier transform method. Since the finite-difference adaption of the ring average technique is a post-solver type of algorithm, which requires no changes to the original computational grid and numerical algorithms, it has also been implemented in much more complicated models with extended physical-chemical modules such as the Coupled Magnetosphere-Ionosphere-Thermosphere (CMIT) model and the Whole Atmosphere Community Climate Model with thermosphere and ionosphere eXtension (WACCM-X). The implementation of ring average techniques in both models enables CMIT and WACCM-X to perform global simulations with a much higher resolution than that used in the community versions. The new technique is not only a significant improvement in space weather modeling capability, but it can also be adapted to more general finite-difference solvers for hyperbolic equations in spherical and polar geometries. Highlights.
-The ring average technique is adapted to solve the issue of clustered grid cells in polar and spherical coordinates with a finite-difference method.

Introduction
Mesoscale structures with a typical horizontal size of 100-500 km have gained more and more attention in research on the dynamics of the upper-atmospheric system. A number of studies have been carried out to investigate these structures, including the formation and evolution of polar cap patches and tongues of ionization (Basu et al., 1995;Foster et al., 2005;Zhang et al., 2013), dynamics of ionospheric irregularities (Makela and Otsuka, 2012;Sun et al., 2015), variations of the polar thermospheric density anomaly (Crowley et al., 2010;Lühr et al., 2004), and the space weather effects of mesoscale electric field variability (Codrescu et al., 1995;Matsuo and Richmond, 2008;Zhu et al., 2018;Lotko and Zhang, 2018). These dynamic mesoscale structures have shown critical importance in understanding the physics of the solar-terrestrial system and in space weather predictions, which challenges the resolution and accuracy of numerical models of the upper-atmospheric system in resolving these important mesoscale signatures. Spherical or cylindrical coordinates are commonly used in solving geophysical problems, including the modeling of the upper-atmospheric systems. As a workhorse for space weather research, a number of general circulation models (GCMs) for the coupled ionosphere-thermosphere (I-T) system have been developed based on spherical coordinates using finite-difference schemes (e.g., Richmond et al., 1992;Fuller-Rowell et al., 1996;Ridley et al., 2006;Ren et al., 2009). However, restricted by the longitudinal grid resolution, current horizontal resolutions used in I-T GCMs are still insufficient for fully resolving mesoscale atmospheric structures, which are either marginal or subgrid. The latest released version of the community code, the Thermosphere-Ionosphere Electrodynamic General Circulation Model (TIEGCM), has a longitude-latitude resolution of 2.5 • ×2.5 • . The Coupled Thermosphere-Ionosphere-Plasmasphere (CTIP) model has a latitude resolution of 2 • and a longitude resolution of 18 • , and the most recent version of the Global Ionosphere Thermosphere Model (GITM) has a flexible grid with a latitudinal resolution up to 0.3125 • , but the typical longitudinal resolution remains 2.5 • due to severe time step restrictions for global-scale calculations.
The major difficulty in increasing longitudinal resolution in spherical-geometry-based GCMs is that the explicit time stepping is constrained by the clustering azimuthal cells near the pole due to the Courant-Friedrichs-Lewy (CFL) condition (Courant et al., 1928). A number of attempts have been proposed to address this coordinate singularity issue (e.g., Purser, 1988;Bouaoudia and Marcus, 1991;Williamson et al., 1992;Takacs et al., 1999;Fukagata and Kasagi, 2002;Prusa, 2018). To use a time step that is larger than the global minimum requirement from CFL conditions, one common method used in a spherical GCM is to employ a low-pass Fourier filter at polar latitudes, which removes nonphysical, high-frequency zonal waves generated due to numerical instability caused by the local violation of CFL conditions (e.g., Skamarock et al., 2008). Although the Fourier filter can maintain computational stability and permit a much larger temporal step, the applicability of the fast Fourier transform (FFT) filter method is problem-dependent, which also creates barriers in moving models forward to finer spatial resolutions. Moreover, the linear filtering of zonal components generated through a nonphysical time step may decrease the accuracy of the model calculations near the polar region, which affects physical conservations of, e.g., mass, momentum, and energy that are essential for the long-term behavior of the GCM (Williamson and Browning, 1973).
Recently, Zhang et al. (2019) developed a new technique called the ring average method for hyperbolic equations to mitigate the CFL restrictions in spherical or polar geometry on the basis of the method originally proposed in the Lyon-Fedder-Mobarry (LFM) magnetohydrodynamics (MHD) simulations . The method is a "post-solver" type of algorithm applied after solving all the physical quantities in the original spherical coordinates; thus, no modification to the numerical solver or the computational grid is required when applying the ring average. Test simulation results have shown the effectiveness of the ring average algorithm in increasing the time step by a factor of 100 while maintaining the fidelity of the solutions. The original ring average technique was developed for solving hyperbolic equations in spherical or polar geometry based on finite-volume schemes, which redistributes the solution azimuthally through a conservative averagingreconstruction algorithm. The finite-volume version of the ring average technique not only releases the time step constraint in spherical geometry, but also keeps the conservative nature of finite-volume schemes to machine precision. In this paper, we adapt the ring average technique to finitedifference schemes for solving hyperbolic equations. Defined on an effective reduced polar grid, the finite-difference adaption of the ring average technique also conducts a postsolver step of averaging-reconstruction in each azimuthal ring to maintain the numerical stability and relax the severe computational time step constraint. To demonstrate the effectiveness of the finite-difference version of the ring average technique, we use solutions from both linear advection equations and the TIEGCM as test beds. The ring average algorithm enables the use of a high-resolution TIEGCM, such as 0.625 • × 0.625 • in longitude and latitude, with reasonable time steps and minimal numerical artifacts. Further applications of the technique to the Coupled Magnetosphere-Ionosphere-Thermosphere (CMIT) model and the Whole × 2.5 • TIEGCM polar longitude-latitude grid. For example, the 144 azimuthal cells in the most inside (highest latitude) grid (a) have been grouped into 9 effective cells (chunks), with 16 original cells in each chunk. In the effective grid, the numbers of chunks from inside to outside are 9, 9, 18, 18, 36, 36, 72, 72, 72, and 72. Atmosphere Community Climate Model with thermosphere and ionosphere extension (WACCM-X) are also addressed.
This paper is organized as follows: in Sect. 2, we describe the details of the model and the ring average technique to solve the problem of clustering of polar grid cells. A hydrodynamic convection experiment with the ring average technique has also been conducted to test the capability of the method. Section 3 shows the preliminary results of the highresolution TIEGCM with the ring average technique implemented and the further applications of the technique. The findings of this work are summarized in Sect. 4.

Methodology
2.1 Ring average in the finite-difference form An example of standard polar grids with a horizontal resolution of 2.5 • × 2.5 • (longitude × latitude) in the TIEGCM is shown in Fig. 1. It is evident that in Fig. 1a, the azimuthal (longitudinal) computational nodes in the standard polar grid are significantly clustered near the pole, even with 144 cells in the azimuthal direction, resulting in very "thin" cells with small azimuthal extensions, which restricts the explicit time step for the advection equations. This azimuthal clustering becomes even worse when grid resolution increases; the time step drops to 1/4 while the grid resolution doubles, corresponding to an increase in computational resources of at least 32 times, which becomes expensive, especially for global simulations with high spatial resolutions, in order to resolve mesoscale structures.
The finite-difference adaption of the ring average algorithm is based on a similar averaging-reconstruction process over a predefined "effective" azimuthal grid as used in the finite-volume version of the algorithm. Figure 1b shows an example of an effective polar grid for applying the finitedifference ring average technique. In the polar grid shown in Fig. 1b, since the reconstructed solution is monotonic within each effective computational cell, a much larger time step is allowed compared to the original grid shown in Fig. 1a. As shown in Fig. 1b, the effective longitudinal grid resolutions have been reduced and are less clustered towards the pole. For the most inside (highest latitude) grids, the 144 azimuthal cells (Fig. 1a) have been grouped into 9 effective cells (chunks), with 16 original cells in each chunk. Moving away from the pole, more chunks are employed. As an example, the numbers of chunks from inside to outside shown in Fig. 1b in the effective grid are 9, 9, 18, 18, 36, 36, 72, 72, 72, and 72, allowing a relatively smooth transition in the size of the cells going radially outward. Note that the choice of the number of chunks in each ring is non-unique. Numerical tests with finite-volume solvers have shown that the computational solution, under both smooth and discontinuous flow conditions, is insensitive to small changes in the chunk configuration .
We use the following example of solving the linear advection equation to illustrate the averaging-reconstruction process within each chunk. Consider the following linear advection equation of an incompressible fluid in the azimuthal direction as an example: where v is the advection velocity, ρ is the density profile, and x is the azimuthal dimension (x ∈ [0 2π ]) along one ring. Assuming the x direction is uniformly discretized into N total computational cells with x = 2π N total , a centraldifference forward Euler form of Eq. (1) for density ρ in cell k between time n and n + 1 is written as where k denotes the index of an individual thin cell in the original azimuthal grid. t is the time step regulated by the CFL condition. Without a ring average type of treatment, the time step t is restricted by the fact that thin azimuthal cells cluster near the pole. The ring average technique takes the average solution within a chunk m that contains 2s cells in the original grid as shown in Fig. 2. Summing over the finitedifference form of Eq. (1) within chunk m gives Then, summing over the k indices within chunk m, Eq.
where n+1 m = i+s k=i−s+1 ρ n+1 k and n m = i+s k=i−s+1 ρ n k . If assuming smoothness of the solution, which applies to typical upper-atmospheric flow conditions, and using a piecewise linear reconstruction for the two interface values at time level n, ρ n the right-hand side of Eq. (7) is in the form of a centraldifference approximation of the spatial derivative ∂ ∂x in chunk m: Equating Eqs. (8) and (11) and considering the fact that the X in computing the chunk derivative is actually 2s x, we obtain where T = 2s t. Equation (12) is in the same numerical differential form of the advection equation in terms of the chunk density in the effective grid within the same order of finite-difference approximation: Equation (12) also suggests that in principle the ring average method is capable of using a time step that is approximately 2s times larger than the original t restricted by the thin cells (assuming the CFL condition is dominated by the azimuthal direction in the innermost ring). Note that the above derivation of the finite-difference version of the ring average algorithm is independent of the numerical schemes solving the linear advection equation (Eq. 1). Thus, the ring average algorithm requires no modifications to the existing hydrodynamic equations solved by GCMs. Furthermore, since the ring average algorithm is applied after all the variables are solved on the original spherical grid, it requires no changes to the existing computational grid.
In the reconstruction step, the above algorithm uses the piecewise linear method (PLM) to reconstruct solutions within each chunk for the next time step of the GCM calculations, resulting in second-order accuracy. To achieve higher accuracy in the reconstruction step, a piecewise parabolic reconstruction method (PPM) (Colella and Woodward, 1984) may be used in the algorithm, which provides fourth-order accuracy for the reconstruction step. In the following section when applying the ring average algorithm in a GCM, we use both PPM and PLM for different variables. The criteria for using PPM or PLM here depend on their spatial gradient from the fluid calculations. For variables that have a relatively greater spatial gradient, we use the PPM to reach high accuracy and maintain stability; otherwise, the PLM is used for the calculations.
The algorithm shown in Fig. 3 illustrates the steps of applying the ring average technique using either PLM or PPM. The steps consist of chunk division, chunk averaging, and reconstruction. The averaging-reconstruction process (ring average) in this study is similar to Zhang et al. (2019), with modifications to the reconstruction method (PPM or PLM) adapted to finite-difference schemes. The detailed procedures of the ring average technique in this study are described as follows.

For variables using the PLM reconstruction -
Step 1. Divide the azimuthal grid cells into chunks and pull data into the chunks. - Step 2. Calculate the average value F A , left interface value F L , and right interface value F R at chunk m (m is the index of the chunk number in an azimuthal ring). F L and F R are the interface values in each chunk determined by the following parabola functions: where F m−2 , F m−1 , F m , F m+1 , and F m+2 are the average values F A at chunks with an index of m − 2, m − 1, m, m + 1, and m + 2, respectively.
-Step 3. Reconstruct the variables by interpolating the average data linearly in each chunk: where N is the number of cells within each chunk and k is the local index ranging from 1 to N.
-Step 4. Re-do the above procedures for the next azimuthal ring until the ring average is not needed.

For variables using the PPM reconstruction
The procedures in PPM are the same with PLM except for Step 3.
Step 3. Reconstruct the variables parabolically in each chunk using the following function: where A, B, and C are constants representing the parabolic function, which connects F L and F R : 2.1.3 For vector variables using the PLM reconstruction and Fourier reduction Step 0 in Fig. 3 corresponds to a Fourier expansion (reduction) step that is required for vector GCM variables in spherical coordinates before applying the ring average process.
The main purpose of the Fourier reduction step is to maintain the direction of vectors after ring averaging, especially for the neutral meridional and zonal wind across the pole. Thus, only the second and higher Fourier components of the data in the azimuthal cell are smoothed using the ring average filter, while the zero and first Fourier components are kept unchanged. Here are the details of the Fourier expansion process.
Step 0. Calculate the Fourier components of the azimuthal data: where i is the thin cell index along the azimuthal direction ranging from 1 to N total , N total is the total thin cell number in the azimuthal direction, F i represents the second and higher Fourier components that will be later reconstructed, and A 0 , A 1 , and B 1 are the zero and first Fourier coefficients: The higher Fourier components F i are pulled into chunks for the ring average processes.
Step 1-4. The steps are the same as the above PLMs, except that the reconstructed data, F i , are brought back together with the first two Fourier components after the reconstruction:

Ring average for the advection equation
In this section, in order to illustrate the implementation of the ring average algorithm in a finite-difference code, we solve the two-dimensional (2D) linear advection equation in the polar geometry as an example. The code used in the 2D linear advection solver is a main subroutine used in the ring average module for GCMs. This two-dimensional advection test in polar geometry is also useful to demonstrate the effectiveness of the finite-difference ring average technique in handling a strong, narrow shear flow near the pole. A fourthorder central-finite-difference scheme is used to solve the following mass continuity equation under the incompressible assumption: where ρ is the density, and u is the time-stationary flow velocity defined in polar coordinates (r, θ ). The polar geometry of this test is defined with a resolution of 0.625 • in both longitude and latitude, with 144 cells in the r direction uniformly distributed within (0, 1) and 576 cells in the θ direction uniformly distributed within (0, 2π ). Figure 4a shows the initial state (t = 0) of ρ, ranging linearly along the y direction from a magnitude of 2 at the topside to 0.01 at the bottom side: The time-independent flow velocity u is set as a Gaussiandistributed shear flow towards −y and centered at x = 0.15 with a peak velocity of −1 and a half-width of 0.01: As simulation time evolves, a large density gradient occurs near the pole driven by the time-stationary shear flow, with its pattern following the analytical distribution of the flow velocity u. Figure 4a-c show three snapshots of the density in the linear advection experiment at t = 0, t = 0.75, and t = 1.5 using the finite-difference version of the ring average technique with PPM reconstructions, as described in Sect. 2.1. For comparison, Fig. 4d-f show the corresponding snapshots derived from another simulation using an FFT filter, and Fig. 4g-i show the results at the same simulation time calculated from the fourth-order finite-difference scheme without applying any filtering technique. In the simulation using the ring average, the number of averaging chunks in each azimuthal ring near the pole is set to be [ 18 18 18 18 36 36 36  36 72 72 72 72 144 144 144 144] from the first ring to the 16th ring, as indicated by the white circles in the top panels around 80 • N. For the FFT filter, a Fourier expansion is applied in the azimuthal direction at each time step to the fluid density. Waves with frequencies that are higher than the cutoff frequencies are eliminated from the Fourier spectra of prognostic variables. The values of prognostic variables are then reconstructed through an inverse Fourier transform using the modified Fourier spectra. Each latitude grid has its own cutoff frequency, and the wave number to be cut off in this experiment near the pole is set to be [1 1 2 2 2 2 4 4 4 4 8 8 8 8 10 10], which is similar to the TIEGCM FFT filter spectrum (Wang, 1998). As shown in Fig. 4b and c, density structures with a large spatial gradient flow across the pole as time progresses. Compared with the non-filter case in Fig. 4h and i, no evident numerical instability or artificial structure occurred when applying the ring average technique. In contrast, the density structure using an FFT filter in Fig. 4d-f exhibits numerical oscillations in the radial direction, together with an artificial depletion of density near the pole. This density depletion is due to the non-conservative nature of the FFT method by truncating high-spatial-frequency wave modes in a linear way. Figure 4j-l show a one-dimensional comparison of the density profiles along x = 0.15, with the region of averaging chunks denoted by yellow. The comparisons suggest that the density flow is not noticeably affected by the implementation of the ring average technique in the finite-difference solver. Note that the time step used after applying the ring average technique is 0.0001 s, which is 25 times larger than that used in the simulation without the ring average (dt = 0.000004 s). Although the FFT filter can result in non-oscillatory solutions in the finite-difference solver, as shown by the onedimensional profiles in Fig. 4l, evident density oscillations occur near the pole due to numerical instability caused by the FFT method. The cutoff frequency of the FFT filter is case-dependent and has a problem of mass loss compared to the ring average method. The advection experiment illustrates that the ring average technique is capable of relaxing the severe time step constraint and resolving large density gradients when passing through the clustered grid cells near the pole.

Ring average for GCMs
We use the NCAR TIEGCM to demonstrate the effectiveness of the ring average technique in resolving mesoscale upper-atmospheric structures. TIEGCM is a physics-based 3D global model that solves the coupled equations of momentum, energy, and continuity for neutral and ion species in the upper-atmospheric I-T system using a fourth-order and centered finite-difference scheme to evolve the advection terms on each pressure surface with a staggered vertical grid (Qian et al., 2014;Roble et al., 1988;Richmond et al., 1992). The TIEGCM utilizes a spherical coordinate system fixed with respect to the rotating Earth, with geographic latitude and longitude as the horizontal coordinates and the pressure surface as the vertical coordinate. The following is a brief introduction of the basic equations in the TIEGCM.
The thermospheric energy equation is with temperature T n , time t, the vertical coordinate Z = ln(P 0 /P ), the pressure P , and the reference pressure P 0 ; g is gravity, K T is the molecular thermal conductivity, C P is the specific heat per unit mass, H is the pressure scale height, K E is the eddy diffusion coefficient, ρ is the atmospheric mass density, U is the horizontal neutral velocity with the zonal and meridional components u n and v n , w is the vertical velocity defined by w = dZ/dt, R * is the universal gas constant, m is the mean atmospheric mass, and Q and L are the heating and cooling rates. The mean molecular mass m is determined by where and m represent the mass mixing ratio and the molecular mass, respectively, for the three thermospheric major species O 2 , O, and N 2 .
The zonal momentum equation is expressed as and the meridional momentum equation is where λ and ϕ represent the geographic latitude and longitude, respectively. R E is the radius of the Earth, µ is the viscosity coefficient, which is the sum of eddy and molecular viscosity coefficients, f is the Coriolis parameter, φ is the geopotential, H is the pressure scale height, v i and u i are the meridional and zonal E × B ion drift velocities, and λ xx , λ xy , λ yx , and λ yy are the ion-drag tensor coefficients. The TIEGCM "vertical velocity" w = dZ/dt is determined by solving the continuity equation: The real vertical velocity is obtained by first integrating the continuity equation (Eq. 29) over Z to get w and then multiplying w by the neutral pressure scale height to get the right unit. The thermospheric major species in the TIEGCM include O 2 , O, and N 2 . The continuity equation for the mass mixing ratio of O 2 and O is given by where˜ = ( O 2 , O ), τ is the diffusion timescale equal to 1.86 × 10 3 s, m N 2 is the molecular mass for molecular nitrogen, T 00 = 273 K is the standard temperature,α is the matrix operator of the diffusion coefficients, K(Z) is the eddy diffusion coefficient, andS andR are the production and loss terms for these two species. The diagonal matrix operator L has elements of the form where i = 1 and i = 2 denote O 2 and O, respectively. The N 2 mass mixing ratio is determined by The minor species in the TIEGCM are N( 4 S), N( 2 D), and NO. The timescale of N( 4 S) is relatively short and is thus considered to be in photochemical equilibrium. N( 4 S) and NO have longer lifetimes, so the transport effects must be taken into account. The governing equation for these two species is wherẽ where˜ = ( NO , N( 4 S) ),Ã is the vertical molecular diffusion coefficient, andS andR are the production and loss terms for each species. Terms inẼ represent the effects of gravity, thermal diffusion, and the frictional interaction with the major species on the vertical profiles of these two species. F is a matrix operator for the frictional interactions,α is the thermal diffusion coefficient, andm is the molecular mass for the two minor species. The ions of the ionosphere in the TIEGCM include O + , O + 2 , NO + , N + , and N + 2 , and the electron density is calculated by chemical equilibrium of these ions. All major ionospheric ions except O + are assumed to be in photochemical equilibrium; thus, their densities can be calculated simply by balancing the loss and production rates. The O + density is determined not only by O + loss and production but also by transport due to E ×B drifts, neutral winds, and field-aligned ambipolar diffusion. The O + continuity equation can be expressed as where n is the O + density, Q is the production rate, L is the loss rate, and ·(nV) is the transport term. The ion velocity V is given by where V (caused by ambipolar diffusion and neutral winds) and V ⊥ (caused by E × B drifts) are the parallel and per-pendicular velocities with respect to the magnetic field line, respectively, b is a unit vector along the magnetic field, ν in is the ion-neutral collision frequency, g is the acceleration due to gravity, ρ i is the ion mass density, P i and P e are the ion and electron pressures, respectively, U n is the neutral velocity, B is the magnetic field, and E is the electric field. By assuming a thermal quasi-steady state, the electron energy equation is with I the geomagnetic dip angle, K e the electron thermal conductivity parallel to the magnetic field, Q e the sum of all local electron heating rates, and L e the sum of all local cooling rates. For the electrodynamics, i.e., the "neutral wind dynamo process", TIEGCM assumes steady-state electrodynamics with a divergence-free current density J for longer timescales: where σ P and σ H are the Pedersen and Hall conductivities, respectively. J || and J M are the ohmic component of current density parallel to the magnetic field and the non-ohmic magnetospheric component, respectively.
The ionospheric convection pattern for computing the plasma advection velocity V ⊥ at high latitudes is specified by either the Heelis et al. (1982) or the Weimer (2005) empirical model, while at the bottom boundary the migrating tides are specified using the Global Scale Wave Model Forbes, 2002, 2003). The current standard version of TIEGCM (TIEGCM v2.0) provides two spatial resolution options: (1) 5 • × 5 • in horizontal geographic latitudelongitude grid and 1/2 scale height in the vertical direction or (2) 2.5 • ×2.5 • in horizontal geographic latitude-longitude grid and 1/4 scale height in the vertical direction.
In this study, the ring average technique is implemented in the TIEGCM v2.0 to solve the issue of clustering grid cells near the poles in the development of a high-resolution version of the TIEGCM. This technique is applied as a postprocessing treatment of the fluid variables including oxygen ion density O + , neutral temperature T n , thermospheric compositions , and meridional, zonal, and vertical winds (U n , V n , w) at each time step, with different reconstruction methods (PPM or PLM) for different variables (Table 1). Due to the use of MPI parallelization in the TIEGCM in supercomputers, the ring average technique firstly collects the azimuthal data in the root thread, conducts the averagingreconstruction process, and finally redistributes data into each MPI thread. Figure 5 illustrates ring average filters used in the main algorithms of the TIEGCM, including the thermosphere solvers in Equations (25)-(34), the ionosphere solver for O + in Eqs. (35)-(39), and the dynamo solver for  (40). For neutral variables in the thermosphere solver, the ring average technique with the PLM reconstruction is utilized. Specifically, for the meridional and zonal neutral winds, the second and higher Fourier components are processed with the PLM ring average filter to maintain the direction of vectors across the pole, as displayed in Fig. 5. The oxygen ion (O + ) in the ionosphere usually has much sharper gradients than the neutral variables, e.g., tongue of ionization (TOI) structures; thus, the PPM is used in the reconstruction process to provide high-order accuracy and handle the larger local gradient. Meanwhile, to balance the numerical stability and computational speed, a sub-cycling technique, which has a smaller time step for O + than neutral variables, has been applied in the O + solver because the ions can move much faster than the neutrals with the E × B drifts, especially during major geomagnetic storms.
On the basis of the ring average technique, a new highresolution version of TIEGCM with a horizontal longitudelatitude resolution as high as 0.625 • × 0.625 • is developed. Table 2 lists the ring average setup used in different TIEGCM resolutions. The third column in Table 2 represents the number of averaging chunks in each azimuthal ring near the pole from the first innermost to the outermost rings. For example, in the first azimuthal ring near the pole of the 0.625 • ×0.625 • grid resolution, 64 longitude grids (576/9 = 64) and 40 longitude degrees (360 • /9 = 40 • ) are grouped into a chunk. In the outermost filtered ring (around 71.25 • latitude), one averaging chunk only contains two longitude grids. Table 3 summarizes the information on different spatial resolutions of the TIEGCM, including the current version of the 2.5 • × 2.5 • TIEGCM with the default FFT filter and the 2.5 • × 2.5 • , 1.25 • ×1.25 • , and 0.625 • ×0.625 • resolution TIEGCM with the ring average filter. As the resolution doubles, the time step decreases approximately linearly rather than quadratically. In practice, the 0.625 • × 0.625 • resolution of the code runs about 2 times faster than real time with 256 processors on the NCAR/CISL Cheyenne supercomputer system (12 h for a 1 d geomagnetic storm simulation), which is at fairly low computational cost for mesoscale-resolving global simulations. The preliminary results of the high-resolution TIEGCM will be shown in the following section.

Applications
To show the capability of the new high-resolution TIEGCM based on the ring average technique in resolving mesoscale I-T structures, we have simulated the ionospheric and thermospheric variations during the 17 March 2013 major geomagnetic storm as an example. Figure 6 displays the comparison of polar maps of electron densities between different filter techniques with the 2.5 • × 2.5 • horizontal resolution. The electron density is plotted on pressure surface 2, which is near the F 2 -region peak (∼ 300 km of altitude). Figure 6a corresponds to the standard TIEGCM with the FFT filter, while Fig. 6b is the result using the ring average technique. Generally, the electron densities in the two simulations in Fig. 6a and b are similar below 60 • N, with an evident electron density enhancement seen in the afternoon sector and negative storm effects in the morning at 10:50 UT during the storm. The dense ionospheric plasma in the afternoon sector is transported in the anti-sunward direction into the polar cap region by the dusk cell of the convection pattern. Consequently, prominent polar tongue of ionization (TOI) features can be seen as a narrow density plume on the dayside, which stretches from 65 • N at noon to latitudes greater than 80 • N inside the polar cap. Those TOI features agree well with the polar Global Position System (GPS) total electron content (TEC) observations (e.g., Foster et al., 2005;Thomas et al., 2013). It is evident that, in Fig. 6a, the TOI cannot go through the polar cap region and generates an artificial "hole" structure above 80 • N. This nonphysical depletion is associated with the loss of electron density induced by the removal of high frequency in the FFT filter, as also indicated in the advection experiment in Fig. 4f. Consequently, the plasma  [9,9,18,18,36,36,36,36,72,72,72,72,144,144,144,144,144,144,144,144] 0.625 • × 0.625 • 576 [9,9,9,9,18,18,18,18,36,36,36,36,36,36,36,36,72,72,72,72,72,72,72,72,144,144,144,144,144,144,144,144,288,288,288,288,288,288,288,288]  within the TOI accumulates around the hole and a "ring-like" structure appears at about 70 • N. In contrast, for the ring average technique, the electron densities in Fig. 6b can successfully flow through the polar cap and arrive at the nightside, which is consistent with Fig. 4c. Thus, using the ring average, the artificial structures no longer exist in the polar cap region, indicating the advantage of the ring average technique in handling numerical instability by causing fewer artificial structures and preserving the real mesoscale structures. Figure 7 shows the comparison of the polar maps of electron densities between simulations with different spatial resolutions using the TIEGCM bolstered by the ring average technique. The simulation results after using the ring average technique are generally similar among different simulations, with finer structures at higher spatial resolutions. Besides the ionospheric parameters, we have also tested the performance of the ring average in thermospheric simulations (not shown here), which indicates that the thermospheric variables generally converge between different spatial resolutions. The thermospheric temperature, O/N 2 , and thermospheric density simulated by two kinds of filters do not show distinct differences compared with the ionospheric simulations due to the relatively smoother variations of neutral parameters.
Only slight deviation exists locally on a smaller scale in the polar thermosphere. The results from Figs. 6 and 7 demonstrate that the ring average technique can be applied in the finite-difference method, which is usually considered to be less stable than the finite-volume scheme. The ring average method can successfully maintain numerical stability, even with the structures of large spatial gradients, and conserve true mesoscale structures. Meanwhile, the ring average technique shows advantages of inexpensive computational cost and easy implementation, as indicated by Table 3. By using the ring average, the time step has been greatly relaxed in the ideal advection experiment and the high-resolution TIEGCM, which would maintain the computational cost at an acceptable level. Furthermore, ring averaging can be applied as a post-filter after each simulation step and would not require a modification of the underlying code; this would make the technique easily applied.
Benefiting from the ring average technique, the newly developed high-resolution TIEGCM has been applied to explore the mesoscale variations in the I-T system during space weather events. For instance, based on the 0.625 • × 0.625 • high-resolution TIEGCM simulations and satellite observations, Dang et al. (2019) reported the occurrence of double TOIs and carried out a comprehensive study on the dynamic evolution and formation mechanism of double TOIs. Lu et al. (2020) used the high-resolution model to study ionospheric disturbances such as traveling ionospheric disturbances and enhanced storm density during geomagnetic disturbances. The high-resolution TIEGCM has also been utilized to simulate the sub-auroral polarization stream (Lin et al., 2019), neutral wind variabilities (Wu et al., 2019), and the responses of the I-T system to solar eclipses (Dang et al., 2018a, b;Lei et al., 2018;Wang et al., 2019). These works highlight the enhanced capability of the high-resolution TIEGCM in resolving ionospheric and thermospheric mesoscale structures enabled by the ring average technique.
Simulating the mesoscale structures also requires a more realistic input from the upper boundary, corresponding to the electric field and auroral precipitation from the magnetosphere, and the bottom boundary, corresponding to the  upward propagation of tides and waves from the lower atmosphere, of the I-T system. In the TIEGCM, these inputs are directly adopted from two empirical models, the Weimer model and the Global Scale Wave Model (GSWM), which might not necessarily represent the complexity of the actual physical processes from the boundaries. To obtain a more physical upper boundary condition, the CMIT has been developed Wiltberger et al., 2004), which couples the LFM global magnetosphere model with the I-T model TIEGCM. The LFM provides the TIEGCM with high-latitude electric fields and auroral electron precipitation, and the TIEGCM feeds ionospheric height-integrated conductance back to the LFM. The standard resolution of the ionosphere and thermosphere in CMIT is 2.5 • × 2.5 • , which is the same as the standard TIEGCM. By implementing the high-resolution TIEGCM in CMIT, the thermosphereionosphere part in CMIT has a horizontal resolution of 1.25 • in both latitude and longitude, which is comparable to the magnetospheric resolution of 100 km mapped to the ionospheric reference altitude. Figure 8 shows an example CMIT simulation of the ionosphere and thermosphere at 17:30 UT during the 17 March 2013 geomagnetic storm. The TEC in Fig. 8a shows more dynamic and finer TOI variations driven by the magnetospheric convection during the storm time. Meanwhile, the thermospheric temperature in Fig. 8b also exhibits distinct mesoscale structures associated with changes in the neutral wind circulation and ion collisional heating. The results illustrate that, with the implementation of the ring average technique, the high-resolution CMIT show advantages in resolving the dynamic evolution of mesoscale structures in the coupled magnetosphereionosphere-thermosphere system. Furthermore, the ring average technique has also been applied in the WACCM-X, which can provide a relatively more realistic bottom boundary for the I-T simulation. The WACCM-X is a whole-atmosphere chemistry-climate general circulation model spanning the range of altitude from the Earth's surface to the upper thermosphere to simulate the entire atmosphere and ionosphere (Liu et al., 2018). The ionosphere and electrodynamo parts in WACCM-X are the same as in the TIEGCM. The ring average scheme has been successfully implemented in the O + transport module of the WACCM-X to get a higher spatial resolution for the ionosphere. Figure 9 shows the simulation results for the 17 March 2013 geomagnetic storm from WACCM-X. For this simulation, the horizontal resolution is 1.25 • × 0.9 • in longitude and latitude directions, respectively, and the vertical resolution in the upper atmosphere is 1/4 of the scale height. Detailed analyses and exploration of the CMIT and WACCM-X results are beyond the scope of this study and will be studied in the future. Ongoing efforts also include improving the resolution of the vertical direction and the electrodynamo of the TIEGCM as well as applying the ring average technique to high-resolution data assimilation and space weather prediction.

Summary
In summary, a post-processing technique with an averagingreconstruction (ring average) algorithm is developed to solve the problem of clustering of azimuthal cells in a spherical coordinate with the finite-difference method. The ring average technique is applied based on a reduced effective polar grid by first averaging quantities within azimuthal effective "chunks" and then reconstructing them within each chunk. The ring average technique shows the advantages of inexpensive computational cost, easy implementation, time step relaxation, and maintenance of the mesoscale structures without introducing artifacts, which allows for the development of high-resolution GCMs to resolve mesoscale structures. We have developed a new version of the TIEGCM, which has a horizontal resolution of 0.625 • × 0.625 • in a geographic longitude-latitude grid, by implementing the ring average technique as a post-processing step. The nonphysical "hole" and "ring" structures, which are induced by an FFT filter in the previous TIEGCM version, no longer exist in the high-resolution TIEGCM associated with the ring average technique. The simulation results illustrate that the highresolution TIEGCM is capable of resolving the mesoscale structures in the I-T system during a geomagnetic storm event. Moreover, the ring average scheme has also been implemented in CMIT and WACCM-X to enable high-spatialresolution self-consistent simulations of the whole geospace from the ground to the magnetosphere.
Fund (Hong Kong and Macau) of the National Natural Science Foundation of China (41922060). Han-li Liu's work was supported by the National Center for Atmospheric Research, which is a major facility sponsored by the National Science Foundation under cooperative agreement no. 1852977. The National Center for Atmospheric Research is sponsored by the National Science Foundation.
Review statement. This paper was edited by Josef Koller and reviewed by two anonymous referees.