4.1 Scanning structure
Each timestep of the model integration procedure consists of three scans.
At the beginning of the timestep, the model fields at time
are specified in grid-point form (as described in Subsection 2.2.7 of Chapter 2 `Basic equations and discretization' , these fields are `partially time-filtered'). The grid-point values of the model variables are contained in a `grid-point work-file', held on a secondary storage device and organized as a random-access file with one record for each latitude row. Meanwhile, the model fields at time
are specified in spectral form, all the spectral coefficients being held in central memory. The first scan consists of Legendre transforms to compute the Fourier coefficients of the model variables at time
on each latitude row, the results being written out to a `Fourier work-file', again organized with one record for each latitude row. During the first scan, latitude rows are processed in north/south pairs with the members of each pair being equidistant from the equator, in order to make use of the symmetries of the Legendre polynomials (see for example Temperton,1991). Once this first scan has been completed, the spectral coefficients are no longer required and the central memory arrays can be released for use during the next scan.
The second scan steps through the latitude rows, starting at the row nearest the North Pole and proceeding southwards. At each row, the corresponding records of the grid-point values at time
and the Fourier coefficients at time
are read in. Fourier transforms then provide grid-point values of the fields (together with any required horizontal derivatives) at time
. At this juncture, the time-filtering of the fields at time
is completed, while `partially time-filtered' fields at time
are also computed and written out to the grid-point work-file ready for the next timestep.
The grid-point calculations for the present timestep continue using the time-filtered values at
and the unfiltered values at time
. The right-hand sides of the equations, discretized in semi-Lagrangian form as described in Chapter 3, are computed with terms being grouped separately depending on whether they will be evaluated at the departure point, the midpoint or the arrival point of the trajectory. The results of these calculations, together with the horizontal wind components and the vertical velocity
, are then stored in a `rotating buffer' which contains values for a number of consecutive latitude rows. The grid-point calculations described so far correspond to the southernmost row contained in this buffer. Next, the focus of the computation returns to the central row of the buffer. Values of the wind fields and the right-hand sides of the equations are now available at a sufficient distance to the north and south of the central row for the trajectory calculations to be performed and for the semi-Lagrangian timestep to be implemented, thus furnishing provisional values at
. As described in Section 3.4, the contributions from the physical parametrization schemes can then be incorporated to complete the calculation of the right-hand sides
of Eqs. (3.26)-(3.30).
These right-hand sides are now Fourier transformed and the coefficients are written out to another Fourier work-file, again organized with one record for each latitude row but this time with a special structure which will be exploited in the third scan. The computation then proceeds southwards to the next pair of `southernmost' and `central' rows, the values computed for the new southern row overwriting those in the buffer for the previous northernmost row, which are no longer required.
At the start of the second scan, there is clearly an initialization phase during the first few rows when only the first part of the above calculations can be done. Similarly, at the end of the scan there is a `winding-down' phase during which the first part of the calculations has already been done, and only the second part is required. The same logical structure is also used to run the Eulerian version of the model, but in this case the width of the `rotating buffer' can be reduced to that for a single latitude row.
The third scan performs direct Legendre transforms to obtain the provisional spectral coefficients at time
from the Fourier coefficients computed in the second scan, using Gaussian quadrature. The calculation proceeds one zonal wavenumber at a time. Here we make use of the special structure of the Fourier work-file; although the file was written row by row, it can be read in `transposed' fashion, wavenumber by wavenumber. The direct Legendre transforms first exploit the symmetries of the Legendre polynomials, and then complete the calculations using highly efficient matrix multiplication routines. To see how this is achieved, notice that since a single Legendre transform can be written as a matrix/vector multiplication of the form
, a set of simultaneous transforms for the same zonal wavenumber but for different variables and model levels can be written as
 |
|
which is indeed in the form of a matrix multiplication
. A similar technique could have been used in the first scan, and this has been incorporated in the latest version of the model.
After the transformation to spectral space, the semi-implicit equations are solved and the horizontal diffusion is implemented as described in Section 3.4, thus completing the calculation of the spectral coefficients at time
. At the end of the third scan, the whole model has been advanced by one timestep.