## 1. Introduction

In order to study the earth’s climate system, climate models are often created by coupling individual component models that simulate the atmosphere, land surface, ocean, and sea ice. Component models are often developed as stand-alone models or perhaps as pairs of components (e.g., atmosphere–land or ocean–ice) and utilize grids that work best for that particular component. For example, ocean circulation models have begun to utilize grids that cover the polar regions effectively (Smith et al. 1995) or that can utilize local mesh refinement (Levin et al. 1997; Taylor et al. 1997). Similarly, atmosphere models have begun to use icosahedral grids or triangular tesselations for horizontal discretizations (Schättler and Krenzien 1997; Heikes and Randall 1995).

In a fully coupled climate model, state variables and heat and water fluxes must be transferred between models periodically, and such fields must be remapped from one component grid to another. Fluxes in particular must be remapped in a conservative manner in order to maintain the energy and water budgets of the coupled climate system. Currently, many coupled models utilize an area-weighted remapping where the interpolation weights are based on the fractional area-overlap of the source and destination grid cells (Bryan et al. 1996). Such a scheme is automatically conservative, but is only first-order accurate. Also, it has been primarily applied to situations where both grids are latitude–longitude rectangular grids. We present here a method for computing remapping weights that will work for any general grid and will provide weights for both first- and second-order accurate remappings. The method was originally introduced by Dukowicz and Kodis (1987) but will be derived for spherical coordinates in the next section. The third section will describe practical considerations and problems encountered in spherical coordinates.

## 2. Conservative remapping

*f*on an old (source) grid, the destination flux

*F*at a destination grid cell

*k*must satisfy where

*F*

*A*

_{k}is the area of cell

*k.*Satisfying (1) will automatically satisfy the global conservation condition where the integral is over the entire grid surface

*A.*Because the integral in (1) is over the area of the destination grid cell, only those cells on the source grid that are covered at least partly by the destination grid cell contribute to the value of the flux on the destination grid. If cell

*k*overlaps

*N*cells on the source grid, the remapping can be written as where

*A*

_{nk}is the area of the source grid cell

*n*covered by the destination grid cell

*k,*and

*f*

_{n}is the local value of the flux in the source grid cell (see Fig. 1).

*f*

_{n}is constant across a source grid cell, (3) would lead to the first-order area-weighted schemes used in current coupled models. A more accurate form of the remapping is obtained by using a more accurate approximation of the flux on the source grid. For a conservative scheme, the flux must satisfy Dukowicz and Kodis (1987) approximate the source flux by

*f*

_{n}

*f*

_{n}

**∇**_{n}

*f*

**r**

**r**

_{n}

**∇**_{n}

*f*is the gradient of the flux in cell

*n*and

**r**

_{n}is the centroid of cell

*n*defined by Such a distribution satisfies the conservation constraint and is equivalent to the first terms of a Taylor series expansion of

*f*around

**r**

_{n}. The remapping is thus second-order accurate if

**∇**_{n}

*f*is at least a first-order approximation to the gradient.

*θ*is latitude,

*ϕ*is longitude, and the three remapping weights are and Again, if the gradient is zero, (7) reduces to a first-order area-weighted remapping. The second-order weights are an area-weighted distance from the source cell centroid.

Computing the area integrals in Eqs. (8)–(10) is simple for very simple grids, but can be difficult for general grids where overlap regions may be irregular in shape. To compute the area integrals for more general grids. Dukowicz and Kodis (1987) convert the area integrals into line integrals using the divergence theorem. Computing line integrals around the overlap regions is much simpler; one simply integrates first around every grid cell on the source grid, keeping track of intersections with destination grid lines, and then one integrates around every grid cell on the destination grid in a similar manner. After the sweep of each grid, all overlap regions have been integrated.

*C*is the curve containing the area

*A.*The selection of the function

*G*is arbitrary as long as

**·**

**∇****G**is chosen to be the integrand of the above area integrals. If

*G*

_{ϕ}= 0, the integrals in Eqs. (8)–(10) become and where

*C*

_{nk}is the counterclockwise path around the region

*A*

_{nk}. Computing these three line integrals during the sweeps of each grid provides all the information necessary for computing the remapping weights.

## 3. Practical considerations

