- Successive Over Relaxation (nn_solv=2, solsor.F90)
- Preconditioned Conjugate Gradient (nn_solv=1, solpcg.F90)

Elliptic solvers (SOL)

!----------------------------------------------------------------------- &namsol ! elliptic solver / island / free surface !----------------------------------------------------------------------- nn_solv = 1 ! elliptic solver: =1 preconditioned conjugate gradient (pcg) ! =2 successive-over-relaxation (sor) nn_sol_arp = 0 ! absolute/relative (0/1) precision convergence test rn_eps = 1.e-6 ! absolute precision of the solver nn_nmin = 300 ! minimum of iterations for the SOR solver nn_nmax = 800 ! maximum of iterations for the SOR solver nn_nmod = 10 ! frequency of test for the SOR solver rn_resmax = 1.e-10 ! absolute precision for the SOR solver rn_sor = 1.92 ! optimal coefficient for SOR solver (to be adjusted with the domain) /

When the filtered sea surface height option is used, the surface pressure gradient is computed in dynspg_flt.F90. The force added in the momentum equation is solved implicitely. It is thus solution of an elliptic equation () for which two solvers are available: a Successive-Over-Relaxation scheme (SOR) and a preconditioned conjugate gradient scheme(PCG) [Madec, 1990, Madec et al., 1988]. The solver is selected trough the the value of nn_solv namsol namelist variable.

The PCG is a very efficient method for solving elliptic equations on vector computers. It is a fast and rather easy method to use; which are attractive features for a large number of ocean situations (variable bottom topography, complex coastal geometry, variable grid spacing, open or cyclic boundaries, etc ...). It does not require a search for an optimal parameter as in the SOR method. However, the SOR has been retained because it is a linear solver, which is a very useful property when using the adjoint model of NEMO.

At each time step, the time derivative of the sea surface height at time step (or equivalently the divergence of the after barotropic transport) that appears in the filtering forced is the solution of the elliptic equation obtained from the horizontal divergence of the vertical summation of (). Introducing the following coefficients:

the resulting five-point finite difference equation is given by:

(15.3) is a linear symmetric system of equations. All the elements of the corresponding matrix A vanish except those of five diagonals. With the natural ordering of the grid points (i.e. from west to east and from south to north), the structure of A is block-tridiagonal with tridiagonal or diagonal blocks. A is a positive-definite symmetric matrix of size , and B, the right hand side of (15.3), is a vector.

Note that in the linear free surface case, the depth that appears in (15.2) does not vary with time, and thus the matrix can be computed once for all. In non-linear free surface (key_ vvl defined) the matrix have to be updated at each time step.

Successive Over Relaxation (nn_solv=2, solsor.F90)

Let us introduce the four cardinal coefficients:

where (i.e. the diagonal of the matrix). (15.3) can be rewritten as:

with . (15.4) is the equation actually solved with the SOR method. This method used is an iterative one. Its algorithm can be summarised as follows (see Haltiner and Williams [1980] for a further discussion):

initialisation (evaluate a first guess from previous time step computations)

(15.5) |

iteration , from until convergence, do :

where satisfies . An optimal value exists for which significantly accelerates the convergence, but it has to be adjusted empirically for each model domain (except for a uniform grid where an analytical expression for can be found [Richtmyer and Morton, 1967]). The value of is set using rn_sor, a namelist parameter. The convergence test is of the form:

(15.7) |

where is the absolute precision that is required. It is recommended that a value smaller or equal to is used for since larger values may lead to numerically induced basin scale barotropic oscillations. The precision is specified by setting rn_eps (namelist parameter). In addition, two other tests are used to halt the iterative algorithm. They involve the number of iterations and the modulus of the right hand side. If the former exceeds a specified value, nn_max (namelist parameter), or the latter is greater than , the whole model computation is stopped and the last computed time step fields are saved in a abort.nc NetCDF file. In both cases, this usually indicates that there is something wrong in the model configuration (an error in the mesh, the initial state, the input forcing, or the magnitude of the time step or of the mixing coefficients). A typical value of is a few hundred when , increasing to a few thousand when . The vectorization of the SOR algorithm is not straightforward. The scheme contains two linear recurrences on and . This inhibits the vectorisation. (15.6) can be been rewritten as:

(15.8) |

This technique slightly increases the number of iteration required to reach the convergence, but this is largely compensated by the gain obtained by the suppression of the recurrences.

Another technique have been chosen, the so-called red-black SOR. It consist in solving successively (15.6) for odd and even grid points. It also slightly reduced the convergence rate but allows the vectorisation. In addition, and this is the reason why it has been chosen, it is able to handle the north fold boundary condition used in ORCA configuration ( tri-polar global ocean mesh).

The SOR method is very flexible and can be used under a wide range of conditions, including irregular boundaries, interior boundary points, etc. Proofs of convergence, etc. may be found in the standard numerical methods texts for partial differential equations.

Preconditioned Conjugate Gradient (nn_solv=1, solpcg.F90)

A is a definite positive symmetric matrix, thus solving the linear system (15.3) is equivalent to the minimisation of a quadratic functional:

inf |

where is the canonical dot product. The idea of the conjugate gradient method is to search for the solution in the following iterative way: assuming that has been obtained, is found from which satisfies:

inf |

and expressing as a function of , we obtain the value that minimises the functional:

where is the error at rank . The descent vector s chosen to be dependent on the error: . is searched such that the descent vectors form an orthogonal basis for the dot product linked to A. Expressing the condition the value of is found: . As a result, the errors form an orthogonal base for the canonic dot product while the descent vectors form an orthogonal base for the dot product linked to A. The resulting algorithm is thus the following one:

initialisation :

iteration from until convergence, do :

(15.9) |

The convergence test is:

(15.10) |

where is the absolute precision that is required. As for the SOR algorithm, the whole model computation is stopped when the number of iterations, nn_max, or the modulus of the right hand side of the convergence equation exceeds a specified value (see §15.7.1 for a further discussion). The required precision and the maximum number of iterations allowed are specified by setting rn_eps and nn_max (namelist parameters).

It can be demonstrated that the above algorithm is optimal, provides the exact solution in a number of iterations equal to the size of the matrix, and that the convergence rate is faster as the matrix is closer to the identity matrix, its eigenvalues are closer to 1. Therefore, it is more efficient to solve a better conditioned system which has the same solution. For that purpose, we introduce a preconditioning matrix Q which is an approximation of A but much easier to invert than A, and solve the system:

The same algorithm can be used to solve (15.11) if instead of the canonical dot product the following one is used: , and if and are substituted to b and A [Madec et al., 1988]. In NEMO, Q is chosen as the diagonal of A, i.e. the simplest form for Q so that it can be easily inverted. In this case, the discrete formulation of (15.11) is in fact given by (15.4) and thus the matrix and right hand side are computed independently from the solver used.

Gurvan Madec and the NEMO Team

NEMO European Consortium2017-02-17