1424
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
VOLUME 19
Fourth- and Fifth-Order Finite-Difference Methods Applied to a Control-Volume Ocean Model BRIAN SANDERSON Environmental Modelling Solutions, Lisarow, and School of Science and Technology, Central Coast Campus, University of Newcastle, Ourimbah, Australia
GARY BRASSINGTON* School of Engineering, James Cook University, Townsville, Australia (Manuscript received 8 December 2000, in final form 14 November 2001) ABSTRACT A semi-implicit, control-volume, nonhydrostatic model is presented. Advection is fifth order with respect to space. Boundary conditions and molecular fluxes are also formulated at fourth order with respect to space. Computational cost is strictly proportional to the number of grid points. Barotropic and nonhydrostatic pressure gradients are calculated using fourth-order explicit calculation followed by a second-order implicit correction for the incremental pressure gradient updates. This strategy is used in the DieCAST model in order to ensure accurate treatment of geostrophy with minimal computational cost, and here it is diagnosed to be advantageous for both small- and large-scale convective flows. Anisotropic grids can result in the vertical Courant number being much larger than the horizontal Courant number, in which case it may be advantageous to use a time step–limited horizontal advection scheme with a more computationally expensive but time step–unlimited vertical advection scheme. An anisotropic grid also admits a quasi one-dimensional calculation of nonhydrostatic pressure, which is not computationally expensive. A two-scale calculation of convecting cells in the deep ocean indicates that, in this circumstance, subgrid-scale processes cannot be parameterized by any means that causes smoothing.
1. Introduction There are two fundamental design constraints that a numerical model must satisfy if it is to converge to the solution of the continuum equations as the grid is refined (Lax and Richtmyer 1956). First the model must be stable. Second, the model must be consistent with the continuum equations so that the truncation error tends to zero as the grid is refined. In spite of the authoritative analysis of Leonard (1979b), many ocean models still use even-order centered advection schemes (Dietrich 1997; Weaver and Eby 1997; Pacanowski 1995; Shchepetkin and McWilliams 1998; among many others). Such schemes have dispersive truncation error, which causes spurious wiggles. These spurious wiggles are usually controlled by incorporating some sort of artifical eddy-viscosity in the model, which amounts to adding an inconsistency in order to control an instability. This is not an optimal * Current affiliation: College of Oceanic and Atmospheric Sciences, Oregon State University, Corvallis, Oregon. Corresponding author address: Dr. Brian Sanderson, 38 Dora Street, Lisarow, NSW 2250, Australia. E-mail:
[email protected]
q 2002 American Meteorological Society
strategy. Such models pose fundamental problems when used in large eddy simulations (LES) and studies of subgrid-scale parameterizations because the instability and the nonphysical eddy-viscosity used to control it interact with truncation error in a seemingly intractable tangle. Nevertheless, Browning et al. (1998) demonstrate that when the resolution is increased sufficiently, the molecular viscosity is more than enough to control the dispersive wiggles and convergence is possible. Such studies are sometimes referred to as direct numerical simulation (DNS). The goal of the present study is to formulate a numerical model that is consistent, accurate, and stable. Eddy-viscosity is banished in favor of ensuring the numerical truncation error is dissipative rather than dispersive. Margolin et al. (1999) observe that nonoscillatory advection schemes appear to include an effective subgrid scale model. In an efficient finite difference model a grid refinement reduces the truncation error at least as quickly as the computational cost is increased. (In spectral models the truncation error reduces exponentially with grid refinement.) Sanderson (1998) demonstrates that to achieve a computationally efficient finite difference numerical model, the order of accuracy must be at least
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
1425
FIG. 1. Amplification factor of a Fourier mode in the control-volume advection scheme using upstream weighted interpolations according to (2.14). Amplification is plotted as a function of Courant number and wavelength normalized by grid spacing (l/Dx 5 2, 3, 4, . . . , 19, 20). Plots show results with various N-cycle time-stepping schemes: 1 cycle (first order), 2 cycle (second order), 3 cycle (third order), and 4 cycle (fourth order).
equal to the space–time dimensionality of the problem being solved. Many geophysical flows are slowly varying in time (relative to stability constraints on the model time step) and have little vertical motion relative to the horizontal motion. Such flows might be well modeled at second order (with advection at third order). Nonhydrostatic turbulent flows, on the other hand, are fully four-dimensional and require a model that treats all important dynamical terms at fourth order or better. The DieCAST ocean model (Dietrich and Kuo 1994) and the barotropic model of Sanderson and Brassington (1998) both ensure accurate treatment of geostrophy by using a fourth-order explicit calculation of the barotropic pressure gradient followed by second-order implicit correction to satisfy continuity. Here this design principle is extended to the treatment of nonhydrostatic pressure gradients. Further, pressure gradient calculations adjacent boundaries are also extended to fourth order. A primary motivation for the present model development was to enable better estimation of the parameterization required to represent subgrid-scale processes. Remember, high-order models calculate the solution at sufficiently resolved scales (e.g., .4D) much more accurately than low-order models (see Fig. 1 of San-
derson and Brassington 1998). Of course features in the solution with 2D scales are not accurately treated regardless of order of accuracy. Indeed, high-order methods will not be monotonic if the solution contains shocks. The numerical dissipation associated with a high-order model acts selectively on the highest wavenumbers so shocks tend to be suppressed, whereas slightly larger scale features in the solution suffer much less numerical dissipation at higher orders than at lower orders. A high-order model that better calculates the solution at the above sufficiently resolved scales will likely require less intervention in the form of a subgridscale parameterization than a low-order model. Thus subgrid-scale parameterization might be expected to be a function of the numerical methods employed. Similarly, a model that relies on eddy-viscosity to control numerical instabilities (or bounded computational modes) will require a subgrid-scale parameterization tuned to the unphysical eddy-viscosity. The present model has design features appropriate for subgrid-scale studies of some (not all) dynamical systems found in the ocean. One example will be given that demonstrates calculation of the subgrid-scale forces in a convecting fluid. Convection is fundamentally important in climate
1426
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
studies. Yet models that run on climatological scales usually have anisotropic grids that cannot even remotely resolve such convection. With anisotropic grid spacing the Courant number associated with the vertical motion can become much larger than that associated with horizontal motion. The feasibility of using a hybrid advection scheme that removes the time step restriction associated with the vertical component of motion is explored, but not analyzed in detail. Anisotropic grid spacing is also exploited to demonstrate the efficient solution to the three-dimensional elliptic equation for nonhydrostatic pressure by iterating on a sequence of one-dimensional tridiagonal equations.
VOLUME 19
The above equations support physical processes with a wide range of spatial and temporal scales. Pressure P is therefore split into three parts: hydrostatic pressure due to the free surface, hydrostatic pressure due to the departures of r from r 0 , and a nonhydrostatic pressure Q. The hydrostatic pressure at z for a fluid with a free surface at h can be written Ph 5
E
h
(r 0 1 r9)g dz,
(2.7)
z
where r9 5 r 2 r 0 . Vertically integrating (2.7) gives Ph 5 r 0 g(h 2 z) 1 g
E
h
r9 dz
z
2. Equations Neglecting molecular viscosity, molecular diffusion, and any sources or sinks of heat, salt, and momentum, the Boussinesq equations of incompressible ocean flow are
5 r 0 g(h 2 z) 1 r 0 r, where r5
g r0
E
(2.8)
h
r9 dz
(2.9)
z
DS 50 Dt
(2.1)
DQ 50 Dt
(2.2)
Du 1 ]P 2 fy 5 2 Dt r 0 ]x
(2.3)
(2.10)
Dy 1 ]P 1 fu 5 2 Dt r 0 ]y
Du ]h ]r ]q 2 f y 5 2g 2 2 Dt ]x ]x ]x
(2.4)
Dy ]h ]r ]q 1 fu 5 2g 2 2 Dt ]y ]y ]y
(2.11)
Dw 1 ]P r 52 2 g Dt r 0 ]z r0 ]u ]y ]w 1 1 5 0. ]x ]y ]z
is the hydrostatic pressure due to density fluctuations from the mean r 0 . The coordinate system is chosen so that the undisturbed surface h 5 0 is at z 5 0 and z is positive upward. The equations of motion can be rewritten in terms of these three pressure contributions as
Dw ]q 52 , Dt ]z
(2.5) (2.6)
East, north, and upward velocity components are given by u, y , and w, respectively. Salinity, potential temperature, and pressure are represented by S, Q, and P, respectively. The Coriolis parameter f is set constant but can be trivially generalized to be a function of space or to include its vertical component. An explicit, fourthorder accurate treatment of molecular viscosity is discussed in section 2h. The total derivative is represented by D/Dt. The average density is r 0 . Density r 5 r(T, S, P) is given by the UNESCO (1981) equation of state (Gill 1982), which is a function of in situ temperature. The in situ temperature T can be efficiently found by using a fixed-point iteration to invert the Bryden (1973) equation for potential temperature Q. For shallow water applications, Q and T are treated as being the same and pressure correction terms in the UNESCO equation of state are omitted. A local fit to the full UNESCO equations is used for deep convection (Sanderson et al. 2002).
(2.12)
where the mean density r 0 is absorbed into the nonhydrostatic pressure Q to create a new variable q 5 Q/ r 0 . Fluctuations of the free surface h are obtained from of the divergence of the velocity vertically integrated over the water column’s depth U, V: ]h ]U ]V 1 1 5 0. ]t ]x ]y
(2.13)
a. Time stepping Incremental updates to sealevel and nonhydrostatic pressure are calculated implicitly, but all other updates are done explicitly within N-cycle integration (Lorenz 1971) at either third or fourth order according to the users discretion. Sanderson and Brassington (1998) and Brassington (2000) demonstrate the performance of N cycle relative to other commonly used time stepping schemes and illustrate the phase and amplitude properties of truncation error. The N cycle iterates using a sequence of first-order Euler updates. The details of an Euler update are presented below.
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
b. Control-volume discretization and indexing Physical conservation laws are naturally formulated using a control-volume cell. Here the control volume cell will be a cuboid with dimensions (Dx, Dy, Dz). The conserved quantity is represented as an average throughout the volume of the cell. Flux of a quantity through a cell face is represented as an average over that cell face. Divergence of the fluxes through the six cell faces gives the temporal rate of change of the quantity in the cell. Equations (2.1)–(2.6) can be represented as conservation laws for salt, heat, the three components of momentum, and volume (conservation of mass in an incompressible flow). Roache (1982) notes that controlvolume discretizations are based on macroscopic physical laws and this ‘‘appears to give them the best batting average.’’ Advective terms, Coriolis, and continuity are all well described as macroscopic physical laws using the control volume. In this sense, the control-volume discretization treats some of the most important terms in a physically exact manner without having to appeal to either the continuum hypothesis or the limit of infinitesimal grid spacing. Another advantage of the control-volume formulation is the unambiguous physical treatment of land–water boundaries. Modern versions of FORTRAN enable efficient vector and parallel use of logical masking (sometimes in combination with gather-and-scatter operations) to distinguish calculations at cells and cell-faces depending on their proximity to boundaries. In the following, h, u, y , w will be values at time t whereas u1 , y 1 , w1 will be values at t 1 Dt. In between there will be partially updated quantities u11 , u12 , u13 , etc. The velocity (u, y , w) and scalar quantities Q, S are all time-stepped as cell averages. The cell-averaged velocity of the (i, j, k) cell is written (u i,j,k , y i,j,k , w i,j,k ). Indices are sometimes dropped when they are the same for all variables within an equation. Half integer indexing is used for quantities averaged over cell faces so u i10.5,j,k is an average over the face joining the (i, j, k) cell to the (i 1 1, j, k) cell. In a crude sense, the control-volume formulation is like using both the A grid and the C grid. Descriptions of various grid schemes, including the A grid and C grid, are presented in Arakawa and Lamb (1977). The A grid plus C grid description is metaphorical for orders of accuracy greater than 2. c. Control-volume advection The advective update uses a modification of the Quadratic Upstream Interpolation for Convective Kinematics (QUICK) control-volume advection scheme (Leonard 1979a, 1995). The advected quantity is calculated at the cell face by using an upstream weighted, fifthorder accurate interpolation of cell-averaged quantities (Sanderson and Brassington 1998):
1427
Q i10.5 23Q i21
5
1 27Q i 1 47Q i11 2 13Q i12 1 2Q i13 , 60 if u i10.5 , 0;
2Q i22 2 13Q i21 1 47Q i 1 27Q i11 2 3Q i12 , 60 otherwise. (2.14)
Multiplying the face-averaged quantity Q i10.5 by the face-averaged velocity component u i10.5 gives the flux through the face. The advective update is obtained from the divergence of fluxes into the control volume. Conservation is ensured to within machine round-off error. Cell-averaged velocity components that have been up11 dated only for advection will be represented (u11 i,j,k , y i,j,k, w11 ). i,j,k The stability of control-volume advection using (2.14) is illustrated in Fig. 1, which shows amplification factor as a function of Courant number and wavelength l normalized by the grid spacing Dx. Values were obtained by numerically calculating the amplification of a single Fourier mode for one-dimensional advection with constant velocity. The advection scheme has been demonstrated in applications involving rotation and deformation in Sanderson and Brassington (1998). The advection scheme is stable only for unacceptably small Courant numbers when used with forward Euler time stepping (equivalent to 1-cycle Lorenz time stepping). Second-order (2-cycle) time stepping improves the stability, but is still unacceptably restrictive on the time step. Third-order (3-cycle) time stepping is stable for Courant numbers as high as 1.5. At fourth-order Courant numbers as high as 2 are stable. The grid spacing in each plot of Fig. 1 shows values of l/Dx 5 2, 3, 4, 5, . . . , 19, 20. The advection scheme totally dissipates a 2Dx signal, which is often the fastest growing mode in unstable numerical computations and is also an entirely inaccurate representation of the continuum solution. At moderate Courant numbers (;0.5) the dissipation is very selective for advection with thirdor fourth-order time stepping. Wavelengths greater than 4Dx suffer very little attenuation. Other advection schemes exist for which the time step is not restricted by stability constraints. Best known are the semi-Lagrangian advection schemes (Leslie and Purser 1995; McGregor 1993) and a control-volume scheme using Conservative Operator Splitting in Multidimensions with Inherent Consistency (COSMIC) reported by Leonard et al. (1996). Lin and Rood (1996) independently developed a multidimensional flux-form transport scheme similar to that of Leonard et al. (1996). Brassington and Sanderson (1999) and Brassington (2000) report further on the performance of the semiLagrangian and COSMIC schemes. COSMIC and semiLagrangian advection have similar computational cost
1428
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
for a given order of accuracy. Bartello and Thomas (1996) argue that semi-Lagrangian calculations have no computational cost advantage over time step–limited advection schemes with similar accuracy. Explicit treatment of the baroclinic mode is more restrictive for the time step than the advection scheme used here. d. Geostrophy on the collocated cell volumes (heuristic A grid) The surface displacement will be broken into two parts, h1 5 h 1 dh,
(2.15)
where h is the value from the previous time step and dh is the increment from h over the time step. Similarly the nonhydrostatic pressure can be broken into q and an update dq so that q 5 q 1 dq. 1
(2.16)
The nonhydrostatic update must, however, be done after the hydrostatic update of cell-averaged and face-averaged fields is completed in order to isolate hydrostatic pressure from nonhydrostatic pressure. The equations for the partly updated horizontal velocity components u12 , y 12 are obtained by considering Coriolis, the old surface gradient, and the hydrostatic pressure gradient associated with the perturbation density field as in the two following equations: 11 u12 i,j,k 5 u i,j,k 1 Dt f y i,j,k 2 Dtg
2 Dt
]r (i, j, k) ]x
11 y 12 i,j,k 5 y i,j,k 2 Dt f u i,j,k 2 Dtg
2 Dt
]h (i, j) ]x (2.17) ]h (i, j) ]y
]r (i, j, k). ]y
(2.18)
Again, the above update is done on the cell-averaged velocity and the spatial derivatives are calculated using the collocated fourth-order differencing operator ]h 1 (i, j) 5 (h 2 8h i21, j ]x 12Dx i22, j 1 8h i11, j 2 h i12, j ).
(2.19)
Note, the above collocated differencing operator treats low-wavenumber signals very accurately but wavelengths near 2D are not treated very accurately regardless of the order of the collocated operator (see Fig. 1; Sanderson and Brassington 1998). Geostrophy is concerned with the low-wavenumber signals. High-wavenumber signals are corrected in the next subsection. Most fluid flows have smoothly varying pressure fields relative to temperature and salinity, largely because the waves that adjust pressure are fast relative to the ad-
VOLUME 19
vective processes that cause the temperature and salinity gradients. It follows that the collocated differencing operator, while effective for the geostrophic pressure gradient, is quite inappropriate for advection and is also inadequate for the treatment of the continuity equation which relates directly to the fast barotropic mode. Cell faces at land–water boundaries impose a zero gradient across the boundary. Applications that are not strongly dependent upon boundary conditions might revert to lower order differencing near the boundary. The DieCAST ocean model, for example, uses the boundary condition h i21,j,k 5 h i,j,k when the i21,j,k cell is on land and the i,j,k cell is in water. Thus, when the ith cell is directly adjacent to land, the second-order operator ]h/ ]x(i, j) 5 (h i11,j 2 h i21,j )/(2Dx) becomes ]h 1 (i, j) 5 (h 2 h i,j ), ]x 2Dx i11, j
(2.20)
which is second-order accurate. When the ith cell is the second cell from a left-hand boundary, then (2.19) becomes ]h 1 (i, j) 5 (27h i21, j 1 8h i11, j 2 h i12, j ), ]x 12Dx
(2.21)
which can be written as a linear combination of secondand fourth-order accurate differencing operators. DieCAST uses (2.20) and (2.21) near boundaries. Sanderson and Brassington (1998) demonstrate that using a second-order version of (2.19) everywhere can cause nonphysical computational modes that grow slowly. Computational modes could be controlled by filtering, increasing eddy-viscosity, or detuning other parts of the calculation (that have dissipative truncation terms) to be second order. None of the above strategies are consistent with present objectives. In circumstances where the flow near the boundaries is not of negligible importance it is, therefore, desirable to use fourth-order accurate boundary conditions. Fourth-order accurate differencing operators to replace (2.19) at cells near boundaries can be constructed as follows. Consider that h,,j,k and cells to the left of h,,j,k are on land, whereas cells to the right are in water. In this circumstance the boundary condition u,10.5,j,k 5 0 requires the x derivative of h be zero at the , 1 0.5 cell face. This derivative can be constructed from the cell-averaged values of h by using a cumulative summation to obtain the exact integral up to cell faces, followed by second differencing using the fourth-order accurate (6-point) off-centered collocated operator y01 5 (20y 0 2 30y1 2 8y 2 1 28y 3 2 12y 4 1 2y 5 )/(24D 2 ) (which is easily derived from Taylor series expansions about the point where y1 is given). Thus the following derivative at the cell face is obtained:
SEPTEMBER 2002
]h (, 1 0.5, j) ]x 5
1 (220h,, j 1 10h,11, j 24Dx 118h,12, j 2 10h,13, j 1 2h,14, j ).
(2.22)
Setting (]h/]x)(, 1 0.5, j) 5 0 the fourth-order accurate boundary condition gives h,, j
1429
SANDERSON AND BRASSINGTON
Equation (2.27) defines a function F f 2a that converts face-averaged quantities R k10.5 to cell-averaged quantities R k (Sanderson and Brassington 1998). Changing the sequence of the above horizontal differencing and vertical integration operations will cause spurious currents near sloping bathymetry in a fluid in static equilibrium with a vertical density gradient. When the kth cell is adjacent, the bottom (2.27) can be written R k 5 Ff 2a (R k10.5 ) 5 (9R k20.5 1 19R k10.5 2 5R k11.5
1 5 (10h,11, j 1 18h,12, j 2 10h,13, j 20 1 2h,14, j ).
1 R k12.5 )/24. (2.23)
To obtain (]h/]x)(i, j) when the ith cell and cells to the right are in water (but cells to the left are on land), consider the off-centered, five-point, fourth-order collocated differencing operator (Berezin and Zhidkov 1965) ]h 1 (i, j) 5 (23h i21, j 2 10h i,j 1 18h i11, j ]x 12Dx 2 6h i12, j 1 h i13, j ),
(2.24)
which upon using the boundary condition (2.23) (with , 5 i 2 1) may be written ]h 1 (i, j) 5 (2230h i,j 1 306h i11, j 2 90h i12, j ]x 240Dx 1 14h i13, j )
(2.25)
and upgrades (2.20) to fourth-order accuracy. To obtain (]h/]x)(i, j) when the (i 2 1)th cell and cells to the right are in water (but cells to the left are on land), use (2.23) with , 5 i 2 2 to eliminate h i22 from (2.19), which gives ]h 1 (i, j) 5 (2150h i21, j 1 18h i,j 1 150h i11, j ]x 240Dx 2 18h i12, j )
(2.26)
and upgrades (2.21) to fourth-order accuracy. The fact that the fourth-order differencing operator changes near a land–water boundary has an important consequence for calculating the gradient of baroclinic pressure r, which is required in (2.17) and (2.18). First, r is calculated by using a cumulative summation to vertically integrate the perturbation density according to (2.9) without truncation error. This gives r i,j,k10.5 at cell faces. Second, the horizontal differencing operator (2.19) is applied to r i,j,k10.5 which gives baroclinic pressure gradients R i,j,k10.5 5 ]r i,j,k10.5 /]x at cell faces. Third, a fourth-order integration from the k 2 0.5 face to the k 1 0.5 face gives the cell-averaged baroclinic pressure gradient R k 5 Ff 2a (R k10.5 ) 5 (2R k21.5 1 13R k20.5 1 13R k10.5 2 R k11.5 )/24.
(2.27)
(2.28)
e. Control-volume update of the hydrostatic free surface The free surface dh is obtained by solving the continuity equation implicitly in order to avoid time step restrictions associated with the fast barotropic mode, although this reduces the temporal order of accuracy with which the barotropic gravity wave is calculated. The vertically integrated continuity equation is most naturally expressed using a control volume, which re12 quires velocity components (u12 i10.5,j,k , y i,j10.5,k ) averaged over cell faces and dh averaged over the top surface of a column of cells. Face-averaged horizontal velocity is 12 obtained from the cell-averaged velocity (u12 i,j,k , y i,j,k ) using a cell-average to face-average conversion function F a2 f . This effectively gives face-averaged velocity updated for advection and geostrophy. The cell-average to face-average conversion function F a2 f 12 u12 i10.5, j,k 5 Fa2 f (u i,j,k ) 5
1 12 (2u12 i21, j,k 1 7u i,j,k 12 12 1 7u12 i11, j,k 2 u i12, j,k )
(2.29)
12 i,j,k
can be derived by cumulatively summing u along i to obtain exact values for the integral up to cell faces. Applying the fourth-order differencing operator (2.19) to the resulting integral gives the above fourth-order estimate of the face-averaged quantity u12 i10.5,j,k (Sanderson and Brassington 1998). Similarly, the fourth-order, off-centered collocated differencing stencil (23, 210, 18, 26, 1)/12 gives 12 u12 i10.5, j,k 5 Fa2 f (u i,j,k ) 5
1 (3u12 1 13u12 i11, j,k 12 i,j,k 12 2 5u12 i12, j,k 1 u i13, j,k )
(2.30)
near boundaries. The face-averaged velocity update by the incremental barotropic pressure gradient can be written 12 u13 i10.5, j,k 5 u i10.5, j,k 2 Dtg
dh i11, j 2 dh i,j Dx
(2.31)
12 y 13 i,j10.5,k 5 y i,j10.5,k 2 Dtg
dh i,j11 2 dh i,j . Dy
(2.32)
Above, the gradient of dh uses staggered second-order
1430
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
differencing and is determined so as to adjust the face velocities to satisfy the vertically integrated continuity equation. The gradient in dh is small (second order) compared to gradients in h, so this second-order adjustment for continuity does not necessarily negate the fourth-order accuracy of previous calculations of spatial gradients (see section 3a). Cell-averaged velocity can be updated using either second- or fourth-order accurate averaging of the gradients in (2.31) and (2.32) onto cell volumes. The vertically integrated continuity equation in discrete form 12 12 dh i,j U 12 V 12 i10.5, j 2 U i20.5, j i,j10.5 2 V i,j20.5 1 1 50 Dt Dx Dy
(2.33)
gives an equation for the change in surface elevation hi10.5,j 12 dh. The integral U 12 i10.5,j 5 #2D i10.5,j u i10.5,j,k dz is obtained
dh i,j 1 g 1g
VOLUME 19
using vertical summation of the cell-face velocity. This integral is exact to within the accuracy with which h i10.5,j is known, and the error in h i10.5,j is very small compared to Dz. Vertically integrating (2.31) and (2.32) in the same manner gives 12 U 13 i10.5, j 5 U i10.5, j 2 Dt(D i10.5, j 1 h i10.5, j )
3g
dh i11, j 2 dh i,j and Dx
(2.34)
12 V 13 i,j10.5 5 V i10.5, j 2 Dt(D i,j10.5 1 h i,j10.5 )
3g
dh i,j11 2 dh i,j . Dy
(2.35)
The finite difference equations (2.34) and (2.35) can be substituted into (2.33) to give the following secondorder elliptic equation for dh:
Dt 2 [(D i20.5, j 1 h i20.5, j )(dh i,j 2 dh i21, j ) 2 (D i10.5, j 1 h i10.5, j )(dh i11, j 2 dh i,j )] Dx 2
Dt 2 [(D i,j20.5 1 h i,j20.5 )(dh i,j 2 dh i,j21 ) 2 (D i,j10.5 1 h i,j10.5 )(dh i,j11 2 dh i,j )] Dy 2
5 R i,j 5
Dt 12 Dt 12 (U i20.5, j 2 U 12 (V 2 V 12 i10.5, j ) 1 i,j10.5 ). Dx Dy i,j20.5
Note, a fully implicit treatment requires (D i10.5,j 1 h i10.5,j ) in (2.34) be replaced by (D i10.5,j 1 h i10.5,j 1 dh i10.5,j ) and similarly for (2.35). This would lead to a nonlinear version of (2.36), where the nonlinearity is small and could be solved for by iterating about the solution for (2.36). This correction is not made here. It is possible to formulate a spatially fourth-order accurate version of (2.36) and solve it using a defect correction (Sanderson and Brassington 1998) but little is gained by doing so. Elliptic equations in two or more dimensions are computationally expensive to solve, so it is convenient to avoid solving them at fourth-order accuracy. If the physics of the problem being modeled has a timescale much slower than the fast barotropic waves then it is reasonable to achieve larger time steps by using the implicit calculation of dh as given in (2.36). An explicit calculation of dh restricts the time step to be less than the time t c for the barotropic wave to propagate across one cell, t c 5 ÏDx/ÏgD 5 ÏDx/ÏgKDz. Clearly high resolution (large K) and great water depth restrict the time step. In such circumstances, (2.36) provides an implicit treatment of the barotropic mode so the model is time step limited by the much slower baroclinic waves. Applications with time steps greater than 50t c may, however, require double precision arithmetic
(2.36)
when solving (2.36) with algebraic accuracy beyond truncation error of the finite differencing scheme. The implicit treatment of the barotropic mode requires solution of an elliptic equation which can be computationally expensive. An alternative approach is to use a mode splitting scheme (Bryan 1969; Blumberg and Mellor 1987) in which the equations for the external mode are solved using shorter time steps. Clearly, this approach may become relatively advantageous in shallow waters that are strongly stratified. A split-explicit version of our model has not yet been coded. If the model is to be run for a strictly hydrostatic calculation then the vertical velocity is obtained implicitly by vertically integrating the continuity equation from the bottom up using the bottom boundary condition w13 i,j,K20.5 5 0: 13 13 13 w13 i,j,k10.5 5 w i,j,k20.5 1 (u i10.5, j,k 2 u i20.5, j,k )
13 1 (y 13 i,j10.5,k 2 y i,j20.5,k )
Dz . Dy
Dz Dx (2.37)
The earlier advective update for w11 i,j,k is not required for a purely hydrostatic calculation.
SEPTEMBER 2002
f. Nonhydrostatic update If the model is being run in nonhydrostatic mode then the face-averaged vertical velocity is obtained from the cell-averaged vertical velocity that was previously updated for advection: 11 w13 i,j,k10.5 5 F a2 f (w i,j,k ).
(2.38)
The function F a2 f must be fourth-order accurate, as given by the operator in (2.29). The cell-averaged velocity is now corrected for the old nonhydrostatic pressure gradient using a fourth-order collocated differencing stencil applied to the cellaveraged nonhydrostatic pressure q: 13 u14 i,j,k 5 u i,j,k 2
Dt (q 2 8q i21, j,k 12Dx i22, j,k 1 8q i11, j,k 2 q i12, j,k )
y
14 i,j,k
5y
1431
SANDERSON AND BRASSINGTON
13 i,j,k
(2.39)
Dt 2 (q 2 8q i,j21,k 12Dy i,j22,k 1 8q i,j11,k 2 q i,j12,k )
11 w14 i,j,k 5 w i,j,k 2
1 8q i,j,k11 2 q i,j,k12 ). Face-averaged velocity u
,y
13 i,j10.5,k
13 i,j,k10.5
,w
14 u15 i10.5, j,k 5 u i10.5, j,k 2
Dt (dq 2 dq i,j,k ) Dx i11, j,k
(2.42)
14 y 15 i,j10.5,k 5 y i,j10.5,k 2
Dt (dq 2 dq i,j,k ) Dy i,j11,k
(2.43)
14 w 15 i,j,k10.5 5 w i,j,k10.5 2
Dt (dq 2 dq i,j,k ). Dz i,j,k11
(2.44)
(2.40)
Dt (q 2 8q i,j,k21 12Dz i,j,k22
13 i10.5,j,k
14 14 explicitly updated to u14 i10.5,j,k , y i,j10.5,k , w i,j,k10.5 using a F a2 f operator to do a fourth-order accurate conversion of the above cell-averaged nonhydrostatic pressure gradients onto the cell face. Note this is not the same as using the (1, 227, 27, 21)/24 staggered differencing stencil. Such a staggered differencing stencil is only secondorder accurate in the present context because it computes a difference averaged over the volume that extends half a cell each side of the cell face. The implicit update to the nonhydrostatic pressure dq is expected to be small compared to q. The final cellface velocity update therefore uses staggered secondorder differencing (heuristically C-grid differencing):
(2.41) is also
Second-order differencing on this small update term minimizes the computational cost of solving the threedimensional elliptic equation for dq. Substituting (2.42), (2.43), and (2.44) into the control-volume form of the continuity equation (2.6) gives the following secondorder elliptic equation for dq:
dq i11, j,k 2 2dq i,j,k 1 dq i21, j,k dq i,j11,k 2 2dq i,j,k 1 dq i,j21,k dq i,j,k11 2 2dq i,j,k 1 dq i,j,k21 1 1 Dx 2 Dy 2 Dz 2 5
14 14 14 u14 y 14 w14 i10.5, j,k 2 u i20.5, j,k i,j10.5,k 2 y i,j20.5,k i,j,k10.5 2 w i,j,k20.5 1 1 . DtDx DtDy DtDz
The above three-dimensional elliptic equation is solved with homogeneous Neumann boundary conditions corresponding to no change in the nonhydrostatic flow through the boundaries—including the surface boundary. The surface boundary does have a flow through it, but this can be computed by integrating the horizontal divergence from the bottom z 5 2D to z 5 0. The boundary condition eliminates short wavelength (nonhydrostatic) surface gravity waves. Substituting the value obtained for dq into (2.42), (2.43), and (2.44) gives the adjustment for face-averaged velocity to satisfy continuity. Similarly, the cell-averaged velocities can be adjusted for continuity by doing a second-order averaging of the gradients in dq onto cell volumes. Providing dq is sufficiently smaller than q then the second-order staggered difference in dq does not lead to an error greater than the collocated fourth-order difference in q, as discussed in section 3a.
(2.45)
g. Full multigrid elliptic equation solvers Elliptic equations with more than one dimension are generally computationally expensive to solve. Full multigrid methods provide a solution with a computational cost proportional to the number of grid points. This basic property makes the full multigrid method highly competitive with other iterative and explicit methods for solving large three-dimensional problems such as (2.45) (Roache 1995). All that is required for present purposes is a sketch of the full multigrid technique. A more substantial introduction can be found in Briggs (1994). Gauss–Seidel and weighted Jacobi iteration both have rapid convergence for high-wavenumber parts of the solution. Signals that have low wavenumber on a fine grid will have high wavenumber when a restriction operator is used to repose the problem on a coarse grid. The multigrid
1432
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
method exploits the rapid convergence of high-wavenumber signals by solving the problem on a sequence of coarsened grids. The solution on a coarse grid is prolongated to finer grids (using an interpolation operator) and smoothed using Gauss–Seidel relaxation. The residual is then restricted back to the coarse grid where a coarse grid correction is calculated which is in turn prolongated and relaxed to provide a correction on finer grids. The full multigrid algorithm used here is based on that of Press et al. (1996) with Gauss–Seidel relaxation instead of red–black Gauss–Seidel relaxation. The Press et al. (1996) algorithm has also been modified to treat staggered Neumann boundary conditions (i.e., zero derivative at the cell face, which is staggered between dq grid positions). Particular attention must be given to the fact that the stencil for the derivative becomes off centered as the grid is coarsened otherwise the boundary condition is only formally accurate to first order (Sanderson and Brassington 1998). The grid is coarsened by factors of 2 and the Press et al. (1996) algorithm discretizes each dimension so it is spanned by n2 m 1 1 points where n and m are integers. This grid is optimal for Dirichlet boundary conditions and achieves a most coarse grid that is spanned by a minimum of three points (two points on the boundary plus one internal point that is solved for) when n 5 1 and m 5 1. When using staggered Neumann boundary conditions, the most coarse grid must have a minimum of two points internal to the domain in order to be well posed. This is done using a fine mesh that divides a linear dimension into n(2 m 1 2 m21 ) 1 1 points—of which n(2 m 1 2 m21 ) 2 1 points are internal to the domain and 2 points are outside the domain and are used to do boundary calculations. When Dx 5 Dy 5 Dz it is appropriate to restrict and prolongate in all three dimensions simultaneously. Thus, the first restriction reduces the number of grid points by a factor of eight. Geophysical applications often have Dx 5 Dy k Dz. In this case one restricts and prolongates in the z direction until coarsened grids are arrived at where the grid scale is the same (or very similar) in each direction. At this stage one can restrict and prolongate in all three dimensions. Finally, it should be noted that for many applications the domain has far more points in the horizontal dimensions than in the vertical dimension. Thus when the grid has been coarsened to span the vertical with the coarsest mesh (m 5 1) we proceed further by restricting the three-dimensional problem only in the horizontal dimensions. In a channel one might end up restricting and prolongating in only the along-channel direction. The guiding principle is that the grid spacing must be the same (or nearly the same) along all dimensions which are simultaneously restricted or prolongated. Violation of this principle seldom causes catastrophic failure of the algorithm, but it will result in suboptimal performance, and can sometimes cause insidious errors.
VOLUME 19
Direct solvers would, at great computational cost, provide an exact answer to the algebraic problem posed in (2.45). As such, they provide face velocities in (2.42), (2.43), and (2.44) that exactly satisfy continuity on the finite control-volume (to within machine round-off error). The full multigrid solver is iterative. It is not sufficient to iterate to within an error comparable to the truncation error of the finite differencing scheme. Any error relating to satisfying continuity in the control volume is serious. It can lead to a slowly growing 2D error through feedback with the control-volume advection. Such errors can be controlled by weak application of a high-order low-pass filter (Purser 1987) but this degrades the usefulness of the model for studying the subgrid-scale problem (for the same reason eddy-viscosity must be rejected). A more specific approach is to build the small compressibility changes into the control-volume advection algorithm, which adds a trivial computational cost, totally removes the 2D instability, and does not further increase the truncation error.
h. Molecular viscosity Eddy-viscosity is not included in the model because it is unphysical. Molecular viscosity and diffusivity are, unarguably, physical and should be included in simulations that are at a sufficiently high resolution. Thus, molecular fluxes are treated using accurate control-volume calculations. An explicit treatment is used since molecular diffusivity and viscosity are small and do not place any undue restriction on the time step for most applications. A control-volume treatment requires us to estimate the molecular flux across each cell face. The molecular flux of u across the i 1 0.5 cell face might be calculated from the cell-averaged values u as follows: M i10.5, j,k 5
n (2u 2 30u i,j,k 1 30u i11, j,k 24Dx i21, j,k 2 2u i12, j,k ).
(2.46)
The above stencil provides a fourth-order accurate estimate of the face-averaged derivative obtained from cell-averaged quantities. The stencil in (2.46) can be derived by cumulatively summing the cell-averaged quantity u i,j,k in the ith direction to obtain the exact integral evaluated at cell faces then taking a fourth-order accurate second-difference (based on node points). Berezin and Zhidkov (1965) give an appropriate stencil for the second difference (22, 32, 260, 32, 22)/24. Molecular fluxes of u across the other cell faces can be obtained similarly to (2.46) in which case the divergence of these fluxes,
SEPTEMBER 2002
= · (n=u) 5
SANDERSON AND BRASSINGTON
M i10.5, j,k 2 M i20.5, j,k Dx 1
M i,j10.5,k 2 M i,j20.5,k Dy
1
M i,j,k10.5 2 M i,j,k20.5 , Dz
(2.47)
is the source term for a temporal update of u i,j,k due to molecular viscosity. The other molecular terms can be treated similarly. Updates for molecular fluxes are conveniently carried out immediately following the advective update. 3. Hydrostatic and nonhydrostatic convection Small-scale convection has vertical accelerations that are just as large as horizontal acceleration and is therefore a fundamentally nonhydrostatic process. Many practical applications of ocean models use horizontal grid spacing that is much larger than the vertical grid spacing and make the hydrostatic approximation. Often, convection might be isolated to a small portion of the domain. Hydrostatic models can relieve buoyancy instability by hydrostatic convection, although such instability is often relieved by a parameterization scheme. Typically the parameterization involves vertical mixing until the buoyancy instability is relieved (Chen et al. 1994). Here, hydrostatic and nonhydrostatic convection are compared without any parameterization scheme but with a robust and accurate numerical model. The comparisons will be done at various resolutions and different ratios of horizontal to vertical grid scale. The convection will be for basins with uniform depth and impermeable walls. In runs 0–8, a constant uniform heat flux of 200 W m 22 is removed from the surface of a small basin in which the planetary rotation plays little role. In runs 9– 10, the heat loss is increased to 1000 W m 22 for a larger basin in which planetary rotation is dynamically important. a. Testing assumptions regarding dh and dq The barotropic and nonhydrostatic pressure are both calculated implicitly. Momentum updates associated with gradients in h and q are obtained using a collocated fourth-order differencing operator. On the other hand, gradients in dh and dq are obtained using a staggered second-order differencing operator. This mix of secondorder and fourth-order spatial differencing operators can still be argued to yield an effectively fourth-order accurate calculation in some circumstances. Figure 1 of Sanderson and Brassington (1998) shows error as a function of the ratio of wavenumber to grid scale for various differencing operators. Errors e 2,C of second-order staggered differencing (2, C grid) and er-
1433
rors e 4,A of fourth-order collocated differencing (4, A grid) are relevant to the present discussion. Staggered second-order differencing results in an error within a factor of 10 of the error of the collocated fourth-order differencing (e 2,C , 10e 4,A ) for a signal with a wavelength less than 20Dx. Providing gradients in dh and dq have a magnitude at least one order less than gradients in h and q, respectively, then it follows that the secondorder differencing will not degrade the fourth-order differencing operators for features in the solution with scales less than 20Dx. Solution features with scales greater than 20Dx might be somewhat degraded relative to a strictly fourth-order treatment of dh and dq, but such features are so accurately calculated, and vary so little from time step to time step, that no significant error is introduced. Thus, it is the size of gradients in h and q relative to gradients in dh and dq that fundamentally determines whether the spatially second-order treatment of the adjustment for continuity can be justified in (2.34)–(2.36) and (2.42)–(2.45). Accurate treatment of geostrophy is a fundamental design feature of the model. Indeed, the assumption that dh K h is guaranteed for quasigeostrophic flow. Similarly, the assumption dq K q is required if the secondorder implicit equation for dq is not to degrade the solution in flows where vertical accelerations are important. Thus a simulation of convection at scales much smaller than those for which planetary rotation play a role will provide a nontrivial test of the above assumptions. Table 1 summarizes the relative magnitudes of spatial derivatives of q to those of dq and similarly for h and dh. The ratio of the root-mean-square value of derivatives of q (or h) to the root-mean-square value of derivatives of dq (or dh) are presented. Also, the ratios of maximum absolute derivatives max( | ]q | )/max( | ]dq | ) are shown. Clearly, updates in both the barotropic pressure and the nonhydrostatic pressure are small relative to values from the previous time step, although less so as the time step Dt increases. (Runs 4, 5, 6 compare the ratio of barotropic pressure updates to barotropic pressure at three different values of Dt. Runs 5, 7, 8 compare the ratio of nonhydrostatic pressure updates relative to nonhydrostatic pressure at two different values of Dt.) This justifies using second-order spatial differencing to formulate elliptic equations for dh and dq. The relative cost of the most computationally expensive algorithms in the model are given in Table 2 below. Values are presented as a percentage of the total computational cost. These calculations were done on a 200MHz Pentium II scalar processor with 64 Mb of RAM. It should be noted that solving (2.45) for dq accounts for 53% of the computational cost of the model. Using a defect correction, or a fourth-order multigrid solver, to obtain dq at fourth-order would, therefore, increase computational cost out of proportion to any improvement in accuracy.
1434
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
VOLUME 19
TABLE 1. Gradients of dh and dq relative to gradients of h and q for various resolutions and model configurations. Run 0 1 2 3 hydrostatic 4 hydrostatic 6 NIRVANA 1 hydrostatic 7 Anisotropic 8 Anisotropic 1 NIRVANA 9 10
Dz (m)
Dt (s)
max |]q| max |]dq|
rms(]q) rms(]dq)
max |]h| max |]dh|
rms(]h) rms(]dh)
rms(g]h) rms(]q)
0.05 0.4 0.2 0.4 3.20
0.05 0.05 0.025 0.05 0.05
1 0.5 1 1
25 76 103 — —
39 113 209 — —
13 62 82 61 429
16 97 102 84 402
1.2 0.64 2.1 — —
3.20 3.20
0.05 0.05
16 2
— 301
— 332
15 161
22 201
— 2.1
3.20 100 100
0.05 100 100
16 60 30
36 66 150
44 95 192
24 122 125
24 98 225
2.1 1.8 1.7
Dx (m)
It is possible to use a defect correction to calculate dh to fourth-order spatial accuracy (Sanderson and Brassington 1998). This would involve a second application of the 2D full multigrid solver which would not require undue additional computational expense. Such an upgrade resulted in little accuracy improvement in the barotropic simulations of Sanderson and Brassington (1998) and has not been implemented here. b. Hybrid control-volume advection Ocean models usually have Dx ø Dy k Dz. Runs 4, 5, and 6 all have Dx 5 Dy 5 64Dz. Once the convection had settled to a statistical equilibrium the maximum sinking speeds were 0.0059, 0.0062, 0.0064 m s 21 for each of these runs. Maximum horizontal velocities were 0.046, 0.043, 0.045 m s 21 . These should be compared to run 0 (Dx 5 Dy 5 Dz), which had a maximum sinking speed of 0.014 m s 21 and a maximum horizontal speed of 0.016 m s 21 . Clearly, the sinking speed is reduced and the horizontal speed is increased as the horizontal dimension is made larger than the vertical dimension. These changes in speed are not in proportion to the change in the ratio Dx/Dz. The ratio of the vertical Courant number to the horizontal Courant number (w/ Dz)(Dx/u) increases with increasing Dx/Dz. Time step limited advection schemes can, therefore, put an unreasonable limitation on the time step when an anisotropic grid Dx ø Dy k Dz is used to model convectively unstable flow. To avoid the above limitation on the time step, it is common to use parameterization schemes (Chen et al. TABLE 2. Computational cost of model components as a percentage of total computational cost. Algorithm
Percentage CPU cost
QUICK advection 2D full multigrid, dh 3D full multigrid, dq Total nonhydrostatic calculation
24% 5% 53% 64%
1994) that increase vertical mixing which relaxes the convective forcing. Alternatively advection schemes that are not time step limited might be used. As noted earlier, three-dimensional advection schemes that are not time step limited are sufficiently computationally expensive that it is arguable that they present any advantage (Bartello and Thomas 1996). Note, however, that the vertical Courant number places by far the greatest restriction on the time step. Thus, a hybrid control-volume advection calculation might be used to good effect. Horizontal advective fluxes are obtained using time step–limited control-volume advection with (2.14). Vertical advective fluxes can be obtained using the Nonoscillatory, Integrally Reconstructed, Volume-Averaged Numerical Advection (NIRVANA) advection scheme (Leonard et al. 1995). NIRVANA is an explicit onedimensional control-volume advection scheme that is not time step–limited. In run 6, a fifth-order accurate NIRVANA calculation was used to calculate the vertical flux. The maximum vertical Courant number was .2 whereas the maximum horizontal Courant number was ,0.25. Calculating the vertical advective flux with NIRVANA increased the computational cost of the nonhydrostatic model by 13% (or about 26% for a hydrostatic version of the model). This may be computationally cost effective because it enables substantially larger time steps. In oceanic applications one could, perhaps, use domain decomposition so that NIRVANA was only used in regions where large vertical velocities are likely, with the less computationally expensive time step limited vertical advection used elsewhere. The order of accuracy of the above composite advection scheme is certain to be reduced from that of its component parts for at least two reasons. First, application of NIRVANA requires more careful consideration within N-cycle time stepping (Sanderson and Brassington 1998). Second, cross terms (Leonard et al. 1996) are omitted. Brassington and Sanderson (1999) raise a relevant issue relating to calculation of field accelerations in rotational flows.
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
FIG. 2. Temperature profiles in a convecting fluid. Profiles have been averaged with respect to the horizontal coordinates. See legend at bottom of figure for runs 0, 1, 3, and runs 4, 5, 6. Run 0 used an isotropic grid and is a fully nonhydrostatic calculation. Run 0 is plotted using a solid line and is most nearly isothermal. Run 4 (hydrostatic) is also plotted with a solid line. Runs 1 and 5 are plotted with dashed lines and are nonhydrostatic. Runs 3 and 6 are plotted with dash–dot lines and are hydrostatic. Runs 1 and 3 used Dx 5 8Dz and are much more nearly isothermal than runs 4, 5, and 6 for which Dx 5 64Dz. Stratification increases as the grid is made more anisotropic. Comparing 1 with 3 and 4, 6 with 5 it is clear that the stratification is little effected by the hydrostatic approximation.
c. Temperature profiles: Horizontal resolution and the hydrostatic approximation Runs 0, 1, 2, 3, 4, 5, and 6 consider convection in response to a steady heat loss. Convecting fluids are observed to have very weak vertical temperature gradients. Figure 2 shows horizontally averaged vertical profiles of temperature. The mean temperature has also
1435
been removed from each profile and the profiles averaged with respect to time (at times after adjustment to a statistical equilibrium). The coldest water is at the surface, as might be expected. As Dx is increased relative to Dz we observe that the surface water gets colder before it is advected away from the heat source (i.e., stronger buoyancy forcing is required to initiate fluid convection as Dx/Dz is increased). The cooler water at depth arises from the asymmetry of vertical motion, whereby cold water is transported downward at higher speed than warm water is transported upward. Clearly, the cold water falls through narrow streams and pools at the bottom. Whether the convective adjustment is hydrostatic or nonhydrostatic is of little consequence to the temperature profile when Dx/Dz is large ($8 based on the present calculations). Indeed, making the calculation nonhydrostatic simply adds inertia to vertical motion which slightly exacerbates the already unrealistically slow convection and unrealistically large temperature gradients caused by Dx being much greater than Dz. Figure 3 shows vertical x sections of temperature and velocity for nonhydrostatic calculations. Figure 3a is from a calculation with Dx 5 Dy 5 Dz K D. The convective motion has horizontal meanders that are substantial relative to the horizontal scale of the convecting cells. Figure 3b shows results from a model run with lower horizontal resolution Dx 5 Dy 5 8Dz which cannot resolve the horizontal meanders seen in Fig. 3a. Convection is much more anisotropic when using an anisotropic model grid. Clearly the steady-state convection problem reduces to vertically mixing heat from top to bottom. In this sense it matters little whether one properly resolves the nonhydrostatic dynamics. The timescale for advecting
FIG. 3. Vertical sections showing velocity vectors and temperature. Darker shading indicates lower temperatures. The temperature range is indicated above each plot: (a) horizontal meanders in the convecting flow when it is modeled in run 0 at high resolution with Dx 5 Dy 5 Dz; (b) the convection in run 1 becomes much more anisotropic when modeled on a grid with Dx 5 Dy 5 8Dz.
1436
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
VOLUME 19
warm water overlays cold water. (The extent of the mixing will depend on the relative mixing of momentum and T, which is largely determined by truncation terms in the present simulation.) d. The anisotropic nonhydrostatic approximation
FIG. 4. Profiles of temperature at 320-s intervals. Initially cold water lays over warm water as shown by the thick line. The model was started from rest with a small random perturbation to initiate the convective instability. The line with intermediate thickness shows the temperature profile after 360 s. After 720 s the thin line shows that, although there has been significant mixing, there has also been an advective overturning so warm water now lays over cold water.
cooler water from the surface is too long when Dx/Dz k 1, but this is of little consequence when the surface heat flux forcing varies on still larger timescales. Mixing cannot, however, represent convection associated with cooling on timescales that are small (or similar) to those for convection. The extreme case is when a surface-layer of fluid is instantaneously cooled. Figure 4 shows results from a nonhydrostatic simulation of the adjustment of a cold layer 9.758C over a warm layer 108C. The simulation used Dx 5 Dy 5 Dz 5 0.05 m. Cold water only partly mixes with warm water during the convective adjustment. After convective adjustment
Column 9 of Table 1 shows the root-mean-square hydrostatic forces rms(g]h) are similar to the root mean square nonhydrostatic forces rms(]q) for all ratios of Dx/Dz tested here. Circumstances may, therefore, arise when it is desirable to include the nonhydrostatic pressure even though Dx ø Dy k Dz. The solution of a three-dimensional elliptic equation is computationally onerous (Table 2). Scaling considerations suggest that ] 2 dq/]z 2 k ] 2 dq/]x 2 1 ] 2 dq/]y 2 in equation (2.45), providing Dx ø Dy k Dz. Run 5 gives solutions for dq for convection with Dx 5 Dy 5 64Dz. These solutions for dq were obtained using a fully three-dimensional elliptic equation solver. Calculating the root-meansquare value of ] 2 dq/dz 2 we find it to be 113 times the root-mean-square value of the horizontal Laplacian ¹ H2 dq 5 ] 2 dq/]x 2 1 ] 2 dq/]y 2 . The above anisotropy is fundamentally a function of the ratio of the length scales of horizontal modes to vertical modes of the flow—not merely a function of the ratio of Dx to Dz. Clearly the smallest horizontal scales are controlled by Dx but the largest vertical scales are controlled by the depth. Certainly, if the depth is smaller than Dx then the anisotropy is guaranteed, although Fig. 3 demonstrates that anisotropy applies in less restricted circumstances. When the elliptic equation for nonhydrostatic pressure is sufficiently anisotropic to ensure that ¹ H2 dq K ] 2 dq/]z 2 , then (2.45) might be reposed as a one-dimensional implicit problem:
n11 n11 n11 n n n n n n dq i,j,k11 2 2dq i,j,k 1 dq i,j,k21 dq i11, dq i,j11,k 2 2dq i,j,k 1 dq i,j21,k j,k 2 2dq i,j,k 1 dq i21, j,k 5 2 2 Dz 2 Dx 2 Dy 2
1
14 14 14 u14 y 14 w14 i10.5, j,k 2 u i20.5, j,k i,j10.5,k 2 y i,j20.5,k i,j,k10.5 2 w i,j,k20.5 1 1 . DtDx DtDy DtDz
Given some initial guess for dq ni,j,k, a tridiagonal solver can be used to solve (3.1) for dq n11 i,j,k . A good initial guess would be bdq from the previous time step, where 0 # b # 1. If the ratio of Dx to Dz is sufficiently large then only one iteration might be sufficient. Otherwise, n dq n11 i,j,k is cycled into dq i,j,k for a further iteration. The boundary conditions are ]dq/]z 5 0 at the surface and bottom. Note that each vertical column of cells is solved independently of the other columns. Each vertical column is only solved to within an arbitrary constant because both surface and bottom have Neumann
(3.1)
boundary conditions. The vertical constant is determined as follows. Vertically integrating ] 2 dq/]z 2 from the bottom to the surface and imposing the boundary conditions ]dq/ ]z | z50 z52D 5 0 we see that the vertical integral of the lefthand side term in (3.1) is zero. Similarly, the vertical integral of the rightmost term in (3.1) is also zero because the barotropic adjustment removes any divergence in the vertically integrated flow. It therefore follows that the horizontal Laplacian of the vertically integrated value of dq is zero:
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
¹ H2 d q 5 0,
(3.2)
which has the solution d q 5 0 if the horizontal boundary conditions are homogeneous Neumann. Here d q is the vertical integral of dq. Thus d q 5 0 is the constraint that can be used to remove the arbitrary constants in the solution of (3.1). The above anisotropic nonhydrostatic calculation was used in a simulation with Dx 5 Dy 5 64Dz and is denoted run 7 in Table 1. The computational cost of the total nonhydrostatic calculation is reduced by slightly more than a factor of 3 when the above anisotropic calculation of dq is used with three iterations. Thus, a 45% savings in total model computational cost was achieved by replacing the full nonhydrostatic calculation with the anisotropic calculation. Run 8 demonstrates the anisotropic nonhydrostatic pressure update with NIRVANA advection in the vertical. Now much larger time steps are possible. Each time step costs 32% less than for the standard model with time step limited advection (2.14) and a fully threedimensional nonhydrostatic calculation (2.45). e. Convection and Coriolis The length scales of convection in runs 0–8 were too small for the convection to be influenced by the earth’s rotation. In runs 9 and 10, the convection is modeled in an enclosed volume with horizontal dimensions of 9.5 km and a depth of 1.1 km. Coriolis corresponding to a latitude of 758S was used, giving an inertial period of about 12.4 h. The convection is driven by surface cooling of 1000 W m 22 . Initially the fluid was at rest with a constant potential temperature of 108C and salinity 35 ppt. Compressibility should not be ignored for deep convection, so a local fit to the full UNESCO equation of state was used (Sanderson et al. 2002). The model was integrated for more than two inertial periods using a grid resolution of 100 m in all three dimensions. Convecting cells had typical horizontal scales of about 0.5 km. This low-resolution (100 m) solution was then reconstructed onto a grid with resolution of approximately 49.74 m in the horizontal and 47.83 m in the vertical. A conserving fourth-order accurate control-volume integral reconstruction was used for this approximate doubling of resolution. Integrating the model with high resolution for an additional 2 h did not change the pattern of convecting cells, but did lead to more intense eddies with sharper fronts and higher peak flow speeds (20 vs 15 cm s 21 ) than in the lowresolution calculation. Figure 5a shows detail of the surface current and temperature over a small portion of the total domain. Some cold regions have strong horizontal convergence and little rotation and others have strong rotation and little horizontal convergence. Vortex stretching results in potential energy being converted to rotational kinetic
1437
energy which arrests sinking and forms eddies with strong cyclonic rotation. The crosses on the y axis of Fig. 5a show west–east transects along which the vertical cross sections in Fig. 5b and Fig. 5c are taken. The southern cross section (at y 5 4.3274 km) shows a developing zone of convection near x 5 6.6 km in an area with little rotation evident in Fig. 5a. The convection of cold water is arrested where Fig. 5a shows strong cyclonic rotation, although cold water obviously leaks from the edges of these cyclonic eddies and subsequently sinks. f. Convection and the subgrid scale Subgrid-scale effects in rotational deep-sea convection might be directly estimated as follows. Integral reconstruction is used to represent the high-resolution solution on a coarsened grid. This is shown in Fig. 6a, titled ‘‘initial.’’ The above initial condition was integrated forward in a low-resolution model for 16 time steps each of 20 s. (This time step is far from being limited by stability constraints.) This gives the solution plotted in Fig. 6b, which is titled ‘‘Lo-res update.’’ The high-resolution solution was used to initialize a highresolution model which was also integrated forward for 16 time steps each of 20 s. The high-resolution solution obtained after this integration can be reconstructed onto the coarse grid to obtain Fig. 6c, which is labeled ‘‘Hires update.’’ The difference between Fig. 6b (low-resolution update) and Fig. 6c (high-resolution update reconstructed onto the low resolution grid) is plotted in Fig. 6d and titled ‘‘Subgrid scale.’’ Dividing the velocity differences in Fig. 6d by the time interval gives the subgrid-scale accelerations. A subgrid-scale parameterization should produce such accelerations based on information contained in the low-resolution fields. Obviously, the subgrid-scale acceleration is a very noisy signal and has very little correlation with the low resolution fields. Certainly, applying a smoothing operator to the low resolution fields could never reproduce the appropriate subgrid-scale accelerations. Indeed, any smoothing operator would push the solution the wrong way. 4. Summary The DieCAST strategy of dividing the barotropic component of the hydrostatic pressure gradient updates into an explicit part calculated at fourth order using h from the previous time step followed by a second-order implicit update for dh has been used. The idea behind this strategy is that gradients in h will be much greater than those in dh for quasigeostrophic flows in which the local time derivative is small compared to the field accelerations and very small compared to Coriolis (Sanderson and Brassington 1998). Further, the magnitude of the truncation error resulting from staggered secondorder differencing of dh is less than the truncation error
1438
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
VOLUME 19
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
1439
FIG. 6. (a) Initial temperature and velocity vector conditions shown on a low-resolution grid (averaged from a highresolution solution). (b) An update of the temperature and velocity field after sixteen 20-s time steps of the lowresolution (100-m) model. (c) After sixteen 20-s time steps of the high-resolution model (grid scale ø 50 m), the updated temperature field is averaged to the low-resolution grid and plotted. (d) The difference between the lowresolution update and the high-resolution update averaged onto the low-resolution grid.
resulting from fourth-order collocated differencing of h—at least for the band of wavenumber signals that most require a high-order treatment. This idea is extended for the nonhydrostatic calculation, where an explicit update using a fourth-order gradient in q is followed by an implicit lower-order update based on the increment dq in nonhydrostatic pressure. Here it has been demonstrated that even for small scale convecting flow the pressure updates (dh, dq) cause small gradients relative to those of the old values (h, q). The advantage of this strategy is that it enables dq to be calculated at second order without greatly reducing the accuracy of the solution but with substantial savings in computational cost. Thus second-order spatial differencing of dq does not necessarily degrade accuracy, but greatly reduces computational cost.
In the present version of this model an iterative method is used to solve the implicit equations for dh and dq. Iterative methods do not provide an exact solution to the algebraic equations resulting from the discretization—rather they are usually converged to be accurate to within truncation error. Small violations of incompressibility can cause a weak 2D instability via feedback from the control-volume advection term. This instability is avoided by modifying the advection scheme to explicitly accommodate these small errors in continuity. For convective flows, the vertical Courant number becomes larger than the horizontal Courant number as the horizontal grid spacing is made greater than the vertical grid spacing. This anisotropy in the advection can unnecessarily limit the time step when time step restricted advection schemes are used. Multidimensional
← FIG. 5. (a) Surface temperature and velocity vectors for convection driven by a 1000 W m 22 surface heat flux. The model resolution is approximately 50 m in all three dimensions. Only a small portion of the total 9.5 km by 9.5 km horizontal domain is shown. (b) Vertical cross section of temperature and velocity vectors along the transect corresponding to y 5 5.173 km. The end points of this transect are indicated by the northern crosses in (a). (c) Vertical cross section of temperature and velocity vectors along the transect corresponding to y 5 4.327 km. The end points of this transect are indicated by the southern crosses in (a).
1440
JOURNAL OF ATMOSPHERIC AND OCEANIC TECHNOLOGY
advection schemes that are not time step limited have substantial computational cost that counteracts any advantage obtained by increased stability with large time steps. In this anisotropic situation, however, we have demonstrated an amalgamation of a low-cost two-dimensional horizontal advection scheme that is time step limited with a somewhat higher cost one-dimensional NIRVANA vertical advection scheme that is not time step–restricted by stability constraints. This composite control-volume scheme is conservative, but its order of accuracy will be degraded relative to the constituent schemes from which it is composed. It is not uncommon for ocean models to have horizontal grid spacing comparable to or greater than the water depth. The hydrostatic approximation is probably quite acceptable in almost all such circumstances, although a computationally inexpensive calculation of the nonhydrostatic pressure is possible. Given the anisotropy of the grid, it turns out that the horizontal Laplacian is small, which reduces the elliptic equation for dq to a quasi–one-dimensional implicit equation that reduces to iterating on a tridiagonal system. A control-volume, nonhydrostatic ocean model has been formulated with many features that are fourth- or fifth-order accurate. Implicit calculation of changes in surface elevation dh reduces the formal accuracy with which the barotropic gravity wave is calculated, so the model is not ideal for all dynamical systems. Efforts are ongoing to address weaknesses in the model; specifically a split-explicit formulation is being considered which would enable the barotropic gravity wave to be calculated at fully fourth-order accuracy with respect to temporal and spatial differencing. The model does not require any artificial damping or eddy-viscosity for stability. For at least some dynamical systems the model is computationally efficient in the sense that it has an effective order of accuracy at least as great as its dimensionality and the computational cost is directly proportional to the number of grid points in the model domain. In such circumstances fourth-order accuracy and consistency with the continuum equations make this model well suited for unambiguously addressing questions relating to subgrid-scale parameterizations. A preliminary calculation shows that diffusive or otherwise dissipative subgrid-scale parameterizations are likely to be counterproductive when modeling convecting cells. Acknowledgments. Three anonymous reviewers identified misleading and unclear material in the earlier draft. We thank them for their care and insight. REFERENCES Arakawa, A., and V. R. Lamb, 1977: Computational design of the basic dynamical processes of the UCLA general circulation model. Methods of Comput. Phys., 17, 174–265. Bartello, P., and S. J. Thomas, 1996: The cost-effectiveness of semiLagrangian advection. Mon. Wea. Rev., 124, 2883–2897.
VOLUME 19
Berezin, I. S., and N. P. Zhidkov, 1965: Computing Methods. Vol. 1. Pergamon Press, 464 pp. Blumberg, A. F., and G. L. Mellor, 1987: A description of a threedimensional coastal ocean circulation model. Three-Dimensional Coastal Ocean Models, N. S. Heaps, Ed., Amer. Geophys. Union, 1–16. Brassington, G. B., 2000: High order methods for computational geophysical fluid dynamics. Ph.D. thesis, School of Mathematics, University of New South Wales, 310 pp. ——, and B. G. Sanderson, 1999: Semi-Lagrangian and COSMIC advection in flows with rotation or deformation. Atmos.–Ocean, 37, 369–387. Briggs, W. L., 1994: A Multigrid Tutorial. Lancaster Press, 90 pp. Browning, G. L., W. D. Henshaw, and H.-O. Kriess, 1998: A numerical investigation of the interaction between large and small scales of the two-dimensional incompressible Navier–Stokes equations. UCLA CAM Rep. 98-23, 67 pp. Bryan, K., 1969: A numerical model for the study of the circulation of the World Ocean. J. Comput. Phys., 4, 347–376. Bryden, H. L.., 1973: New polynomials for thermal expansion, adiabatic temperature gradient and potential temperature gradient in sea water. Deep-Sea Res., 20, 401–408. Chen, D., L. M. Rothstein, and A. J. Busalacchi, 1994: A hybrid vertical mixing scheme and its application to tropical ocean models. J. Phys. Oceanogr., 24, 2156–2179. Dietrich, D. E., 1997: Application of a modified Arakawa ‘‘A’’ grid ocean model having reduced numerical dispersion to the Gulf of Mexico circulation. Dyn. Atmos. Oceans, 27, 201–217. ——, and D.-S. Kuo, 1994: A semi-collocated ocean model based on the SOMS approach. Int. J. Numer. Methods Fluids, 19, 1103– 1113. Gill, A. E., 1982: Atmosphere–Ocean Dynamics. Academic Press, 662 pp. Lax, P. D., and R. D. Richtmyer, 1956: Survey of the stability of linear finite difference equations. Commun. Pure Appl. Math., 9, 267–293. Leonard, B. P., 1979a: A stable and accurate convective modelling procedure based on quadratic upstream interpolation. Comput. Methods Appl. Mech. Eng., 19, 59–98. ——, 1979b: A survey of finite differences of opinion on numerical muddling of the incomprehensible defective confusion equation. Finite Element Methods for Convection Dominated Flows, T. J. R. Hughes, Ed., AMD-34, ASME, 1–17. ——, 1995: Order of accuracy of QUICK and related convection– diffusion schemes. Appl. Math. Model, 19, 640–653. ——, A. P. Lock, and M. K. MacVean, 1995: The NIRVANA scheme applied to one-dimensional advection. Int. J. Numer. Methods Heat Fluid Flow, 5, 341–377. ——, ——, and ——, 1996: Conservative, explicit, unrestricted time step, multidimensional, constancy-preserving advection schemes. Mon. Wea. Rev., 124, 2588–2606. Leslie, L. M., and R. J. Purser, 1995: Three-dimensional mass-conserving semi-Lagrangian scheme employing forward trajectories. Mon. Wea. Rev., 123, 2551–2556. Lin, S.-J., and R. B. Rood, 1996: Multidimensional flux-form semiLagrangian transport schemes. Mon. Wea. Rev., 124, 2046–2070. Lorenz, E. N., 1971: An N-cycle time-differencing scheme for stepwise numerical integration. Mon. Wea. Rev., 99, 644–648. Margolin, L. G., P. K. Smolarkiewcz, and Z. Sorbjan, 1999: Largeeddy simulations of convective boundary layers using nonoscillatory differencing. Physica D, 133, 390–397. McGregor, J. L., 1993: Economical determination of departure points for semi-Lagrangian models. Mon. Wea. Rev., 121, 221–230. Pacanowski, R. C., 1995: MOM2 documentation, users’s guide and reference manual. GFDL Ocean Group Tech. Rep. 3, 232 pp. [Available online at http://www.gfdl.gov;smg/MOM/ MOM.html.] Press, W. H., S. A. Teukolsky, W. T. Vettering, and B. P. Flannery, 1996: Numerical Recipes in Fortran 90: The Art of Parallel Scientific Computing. Cambridge University Press, 1486 pp.
SEPTEMBER 2002
SANDERSON AND BRASSINGTON
Purser, R. J., 1987: The filtering of meteorological fields. J. Climate Appl. Meteor., 26, 1764–1769. Roache, P. J., 1982: Computational Fluid Dynamics. Hermosa, 446 pp. ——, 1995: Elliptic Marching Methods and Domain Decomposition. CRC Press, 185 pp. Sanderson, B. G., 1998: Order and resolution for computational ocean dynamics. J. Phys. Oceanogr., 28, 1271–1286. ——, and G. Brassington, 1998: Accuracy in the context of a controlvolume model. Atmos.–Ocean, 36, 355–384. ——, D. Dietrich, and N. Stilgoe, 2002: A numerically effective
1441
calculation of sea water density. Marine Models Online, 2, 19– 34. Shchepetkin, A. F., and J. C. McWilliams, 1998: Quasi-monotone advection schemes based on explicit locally adaptive dissipation. Mon. Wea. Rev., 126, 1541–1580. UNESCO, 1981: Tenth report of the joint panel on oceanographic tables and standards. UNESCO Tech. Papers Mar. Sci. 36, UNESCO. Weaver, A. J., and M. Eby, 1997: On the numerical implementation of advection schemes for use in conjunction with various mixing parameterizations in the GFDL ocean model. J. Phys. Oceanogr., 27, 369–377.