THE DIFFUSIVE PROBLEM
J. J. O'Brien
Mesoscale Air-Sea Interaction Group The Florida State University
435 Oceanography/Statistics Building
Tallahassee, FL 32306-3041
1. INTRODUCTION
The ocean contains motions on many scales. In all nuuerica1 models it is necessary to parameterize the effect of unresolved scales of motion by some smoothing, usually in the form of Laplacian friction. This leads to equations which are both hyperbolic and parabolic. In this chapter we study siap1e diffusion equations in order to learn how to formulate the diffusive part of the problem and how to investigate the linear numerical stability of finite difference schemes. All methods are not stable.
2. THE SIMPLE ONE-DIMENSIONAL DIFFUSIVE EQUATION 2
~=Kau,
at 37
(1) K> 0 and constant.
The simplest finite difference scheme is
6,tK
+ un - 2u n
j-l j (2)
un+l - un +
j j
This has a truncation error O(At) + O(Ax2).
BIerciae:
If K
- ~x2/6~t, then the scheme is O(~t2) + O(~x~). Prove it.Equation (1) states physically that u should decrease smoothly in time. If we multiply (1) by u and use the chain rule on the right
side, we obtain
2 2
li.!!-.
2 at
- ~-{~) - K(!!.) ax ax ax
2
uKU ax2
Integrate over all x, say x £[0,1
127
!. J. O'Brim (ed.), Advanced Physical OCeQI8OgrQphk Numerical Modelling, 127-144.
<C 1986 by D. Reidel PublUhing Company.
~ - K J 1 (~ ) 2
0 ~x dx
The first term on the rigi:tt hand side is called the "dispersion"
or
"diffusion" term; the second is the "dis3ipation".
If we have cyclic boundaries, u or
~
vanishes at boundaries2
E(t) - -K J l(~)
0 ax
dx(O
~
it
Let us call E(t) energy or variance of u. The relationship says that E(t) must decrease monotonically with time. Therefore any finite difference solution of (1) must exhibit this same property. It also demonstrates that K must be positive for Laplacian friction.
Another way to understand the physics of this simple problem is to assume that there is a known solution
u(x,t) = U(t) e1.tx
(3)
Substitution in~o (1) proves immediately that (3) is at least a local solution of (1)w1thout regard to boundary conditions. If ~ is arbitrary, then U(t) satisfies~U + U2U - 0
~t
which has a solution
- KJ.2t]
u - c exp
This explicitly states that the time-dependent solution of (1) must decay in time for every wavelike solution! The solution decays exponentially in time and the e-folding scale is a quadratic function of wave number, 1.
Since we expect any physical solution to remain bounded in time, we must require any finite difference solution to remain bounded in
time.
Therefore, for any finite-difference approximation to be called numerically stable, the solution should consist of Fourier components whose amplitudes do not grow unbounded in time. We shall call a
scheme stable if all Fourier components remain bounded with time. It is unstable if even one component (or mode) is not bounded.
mE DIFFUSIVE PROBLEM 129
3. JOHN VON NEUMANN NECESSARY CONDITION FOR STABILITY
Consider the simple diffusion equation in the finite difference form
(4) Assume
exp [ikj6x]
A
where K - KAtl fJ;x .
2un - U
j n
and substitute in (1). Use of Euler's formula yields
- (I + 2K(cos kbx - I»U
An
Define an amplification factor, G, such that .
where G . 1 + 2 K(cos kAx - 1)
Un+ 1 = GUn
In this somewhat trivial case G is a scalar. However, in later, more general examples G will be a matrix. The simple difference equation has as a solution
Un - ~UO
Since the initial condition Uo is arbitrary, Un is bounded for large n if IGI
< 1. If G is a matrix, then we require the spectral radius of
G (say a(G» to be less than or equal to 1.a(G) < 1 is the Van Neumann necessary condition for linear computatiollal stability.
For physical problems with growing solutions, we need to allow for growth. Therefore it is permissible for IGI - 1 + O(At) but not faster. Indeed, let
). Un
AI is the amplification factor IUn+ll - 1)..llunl
For the method to be stable, we require Un to be bounded after n time steps
Iunl - IAlnluol < B
Therefore
n lnlAI< In(B/luol> = B'
Since n - t/~tt the necessary condition for stability
Inl ~I < B'At!t
If we require boundedness for a finite timet then
Inlxl' O(~)
Let ~I = 1 + 6
In( 1+6) = 6 + higher order terms
Therefore,
6 < O(At
or
1 + O(A.t)
This is the Von Neumann necessary condition for linear computational stability. In cases where no physical growth is anticipated, the practical stability criterion to use is
< 1
A
For our special case for the diffusion equation,!GI < 1 if K <
1/2. Therefore we say that the scheme is conditionally stable if
KAt
~
1
"2
< 5
It is important to note that k&K - ~ is the most unstable wave;
i.e., if we violate (5), the waves of length 2&K will grow fastest.
(See Figures la and lb)
4. CENTERED TIME DIFFERENCE FOR DIFFUSION EQUATION
Suppose we use the leap-frog finite difference schemeThe reader can show that the truncation error is now O( At 2 + hx 2) and is, therefore, more accurate than the forward time difference.
However, we can use the stability test to show that the scheme is
unconditionally unstable!
THE DIFFUSIVE PROBLEM 131
0
oa
0.50X
0.75
o.7Gc
0.&0
u
0.25
0
a25 0.50
X 0 0.78
Figures
la and lb. The solution of the diffusion equation (1) with
~(x,O) - sin(vx), u(O,t) - O. The curves are at n = 0,50,100 for K = 0.45 and 0.55 which exceeds the value 0.5. Note that the 2Ax wave is the most unstable wave.
Let
uj - Un exp [ikj Ax]
to obtain
Un+l . Un-l + 4K [COB kAx - 1 . Un
This is a three-term difference equation which can be solved by introducing the trivial equation Un - un- We then have a set of tWo equations
A
4K(cO8 kAx - 1
Un
Un+l . 1
~ 1 0 Un-l
Define the amplification matrix
4K(cO8 kAx -1) 1
G -
1 0
The scheme is stable if a(G) < 1 :&.erc.ise :
Show that this is not true. Hence, this centered-difference scheme is always unstable!
There is a nice trick for handling the analysis of three time level schemes such as (6). Observe that we want to find the
amplification {actor, G, which satisfies Un+ll= GUn. Since G - 0 is not useful, ~ must exist and thus Un-l - G- Un. Substitu~ion of these 2 equations into (6) immediately yields the desired equation for G. This trick will be used frequently in the next few Chapters.
E:Kerdse:
Show that the characteristic equation for (7) is identical to (8)
A
G - ~l + 4K(cos kAx-l)
We shall use this general approach to test the stability of many finite difference schemes even for problems which are not parabolic.
However, we can only find G for linear problems. For non-linear problems, it is necessary to linearize and apply the Von Neumann technique locally. Experience indicates that if a non-linear problea is linearly unstable, it is unstable.
There is some important vocabulary related to linear co8Putational stabilitv.
mE DIFFUSIVE PROBLEM 133
Definition: If a(G) = 1, we say the scheme is neutral If a(G) < 1, we say the scheme is stable. The stability
may be conditional or unconditional.
If a(G) > 1, the scheme is unstable.
a(G) is the spectral radius of a matrix G or the modulus of a scalar G. These conditions must be true for any wavenumber k, if the scheme is to be called stable.
5. FINITE DIFFERENCE SCHEMES FOR PARABOLIC PDE' S
Consider the simplest diffusion equation au K a2u
-:s-t - w
K =
canst > 0u =
u(x,t)u(x,O) - UO(X)
and is prescribed.Define the operator 62 such that
62Uj - Uj+l + Uj-l - 2ujA general four or six point difference equation is
n+l u
j
- un - tJ.tK
j ~)"2 96 uu+l + (1 - 9) 6 un]
2 j 2 j
where e ) O. e
= 0 gives the usual four point formula (2) 9
- 1/2 gives the trapezoidal rule (centered timedifference called the Crank-Nicholson Method).
The truncation error is
O(At2) + O(&x2) when e
- 1/2.If e
= 0 we have an explicit system to solve; meaning we can
solve for un+l without any terms on the right hand side depending onuj+1 for any
j.If e * °t
we have an implicit system to solvet and it may require
a matrix technique like the.tridiagon~l algorithm.In the followingt let K = ~/hx and e be the truncation error.
The stick diagrams in the following lists are called the 'finite difference stencil' (adapted from Richtmyer & Morton [1967]).
5.1.
Brief Outline of Methods for Diffusion EquationMethod 1. (8 - 0)
5.1.1.
0
1 O---~O"" :-" '0
n+l' n + K AF.,. n u - u v~ U ,
j j j
e - O(&:) + O(~2)
This scheme is explicit and stable if K < 1/2 as At, Ax + o.
5.1.2. Method 2. (9 - 1/2)
0---0---0 1/2
0--0 0 1/2
u
n+l
- jIt is implicit and always stable.
This is the Crank-Nicholson scheme.
5.1.3. Method 3. (8 - 1)
0 0-'-- -'0
I 0
n+l u
j
n
A+ K 62 Un+l j
e = O(At) + O(Ax2.
'U
This is implicit and always stable.
5.1.4. Method 4.
0
0---0---0
I(Special)
. 2 4
Same as Method 1 except K = 1/6, e a O(At ) + O(~ )
This scheme is explicit and stable
mE DIfFUSIVE PROBLEM 135
5.1.5. Method 5.
0 0 0
I I
0 0 0
e 1 - e
It 0 < 9 < 1/2, the ,scheme is stable it
K< (2- 49)-1. If 1/2
~ e ~ 1, the scheme is always stable. Methods 1 through 4 are special cases of 5.
Exercise:
~
/2l1-1/6K).
Verity that e - O(At2+Ax2) it e - 1/2 and it e -
5.1.6. Method 6.
0
0 0
I
00I
This is the centered scheme
This scheme is always unstable.
considered in 4.4.
5.1.7. Method 1.
Dufort-Frankel [1953]
0_-
__0- un-1 J
e - 0(At2) + 0(6%2) +. 0((At/6%)2)
This scheme is implicit and always stable. The un+1 term on right
may be brought to the left yielding an explicit f~rmula. The DuFort-
Frankel scheme is widely used in oceanography. However it has
an inherent problem. This scheme is not consistent unless
(Nc/bx) goes to zero at th~ same rate that At, Ax O. In cases with time steps large compared to K=
1/2, the solution behaves like a hyperbolicproblem with the governing equation
2 K a2u + K a2u
~ ~
~ ~t ~
-~
6x
However, in many problems K(At)2 « ~2, and the scheme behaves
properly. It is convenient to use the Dufort-Frankel method in many oceanography problems that are two and three dimensional.
There are numerous other schemes involving three time levels.
They are too rarely used to reproduce here.
TWO-DIMENSIONAL DIFFUSIVE PROBLEMS
6.
n+l n u = u
.l,m .l,m
+ u.t-l,m n - 2 u.t,n n K&
( n+~ u.t+l,m
- 2uJ.,n n
K6,t
( n + n
+ ~ u ~m+l U .t,m-l
Let us investigate the linear computational stability of this equation. Let
imkAy e
U.t n ,m = u n e i.tjAx
Substitution of (11
11 - u.
in (10) yields
2 2
+ [2Ut/6x (cos jAx-l) + 2KAt/Ay (cos ki1y-1)]U
n+l
Qn
For jAx - k~y - ~, the amplification factor is
2 2
G = 1 - 4Ut/Ax - 4Ut/~y
or
1 1 )
G- 1 - 4KAt(~+~
mE DIFFUSIVE PROBLEM 137
This scheme is stable if
1 1
) 1KAt(~ + "AY7 < '2
In the usual physical problem Ax
=
6Y, and thusThus the time step is more restrictive for a two-dimensional problem than for a one-dimensional problem. The reader must also realize that this is a practical restriction on the time step. We expect that K is chosen based on the physics of the problem; Ax should be chosen on the basis of the scales of variability that one is
modelling. Practically, 6x is frequently Chosen on the basis of storage availability or economics of computing. Hence, for most conditionally stable finite difference schemes, the stability
criterion is a constraint on the time step!
TURBULENCE PARAMETERlZATIONS IN OCEANOGRAPHY
7 ADVANCED SECTION:AND METEOROLOGY
On the length scales where rotation is important, we know relatively little about turbulence in the ocean or atmosphere. Numerous studies in air-sea interaction and boundary layer meteorology have given us insight into the vertical distribution of eddy diffusivities but little understanding of parameterizing horizontal turbulence. Various simple and complex approaches have been taken. Many atmospheric
modelers use numerical damping or occasional spatial filtering to remove noise from numerical solutions. In this section we will review some of the explicit damping mechanisms used in large scale models.
Some friction is always needed in numerical models to damp unwanted noise which arises from numerical errors or non-linear interactions.
7.1.
Bottom FrictionThe simplest form of friction is linear bottom friction or Rayleigh friction.
(12)
The inverse of a is an e-folding scale for damping.
wavenumbers at the same rate.
It damps all
Exercise:
Show that forward time differencing is stable if aAt<2 and that leap frog is unconditionally unstable.
In many ocean proble.s, quadratic bottom friction is used.
Numerous flow studies in streams, rivers and the laboratory show that the bottom friction is proportional to the square of velocity.
Usually the equation takes the form
~ at - -cu2/H + other physics. c > 0
The drag coefficient is non-dimensional; H is a characteristic depth
-
sometimes the depth of the fluid' and soaetimes the depth at which u is measured. We cannot check stability of this equation because it is non-linear. However, if we employ a "local"approximation in time and space, (2) reduces to (1) for linear stability analysis.
7.2. Laplacian Friction
The most common approximation for turbulence is Laplacian friction.
Most researchers believe that eddy dissipation can be modelled like Pickian diffusion with a constant viscosity, such as:
~ ~t - K W 02u + other physics
This is the problem we have investigated in detail in this chapter.
It is important to recall that each wavenumber, k, is damped according to
u(x,t
.!.!-
The smallest waves, Lmln - lAX' are damped fastest.
7.3. Bihar1*>nic Friction
Many
oceanographers have found that they cannot af ford to use very
small grid distances (high resolution) and have invented new ways to damp the smallest scales in numerical solutions. The simplest is bi -harmonic friction in the form~ at - ~V4u + other physics ~ A > 0
The necessity for the negative sign is easily seen if we substitute a single harD>nic,
u(x,t) - U(t,k,l)eikx eily
mE DIFFUSIVE PROBLEM 139
"local" solution U(t,k,1) - U e-A(k~12)t
0
which has theIn order for biharmonic f~iction to be dissipative, the negative sign is imperative. This parameterization of friction is called "scale selective" because it damps the waves according to k4 instead of k2.
Consequently the rate of damping decreases faster for longer waves for biharmonic friction than Laplacian friction. It still is an open question whether it is a good approximation for oceanic turbulence.
If w~ consider the equation
~- ~t
and use second-order finite differences with bx - dy, we obtain the
weights shown in Figure 2.
k+2 k+l
k
k-l
k-2
Figure 2. The stencil is very wide~ If a boundary is at (j-l)bxt ort in other termst if the nearest interior point is jbxt then we need to specify Uj-lt (Ux)j-l and V2uj-l as appropriate boundary
conditions.
E:zercise:
Use the von Neumann stability analysis with a forward time difference
and 6x . 6.y to show that
AAt
Ax:
for stability.
Non-Linear Diffusivity Based on Turbulence Theory
The inclusion of eddy diffusivities is based on a parameterization of the turbulence at the smallest scales in a particular oceanic model. If the scales are small enough so that the flow is not significantly dominated by rotation. we may propose that the
turbulence is three dimensional; if rotation is important. we might propose that geostrophic turbulence [Charney.
1976] is important.
each case there is a formulation which has found success in various models. As a preliminary
caveat~
we state that these nonlinear formulations are expensive to include in a model. If we want to investigate the linear physics of a particular situation. we should not include the following parameterizations. If we are trying to predict a real ocean flow. they are suggested as usefulparameterizations.
In
Three-Dimensional TUrbulence
We envision a three-dimensional turbulence problem in which the largest scales are forced; the intermediate scales are an inertial subrange and the smallest scales (smaller than 2&X) are viscously dominated. The Kolmogoroff hypothesis states that in the inertial subrange, the kinetic energy spectrum, E(k) depends only on wavenumber, k, and the rate of energy dissipation, £.
The concept of using this hypothesis for eddy diffusivities was developed by Smagorinsky [1963] and Lilly [1967]. It has been used with success by Smagorinsky [1963], Deardorff [1970, 1971] and O'Brien
[1971].
In the standard derivation of the -5/3 law, we hypothesize
E(k) = Cka£~
where
£ = v Dij Dij
The molecular viscosity is v and Dij is the deformation tensor D1j - 1/2(~ + ~
~Xj ~x1
where the velocity, y has components U{j C is the KOlmogoroff constant. Dimensional analysis yields
E(k)
=
Ck-5/3 £2/3The hypothesis for eddy diffusivity, K, is that K depends only on k
and £
K
a ckCXe:Pnm DIFFUSIVE PROBLEM 141
Dimensional analysis yields
K
- ck-4/3We only want to use K for horizontal diffusivity where
E = KD2 and
D2 - (D2 + T .
where
~ ~x
--~v
~y
stretching deformation
DT =
~
ay
shearing deformation
~v + D S a- ~x
The solution for K is K - c3/2 k-2n
The viscosity depends on the square of the wavelength of the flow.
implement the approximation, we assign the smallest scale to wavenumber
To
k - 2~/2~
which yields
K - c'(Ax,)2n
If T is the quantity being
where c' is an empirical constant.
diffused, K is used in the form
~T
~t - V.(KVT)
+ other physicsSecond-order derivatives are recommended, and D is calculated from the flow field at each time step from previous values.
7.6. Two~Dimensional Turbulence
We hypothesize that the turbulence at scales near 26x is dominated by geostrophic turbulence or 2-dimensional turbulence theory. Leith
[1968J,
Crowley[1968J and Haney [1975J have used this idea
successfully in various ocean circulation simulations. In this 2-D case, the kinetic energy spectrum, E(k), depends on wavenumber, k, and the rate of enstrophy dissipation, 11. Enstrophy is mean square
vorticity and 11 is
11 - vVC . vc
where the vertical component of vorticity, " is
h ~x -- ~u
,=~. vxy- ~y
The dimensional analysis
- Ck~f3
yields the -3 law in wavenumber E(k) - Ck-31)2/3
For a turbulent eddy viscosity formulation, we propose that K2 depends only on wavenumber, k, and rate of enstrophy dissipation,~.
= ck~~
Dimensional analysis yields
- ck-21}1/3K 2
As in the previous case, we solve for K2, letting k - 2w12Ax, and
obtain
The The The "constant," c', must be determined by numerical experiment.
magnitude of the gradient of vorticity is expensive to calculate.
coefficient is used in the equation for a variable, T, as
~ - ~K ~
~t ~x 2 ~x
~T.
+ ~Kxoy) ~ ~T + other physics
The eight nearest neighbors of a grid point are involved in determining Kl- This foraulation for eddy diffusivity has the advantage that we induce substantial dissipation in those regions where the gradient of vorticity is large (strong currents) and no dissipation in regions where geostrophy dominates- We obtain
dissipation where it is essential but not Where it is not part of the essential physics.
7.6.1. ~
!!!is,2tropic nonlinear eddy viscosity. In many rotating stratified simulations of atmospheric and oceanic convection, symmetry in one horizontal direction is presumed. Computer efficiency and availability also dictate that the horizontal mesh spacing Ax exceed the vertical spacing Az. We expect,a pFioFi~
that the eddyviscosities appropriate to these scales will not be isotropic. To
mE DIFFUSIVE PROBLEM 143 prevent nonlinear computational instability, we anticipate that
~ >
Kv where these are the horizontal and vertical eddy viscosities, respectively.
If Q 8 C2/2 is the enstrophy, then the local enstrophy dissipation rate ~ is
Following Leith [1968], if we assert that ~ and Kv depend only on wavenumber and~, the dimensionally consistent forms for ~ and Kv are
Ka = ck-2 ,,1/3 x
ck-21'11/3
z
where some generality has been sacrificed
~
allowing c to appear in both equations. The wavenumbers are chosen to be the largest resolved by the grid, kx= 2~/2~,
kz= 2~/2bz. Eliminating ~ in the above, we
obtain
KH
- Y(Ax.)3[(~)2 + (Az)2 (~ ) 2
]1/2ax (~az
(15)Kv=~2!x
(l1x) ;t~'Hwhere y contains all the constants. It is possible that y may eventually be estimated from turbulence theory. If Az = dx, (2) reduces to Leith's [1968] formulation. Kasahara (personal
communication) has used c - 0.5 successfully in the horizontal eddy viscosity prescription for the NCAR general circulation model.
Crowley [1968] reports a value of c = 3.7, but there is apparently some uncertainty about his definition of c. The reader must see numerical experimentation to determine an appropriate value of c.
However, whereas most fluid simulation codes will integrate
satisfactorily with a wide range of constant eddy viscosities, this author's experience [O'Brien, 1971] is that non-linear viscosity constants may only be varied by a factor of two for acceptable results.
In many simulations of mesoscale convection, Ax »&Z, the
formula reduces to the simple equations
These are easily calculated on a grid.
These suggestions are no panacea for parameterizing the
turbulent flow unresolved in two-dimensional simulations of rotating convective elements. We expect qualitatively better integrations than with constant eddy viscosities, but more sophisticated
prescriptions based on physical understanding of microscale turbulence are required.
8. REFERENCES
Charney, J., Geostrophic Turbulence, 1977.
J. Atmos. SOl.,- 28, 1087-1095, Crowley, W. P., A global numerical model: Part 1, J. Comp. Phys., 3,
111-147, 1968. -
Deardorff, J. W., A three-dimensional numerical investigation of the ideali zed planetary boundary layer, Geophys. Fluid Dynamics, 1,
377-410, 1970. -
Deardorff, J. W., On the magnitude of the subgrid scale eddy coefficient, J. Camp. Phys., 7, 120-133, 1971.
Dufort, E. C., and Frankel, S: P.,-Stability conditions in the numerical treatment of parabolic differential equations, Math
Ta~les_~d O~he~ Ai~ to Com~tations, I, 135-152, 1953. -
Haney, R., The relationship between the grid size and the coefficient of nonlinear lateral eddy viscosity in numerical ocean
circulation models, J. Comp. Phys. , ,l2., 257-266', 1915.
Leith, C. E., Two dimensional eddy viscosity coefficients, Proc.
WHO/IUGG S posium on Numerical Weather Prediction, TokjO:- Japan, Nov. 2 -Dec. , 19 ,1-41-1-44,19 .
Lilly, D. K., The representation of small-scale turbulence in
numerical simulation experiments, Proc. IBM Scientific Computing
§ym~si~ o~ ~nvi!:2nmental Sciences, 195-210,19(;1.
O'Brien, J. J., A two-dimensional model of the wind-driven North
,