As mentioned in the previous section, the algorithm for computing the remapping weights is relatively simple. The process amounts to finding the location of the end point of a segment and then finding the next intersection with the other grid. The line integrals are then computed and summed according to which grid cells are associated with that particular subsegment. Despite this relative simplicity, the practical application of this method requires avoiding some spherical coordinate problems and optimizing search and intersection algorithms.

### a. Search algorithms

The most time-consuming portion of the algorithm described above is finding which cell on one grid contains an end point from the other grid. Optimal search algorithms can be written when the grid is well structured and regular. However, if one requires a search algorithm that will work for any general grid, a hierarchy of search algorithms appears to work best. In such a case, a preliminary sorting of grid cells based on latitude bins or bounding boxes can be used to restrict a more robust but expensive algorithm.

**r**

_{12}in Fig. 1) and a vector extending from the beginning of the cell side to the search point (

**r**

_{1b}). If

**r**

_{12}

**r**

_{1b}

### b. Intersections

*θ*

*θ*

_{b}

*s*

_{1}

*θ*

_{e}

*θ*

_{b}

*ϕ*

*ϕ*

_{b}

*s*

_{1}

*ϕ*

_{e}

*ϕ*

_{b}

*θ*

*θ*

_{1}

*s*

_{2}

*θ*

_{2}

*θ*

_{1}

*ϕ*

*ϕ*

_{1}

*s*

_{2}

*ϕ*

_{2}

*ϕ*

_{1}

*θ*

_{1},

*ϕ*

_{1},

*θ*

_{2},

*ϕ*

_{2},

*θ*

_{b}, and

*θ*

_{e}are end points as shown in Fig. 1, the intersection of the two lines occurs when

*θ*and

*ϕ*are equal. The linear system is then solved to determine

*s*

_{1}and

*s*

_{2}at the intersection point. If

*s*

_{1}and

*s*

_{2}are between zero and one, an intersection occurs with that cell side.

It is important also to compute identical intersections during the sweeps of each grid. To ensure that this will occur, the entire line segment should be used to compute intersections rather than using a previous or next intersection as an end point.

### c. Coincidences

Often, pairs of grids will share common lines (e.g., the equator). When this is the case, the method described above will double count the contribution of these line segments. Coincidences can be detected when computing cross products for the search algorithm described above. If the cross product is zero in this case, the end point lies on the cell side. A second cross product between the line segment and the cell side can then be computed. If the second cross product is also zero, the lines are coincident. Once a coincidence has been detected, the contribution of the coincident segment can be computed during the first sweep and ignored during the second sweep.

### d. Spherical coordinates

Some aspects of the spherical coordinate system introduce additional problems for the method described above.

#### 1) Multiple-valued coordinate

Longitude is multiple valued on one line on the sphere, and this branch cut may be chosen differently by different grids. Care must be taken when calculating intersections and line integrals to ensure that the proper longitude values are used. A simple method is to always check to make sure the longitude is in the same interval as the source grid cell center.

#### 2) Pole

Another problem with computing weights in spherical coordinates is the treatment of the pole. First, note that although the pole is physically a point, it is a line in latitude–longitude space and has a nonzero contribution to the weight integrals. If a grid does not contain the pole explicitly as a grid vertex, the pole contribution must be added to the appropriate cells. The pole contribution can be computed analytically.

The pole also creates problems for the search and intersection algorithms described above. For example, a grid cell that overlaps the pole can result in a nonconvex cell in latitude–longitude coordinates. The cross-product test described above will fail in this case. In addition, segments near the pole typically exhibit large changes in longitude even for very short segments. In such a case, the linear parametrizations used above result in inaccuracies for determining the correct intersections.

### e. Gradients

For a second-order remapping, a gradient must be supplied. Methods for computing gradients can vary depending on the grid and numerical algorithm employed, and the remapping method above requires only that the gradient be at least first-order accurate. If a field to be remapped has strong gradients, numerical approximations to the gradient may be too steep. In such cases, (5) may overshoot the expected value of the field, resulting in spurious oscillations in the resulting remapped field. Avoiding such oscillations requires limiting the gradient, and sample methods for limiting the gradient are discussed in Dukowicz and Kodis (1987). When gradient limiters are employed, formal second-order accuracy is lost, but the remappings can be made monotone.

