# Usage of numerical models

Dimensionality (general)
Boundaries of the grid (general)
Discrete step sizes in the grid (general)
Iterative processes (general)
Nesting (general)
Validation of the model (general)
Dimensionality of a Swan model
Choice of computational region and boundary conditions (Swan)
Choice of step sizes (Swan)
Iterative behaviour of Swan
Nesting with SWAN
Validation of SWAN results

## Numerical models in general

Numerical computations by nature always involve a finite number of values that can be computed; so the phenomenon that is to be simulated has to be schemetised to such extent that it is represented by a finite number of values (often a large number, e.g. many millions). Most numerical models therefore carry out computations on a grid in space, and if the phenomenon is time-dependent, also for a finite number of time steps.

### Dimensionality

Sometimes the number of grid points can be reduced drastically by reducing the number of dimensions. For instance a 2-dimensional problem can be reduced to a 1-dimensional problem if the gradients in one direction are much smaller than those in the direction perpendicular to it. Or, which is quite common in near-shore wave models, the conditions are considered to be stationary, so that it is not necessary to make computations over many time steps. Conditions in nature are never truly stationary, so criteria are needed to decide if the reduction is justified. Time-derivatives cannot be compared with space-derivatives because of their different physical dimensions, but for wave problem criteria are available to decide whether a stationary computation is applicable.

Specifics for Swan are described below.

### Boundaries of the grid

Numerical simulation are carried out on a grid, usually a regular grid. The grid necessarily covers a finite region, and the influence of the outside world is taken into account by means of the boundary conditions on the boundary of the grid. The partial differential equations underlying the model determine how many boundary conditions are needed. The choice of the computational area is one of the responsibilities of the model engineer (i.e. the SWAN user).
Although the differential equations determine the number of boundary conditions, they do not determine what quantities have to be prescribed on the boundary. The model engineer has to choose the right quantities and the values that hold on the boundary. These should be such that they correctly represent the influence of the outside world, not only in the present situation but also in the design situation.
The correct boundary condition is not always known. This is not always detrimental, because one can move the boundary so far away from the region of interest that its influence is negligible. Whether or not this is possible depends on the nature of the problem at hand. This requires knowledge of the model engineer. If he is uncertain whether the boundary is far enough from the region of interest, he can experiment with the numerical model, by comparing two different model computations with different location of the boundary segment involved. If the results from the two equations are very close, at least in the region of interest, the boundary segment is at a good location.

Specifics for Swan are described below.

### Discrete steps in the grid

The mesh sizes in the grid, and the time steps, have to chosen also by the model engineer. In each case these steps must be such that relevant (length or time) scales are resolved well, i.e. the steps must be small compared with these characteristic lengths or time intervals; a good initial guess is 1/20 or 1/40 of such lengths or intervals.
If the model engineer is uncertain whether the steps are small enough, he can experiment with the numerical model, by comparing two model computations with different step sizes. If the results from the two equations are very close, at least in the region of interest, the step sizes are small enough.

Specifics for Swan are described below.

go to top

### The need for Iteration

Many numerical models employ iterative procedures. Some also have coefficients that can speed-up the iteration, at the risk of making the model unstable.
The main problem with iterations is that the criterion for terminating the iterative process is never what one would like to use: the difference between the approximate solution and the exact solution is small enough. This is impossible simply because the exact solution is unknown. All iterative processes use criteria whereby subsequent solutions are compared. This is no problem if the process converges rapidly. In a slowly converging process the difference between the (i+1)-th solution and the i-th solution is not much smaller than the difference between the i-th solution and the (i-1)-th solution. Then both may be small compared with the difference with the final limit, so that the difference between two subsequent solutions is not a good stopping criterion.
A model user must therefore experimentally find out the convergence behaviour of the simulation model he is using. A way to do this is e.g. halving the allowed difference between solutions and observing the number of iterations that the computation is taking. In a slowly converging computation the number of iterations will become significantly larger.

Specifics for Swan are described below.

go to top

### The need for Nesting

Frequently the desired accuracy requires a dense grid in the area of interest, whereas at the same time boundaries have to be chosen so far away from the area of interest that the total number of grid points becomes infeasible, either because of memory constraints or because of constraints on the simulation time.
In such a case the user of the simulation model can often make use of nesting. In this procedure the overall region is simulated with a coarse resolution; this simulation provides boundary values to a finer grid. Generally modellers are advised to reduce step size from one nesting level to the next by a factor of 2 or 3. Therefore sometimes several nesting steps have to be done in order to get an efficient computational procedure.
In iterative models it may be advantageous to use nesting also because coarse models tend to converge faster than finer models.
The above text suggests that nesting is a one-way procedure, starting with the largest scale working towards the smallest scale. In most cases this is true, but in a few cases the influence of the smaller-scale model on the large-scale model cannot be neglected. Then nesting is an iterative procedure. The user can check whether this is necessary by actually carrying out the iterative procedure where a larger-scale model is also fed with boundary conditions resulting from the next smaller scale.

