5.9 Exercise 13: Inclusion of Nonlinear Terms
111
return fl w running from the northwestern corner to the southeastern corner of the
lake. This return f ow disintegrates into two separate “gyres” as it approaches the
southern bank of the lake. Obviously, the island forms an obstacle for the eastern
gyre.
5.8.4 Sample Code and Animation Script
The computer codes for this exercise can be found in the folder “Exercise 12” of
the CD-ROM. The code includes a random-number generator, taken from Press
et al. (1989), for allocation of initial floa locations. One Scilab script produces an
animation of the drift of floats whereas the other script produces a single graph
displaying trajectories of a selected number of float (see Fig. 5.14).
5.9 Exercise 13: Inclusion of Nonlinear Terms
5.9.1 Aim
The aim of this exercise is to include the nonlinear terms (advection of momentum)
in the shallow-water equations.
5.9.2 Formulation of the Nonlinear Terms
Using the product rule of differentiation, the (horizontal) nonlinear terms in our
shallow-water model can be written as:
Adv h (ξ ) = u
∂ξ
∂x
+ v
∂ξ
∂y
=
∂(uξ )
∂x
+
∂(v ξ )
∂y
− ξ
∂u
∂x
+
∂v
∂y
(5.29)
where ξ is either u or v. The firs two terms on the right-hand side of this equation
can be discretised using the TVD advection schemes for a control volume as in
Exercise 11. The remaining term can be formulated in an explicit manner.
5.9.3 Sample Code
Due to its multiple use, it make sense to formulate the advection scheme in generalised form as a subroutine. This subroutine can then be used for calculations of
the nonlinear terms and advection of Eulerian tracer, and also as a solver of the
vertically integrated form of the continuity equation. In this exercise, the Superbee
scheme is used for the sea-level predictor and different flu limiters are tested for
the nonlinear terms. The folder “Exercise 13” of the CD-ROM contains the amended
simulation code.
111
return fl w running from the northwestern corner to the southeastern corner of the
lake. This return f ow disintegrates into two separate “gyres” as it approaches the
southern bank of the lake. Obviously, the island forms an obstacle for the eastern
gyre.
5.8.4 Sample Code and Animation Script
The computer codes for this exercise can be found in the folder “Exercise 12” of
the CD-ROM. The code includes a random-number generator, taken from Press
et al. (1989), for allocation of initial floa locations. One Scilab script produces an
animation of the drift of floats whereas the other script produces a single graph
displaying trajectories of a selected number of float (see Fig. 5.14).
5.9 Exercise 13: Inclusion of Nonlinear Terms
5.9.1 Aim
The aim of this exercise is to include the nonlinear terms (advection of momentum)
in the shallow-water equations.
5.9.2 Formulation of the Nonlinear Terms
Using the product rule of differentiation, the (horizontal) nonlinear terms in our
shallow-water model can be written as:
Adv h (ξ ) = u
∂ξ
∂x
+ v
∂ξ
∂y
=
∂(uξ )
∂x
+
∂(v ξ )
∂y
− ξ
∂u
∂x
+
∂v
∂y
(5.29)
where ξ is either u or v. The firs two terms on the right-hand side of this equation
can be discretised using the TVD advection schemes for a control volume as in
Exercise 11. The remaining term can be formulated in an explicit manner.
5.9.3 Sample Code
Due to its multiple use, it make sense to formulate the advection scheme in generalised form as a subroutine. This subroutine can then be used for calculations of
the nonlinear terms and advection of Eulerian tracer, and also as a solver of the
vertically integrated form of the continuity equation. In this exercise, the Superbee
scheme is used for the sea-level predictor and different flu limiters are tested for
the nonlinear terms. The folder “Exercise 13” of the CD-ROM contains the amended
simulation code.