It should also be noted that (5) implies that little increase in accuracy is gained using the second-order remappings to remap from a fine grid to a coarse grid. Remapping from a fine grid to a coarse grid consists of averaging over cells on the fine grid; the gradient components in (5) will average to zero when averaging over an entire cell.

### f. Mask conflicts

While computing the remapping weights, the fraction of a grid cell participating in a remapping is also computed. For an ocean-to-atmosphere mapping, this means that the land fraction on the atmosphere grid is computed automatically. This land fraction and the associated land mask may differ from that used by the atmosphere in stand-alone mode. In this case, one grid must be chosen as a “master” grid for determining land–ocean boundaries. The problem is further compounded if all components use different grids, and in this case all components must conform to the same “master” grid.

### g. Optimizations

Throughout the descriptions above, the most general algorithms have been presented that are robust enough to work for any grid on a sphere. Such robustness comes at a cost in computational time, but the weights only need be computed once for each grid pair and stored in a file for later use. Computational cost is typically less of an issue than robustness and accuracy. However, the algorithms can be highly optimized for grids that are highly structured. For example, it is very easy to determine the location of a point in a simple latitude–longitude grid using an arithmetic calculation without using a full search algorithm. Also, for logically rectangular grids, it is simple to determine which cell you are entering after an intersection, so a search is unnecessary.

For grids in which cells share a common side (e.g., logically rectangular grids), the line integral contribution can be computed once for both grid cells on each side of the segment; the contribution to the cell on the right of the segment has the opposite sign of the contribution to the cell on the left. For a logically rectangular grid, all of the line integrals can be performed by integrating once along the *i*-axis and then once along the *j*-axis rather than integrating around each cell individually.

Finally, note that lines of constant longitude do not contribute to the integrals and can be ignored in the weight calculations. For some grids, this results in a large savings in computational work.

## 4. Results