Specifics for Swan are described below.

go to top

### Validation of the model

Whether the quality of numerical computations allows valid conclusions to be drawn, can never be taken for granted. Thus validation is necessary, by comparing numerical results with observations, preferably in the area of interest. The unfortunate thing with validation is that it is possible only for an existing situation and for conditions that have actually occurred. Validation is impossible for design situations, and/or for extreme (and therefore rare) conditions. Thus conclusions have to be drawn with great care.
The quality of the results does not depend only on the numerical choices described above. More often than not other input data are far more critical. In principle all input quantities have to be measured with great care in order to be able to validate the model. However, the final results will not be equally sensitive to all these input data. Therefore one is advised to carry out a sensitivity analysis with the simulation model before planning measurements so that one only measures those input data whose accuracy is critical for the quality of the final result.

Specifics for Swan are described below.

## Specifics of SWAN

In this section the findings of the previous section are applied to the SWAN model.

### Dimensionality

In many places in the world gently curved beaches occur. Such situations can usually be modeled as one-dimensional, also if the incident waves are not perpendicular to the coast. Note that the requirement is that the alongshore gradients of the wave field (and consequently also of the bottom) are much smaller than the gradients in cross-shore direction. The one-dimensional domain must be normal to the coast, NOT parallel to the (average) wave direction.
It is quite common to make stationary computations for the coastal region. This is justified if wind, depth and current conditions change only slightly during the time it takes for disturbances on the boundary to travel through the entire region. The travel time from the boundary to the coast is often of the order of a half hour; this is sufficiently small compared with the tidal period and with the time interval over which the wind field changes significantly.

General considerations on dimensionality are described above.

go to top

### Choice of computational region and boundary conditions

The spectral action balance equation requires boundary values for all incoming wave components at the boundary. It is stressed here that outgoing components cannot be prescribed by the SWAN user.
Boundary conditions for a SWAN computation are taken either from computations over a larger region (nesting situation), or from observations at an offshore location.
We first consider the nesting situation. If the computation for the large region was done with a model different from SWAN, the physics will be represented with different expressions in that model. SWAN will need some distance to adapt wave conditions to its own physics. As a consequence the boundary should be at some distance away from the region of interest.
Also the computation for the large region was obviously done with a larger grid size than the present SWAN computation. This also calls for an adaptation zone around the region of interest.

If observations have been used to obtain the boundary condition there is an essential problem in the sense that most measuring instruments cannot distinguish incoming and outgoing spectral components. The usual assumption is that energy is incoming. A discrepancy between the imposed boundary wave height and the wave height computed by SWAN for the boundary location is an indication that the assumption is not justified.
The seaward boundary is usually chosen parallel to the coast through the measurement location, and it is assumed that the wave conditions are uniform over this boundary. The model engineer has to make sure that the physical conditions allow such an assumption.
The observations do not provide any useful information to determine the conditions at the lateral boundaries of the computational region (the boundaries crossing the coast). Thus these boundaries have to be chosen at sufficient distance from the region of interest; see an example.
In the case of a spectral model such as SWAN the user also has to choose boundaries in spectral space, i.e. limits in the frequency and in the directional domain. In the directional domain it is often chosen to cover the full circle, i.e. all possible directions.
If a user chooses a limited sector, there is the possibility of leak over the directional boundaries. SWAN assumes that no wave energy enters over the directional boundaries, and that energy propagating towards the directional boundaries (due to refraction) is absorbed. Leak is the amount of energy lost in this process, it has the dimension of a dissipation, and it can be output by SWAN to enable the user to judge its importance.
In the frequency domain the choice of boundaries cannot be avoided. The lower limit of the frequencies should be at roughly 0.7 times the lowest occurring peak frequency or lower, and the highest at 2 times the highest peak frequency. Again sensitivity analysis with the frequency limits can show whether the choice was correct.

General considerations on the choice of boundaries are described above.

go to top

### Step sizes

