Lecture Barotropic equations 8. Barotropic equations The barotropic equations describe balanced motion in a two-dimensional incrompessible homogeneous fluid. A quick (and dirty) derivation involves imposing a rigid-lid on the shallow water equations; the vorticity and continuity equation are then: ρ t (Hq) + ρ x (Hqu) + ρ y (Hqv) = 0 (8.) ρ x (Hu) + ρ y (Hv) = 0. (8.) Hq = f + ψ is the absolute vorticity. If we further assume a flat bottom then we can re-write the equations as ρ t ψ + J(τ, f + ψ) = 0 (8.3) ψ = τ (8.4) v = ρ x τ (8.5) u = ρ y τ (8.6) where ψ is the relative vorticty and τ is a stream-function. J(p, q) is the Jacobian operator J(p, q) = ρ x pρ y q ρ y pρ x q which may also be written in flux form as J(p, q) = ρ x (pρ y q) ρ y (pρ x q) 0
.950 Atmospheric and Oceanic odeling, Spring 04 03 or as J(p, q) = ρ y (qρ x p) ρ x (qρ y p) Because of these flux forms, if either p or q is either zero or constant on the boundary of a domain then the domain integral of J(p, q) dx dy = 0. Further, < pj(p, q) > = < J( p, q) >= 0 < qj(p, q) > = < J(p, q ) >= 0 These properties imply that domain integrated kinetic energy, τ, and enstrophy, f + ψ, are conserved. We ll consider three approaches to solving the barotropic equations numerically. For pragmatic purposes we must include friction and viscosity; hte most typical form of the barotropic equation is ρ t ψ + J(τ, ψ) + ωρ x τ = F ζψ + ψ (8.7) where F is a general forcing and other terms on the R.H.S. are arbitrary forms of dissipation; ζ is a (bottom) drag coefficient and is a lateral viscosity. The model is forced by a wind-stress curl, F = τ which is prescribed. The model domain may be either a doubly periodic domain, a channel or a bounded box with no normal flow on the sides which means that the stream function is constant on the boundary: and no-slip at the side walls: τ = 0 on boundaries (8.8) τ ˆn = 0 on boundaries (8.9) 8. Finite difference barotropic model We ll describe a finite difference approximation to the above equations for the purposes of comparison. We ll use the leap-frog method for advection (the Jacobian term) and a forward method for the dissipation terms: ( ) ψ n+ = ψ n + t F J n B n + D n (8.0)
.950 Atmospheric and Oceanic odeling, Spring 04 04 where F is the forcing term, J n and B n are the Jacobian and beta terms evaluated at the mid-point, n, and D n is the dissipation terms evaluated at the past point, n. The dissipation terms are discretized in space using second order finite differences: β 3 β 3 D n = ζψ n + β ii ψ n + β y jj ψ n (8.) x The beta term is a centered second order difference: The vorticity is discretized: i B n = β i τ n (8.) x ψ n = ωy ij + β ii ψ n + y β jj ψ n (8.3) x The treatment of the Jacobian term will be desribed in the next section. The complete algorithm then is as follows: from ψ n, compute τ n by inverting τ n = ψ n, compute the Jacobian J n = J(τ n, ψ n ) compute the dissipation D n compute ψ n+ = ψ n + t(f J n B n + D n ) increment n and repeat cycle and at some interval, say every 50 steps, after computing ψ n+ we will filter out the leap-frog computational mode by setting ψ n = (ψ n+ + ψ n )/. 8.3 The Arakawa Jacobian Fig. 8. shows a grid with labels for the stencil of points involved in the simplest finite difference Jacobians proposed by Arakawa, 960. Using these labels, the Jacobians evaluated at point 5 are defined x yj ++ = (τ 8 τ )(ψ 7 ψ 4 ) (τ 6 τ 3 )(ψ 7 ψ 0 ) x yj + = τ 8 (ψ 7 ψ 4 ) τ (ψ 0 ψ ) τ 6 (ψ 7 ψ 0 ) + τ 3 (ψ 4 ψ ) x yj + = ψ 6 (τ 7 τ 0 ) ψ 3 (τ 4 τ ) ψ 8 (τ 7 τ 4 ) + ψ (τ 0 τ )
.950 Atmospheric and Oceanic odeling, Spring 04 05 3 0 6 7 0 5 8 9 3 4 Figure 8.: The stencil of points for evaluating the Arakawa Jacobians; evaluation at point 5 involves contributions from points 0 through 7 and evaluation at point 7 involves contributions from points 5 through 3. The blue cross indicates the stencil of points of the + terms and the red indicates the stencil of points of the terms, both at point 5. The continuum energy equation is found by multiplying the vorticity equation by τ and noting that < τj(τ, ψ) >= 0. Consider the contributions to the energy equation arising from τ 5 J +5 and τ 7 J +7 : τ 5 J +5 = τ 5 ψ 6 τ 7 τ 5 ψ 6 τ 0 τ 5 ψ 3 τ 4 + τ 5 ψ 3 τ τ 5 ψ 8 τ 7 + τ 5 ψ 8 τ 4 + τ 5 ψ τ 0 τ 5 ψ τ τ 7 J +7 = τ 7 ψ τ τ 7 ψ τ 3 τ 7 ψ 8 τ 9 + τ 7 ψ 8 τ 5 τ 7 ψ 0 τ + τ 7 ψ 0 τ 9 + τ 7 ψ 6 τ 3 τ 7 ψ 6 τ 5 We see that the underlined terms appear in both contributions with the opposite sign so that they cancel; summing over all points, all terms cancel in a similar fashion. It follows that J + globally conserves energy and it follows by symmetry that J + globally conserves enstrophy. However, similar consideration of the contributions from ψj + shows that there is no such cancellation: ψ 5 J +5 = ψ 5 ψ 6 τ 7 ψ 5 ψ 6 τ 0 ψ 5 ψ 3 τ 4 + ψ 5 ψ 3 τ
.950 Atmospheric and Oceanic odeling, Spring 04 06 ψ 5 ψ 8 τ 7 + ψ 5 ψ 8 τ 4 + ψ 5 ψ τ 0 ψ 5 ψ τ ψ 7 J +7 = ψ 7 ψ τ ψ 7 ψ τ 3 ψ 7 ψ 8 τ 9 + τ 7 ψ 8 τ 5 ψ 7 ψ 0 τ + ψ 7 ψ 0 τ 9 + ψ 7 ψ 6 τ 3 ψ 7 ψ 6 τ 5 There is only one term with the quantity ψ 5 ψ 6 τ 7 and so nothing can cancel it. However, the J ++ conserves neither but it happens that The most obvious discretization of the Jacobian: ( J ++ (τ, ψ) = β i τ i β j ψ j β j τ j β i ψ i) (8.4) x y corresponds to the continuum form, J(τ, ψ) = ρ x τρ y ψ ρ y τρ x ψ. The flux form Jacobian ( i J + (τ, ψ) = β i (τβ j ψ j ) β j (τβ i ψ ij ) (8.5) x y corresponds to the continuum form, J(τ, ψ) = ρ x (τρ y ψ) ρ y (τρ x ψ) and the other flux form Jacobian ( i J + (τ, ψ) = β j (ψβ i τ ij ) β i (ψβ j τ j ) (8.6) x y corresponds to the continuum form, J(τ, ψ) = ρ y (ψρ x τ) ρ x (ψρ y τ). In the fashion shown above, Arakawa, 960, showed that J + conserves the integral of enstrophy, ψ, (J ++ + J + ) conserves the integral of enstrophy, ψ, J + conserves the integral of energy, τ τ, (J ++ + J + ) conserves the integral of energy, τ τ, so that the famous combination of J n = (J ++ + J + + J + ) 3 conserves both the enstrophy and energy and therefore also conserves mean wave number; this prevents nonlinear instability occurring.
.950 Atmospheric and Oceanic odeling, Spring 04 07 8.4 Solving elliptic boundary value problems In the preceding finite difference model, we had to solve a problem of the form τ = ψ given some boundary conditions on τ (e.g. τ = 0). One approach is to note that the solution to the above elliptic problem is the steady state solution to the following time-dependent ρ t τ = τ ψ This is simply a diffusion problem with a source term and can be solved use simple explicit method with an appropriately chosen time-step. Consider the FTCS discretization t ( ) τ n+ = τ n + τ n i,j + τn tψ x i,j + τ i n +,j + τn i,j+ 4τ i,j This system can be integrated forward in a stable fashion so long as t x. If we chose the largest time-step then the system simplifies to 4 τ n+ ( ) n n x = τ ψ 4 i,j + τ i +,j + τi,j n + τi,j+ n 4 which is known as Jacobi s method. The method converges but converges slowly. A slightly more efficient iterative method is the Gauss-Seidel method which uses the latest estimates on the RHS as the computations procede. A commonly used GS method is known as the red-black Guass-Seidel method where the points on the grid are labelled in a checker-board fashion (redblack). The Jacobi method is applied to the red and black points seperately, using the latest values in each consecutive copmutation. A more efficient iterative method is successive over-relaxation (SOR) which is described in some detail in Numerical Recipes, chapter 9. For the recast problem n a i,j τ i,j + b n i,j τ i +,j + c i,j τi,j n + d i,j τi,j+ n + e i,j τ i,j = ψ
.950 Atmospheric and Oceanic odeling, Spring 04 08 the SOR algorithm is where ( ) τ n = ψ a i,j τ i,j b n i,j τ i +,j c i,j τi,j n d i,j τi,j+ n ei,j τi,j n+ = φτi,j + ( φ)τi,j n φ 0 = φ = ( ρ J acobi ) φ n = ( φ n ρ J acobi) n =, 3,... 4 and ρ J acobi is a function of a, b, c, d and e. The original elliptic problem can be solved directly by Fourier analysis. Suppose we have Dirichlet boundary conditions (τ = 0 on the boundaries) then a natural basis function is sine waves. The solution is represented by the Fourier series and N νik νjl τ i,j = a k,l sin sin N k= l= N νik νjl ψ i,j = b k,l sin sin N k= l= This allows us to solve the elliptic problem by first computing N νik νjl b k,l = ψ i,j sin sin N i= j= N and then for each Fourier mode ( ν(i )k νjl ν(i + )k νjl a k,l sin sin + sin sin N N νik ν(j )l νik ν(j + )l + sin sin + sin sin N N νjl νjl νjl νjl 4 sin sin = b k,l sin sin
.950 Atmospheric and Oceanic odeling, Spring 04 09 or or simply ( a k,l ( cos νk N +( cos νl ) sin νik N ) sin νik N 4 sin νjl sin νjl sin νjl sin νjl = b k,l sin νjl sin νjl a k,l = b k,l cos πk + cos πk 4 N N 8.5 Finite element barotropic model We ll now solve the barotropic equations using the Galerkin approximation. The basis function must now be two-dimensional. Since we are in a rectangular domain, we can use a square based function known as the pagoda function: x x i y y i φ ij (x, y) = max(0, ( )( )) x y which gives bi-linear interpolation between values on a quadrilateral grid. The result of the Galerkin approximation is: 3 3 ω i β β β i τ A x A y ρ t ψ + J + A y = ζa x A y ψ A y β ii ψ A x β jj ψ (8.7) x x y The operator A x A y is a two-dimensional operator and thus potentially expensive to invert but since it is separable into two tri-diagonal operators we can invert it relatively efficiently. The Jacobian term is the complicated term to calculate. The Galerkin approximation is: J = φ ij ρ x τρ y ψ dx dy φ ij ρ y τρ x ψ dx dy Substituting in the series expansions τ = τ k,l φ k,l (x, y) k,l ψ = ψ m,n φ m,n (x, y) m,n
.950 Atmospheric and Oceanic odeling, Spring 04 0 into the first integral in J gives dx dy φ ij τ k,l ρ x φ k,l (x, y) ψ m,n ρ y φ m,n (x, y) k,l m,n Since the pagoda functions only interact with the eight neighboring elements the summations reduce to sums over k = i, i, i + ; l = j, j, j + ; m = i, i, i + ; n = j, j, j + we can anticipate up to 9 9 = 8 coefficients arising from the double sum. Fortunately, many of these are zero since some of the pairs of basis functions, (k, l) and (m, n) don t overlap (e.g. (k, l) = (i, j ) and (m, n) = (i +, j + )). Others can be deduced to be zero by symmetry, for example, dx dyφ i,j ρ x φ i,j+ ρ y φ i,j+ = 0. However, rather than compute all these coefficients we can make an inspired guess based on the structures of the other terms: i j i x yj = A y β i τ A x β j ψ j A x β j τ A y β i ψ If we use the leap-frog scheme for the Jacobian and beta terms and forward method for the dissipation terms then our model algorithm is: δ3 δ3 A x y compute D n = A x A y ζψ n y β ii ψ n A x β jj ψ n i compute B n = A x β i τ n ( i j i compute J ) n = x A y y β i τ A x β j ψ A x β j τ j A y β i ψ invert A x A y ρ t ψ = F J n B n + D n step forward for ψ n+ = ψ n + tρ t ψ increment n and repeat cycle An alternative approach is to invert the equation so that each term requires a matrix solve. ultiply through by the inverse of A x A y : β 3 β 3 ρ t q = J A x βi τ i ζq A x β ii q x x A y y β jj q
.950 Atmospheric and Oceanic odeling, Spring 04 Now, solve And then the Jacobian can be appriximated as and similarly the beta term is and dissipation term i A x ρ x τ = β i τ (8.8) x A y ρ τ y = β j τ j (8.9) y A x ρ β i q i x q = (8.0) x A y ρ β j q j y q = (8.) y A y ρ xx q = β ii q (8.) x A y ρ yy q = β jj q (8.3) y J = ρ x τ ρ y q ρ τ ρ x q y B τ = ρ x D = β 3 (ρ xxq + ρ yy q ) This method is the method of compact differencing and is gives fourth order accuracy. The prognostic equation then becomes ( ) q n+ B n + D n = q n + t F J n 8.5. Spectral and pseudo-spectral barotropic model For simplicity, we will limit ourselves to a doubly periodic domain or dimensions ν by ν. This reduces the number of coefficients in the following model. Using fourier basis functions and the Galerkin method we can obtain the differential equation for the spectral coefficients (k + l )ρ t a kl + ( ) ωik + ζ(k + l ) + (k + l ) a kl = φ k (x)φ l (y)(f J ) da Ikkll
.950 Atmospheric and Oceanic odeling, Spring 04 where I kkll = I kk I ll and I nk = φ n (x)φ k (x) dx noting that I nk = 0 n = k because φ k (x) = e ikx form an orthogonal set of basis functions. In the spectral method, the fourier transform of J leads to a convolution and is relatively expensive to evaluate. The transform method is the more efficient approach in which J is evaluated in physical space and the transformed to wave-number space: τ x (x i, y j ) = τ y (x i, y j ) = ψ x (x i, y j ) = ψ y (x i, y j ) = ika kl e ikx i e ily j k l ilakl e ikx i e ily j k l ik(k + l )a kl e ikx i e ily j k l il(k + l )a kl e ikx i e ily j k l J(x i, y i ) = τx ψ y τ y ψ x J kl = J(x i, y j )e ikx i e ily j N F kl = N i j so that we can now integrate ( ) (k + l )ρ t a kl + ωik + ζ(k + l ) + (k + l ) a kl = F kl J kl i j F (x i, y j )e ikx i e ily j Note that the left hand side can be integrated in time analytically but that some explicit and stable time-stepping method must be used for the right hand side. 8.5. Aliasing and nonlinear aliasing Discrete representations of functions always allow aliasing of unresolved wave numbers onto resolved numbers. Fig. 8. shows an example using the regular finite difference grid x j = νj/n with N = 8. Evaluating the function cos(5x) at x j (black) only on the finite difference grid gives the eight values indicated by the circles. The highest mode that can be resolved on this grid is
.950 Atmospheric and Oceanic odeling, Spring 04 3 cos(3x), cos(7x) & cos(x) 0.8 0.6 0.4 0. 0 0. 0.4 0.6 0.8 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 x/(*π) Figure 8.: Aliasing of high wave number to a low wave number on a finite resolution grid: the grid has 8 nodes and on that grid, cos(5x) (solid black)is indistinguishable (circles) from cos(3x) (dashed blue). The highest mode that could be represented is cos 4x. The mode cos(x) (red) is also aliased to cos(3x). cos( N x) = cos(4x) and all higher mode number waves are mis-represented on this grid. In this case, cos(5x) is aliased to cos(3x); evaluating the function cos(3x) on the finite difference grid gives the exact same values as from cos(5x). ore generally, the relation ikx j ikj x iπn ikj x i(k+ πn )j x i(k+ πn )x e = e = e e = e x = e x j n = 0, ±, ±,... means that a resolved mode k can result in aliasing an infinite set of modes k + νn/ x. In the above example, with x = ν/8, n = corresponds to cos(5x) and n = corresponds to cos(x). Non-linear instability can occur when the result of nonlinear interactions between two waves result in higher mode number waves that can not be represented on the grid. The aliasing of these unresolved waves implies a false source of energy at lower wave numbers. Thus, if nonlinear interactions
.950 Atmospheric and Oceanic odeling, Spring 04 4 cos(3x), cos(4x) & cos(3x)cos(4x) 0.8 0.6 0.4 0. 0 0. 0.4 0.6 0.8 0 0. 0. 0.3 0.4 0.5 0.6 0.7 0.8 0.9 x/(*π) Figure 8.3: Nonlinear instability occurs when the product of two resolved waves leads to a high mode number component that can not be resolved by the grid and is aliased to lower resolved waves. Here, we show the same 8 point grid with the functions cos(3x) (blue circles) and cos(5x) (red circles) and their product cos 3x cos 5x = cos(8 x) + cos( x) (black squares) which has a cos(8x) component that aliases to cos(x). produces a wave number k + k > N/, then it will falsely appear as k 3 = N (k + k ). We illustrate this in Fig. 8.3 in which the product of cos(3x) and cos(4x) on an 8-point grid results in a higher mode signal with