The conservative first- and second-order remappings have been implemented and tested for a variety of grid combinations described below. Tests were conducted using several analytic fields. The first field is a cosine hill *f* = 2 + cos(*πr*/*L*) where *r* is the distance from the center of the hill and *L* is a length scale. Such a function is useful for determining the effects of repeated applications as shown below. The other two fields are representative of spherical harmonic wavefunctions. A relatively smooth function *f* = 2 + cos^{2}*θ* cos(2*ϕ*) is similar to a spherical harmonic with *l* = 2 and *m* = 2, where *l* is the spherical harmonic order and *m* is the azimuthal wave number. The function *f* = 2 + sin^{16}(2*θ*) cos(16*ϕ*) is similar to a spherical harmonic with *l* = 32 and *m* = 16 and is useful for testing a field with relatively high spatial frequency and rapidly changing gradients. The latter two functions will be referred to as *Y*^{2}_{2}*Y*^{16}_{32}

A first test compared the conservative remappings to bilinear and bicubic interpolations for two simple grids. While the bilinear and bicubic interpolations are not conservative, such a test is useful to gauge the accuracy of the remappings. The grids in this case were a Gaussian latitude–longitude grid used for T42 spectral truncations and a latitude–longitude grid with one-degree spatial resolution. The results of a remapping from the coarse T42 grid to the finer one-degree grid are shown in Table 1. The errors shown in the table are relative errors *ϵ* = |(*f*_{computed} − *f*_{analytic})/*f*_{analytic}| and both the maximum and spatially averaged values are shown. For all of the test fields, the second-order conservative remappings resulted in errors somewhere between the bilinear and bicubic results. The second-order mappings used analytic gradients, so a more typical case with numerically approximated gradients would likely be closer to the bilinear result. Such a result is consistent with the assumption of constant gradients across a cell for the second-order remappings. The first-order remappings assume a piecewise constant field and are much less accurate than the bilinear and bicubic cases. Such a piecewise constant field is a very poor approximation for fields with high spatial frequency exhibited by the *Y*^{16}_{32}

In order to show the robustness and generality of the method presented here, the remappings were tested using more general grids. Results for combinations of four different grids are shown in Table 2. The icosahedral (ICOS) grid (Heikes and Randall 1995) is made up of cells with either five or six sides and has an average resolution of 4.5°. It is used to provide a good test of the generality of the method. A second grid is a high-resolution (27 km) ice grid (ICE; Washington and Weatherly 1997) that provides a good test of a grid with incomplete coverage (the grid only covers the polar regions) and of the coordinate transformation utilized in the polar regions. The third grid is a displaced-pole grid used by the Los Alamos Parallel Ocean Program (POP) and is a general grid with a land mask. The final grid is a standard Gaussian latitude–longitude grid at T42 resolution. Only the conservative mapping results are shown as the bilinear and bicubic interpolations cannot be applied to some of these grids. Where bilinear interpolations can be applied, the second-order conservative results are again comparable to the bilinear results for accuracy.

For all remappings from a coarse grid to a fine grid, the second-order scheme results in an order-of-magnitude improvement over the first-order conservative remapping. The first-order mappings are particularly bad for the high-frequency *Y*^{16}_{32}

The conservation properties of the remappings were tested by computing global area integrals of the analytic field on the source grid and of the remapped field on the destination grid. The resulting integrals agreed to one part in 10^{−15}, so the remappings are conservative to machine accuracy.

The conservative remappings presented here have been used in production coupled model simulations, including the work of Washington and Weatherly (1997) and a spinup of the Los Alamos POP model in preparation of a full coupled model simulation. In both of these cases, the remappings have worked well and no biases have been detected associated with the remappings. However, to try and assess the effects of repeated remappings, a test was performed mapping the hill function back and forth repeatedly between a T42 grid and the 1° latitude–longitude grid. Figure 2 shows the result after one mapping and after 100 repeated mappings of the hill function for both the first-order and second-order methods. The second-order method retains the shape quite well, while the first-order method is quite diffusive and begins to show the pattern of the coarse grid on the fine grid. It should be noted that such a pattern does not appear in actual coupled model simulations where the identical field is never mapped repeatedly.

## 5. Conclusions

The method described here provides a mechanism for computing remapping weights for both first- and second-order remappings. Use of these weights provides remappings that are up to second-order accurate and conservative to machine accuracy. Because the method is completely general, weights can be computed for any type of grid on a sphere, allowing developers of component models in a coupled model context to use whatever grid is appropriate for a given component and not be constrained by compatibility with other component model grids.

Software implementing the methods described in this paper is freely available from the author (http://www.acl.lanl.gov/lanlclimate/SCRIP).

## Acknowledgments

The author would like to thank J. Dukowicz for many useful conversations regarding his method and A. Craig and T. Ringler for helping to test the method on various grids. This research is supported by the Department of Energy under Contract W-7405-ENG-36.

## REFERENCES

Bryan, F. O., B. G. Kauffman, W. G. Large, and P. R. Gent, 1996: The NCAR CSM flux coupler. NCAR Tech. Note 424, 50 pp. [Available from NCAR, Boulder, CO 80307.].

Dukowicz, J. K., and J. W. Kodis, 1987: Accurate conservative remapping (rezoning) for arbitrary Lagrangian-Eulerian computations.

*SIAM J. Sci. Stat. Comput.,***8,**305–321.Heikes, R., and D. A. Randall, 1995: Numerical integration of the shallow-water equations on a twisted icosehedral grid. Part I: Basic design and results.

*Mon. Wea. Rev.,***123,**1862–1880.Levin, J. G., M. Iskandarani, and D. B. Haidvogel, 1997: A spectral filtering procedure for eddy-resolving simulations with a spectral element ocean model.

*J. Comput. Phys.,***137,**130–154.Schättler, U., and E. Krenzien, 1997: Model development for parallel computers at DWD.

*Making Its Mark,*G. R. Hoffmann and N. Kreitz, Eds., World Scientific, 83–100.Smith, R. D., S. Kortas, B. Meltz, 1995: Curvilinear coordinates for global ocean models. Los Alamos Unclassified Rep. 95-1146, 51 pp.

Taylor, M., J. Tribbia, and M. Iskandarani, 1997: The spectral element method for the shallow water equations on the sphere.

*J. Comput. Phys.,***130,**92–108.Washington, W. M., and J. W. Weatherly, 1997: Simulations with a climate model with high-resolution ocean and sea ice. Polar Processes and Global Climate, Draft Summary Report from the Conference on Polar Processes and Global Climate, WMO/ICSU/IOC World Climate Research Programme. 250–252.

Results of remappings from a T42 grid to a 1° latitude–longitude grid.

Results of remappings between various grid pairs.