Since computations by SWAN are carried out in 5-dimensional space, in general 5 step sizes have to be determined. For each of these the arguments in the previous section have to be kept in mind.
The main advantage of a spectral model over a phase-resolving model is that the time and space steps do not have to be small compared with the wave period and the wave length.
In time-dependent computations the time step has to be small enough to resolve the temporal variation of the wave field. Thus the time step has to be small compared with the tidal period if the tidal variation of depth and/or current velocities is taken into account. Furthermore the time step has to be small enough to represent the variations of the wind velocity.
In near-shore areas the spatial scales of the wave field are determined by the variations in water depth and in current velocity. Thus the spatial steps have to be small enough to resolve the bathymetry and the current field well.
The step size in the directional domain can be 5 or 10 ° in case of a wind sea. If there is an incoming swell the step size has to be smaller, e.g. 2 °. In some oceanic applications the resolution of 10° is still too large, also for a wind sea; see the section on the garden sprinkler effect.
In contrast with the other dimensions the frequency domain is covered by a logarithmic grid, i.e. $\Delta f/f$ is constant. Usually a resolution in which $\Delta f/f = 0.1$ is sufficient to resolve the spectral shape.
One of the consequences of the finite size of the spatial steps is numerical diffusion. See the illustration.

Note that time and space steps do NOT have to be small compared with the wave period or length. This is because the average properties of the wave field (which is what we compute when using a spectral model) vary over a period and length much larger than the wave period and length. Time and space steps must be small compared with the wave period or length in the case of phase-resolving models; this is the type of models used for wave penetration in harbours.

General considerations on the choice of step sizes are described above.

go to top

### Iterative behaviour

The SWAN model uses a four-sweep numerical integration technique. Since there are interactions between the sweeps, due to refraction and to nonlinear source terms, SWAN has to carry out a number of iterations. Experience shows that SWAN is often slowly converging. This seems to be due mainly to the quadruplet interaction term. Its value at the peak of the spectrum is relatively small, but it still has a non-negligible effect on the final results of the computation.
This is illustrated by the fact that in cases with a growing wave field 1st and 2nd generation computations need much less iterations to complete the iteration process.
In non-stationary computations the number of iterations per time step is usually kept limited to 1 or 2. The reason is that with sufficiently small time steps the change in values from one time to the next is already small so that the time stepping can replace the iterative process.

In SWAN you can control the iteration by specifying a maximum allowed difference between subsequent values of wave height and wave period, and the number of grid points where the difference has to be smaller in order to stop the iteration process.
It is also possible to run a prescribed number of iterations. You may then see that after a certain number of iterations the accuracy criterion is met in 100% of the grid points. This does not mean that the values do not change any more; the changes will be small however. Click to see an example.

For investigating the iterative behaviour of SWAN there is the possibility of producing output of action density and source terms for a number of test points (see command TEST); the output can be in the form of a table of overall wave parameters, or in the form of 1-dimensional or 2-dimensional spectra.

General considerations on iteration are described above.

go to top

### Nesting with SWAN

Nesting from a coarse model to a finer model is extremely simple in SWAN. It is done by means of the combination of the commands NGRID and NESTOUT. In some cases it is done by means of the the combination of the commands CURVE and SPECOUT. This way is more complicated, but this is seldom necessary. SWAN allows the user to build nesting boundary conditions to more than one nested model from a computation. Thus it is easy to find out whether it is possible to skip an intermediate nesting level or not. The depth at the nesting boundary may be different for the coarse and the fine model because the values are interpolated from a different bathymetry in the two models. Since some of the source terms depend strongly on the depth the nesting may cause a strong gradient near the boundary of the finer grid. The model engineer can take precautions to guarantee that the depth is continuous from the coarse to the fine model.
A separate section explains how to carry out the nesting in various combinations of large and small grids.

General considerations on nesting are described above.

go to top

### Validation of SWAN results

In near-shore applications of SWAN the bathymetry is crucial to the results. It must be determined accurately in a SWAN validation. A problem with design situations is that sandy bottom may be very dynamic so that the bathymetry may be variable during the period for which the design is intended.
Also the incoming waves are important. However, if dissipation is dominant in the region the results may not be too sensitive w.r.t. the incoming wave field.
The strength of dissipation terms is another factor in the results. Bottom roughness is an input quantity which is influential through the bottom friction term. With sensitivity analysis one can determine whether the friction term has a large influence on the results. If so, it is important to determine the bottom roughness. A careful survey of the bottom properties is needed in that case. Bottom properties may not be uniform over the computational domain. Therefore SWAN allows the user to enter a non-uniform bottom friction coefficient or bottom roughness.

General considerations on validation are described above.

go to top