Public Works
r>
departement
/a
COHERENS 11
M o b ilite it en
Openbare Werken
Colophon
Cover picture: sediment plumes at the Port of Zeebrugge (Bing Maps)
i: + 32 3 235 67
11
Email: info@imdc.be
Website: www.imdc.be
T H V IM D C S o resm a
Title
Project
Client
Document name
Document ref
Revision
Version
1.0
2.0
Date
Description
Author
C hecked / Approvf
14/09/2011 Draft
TVO/PRW
PRW /
GVh
09/08/2012 Final reportTVO/PRW
PRW
Distribution list
12
X
Hard Copy
Digital
Abstract
In this document, we first describe the physical set of equations and the numerical algorithm
implemented in COHERENS version 3.0.0. Next, an overview of the architecture and structure of
the final Implementation Is provided. Subsequently, we list the output of the subtask. In the final
Chapters, the testing of the code is discussed and recommendations for further development are
formulated.
l/RA/11339/10.072/G VH
Version 2.0 09/08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Contents
Table of contents
1
Introduction
1.1
1.2
1.3
1.4
The assignment
Objective of the
Overview of the
Structure of this
1
...............................................................................................................
s t u d y .................................................................................................
s t u d y .................................................................................................
r e p o r t.................................................................................................
1
1
2
3
Implementation
2.1
2.2
2.3
5
5
6
6
8
iv
9
9
15
16
Output of subtask 5
19
4.1
4.2
4.3
4.4
Report
internal discussion at BMM on 11/05/2011..................................................
Report
first followup meeting UgentIMDCSORESMA on 17/05/2011...............
Conceptreport distributed for the expert workshop........................................................
Expert
w o r k s h o p .........................................................................................................
4.4.1 Presentation at the expert w o rk s h o p ..................................................................
4.4.2 Report expert w o rk s h o p ........................................................................................
4.4.3 Report meeting Prof. S te llin g ...............................................................................
4.5 Final conce ptre p o rt............................................................................................................
4.6 Note on hydrodynamic a lg o r ith m ...................................................................................
4.7 Report on meeting between Pieter Rauwoens and Patrick L u y te n ...........................
4.8 Presentation on the Technical W o rk g ro u p ....................................................................
4.9 ACOMEN congress ........................................................................................................
4.9.1 ACOMEN p a p e r ....................................................................................................
4.9.2 ACOMEN presentation .......................................................................................
4.10 Test cases for v a lid a tio n ...................................................................................................
4.11 Revised manual ................................................................................................................
19
19
19
19
19
19
19
20
20
20
20
20
20
20
20
20
21
5.1
5.2
21
21
21
22
22
24
24
5.3
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
5.4
24
27
31
35
39
99
131
Final conceptreport
133
237
249
253
Acomen Paper
269
Acomen presentation
279
295
299
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
List of Figures
3.1
3.2
5.1
5.2
5.3
17
18
22
23
23
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
vi
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
List of Tables
5.1
Comparison of CPU times for the COHERENS test cases: semiimplicit scheme,
semiimplicit scheme with 1 SIMPLEiteration and explicit (modesplitting) scheme.
25
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 1
Introduction
1.1
1.2
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
The main focus of the client is the application of the tool in the optimization of the maritime access
of the various Flemish harbors, more particular to the complex fine sediments behavior in the
Port of Zeebrugge, the tidal dock Deurganckdok in the Port of Antwerp, the influence of geometri
cally complex infrastructures on water movement (such as the Current Deflection Wall, CDW), the
morphological impact of large scale use of dredged material and the influence of marshes and
dredge/dump activities on water quality of North Sea and River Scheldt. Based on this presump
tion, priorities have been given to the various required functionalities that have been identified in
the Inception Strategy (THV IMDC  Soresma, 2009).
From the Inception Strategy the following functionalities have been identified that support the main
goals for the development of the morphological module:
Implementation of an online suspension transport module (sand and silt)
a. Graded sediments
b. Hindered settling
c. Flocculation
d. Sediment turbulence interaction: Adjustment of turbulence damping for high concen
trations of suspended sediments
e. Effect of nonbreaking waves on the bed shear stress
Transport formulae for sand
Implementation of the morphological module
a. Morphological acceleration
b. Nonerodable layers
c. Scenarios (of e.g. wind and waves)
d. Dredging and dumping routines
The following functionalities were identified as of lower priority, but would have a surplus value:
(Dynamic) bed roughness predictors for hydrodynamics and / or sediment transport
Fluid Mud model KULeuven
Sandsilt mixtures and bed (consolidation) model
Effect breaking waves, wavedriven longshore transport
Besides these points, within the study, the development of an implicit numerical scheme for the
hydrodynamica! equations is put forward as an important achievement in order to realize large
gain in computational calculation time.
The goals of this specific task are:
1. Design of an implicit scheme in COHERENS
2. Implementation of the implicit scheme
3. Validation of the code
1.3
Based on the Inception Strategy a selection of seven tasks has been assigned to the THV IMDC
 Soresma to commence the study with. These are:
Task order 1 : Course COHERENS V2
Task order 2: Update and expansion of the manuals of COHERENS V2
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
1.4
In this report, the final implementation and validation of the semiimplicit numerical algorithm is
described. The structure of this report is as follows: in Chapter 2, the physical equations and
numerical scheme implemented in COHERENS version 3.0.0. is reported. Chapter 3 provides
an overview of the achitecture and structure of the final implementation. Then, the output of the
validation tests of the numerical code is described. Concluding remarks and recommendations
for future prospective developments are formulated in Chapter 6.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 2
Implementation
2.1
Introduction
The aim of this chapter is to provide a brief overview of (1) the physical equations solved in
COHERENS version 3.0.0. together with the consequences of the introduced approximations
and (2) the adopted method to solve these equations numerically. By no means, this chapter
intends to describe all the physical and numerical details of the implemented equations which
have yet been documented in the concept report (Van Oyen et al. , 2011). We merely aim to
emphasize the highlights, and point out the differences that have occured between the Concept
Report and the final version.
2.2
The dynamics of the flow field in coasts, estuaries and the ocean can be described by considering
the Reynolds averaged equations of motion and continuity; coupled with transport equations for
potential temperature, salinity and an equation of state. Three approximations have been con
sidered to obtain the model equations which are implemented into COHERENS version 3.0.0.:
(1) the Boussinesq approximation, (2) the traditional approximation and (3) the hydrostatic ap
proximation. The first two approximations do not impose severe limitations on the capacity of
COHERENS to describe physical phenomena. In particular, the first approximation only filters
out the acoustic modes as natural modes of the system; while the second approximation implies
that the model provides only a crude description of the dynamics in regions close to the equa
tor. The hydrostatic approximation means that inertial accelerations in the vertical momentum
equation are neglected, leading to a direct relation between pressure and gravitational acceler
ation. Consequently, the vertical velocity is enslaved to the horizontal velocity field through the
continuity equation. The hydrostatic approximation can sometimes impose a substantial limitation
to describe physical phenomena, mainly when relatively steep depth variations are considered.
Therefore, as example, the ability of describing the flow field over tidally generated bed forms with
small wavelengths is limited (e.g. Blondeaux & Vittori, 2011).
Applying these three approximations, the equations governing the dynamics of the flow field are
given by
du
du
dv
dv
dx
dy
dv,
dx
dv
du
du
dy
dz
div
1 d P n.
d C.
= g
dx
po
9R l
9 R 12
9 R 13
Po
dx
dy
dz
dv
dv
(2.1)
dz
d C
m + u Tx + v d y+ w Yz =  9T
+ t; /
dx
dx
bdz
(2.2)
bdz
(2.3)
fv
1 d P atm
x  ^ ^ r
+ tt /
dy
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
,
[ R 21
p0
dx
 1
1
ay
= 
dz
J u ;
(2.4)
dU
dV
(2'5)
in which (U,V) are the depthintegrated velocity components in the x and y directions. The
equations implemented in COHERENS version 3.0.0. and summarized above (eqs. (2.1)  (2.5))
do not differ from the set of equations described in the concept report (Van Oyen et a l. , 2011).
2.3
2.3.1
Algorithm overview
Before discussing the numerical scheme implemented in COHERENS version 3.0.0., we simplify
first the notation in (2.2)  (2.3) by introducing A v {), D v {), A h {) and D h {) to denote the vertical and
horizontal advective and diffusive terms, respectively. Moreover, we represent the source terms
related to gradients in the atmospheric and the baroclinie pressure by S.
Considering the vertical advection and diffusion terms as well as the free surface gradient implic
itly, the semidiscretized (only in time) governing equations read
d u n+1
d v n+1
d i u n+1
dx
dy
dz
An + 1 _
At
/7l+1?/n+l h n i i n
At
Q jjn + 1
An
dx
0,
(2 .6)
d V n+ 1
1
dy
(2.7)
d f n+1
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
computational mesh. After each iteration step, the mesh is adjusted, according to the newly
calculated free surface height. For clarity, we introduce a new superscript indicating the iteration
level; i.e. </>n+ 1i i + 1 denotes the value of the variable <f> at the new time step n + 1 obtained after
performing iteration it. To circumvent the coupling between the momentum equations and the
free surface evolution equation, we adopt a predictorcorrector scheme. Flereto, we introduce the
free surface correction
/ _
n+l,it+l _ n + l , i t
(2
10)
'
n+l,it
f)/n + l, i t
3 '
At
i n n
in
Af
= A v (u n,
) + D v (u n,
) + A h (u n ) + D h (u n ) + Sx 
dx
(2 .11)
f ) f n + l,it
Both (2.11) and (2.12) consist of a tridiagonal system that is readily solved using the Thom as
algorithm. The horizontal velocities are then corrected as
hn+ l,it+ lu n+ l,it+l
h n + l,it+ iv n+ l,it+l
h n+ l,itv * _
/7 + M i +
(2.13)
lg A t ^ ,
h%+ 1 U + 1 g
A t ^ 
(2.14)
At
C'
, OU*
At '
dx
, 91/ *
'
dy
9^
) + y
The inversion of (2.15) is computed using preconditioned Krylov methods, taking advantage of
the open source scientific computation library PETSc (Balay et a l. , 1997). Once C' is determined,
u n + i , i t + i anc v n + i , i t + i are reaqy obtained from relations (2.13) and (2.14).
To check if the
computation can be proceeded to the next time leve, the L ^ n o rm of C' is compared to a threshold
value e. If He'll < e, a next time step is computed setting Cn+1 = en+ 1,ii+1, u n+1 = u " + M t+ i;
otherwise a new iteration is performed.
In summary, the iterative algorithm consists of:
for ntimesteps do:
n + l,it +
1 t
(u,v)corrector (eq.
if(converged) return
end do
H n+ l,it+l
2.15)
H n + 1,it +
and
/?n + l,+l =
H lA A } 1^ + i t
In the convergence check the norm of C' is compared with a treshold value e: C' < e.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
2.3.2
The numerical algorithm described above and implemented in COHERENS version 3.0.0. slightly
differs from the scheme presented in the conceptrapport Van Oyen et al. (2011):
2.3.2.1
In the concept report, a splitting of the velocity field was proposed in a value related to the full
free surface gradient, and the remainder (equation 6.17, from Van Oyen et al. (2011)). The
actually implemented splitting was performed on the basis of the free surface correction (equation
2.13). This adjustment was made because as such, their is a gain in accuracy, without extra
computational cost (see also Chen (2003)). The adjustment is also convenient for the linear
solver, since the solution for ' automatically starts from the initial guess C' = 0.
2.3.2.2
Following the concept report, two tridiagonal matrix inversions were needed. Here, one of them is
eliminated by applying a constant coefficient in front of the free surface correction gradient in the
velocity splitting (2.13). This means that the vertical advection and diffusion terms are only implicit
at predictor level. This modification is justified because of the free surface correction adjustment
described above. By means of this adjustment, there is an increase in computational efficiency,
by removal of one tridiagonal matrix inversion. More importantly, the adjustment provides that the
algorithm is now capable of dealing with the time splitting method, accompagnying hte TVD space
discretization scheme. Also, it is not clear which boundary conditions apply at the bottom and
surface for , because the physical boundaries act on u as a whole. If needed, the full implicitness
of vertical advection and diffusion can be taken into account by using the outer iteration loop, which
is needed for the variation of h3 anyway.
2.3.2.3
Although the iteration loop to account for the variability of h3 was already mentioned in the concept
report (Van Oyen et al. (2011), section 6.1.3), it is now inherently part of the algorithm. The extra
loop is the only way possible to reach an implicit /?3term. It will be proven considerably useful
when also horizontal advection and diffusion are discretized implicitly.
2.3.2.4
boundary conditions
With respect to the concept report more boundary conditions are implemented than first proposed.
In particular, Van Oyen et al. (2011) suggested to implement only the four barotropic and two
baroclinie boundary conditions. In the release of the implicit code (V3.0.0), all available boundary
conditions are adjusted to suitably perform in combination with the implicit scheme. In particular,
the effect of the barotropic open boundary conditions has to be considered when building the
linear system 2.15, providing different matrix entries, depending on the open boundary type.
l/R A /1 1339/10.072/GVH
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 3
Architecture and structure
3.1
Introduction
When implementing the semiimplicit code within COHERENS, we tried to change as little as
possible to the original structure and implementation. Indeed: the modesplitting scheme, which is
currently the only scheme available in COHERENS, had to be retained. Also, since the equations
to be solved are essentially the same, several subroutines could be used both by the semiimplicit
scheme and the modesplitting scheme. Hereto, some (technical) modifications to the routines
were needed.
The major adjustments to the existing code are found in the files:
1. currents.f90, where extra arrays are declared
2. depths.f90, where extra arrays are declared
3. solverpars.f90, a new file, defining parameters needed for the linear solver, and the outer
iteration loop.
4. gen_inversion.f90, a generic file for notimplemented linear solver output and routines.
5. mat_inversion.f90, describing the linear solver output and routines. This file links to gen_inversion.f90
or petsc_inverstion.f90.
6. petsc_inversion.f90, linear solver output and routines, linked to PETSc.
7. Hydrodynamic_Equations.F90, major additions due to the implicit scheme.
8. Open_Boundary_Conditions.f90, with additional subroutine to incorporate the effect of open
boundary conditions on the free surface correction matrix entries.
The following routines have been created:
correct_free_surf
SUBROUTINE correct_free_surf (residual)
REAL, INTENT(OUT) :: residual
File
HydrodynamicEquations. F90
Type
Subroutine
Purpose
Corrector step to determine (implicit) free surface elevation
Called external procedures
mat_add, mat.create, mat_destroy, solution_create, solution_destroy, vec.add, vec.create,
vec_destroy, open_boundary_conds_cont, open_boundary_conds_2d, water.depths
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Arguments
residual
Calling procedures
hydrodynamic_equations
store_old_time_2d
SUBROUTINE store_old_time_2d
File
HydrodynamicEquations. F90
Type
Subroutine
Purpose
Store old time level of 2D velocity fields.
Calling procedures
hydrodynamic_equations
store_old_time_3d
SUBROUTINE store_old_time_3d
File
HydrodynamicEquations. F90
Type
Subroutine
Purpose
Store old time level of 3D velocity fields.
Calling procedures
hydrodynamic_equations
store_zeta_old
SUBROUTINE store_zeta_old
File
HydrodynamicEquations. F90
Type
Subroutine
Purpose
Store old time level of CCalling procedures
hydrodynamic_equations
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
10
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
open_boundary_conds_cont
SUBROUTINE open_boundary_conds_cont
File
Open.Boundary.Conditions. f90
Type
Subroutine
Purpose
Apply the open boundary conditions for the 2D continuity equation (free surface implicit).
Calling procedures
correct_free_surf
store_old_obc_arrays
SUBROUTINE store_old_obc_arrays
File
Open_Boundary_Conditions. f90
Type
Subroutine
Purpose
Store old time level value of arrays for 2D Orlanski and characteristic open boundary con
ditions.
Calling procedures
hydrodynamic_equations
mat_initialize
SUBROUTINE mat_initialize
File
petscJnversion. F90
Type
Module subroutine
Purpose
Initializes PETSc solver variables.
PETSc call
Petsclnitialize
mat_finalize
SUBROUTINE mat_finalize
File
petscJnversion. F90
Type
Module subroutine
Purpose
Finalizes PETSc solver variables.
PETSc call
PetscFinalize
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
11
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
m atxreate
SUBROUTINE mat_create
File
petscJnversion. F90
Type
Module subroutine
Purpose
Creates a 5point stencil matrix.
PETSc call
MatCreateMPIAIJ
mat_destroy
SUBROUTINE mat_destroy
File
petscJnversion. F90
Type
Module subroutine
Purpose
Destroys the created matrix.
PETSc call
MatDestroy
mat.add
SUBROUTINE mat_add(ieqn,j e q n ,ivar,j v a r ,val)
INTEGER :: ieqn, jeqn, ivar, jvar
PetscScalar : : val
File
petscJnversion. F90
Type
Module subroutine
Purpose
Adds a value to the present value in the matrix at the row and column position defined by
the indices.
Arguments
ieqn
jeqn
ivar
jvar
val
PETSc call
MatSetValues
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
12
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
matinsert
SUBROUTINE mat_insert(ieqn,je q n ,ivar,jva r ,val)
INTEGER :: ieqn, jeqn, ivar, jvar
PetscScalar : : val
File
petscJnversion. F90
Type
Module subroutine
Purpose
Overwrites a value in the matrix at the row and column position defined by the indices.
Arguments
ieqn
jeqn
ivar
jvar
val
PETSc call
MatSetValues
vec_create
SUBROUTINE vec_create
File
petscJnversion. F90
Type
Module subroutine
Purpose
Creates a right hand side in vector format.
PETSc call
VecCreateMPI
vec_destroy
SUBROUTINE vec_destroy
File
petscJnversion. F90
Type
Module subroutine
Purpose
Destroys the created vector.
PETSc call
VecDestroy
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
13
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
vec.add
SUBROUTINE vec_add(i,j,val)
INTEGER :: i , j
PetscScalar : : val
File
petscJnversion. F90
Type
Module subroutine
Purpose
Adds a value to the present value in the vector at the position defined by the indices.
Arguments
i
val
PETSc call
VecSetValue
vecJnsert
SUBROUTINE vec_insert(i,j,val)
INTEGER :: i , j
PetscScalar : : val
File
petscJnversion. F90
Type
Module subroutine
Purpose
Overwrites a value in the vector at the position defined by the indices.
Arguments
i
val
PETSc call
VecSetValue
solution_create
SUBROUTINE solution_create
File
petscJnversion. F90
Type
Module subroutine
Purpose
Creates the solution in COHERENS format of the linear system. Solver, preconditioner and
tolerance can be user defined.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
14
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
PETSc calls
KSPCreate, KSPDestroy, KSPGetPC, KSPSetOperators, KSPSetTolerances, KSPSetType,
KSPSolve, MatAssemblyBegin, MatAssemblyEnd, PCSetType, VecAssemblyBegin, VecAssemblyEnd, VecCreateMPI, VecDestroy, VecGetArray, VecRestoreArray
solution.destroy
SUBROUTINE solution_destroy
File
petscJnversion. F90
Type
Module subroutine
Purpose
Destroys (deallocates) the created solution array.
3.2
Implementation
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
15
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
In order to allow for the iteration loop, the storage of values at previous time levels had to be
removed from within the routines themselves. As such, both the modesplitting scheme and the
semiimplicit scheme can make use of the routines current_pred and current.cor. The current.cor
routine is not essential for the algorithm desrciption. The current_pred routine could be retained
because of the free surface correction method (instead of the projection method).
A new routine, correct_free_surface, solves for the 2D continuity equation and builds up an implicit
system, yielding a matrix which has to be inverted. The calculation of the matrix entries happens
inside this routine. It is stored at the right place in the matrix by calling the routines mat_add and
vec_add, from within petsc_inversion.f90. Once the matrix is entirely filled, it can be inverted by
calling solution.create, which provides the solutionarray, i.e. the twodimensional free surface
correction array. All matrix handling is left for the petscJnversion module and is deliberately kept
out of the HydrodynamicEquations.F90 file, so that a later change in linear solver is made less
invasive for the source code.
The addition of matrix entries at the open boundaries is handled by the routine open_boundary_conds_cont
in the Open_Boundary_Conditions.f90 file. Also there the same calls mat.add and vec_add are
found. Entries are calculated differently, depending on the type of boundary condition.
3.3
Structure diagrams
Structure diagrams for the time loop and the added routine correct_free_surf are provided in the
figures below.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
16
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
nt=0
tim e loop
n t= n t+ l
up date_tim e
predictor
step
nt1 m u ltip le
o f ic3d
m e te o jn p u t
equ at io n_of_state
baroclinic_g radient
s t o r e z e t a o ld
hydrodynam ic_equations
st o re o Id_t i m e_2d
store old tim e 3d
it = o
pre d icto r
it = it+1
step
nt1 m u ltip le
o f ic3d
cu r r e n tp r e d
NO
co rre cto r
step
YES
correcto r
step
nt m u ltip le
o f ic3d
current corr
converged?
salinity_equation
user o u tp u t
fina l conditions
nt<nstep
I/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
17
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
initialisation
m at add
c on tributio ns
vec add
Tim e derivative
U velocity fluxes
V velocity fluxes
Boundary conditions
o p e n b o u n d a ry c o n d s c o n t
solution create
use solution
open_boundary_conds_2d
w ater_depths
w a te r depths
mean currents
finalise
exit
Figure 3.2: Diagram o f routine c o rre c tJ re e s u rf which solves the 2D depth integrated continuity equation.
I/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
18
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 4
Output of subtask 5
In this chapter, the output and submitted reports produced in subtask 5 are summarized. The
reports themself are enclosed as appendix.
4.1
This document describes an internal discussion meeting between Patrick Luyten, Jose Ozer,
Tomas Van Oyen and Peter Troch on methods to implement an implicit scheme. The report is
given in appendix A.
4.2
This report describes a meeting between UgentIMDCSOMESMA in which the state of the conceptreport is discussed. The report is given in appendix B.
4.3
The conceptreport that was distributed for the expert workshop is not included here, since it is
mostly identical to the final concept report.
4.4
4.4.1
Expert w orkshop
Presentation at the expert workshop
4.4.2
A summary of the presentations and discussions presented on the expert workshop is given in
appendix D.
4.4.3
In appendix E, the meeting between Prof. Stelling, Marcelo Heredia and Alexander Breugem is
reported.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
4.5
Final conceptreport
The final conceptreport which takes into account the comments formulated by the experts at the
expert workshop is given in appendix F.
4.6
In appendix G, a note on the hydrodynamic algorithm presented in the final conceptreport is given.
4.7
The report provided in appendix FI describes a meeting between Patrick Luyten and Pieter Rau
woens on 23/03/2011.
4.8
The presentation given by Pieter Rauwoens at the Technical Workgroup is given in appendix I.
4.9
4.9.1
ACOMEN congress
ACOMEN paper
The paper, written for the ACOMEN congress in Lige in November 2011 is given in appendix J.
4.9.2
ACOMEN presentation
4.10
In appendix L, test cases are suggested to validate the implicit code. The proposed test cases
were not retained.
4.11
Revised manual
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
20
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 5
Testing the code
5.1
Since the developent of the implicit scheme does not add new physics into the code, no new
validation tests had to be found. Therefore, we restricted the testing of the code to the standard
test cases, included in COHERENS. Test cases of importance are: seich, fredy, river, plume,
rhone, bohai and optos.
The specific improvement following from the implicit scheme is that greater time steps can be
taken without running into stability problems. As such, all tests were done with time steps equal
to the 3D time step, as used in the original tests. The optos test was run with a larger time step,
to test the stability close to CFL=1.
5.2
Findings
It seemed that all tests went well. A general finding is that the larger the time step, the more
(SIMPLE) iterations are needed per time step in order to meet the convergence criterion.
5.2.1
Figure 5.1 plots the location of the point where the salinity front outcrops the surface, hf r , during
the tidal cycle. hf r is measured by the distance i km of the 34 PSU contour line (taken at the
first grid cell below the surface) to the left boundary. It is found that the front moves to the right
with an almost uniform speed on which tidal modulations are superimposed. The position of the
outcrop is presented in figure 5.1 considering the free surface gradient implicitly (full line) and
explicitly (dashed line). A good agreement is found indicating the equivalence of both algorithmic
approaches.
The sensitivy of the results and the performance of the model with respect to the treshold value e
is analysed in figures 5.2 and 5.3. In figure 5.2, A hfront and A res velocity is plotted for several
treshold values with
A hfront = lfe/r(f
A res velocity =
(5.i)
'U'res ,c o n v
In (5.1), ures represents the residual surface horizontal current and the underscript 'conv' denotes
the value to which hf r and ures converge descreasing the treshold value. It is found that the
relative difference for both output parameters is smaller than 2%, indicating that the obtained
accuracy by decreasing the treshold value is not substantial. Here, it is worth to point out that for
the largest value of e considered (e = 0.1), the norm of C' turns out smaller than the treshold value
at the first check; i.e. only one iteration is performed. Considering that a decrease from e equal
0.1 to l.0 ~ 5 triples the computational time (see figure 5.3), the results suggest that the use of a
very small value of e is not necessary. Depending on the desired accuracy, for these simulations
a value of e equal to 0.01 or 0.07 seems appropriate.
Finally, in figure 5.3, also the computational time to complete the simulation using the explicit
(modesplitting) scheme is presented (red horizontal line). For stability, the mode splitting scheme
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
90
E x p lic it
Im p licit
80
70
60
1
</)
50
13
0
o
Q_
40
30
0
10
20
30
40
50
60
70
80
tim e [h o u rs]
Figure 5.1: The time developm ent o f the distance between the left boundary and the po in t where the salinity
front outcrops the surface considering the free surface gradient im plicitly (full line) and explicitly (dashed
line).
requires 10 2D substeps, each time step. It is found that the implementation of the implicit
algorithm sligthly decreases the computational cost of the numerical model when the treshold
value is large. For decreasing values of e, it turns out that the numerical simulation with the free
surface gradient implicit becomes more expensive than using the modesplitting scheme. The
only slight increase in efficiency does not correspond to the expectations and is probably due to
the way PETSc is coupled to the main source code. It is expected that a more efficiently coded
matrix fillup will result in higher efficiencies. In the future, a linear solver will be coded within the
source code, yielding faster calculations.
5.2.2
It was found that for the optos.csm case, the time step could be raised with a factor 90 in the
semiimplicit mode to reach the stability limit. A factor 3 in gain in CPU time was found.
As a result, one can conclude that the semiimplicit scheme yields faster simulations in 2Dmode
(cf. optos). Flowever, in 3Dmode, the amount of outer (SIMPLE) iterations has strong repercus
sions on the codes efficiency.
5.2.3
A problem was found with respect to boundary condition 13 (characteristic method without im
posed water levels and transports). We found that the instability arose due to the incoming cha
racteristic. First, the problem was circumvented by the following advice: The user is decouraged
to use the m ethod o f characteristics as a boundary condition in the corner points where these
boundary conditions meet. Doing this, the problem seemed resolved for the first test cases. How
ever, sometimes we ran into problems.
A closer look into the boundary conditions revealed that the transverse transports for the incoming
characteristic are causing the instability. By setting them to zero, the results seemed unaltered, but
instabilies were no longer encountered. A possible explanation is this: the incoming characteristic
is fully determined by what happens outside of the domain, such that transverse components from
within the domain are downwind located and hence may result in instability.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
22
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
0.02
A hfront
Ares ve lo city
0.015
a)
o
c
0.01
CD
i_
CD
0.005
CD
0.005
1e06
1e05
0.0001
0.01
0.001
0.1
convergence criterium
Figure 5.2: Sensitivity o f the model results with respect to the treshold value e[m].
32
tim e
explicit
30
28
26
24
22
20
18
16
14
12
10 1
1e06
1e05
0.0001
0.001
0.01
0.1
convergence criterium
Figure 5.3: The time necessary to complete the simulation for different values o f e[m].
com putational time, using the explicit scheme, is represented by the red line.
I/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
The necessary
23
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Following this route, also the outgoing characteristics are expected to be unstable, since the cfllimit related to the surface gravity wave speed, is exceeded. We did not encounter instabilities
in this respect, perhaps because the outgoing characteristic goes outwards and does not really
influence the inner domain. It would be better to consider these terms implicitly, but doing this,
would result in a boundary condition with greatest complexity ever seen. Moreover: at corners (or
jigsaw boundaries), boundary conditions would become coupled, requiring much more program
ming effort and computational overhead.
5.2.4
General comments
Following table (tab. 5.1) presents the CPUtime comparison between the implicit sheme and the
explicit scheme, performed with the released version (rev. 476), leaving the test case parameters
unchanged:
Gererally speaking, the results with the implicit scheme are promising, but the expected gain in
computational time is not reached. This is due to the programming inefficiency with respect to
the coupling with PETSc. Implementation of a solver within the code is exptected to resolve this
problem.
5.3
The implementation of the semiimplicit scheme was regularly checked by the BMM. Also, the
BMM has tested the code on the regular suit of testcases, that come with the COFIERENS source
code. No issues were found: results are reproduced as expected; this means: there is a slight de
viation of the numerical results, compared to the explicit runs, which is normal, since the solution
algorithm has changed. Deviations are, however, within acceptable limits.
Specific comments concerning boundary conditions have resulted in the replacement of the cha
racteristic boundary condition into an Orlanski boundary condition for the plume test case by
BMM.
The observation that the semiimplicit code runs slower than the modesplitting algorithm for 3D
simulations is one of the reasons to start the implemenation of a multigrid solver in a new subtask.
5.4
Since feedback was given during the implementation stage, no modifications have been made
with respect to the alpha version of the code. The merging procedure (by BMM) into the trunk
has led to a major modification of the alpha code in terms of code structure and organization
and variable declaration. These modification are technical and deliver the exact same solution
algorithm as presented in this report.
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
24
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
testcase
river
plume
rhone
boh ai
optcsm
optnos
optbcz
0A
1A
OB
1B
OC
1C
0D
1D
0A
1A
OB
1B
OC
1C
0D
1D
0E
1E
OF
1F
0G
1G
A
B
C
D
E
F
G
A
B
C
D
E
F
im plicit
default max_it=1
10.7
6.9
14.4
21.0
4.2
9.1
19.1
11.6
6.4
9.0
21.7
12.4
18.4
10.7
36.4
19.1
384
194
722
451
172
125
371
339
144
196
410
376
187
134
399
359
224
133
357
470
182
133
397
355
150
191
434
523
1931
1465
1988
1461
1856
1370
1918
1459
1916
1455
1925
1455
1914
1458
445
161
167
436
443
178
3926
1809
1807
3820
3820
1813
5305
5305
35094
7768
39063
13206
explicit
6.8
12.1
6.2
11.1
4.2
11.4
9.1
20.4
162
377
94
271
114
302
102
269
97
270
97
268
152
346
1410
1372
1292
1366
1368
1364
1366
616
573
569
1697
1693
1695
28617
10115
13670
Table 5.1: Comparison o f CPU times for the COHERENS test cases: sem iim plicit scheme, sem iimplicit
scheme with 1 SIMPLEiteration and explicit (modesplitting) scheme.
I/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
25
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
26
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Chapter 6
Conclusions and recommendations for further developments
The explicit COHERENS code has been converted into a (semi) implicit code to yield faster cal
culations. Although the implementation is done well (as proven with the verification test cases)
the expected gain in computational time is not yet obtained. As to resolve this matter, the imple
mentation of a fast solver within COHERENS will be a key issue. In order to really obtain fast
calculations, a multigrid solver is the best option.
The code is no longer parallel in the implicit version. This problem is related to the coupling with
PETSc. Also here, the development of an incode solver, will be the solution.
With the semiimplicit version of the algorithm, the time step size is greatly increased, but still
suffers from a stability criterion: For convection dominated flows, the time step has to satisfy
C F L < 1, with the Courant number based on the convective flow velocity. For diffusion dominated
flows, the Neumann stability criterion comes into play. To achieve a code without restrictions
upon the time step (apart from the restrictions related to accuracy), a full implicit scheme has
to be implemented, including the implicitness of advection and diffusion terms in the horizontal
direction.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
28
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Bibliography
Balay, Satish, Gropp, William D., Mclnnes, Lois Curfman, & Smith, Barry F. 1997. Efficient Man
agement of Parallelism in Object Oriented Numerical Software Libraries. Pages 163202 of:
Arge, E., Bruaset, A. M., & Langtangen, H. P. (eds), Modern Software Tools in Scientific Com
puting. Birkhuser Press.
Blondeaux, P., & Vittori, G. 2011. The formation of tidal sand waves: Fully threedimensional
versus shallow water approaches. Continentel Shelf Research, 31, 990996.
Chen, X. 2003. A free surface correction method for simulating shallow water flows. Journal o f
Computational Physics, 189, 567578.
Luyten, P. 2009. Coherens version 2, user manual (in prep.).
Luyten, P., Jones, E., Proctor, R., Tabor, A., Tett, P., & WildAllen, K. 1999. Coherens, a coupled
hydrodynamicalecological model for regional and shelf seas. MAS3CT970088, pp914.
THV IMDC  Soresma. 2009. Uitbouw numeriek modelinstrument voor de Noordzeehavens Deelrapport 1  Aanvangsstrategie, opgesteld voor afdeling Maritieme Toegang, Departement
Mobiliteit en Openbare Werken, Vlaamse Overheid, l/R A/11339/09.059/GVH, september 2009.
Van Oyen, T., Breugem, A., & Heredia, M. 2011. Design o f the implicit scheme in COHERENS.
Tech. rept. THV IMDCSoresma. 91 pp.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
30
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix A
Report internal discussion at BMM on 11/05/2011
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
34
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix B
Report first followup meeting UgentIMDCSORESMA on
17/05/2011
7. The 3D ADI schem e can be parallelized (w hereas th e version w ith m odesp littin g cannot). However, in th e "a a n v a n g s s tra te g ie " is has been decided
not to im p le m e n t th is p a rallellisa tio n during th is project. If e xp ertise on th is
to p ic becom es available, it w ill be added as a c o m m e n t in th e final re p o rt .
8. A le xa n d e r re ports on th e co n te n ts and th e progress m ade w ith regard to
section 2 o f th e co n cep t re p o rt on task 5. A n u m b e r o f s m a lle r suggestions
are m ade w ith regard to th e te x t (add references to th e Coherens Manual,
if feasible; s p lit up th e d e scriptions betw een scalars and tu rb u le n ce ).
9. Tom as states e x p lic itly th a t he appreciated th e re p o rt fo r its c la rity and
com pleteness.
10.The co n te n ts o f sections 3 and 4 is discussed in som e detail and th e tim in g
is repeated. It is decided not to w rite in section 4 th e " firs t user
e xperiences" as described in th e co n te n ts note o f th e report. Instead,
Tom as w ill add th is section a fte r he sta rts using th e code.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09 /08/2012
38
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix C
Presentation at the expert workshop
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
4 SP
N e w n u m e ric a l s c h e m e
a O
Introduction
W hat is our aim?
Numerical implementation
9 The grid
9 Numerical discretizations
9 The algorithm
Conclusions
4 4SP4 ~ 4 == E Gao
4
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
<*g
N e w n u m e ric a l s c h e m e
>
^ O
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
< *g
N e w n u m e ric a l s c h e m e
4 'f
>
FF
*T)
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
J
m
i
i
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
....
.
.
W h a t is o u r a i m ;
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
are we forgetting
something?
maybe the salt?
< *g
N e w n u m e ric a l s c h e m e
>
HE
0 0 . 0
dp
dpu
dt
dx
dpw
 77
dy
dz
(i)
dpu
dpu2
0 /01/V
dpuw
dp_
dRn
dt
dx
dy
dz
<9x
dx
R12
dy
<9Ri3
dpv
dpuv
dpv2
dpvw
dt
dx
dy
dz
dy
dpw
dpuw
+
R 23
dz
dpvw
dx
dy
t R 32
T . V a n O y e n , A . B re u g e m
&
(2)
.
2 p\l[c o s {(p )w s i n ( 0 ) v ] ,
dz
R 22
dt
dpv
 77
M . H. G om ez
dy
(3)
dx
2pls\n((/))u ,
dpw2
dz
R 33
dp + d R 2i
d p + <9R3i
= p g
dz
2 oQ eos( ) u .
N e w n u m e ric a l s c h e m e
dx
(4)
JF
~T)
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Boussinesq approximation
density is taken constant except for the term related to gravitational
acceleration
filte r out the acoustic modes
Traditional approximation
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
N e w n u m e ric a l s c h e m e
In tro d u c tio n
i, i
it
. .
j i r .
r i .
P h y s ic a l d e s c r i p t i o n o t t h e f l o w fie ld
J
N u m e ric a l im p le m e n ta tio n
i
C o n c lu s i o n s
. . .
P rim itiv e e q u a tio n s
J
...
A p p r o x i m a t i o n s a p p lie d
i i i
T u rb u le n c e
Hydrostatic approximation
Inertial accelerations can be neglected in the vertical momentum
balance such th at
dp
dz
^ _
PS
Implications 71
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
< *g
N e w n u m e ric a l s c h e m e
4 'f
4 =
HE
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
du
du
+ u h
dt
dx
du
dv
dx
dy
du
V
du
h wdz
dy
dw
dz
1 d P at m
po
dx
d R n ^ d R 12 ^ d Ri3
Po
dv
m
dv
+ u d
dv
+
v d
dv
+
dz
dy
dx
(5)
1 d P atm
w ~dz
po
R21
d R 22
Po
dx
dy
dy
<9^23
dz
d
 g ~ z 
dx
d
bdz
dx
+2Qsin((/>)v
d
d
g +
dy
dy
bdz (7)
2 Q sin((/>)v
dp
dz
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
P g
(6 )
( 8)
4 S 1
N e w n u m e ric a l s c h e m e
 0 0 , 0
d
dt
dU
dx
dV
dy
=0
(9)
I udz
J h
and
V=
vdz
J h
< 5P
T . V a n O y e n , A . B re u g e m
&
M . H. G om ez
(10)
N e w n u m e ric a l s c h e m e
< =
JF
T )
a constant
algebraic scheme
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
u s a
Adaptions of the grid to the physics
9
horizontal directions:
=> orthogonal curvilinear coordinates ( 1 ,^ 2 )
vertical direction:
s coordinates, which are spatially varying a coordinates
z + h
(J =

h+
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The
rid
, ..
N u m e ric a l d is c re tiz a tio n s
T h e a lg o rith m
Transformed equations
1 d /73
/3
'
1 d
(h 2h3u) +
/ 71 / 72/73
( h i h 3v)
d hi
h i d g i
ta ;
+ 7 9s
dh2
h t {h 3 ) + A ( u ) + A ( u ) +
_ g _9 C _ _______________
2Q vsin (j)
+ Fi +
T>v{u)
+ T>mf,i () + 2^01/
d i
dh2
d hi ,
vW i ~ uW 2 l + 2 f s m ^
g
1
<9P;
d _______________
/2 <9^2
PO^2 <9^2
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The
rid
, ..
N u m e ric a l d is c re tiz a tio n s
T h e a lg o rith m
Transformed equations
d t ' h \h 2
d ( h 2U)
d (h iV )^
= 0
di
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
Implications
9 Grid size changes in tim e
<% 3
/3
d t
/l/2 ^ 3
(h2h3u) +
%
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
(h ih v )
4 51 4 
N e w n u m e ric a l s c h e m e
dj
~h~ds
4 =
O a O
Implications
1

<9

( M
+ A W
+ A
d h i
dh2
 2fivsin*
S /g"
h i d i
F1
T>v ( u )
+ T >m h l
{') +
d i
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
4 S1 4 4 =
N e w n u m e ric a l s c h e m e
O a O
Implications
<9
d h i
dh2
(h3u) + A h(u) + M u ) + ] ^  A U9 f 2  VW i ] ~
Sm *
S /g"
h i d i
F1
T>v ( u )
+ T >m h l
{') +
d i
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
4 'f
4 J?
HE
~ 0 Qv O
Implications
Grid has a velocity
Extra (m etric) terms
1
< 9 _______________
hi di
pohi di
dhi
dh2
d^2
d i
00
I ziZvsin <fi
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
4 s 1 4 4 =
N e w n u m e ric a l s c h e m e
o a o
Implications
Grid has a velocity
Extra (m etric) terms
Extra nonlinearities
1
d _______________
h i d i
p o h i
dhi
dh2
d^2
d i
00
I ziZvsin <fi
d i
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
4 S1 4 
N e w n u m e ric a l s c h e m e
4 =
O a O
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
Model Grid
Vertical
Horizontal
UV(i,j+l)
VCij+1)
UfHlj)
U(1J)
UV(ij)
9
9
9
UV+lj+l)
V (ij)
UV(i+lj)
sea surface
w
c
w
c
w
c
w
c
w
c
w
c
w
nz+1
tiz
seabed
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
du
d i +
du
u d
du
^
V ert. A dv
Hor. Adv.
po
Free Surf.
(9 R n
< 9 R i2
PO
dx
dy
Hor. D iff.
1 dP.atm
Po
dx
A tm . Pres
d_
dx
Baroclin. Pres.
dR i3
V ert. D iff.
+ 2Q sin (0 )v ,
Coriolis
explicit
dx
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
bdz +
o ^ o
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
du
d i +
du
u d
du
^
V ert. A dv
Hor. Adv.
S
Free Surf.
A tm . Pres.
(9 R n
< 9 R i2
PO
dx
dy
Hor. D iff.
d
g
dx
( A t ) restr
Ax
d_
dx
B aroclin. Pres.
dR i3
V ert. D iff.
+ 2Q sin (0 )v ,
Coriolis
0 ( 1 . Os) im plicit
gH
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
bdz +
o ^ o
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
du
du
d i + ud
du
^ %
du
V ert. A dv
Hor. Adv.
d
Po
dx
<9R n
PO
dx
0 R i2
dy
Hor. D iff.
d_
dx
Ax
bdz : ( A t )
J
dx
Free Surf.
A tm . Pres.
d
dx
Baroclin. Pres.
d R i3
dz
V ert. D iff.
+ 2Q sin (0 )v ,
Coriolis
(1 0 0 s ) > explicit
Ap !
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
bdz +
0 ^ 0
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
Ki
. . .
. ^.
N u m e ric a l im p le m e n ta tio n
~
C o n c lu s i o n s
The
rid
..
. ,
N u m e ric a l d is c re tiz a tio n s
.
T h e a lg o rith m
du
du
d i + ud
du
^ %
du
+
V ert. Adv.
Hor. Adv.
d
po
dx
<9R n
PO
dx
d
dx
bdz +
Free Surf.
A tm . Pres.
0 R i2
dy
Hor. D iff.
Baroclin. Pres.
d R i3
dz
V ert. D iff.
+ 2Q sin (0 )v ,
Coriolis
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
du
d i +
du
u d
du
^
V ert. A dv
Hor. Adv.
S
Free Surf.
A tm . Pres.
(9 R n
< 9 R i2
PO
dx
dy
Hor. D iff.
du
W
dz
(A t)
Az
w\
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
d_
dx
bdz +
Baroclin. Pres.
dR i3
V ert. D iff.
+ 2Q sin (0 )v ,
Coriolis
0 ( 1 . Os) im plicit
o ^ o
N e w n u m e ric a l s c h e m e
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
Ki
. . .
. ^.
N u m e ric a l im p le m e n ta tio n
~
C o n c lu s i o n s
The
rid
..
. ,
N u m e ric a l d is c re tiz a tio n s
.
T h e a lg o rith m
du
d i +
du
u d
du
^
V ert. A dv
Hor. Adv.
S
Free Surf.
A tm . Pres.
(9 R n
< 9 R i2
PO
dx
dy
Hor. D iff.
* 3 _ (Af)
dz
d_
dx
bdz +
B aroclin. Pres.
dR i3
V e rt. D iff.
+ 2 Q s in (0 )v ,
Coriolis
\
(A ,)=
 ~ 0 ( 1 . Os) im plicit
v ver
jo Vo
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
Ki
. . .
. ^.
N u m e ric a l im p le m e n ta tio n
~
C o n c lu s i o n s
The
rid
..
. ,
N u m e ric a l d is c re tiz a tio n s
.
T h e a lg o rith m
du
du
du
+ u + v +
dx
dt
dy
V ert. A dv
Hor. Adv.
dx
dx
> ( A t ) ~
(A x )2
Vhor
bdz +
Baroclin. Pres.
dy
Hor. D iff.
9R n
dx
dR i3
PO
Free Surf.
A tm . Pres.
d_
V ert. D iff.
+ 2Q s in (0 )v ,
Coriolis
0Q.C
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
Ki
. . .
. ^.
N u m e ric a l im p le m e n ta tio n
~
C o n c lu s i o n s
The
rid
..
. ,
N u m e ric a l d is c re tiz a tio n s
.
T h e a lg o rith m
du
d i +
du
u d
du
^
V ert. A dv
Hor. Adv.
<9
S
Free Surf.
A tm . Pres.
(9 R n
< 9 R i2
PO
dx
dy
Hor. D iff.
du
Ax
u  > ( A t ) ~
~
dx
u
d_
dx
Baroclin. Pres.
dR i3
V ert. D iff.
O (3 0 s )
bdz +
+ 2Q sin(0)v ,
Coriolis
 im p lic it ?
o^o
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
Spatial discretizations
Spatial discretizations
central scheme
vertical advection
horizontal advection
=>
upwind  central  TV D
=>
upwind  LaxWendroff  T V D
=>
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
central
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
Spatial discretizations
Spatial discretizations
central scheme
vertical advection
=>
upwind  central  TV D
horizontal advection
=>
upwind  LaxWendroff  T V D
=>
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
central
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
Spatial discretizations
Spatial discretizations
central scheme
vertical advection
horizontal advection
9
=>
upwind  central  TV D
=>
upwind  LaxWendroff  T V D
=>
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
central
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
Spatial discretizations
Spatial discretizations
central scheme
vertical advection
horizontal advection
9
=>
upwind  central  TV D
=>
upwind  LaxWendroff  T V D
=>
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
central
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
W h a t is the approach?
du
dv
dx
d
dy
d il
d i
du
dt
dv
dt
+
+
d
dz
d
dz
^d x
du
uw V
v ~dz
wv V
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
dv
dz
dw
~
dz
dV
dy
+
,
+ g dx
+ g
dy
exp
V,e xp
N e w n u m e ric a l s c h e m e
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
Step 1: n ^
n + 1/2
im plicit in
momentum
explicit in
momentum
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
4 'f
4 =
HE
Qv O
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
^ n + I/2
__ ^
At d
_ _
vm r;
, 1/2
n d v n+1/ 2 ]
At
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
4 'f
4 =
he
O 'tO
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
Step 1: n > /? T 1/2
X  momentum:
n+1/ 2
u
n At d
+
, 1/2
v_2" 9
n <9vn+1/ 2 l
At
 +
<9n+1/ 2
At
=
n
e x p /
W ritin g un+1/2 =
n + i/2 +
A t
" + l / 2 + 0v A t
 ( W' ) n + 1 / 2 
/; ^ i
( w S ) n + l/ 2 _ " ^
un
2
expl
=
1
o a o
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
W h a t is the approach?
n + 1 /2
At
1 dx
At d
2 dy
dx
n + l/2
V
L k
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
^ n+ l / 2
4 51 4 
N e w n u m e ric a l s c h e m e
4 =
O a O
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
W h a t is the approach?
Step 2: n + 1 /2 > n + 1
,A 7+ 1
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
4 5P 4 4 =
N e w n u m e ric a l s c h e m e
O a O
Some remarks/questions
nonlinear terms:
d ( w u ) n+l
dz
iterate on
d w nun+1
<9(/73L/)n+1
 and dz
dt
d h ^u n+1
dt
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
^ O
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
W h a t is the approach?
du
dt
dz
uw
d
dx
dv
dt
dz
d
dx
du
dz
uu  2vh
wv

uv
du
dx
du
dy
dy
d
Tj
dx
U ,e xp 5
dv
dz
dv
'" a *
d_
dv
dy
dy
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
+ g ~ V,exp
dy
N e w n u m e ric a l s c h e m e
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
horizontal
adv./diff.
explicit
im plicit
horizontal
adv./diff.
im plicit
explicit
free surface
gradient
im plicit
explicit
free surface
gradient
explicit
im plicit
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
4 'f
4 =
HE
O Qv O
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
At
n+l/2
+
$/7
& I ( \n + 1/2
n d v n+1/ 2
(.u v)n+1/2  v n
h
 > +
dx
dx
I ( \n + 1/2
( w )
7
dy
At d
V
2 dz
o nd v n+1/ 2

( w v ) n+1' 2
v"v
d v nJr 1/2
At
dz
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
+
n
Ve x p l i
4 5P 4 4 =
N e w n u m e ric a l s c h e m e
O a O
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
Iterative method
RedBlack Jacobi
Successive Over Relaxation
GaussSeidel iteration
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
In t r o d u c t io n
P h y s ic a l d e s c rip tio n o f th e flo w fie ld
J
m
i i
N u m e ric a l im p le m e n ta tio n
^
C o n c lu s i o n s
The rid
.
.
N u m e ric a l d is c re tiz a tio n s
i
T h e a lg o rith m
W h a t is the approach?
Iterative method
RedBlack Jacobi
Successive Over Relaxation
GaussSeidel iteration
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
Another option:
du
dx
dv
+
dy
dU
d
dt
du
TT
dx
du
dt
dz
dv
dt
dz
v ldz
dv
VV
dz
dw
+
dz
= 0
dV
+
dy
_i_
+ edx
 a
exp
d
dy
exp
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
'0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T h e g rid
N u m e ric a l d is c r e tiz a tio n s
T h e a lg o r ith m
un+1
v n+1
A t
n<9i/n+1]
<9n+1
A t
g
A t
dx
A t
A t <9n+1
A t
2
u n+ i
n+1
dy
+ 41
4
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
u
~ expl i
n
Ve x p l
exp
exp
4 S 1
N e w n u m e ric a l s c h e m e
4 "Si >
4 .=?
JF
T ) < \ V
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
==
~T)
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicf
Convective terms > non
A D I/tw ostep scheme: Updati
A dv./diff. implicit: Large banded matrix
Other view: one step > conjugent gradient solution
/
<  < =
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
0 0 , 0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicit?
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
HE
0 0 . 0
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicit?
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
HE
0 0 . 0
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicit?
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
HE
0 0 . 0
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicit?
<  < =
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
N e w n u m e ric a l s c h e m e
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
Consideration of terms:
Free surface gradient > im plicit
Baroclinie > explicit
Horizontal adv./diff. explicit?
9
9
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
HE
0 0 . 0
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
N e w n u m e ric a l s c h e m e
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
N e w n u m e ric a l s c h e m e
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
N e w n u m e ric a l s c h e m e
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
N e w n u m e ric a l s c h e m e
0 0 ,0 '
In tro d u c tio n
P h y s ic a l d e s c r i p t i o n o f t h e f l o w fie ld
N u m e ric a l im p le m e n ta tio n
C o n c lu s i o n s
T . V a n O y e n , A . B re u g e m & M . H . G o m e z
< *g
N e w n u m e ric a l s c h e m e
>
 o Qv o
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/RA/11339/10.072/GVH
Version 2.0 09/08/2012
98
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix D
Report expert workshop
C o n ten ts
1
2
P r e s e n t COHERENS h y d r o d y n a m ic a l a lg o r it h m
P r e s e n ta tio n o f T o m a s V a n O y e n  G e n t U n iv e r s it y
2.1
I n t r o d u c t io n ...............................................................................................
2.2
2.3
....................
2.4
C o n c lu s io n s ...............................................................................................
C o n s e q u en ce s COHERENS h y d r o d y n a m ic a l a lg o r it h m
E x p e r t e v a lu a tio n
13
4.1
Im p lic it code
4.2
......................................................................
14
4.3
14
4.4
15
4.5
R e c o m m e n d a tio n s ....................................................................................
15
...........................................................................................
13
17
5.1
I n t r o d u c t io n ...............................................................................................
17
17
5.2.1
F lo w over tr e n c h e s /b u m p s .....................................................
17
C o n c lu s io n s ...............................................................................................
18
5.2
5.3
6
P r e s e n ta tio n o f J a n V ie r e n d e e ls  G e n t U n iv e r s it y
19
6.1
I n t r o d u c t io n ...............................................................................................
19
6.2
P h ysica l a p p r o x im a t io n s ......................................................................
19
6.3
19
6.4
19
6.5
20
6.6
A c c u r a c y ......................................................................................................
20
6.7
21
CO NTEN TS
6.8
7
21
P r e s e n ta tio n o f J e a n M a r i e B e c k e rs  L ie g e U n iv e r s it y
23
7.1
I n t r o d u c t io n ...............................................................................................
23
7.2
23
E x p e r ts p re s e n ta tio n s
25
D is c u s s io n Session
27
9.1
I n t r o d u c t io n ...............................................................................................
27
9.2
......................................................................
27
9.3
28
9.4
Im p lic it s c h e m e ........................................................................................
28
CO NTEN TS
C h a p te r 1
P resen t COHERENS
h y d ro d y n a m ic a ! a lg o rith m
Jose O zer gives a p re se n ta tio n w ith th e purpose to give an o verview o f the
n u m e ric a l schemes th a t are c u rre n tly present in COHERENS . COHERENS
is th e code, in w h ic h pre viou s research in th e M a st p ro je c t is in clu de d . As
th e nam e says (C o u pled H y d ro d y n a m ic a lE c o lo g ic a l M o d e l fo r R egional and
S helf Seas), COHERENS was developed especially fo r re g ion a l and shelf seas
(th us fo r d iffe re n t a p p lic a tio n s th a n are in te n d e d in th e present p ro je c t).
T h e ch ara cte ristics o f th e COHERENS code are given:
F o rtra n 90
H y d ro s ta tic equations (using Boussinesq a p p ro x im a tio n )
C u rv ilin e a r o rth o g o n a l g rid h o riz o n ta lly , scoordinates v e rtic a lly .
M o d e s p littin g (b a ro tro p ic equations are solved w ith sm a ll tim e step,
b a ro c lin ie equations w ith a large tim e step).
P a ra lle liz a tio n using M P I
N u m e ric a lly , COHERENS uses an s e m iim p lic it scheme v e rtic a lly and an
e x p lic it scheme h o riz o n ta lly . A p re d ic to r c o rre cto r m e th o d is used, in w h ich
th e fu n c tio n o f th e co rre cto r step is to ensure th a t th e mass fluxes in th e 2D
and 3D c a lc u la tio n are equal. T h e C o rio lis force has an im p lic it co rre ctio n
te rm (second o rd e r), w h ic h is necessary fo r s ta b ility .
scheme. In case m ode s p littin g is rem oved, these filte re d ve locities disappear,
C h a p te r 2
P re s e n ta tio n o f Tom as V a n
O yen  G e n t U n iv e rs ity
2.1
In tro d u ctio n
In tro d u c tio n
P h ysica l d e s c rip tio n o f th e flo w fie ld
N u m e ric a l im p le m e n ta tio n (n u m e rica l a lg o rith m )
C onclusions
2.2
2.3
2.4
C on clu sion s
C O N C LU S IO N S
8 C H A P T E R 2. P R E S E N T A T IO N O F T O M A S V A N O Y E N  G E N T U N IV E R S IT Y
C hapter 3
Consequences COHERENS
h y d ro d y n a m ic a l a lg o rith m
A p re s e n ta tio n is given by M a rce lo and A le x a n d e r on th e consequences o f
th e im p lic it scheme fo r th e o th e r subtasks.
M a rce lo his p re se n ta tio n concerns three m a in p arts:
c e n tra l in p u t file fu n c tio n a lity
in u n d a tio n schemes
s tru ctu re s m o d ule
 Structures
D iffe re n t b o u n d a ry c o n d itio n s are developed to m o d el th e influence o f s tru c
tures.
 Comments made
P ro f. Beckers asks i f th e in u n d a tio n scheme is now d iffe re n t fro m the
flo o d in g scheme.
I t is questioned b y D r.
B o u rb o n i f a t th e b e g in n in g a ll p o in ts th a t
It
T h e p re se n ta tio n o f A le x a n d e r discusses m a in ly
an o verview o f th e o th e r subtasks
suspended sedim ent tra n s p o rt m o d ule
bed load
bed m o rp h o lo g y m o d ule
b o tto m roughness
flu id m u d
describe im p lic a tio n s o f im p lic it code on subtasks
v e rific a tio n process
11
 Bed roughness
I t is re m a rke d th a t th e bed roughness is fu n c tio n o f th e flo w c o n d itio n s such
th a t w ith an im p lic it code th is induces e x tra n o n lin e a ritie s.
 Comments made
Is i t a tw o w a y c o u p lin g between th e flu id and th e sedim ent? Yes, in
th e sense th a t th e sedim ent can influence th e flu id tro u g h th e eddy v is
cosity; i.e. th e m ore sedim ent, th e m ore th e flu id is dam ped. However,
th is is n o t coupled in tim e b u t staired.
T h ere are d iffe re n t tim e steps in th e m odel; i.e. m o rp h olo g y, 3D, scalara dvection. I t is discussed th a t th e sca la ra dve ctio n does n o t have to be
w ith th e same step as th e h yd ro d yn a m ics. F u rth e rm o re , i t is rem arked
th a t m o rp h o lo g y tim e s te p p in g depends on th e phenom ena, however
i t should be ta ke n in m in d n o t to u p d a te to o sm a ll values o r to tra c k
differences between new and o ld in stea d o f su m m in g ju s t o ld w ith e xtra ,
as th is e x tra co uld be to o sm all.
12 C H A P T E R 3. CO N S EQ U E N C E S COHERENS H Y D R O D Y N A M IC A L A L G O R IT H M
C h a p te r 4
E x p e rt e v a lu a tio n
S. B o u rb a n (H R W a llin g fo rd ) presents a c ritic a l re vie w o f th e re p o rt. In th is
re vie w he goes in p a rtic u la r d e ta il w ith respect to th e fo llo w in g subjects: the
use o f th e h y d ro s ta tic a ssum ptio n , th e use o f im p lic it code (using ite ra tiv e
m a tr ix solvers), and p a ra lle liz a tio n o f th e code.
4.1
Im p licit cod e
A D I is n o t strong.
T h e a rg u m e n ta tio n conjugate
T h e y solved th a t by
13
14
open b ou ndaries are present, b u t can be an issue w ith a closed dom ain.
He also suggests th a t h o riz o n ta lly , u n s tru c tu re d meshes are preferable to
re g u la r grids, b u t th a t the re is no necessity to im p le m e n t these.
4.2
4.3
15
4.4
He presents his experience w ith p a ra lle liz a tio n (in Telem ac). In th is m odel,
i t is done w ith o u t a m a ster node (w h ich m ig h t be w a itin g fo r th e o th e r
processes to fin is h ) using M P I. T h e y experienced speedup o f th e c a lc u la tio n
u p to a ve ry large n u m b e r o f processors (4000). O n ly a fte r th is n u m b e r was
reached, th e c a lc u la tio n slowed dow n. T h e g ain in speed was super lin e a r.
T h e reasons fo r th is are:
T h e m a trix size decreases w ith an increasing n u m b e r o f dom ains and
th e increase in speed because o f sm a lle r m a trix is solved is la rg e r th a n
th e decrease because ite ra tio n s are necessary.
Less cache e rro r o ccur fo r a sm a lle r a m o u n t o f d a ta (w ith an increas
in g n u m b e r o f d o m a in s ), w h ic h gives a stro n g increase in c o m p u ta tio n
speed.
P a ra lle liz a tio n w ill n o t be a p ro b le m in th e c u rre n t concept, as lo n g as
halos are used. Ite ra tiv e m a trix solvers are an advantage w ith p a ra lle liz a tio n ,
because th e ite ra tio n is necessary in o rd e r to couple th e d iffe re n t dom ains.
4.5
R eco m m en d a tio n s
H is re co m m endations are:
A im a t developing a n o n h y d ro s ta tic code eventually.
Use ite ra tiv e m a tr ix solvers.
M ake th e code p a ra lle l to increase c o m p u ta tio n speeds.
C H A P T E R 4. E X P E R T E V A L U A T IO N
C hapter 5
P re s e n ta tio n o f Sebastien
B o u rb a n  H R W a llin g fo rd
5.1
In tro d u ctio n
5.2
5 .2 .1
F lo w over tre n c h e s /b u m p s
I t is possible to conclude th a t n o n
17
5.3
C on clu sion s
C hapter 6
P re s e n ta tio n o f Jan V ie re n d e e ls
 G e n t U n iv e rs ity
6.1
In tro d u ctio n
6.2
6.3
6.4
19
6.5
6.6
A ccu racy
to be
avoided
C ra ckN ico lso n 2nd o rd e r ce n tra l sp a tia l d is c re tiz a tio n : accurate i f C F L
is a ro u n d 1, o r fo r h ig h e r C F L n u m b e r i f la m b d a is la rg e r enough
(la m b d a = n u m b e r o f g rid cells p e r wave le n g th )
6.7
21
6.8
P a ra lllisa tio n
C hapter 7
P re s e n ta tio n o f Jean M a r ie
Beckers  Liege U n iv e rs ity
7.1
In tro d u ctio n
7.2
23
C hapter 8
E x p e rts presentations
E x tra in fo rm a tio n on some specific to p ics is presented in a sh ort p re se n ta tio n
b y th e experts.
D r. S. B o u rb a n
Describes problem s th a t were e nco u ntu re d in th e developm ent o f d ry in g /w e ttin g
schemes in T E L E M A C . A lso differences th a t o ccur w h ile changing between
conservative and nonconservative fo rm are discussed. I t is recom m ended to
use th e conservative form .
P ro f. V ierendeels
N o n h y d ro s ta tic extension
P ro f. Vierendeels discusses th a t using th e pressure m e th o d to handle
th e d y n a m ic pressure leads to a poisson e q u a tio n w h ich is u s u a lly con
sidered as a b o ttle n e ck. E xperience, however, has show n th a t th is can
be solved b y means o f m u ltig rid m ethods. A tte n tio n sh ould be p u t on
th e d iffe re n t g rid sizes in th e v e rtic a l and h o riz o n ta l, nevertheless.
P a ra lle lliz a tio n
C om m ents are m ade on th e p a ra lle lliz a tio n o f th e T h o m a s A lg o rith m
a nd th e differences i f th e co m p u te r uses a shared o r a d is trib u te d m em
ory.
P ro f. Beckers
P ro f. Beckers discusses a recent developm ent th a t was im p le m e n te d in the
G E T M m o d e l to a d a p t th e g rid in fu n c tio n o f th e so lu tio n .
25
C h a p te r 9
Discussion Session
9.1
In tro d u ctio n
9.2
27
28
9.3
we decide i f I tu r n in to
an im p lic it scheme
A D I im p le m e n te d as an ite ra tiv e solver
9.4
Im p licit sch em e
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix E
Report meeting Prof. Stelling
Report meeting with Prof. dr. ir. G. Stelling on the 2th of September 2010:
Attendees: Tomas Van Oyen, Marcelo Heredia Gomez and Alexander Breugem. Dr. ir. Marcel Zijlema
attended almost half of the meeting.
A meeting has been organized with Prof. Stelling in Delft, The Netherlands on the 2th of September
2010. The objective was to discuss the concept note on the design of the implicit scheme in
COHERENS. The following points summarize the main discussion points:

The method to describe the free surface gradient implicitly is discussed. It is commented that the
method we decided to follow, after the workshop, is a good method. Although also the ADImethod, proposed initially, would be a plausible path; it is considered to be less appropriate due to
the inherent limitation to a CFL number of 10 which occurs due to the splitting of the implicitness
of the free surface into two independent steps. Even worse, for calculations with CFL above 10, this
approach can provide results, however incorrect results.
The proposed implicitness of the vertical advection and diffusion terms is a necessity; as proposed
in the concept note. Horizontal advection and diffusion terms, on the other hand, need not to be
considered fully implicit for all cells. Nevertheless, to remove instabilities which can occur in the
domain, Prof. Stelling advises to consider the method he presents in the article of Kramer and
Stelling (2008) which is based on the method of Carlson. This approach considers to integrate
locally implicit in time, allowing an explicit calculation in most of the domain, while maintaining
unconditional stability (by implicit calculations) only where necessary.
A slight preference is expressed by Prof. Stelling to the Conjugent Gradient method as iteratieve
solution procedure as this guarantees conversion and is most of the time the fastest iteratieve solver.
However, Dr. Zijlema remarked that this does not close the door to other methods (like GMRES,
BiCG) as these also (almost) always lead to the solution and have as advantage that the matrix does
not have to be symmtric.
Furthermore, it is discussed that using an Incomplete LU factorization (ILU 2) as precontioner is an
efficient approach, as was foreseen in the method considered after the workshop.
Prof. Stelling remarks that using the ADI method, it does not matter when the vertical velocity is
updated, as this, considering the hydrostatic assumption, in any case will not provide correct results.
Nevertheless, he would suggest to update everything as much as possible. Furthermore, it is
remarked that results considering nonhydrostatic pressure are only reasonble when the horizontal
grid spacing is of similar dimensions with the vertical grid spacing.
Prof. Stelling thinks that multigrid methods will not lead to considerable advantages for the shallow
water equations, altough subgrid methods could. Reference is made to Casulli and Stelling (2010).
It is remarked that, considering the equations in weak form, attention should be made to discretize
the equations conservative; i.e. preference is given to a strict finite volume approach.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix F
Final conceptreport
r>
departement
/a
COHERENS l
M o b ilite it en
Openbare Werken
Colophon
Cover picture: sediment plumes at the Port of Zeebrugge (Bing Maps)
i:+ 32 3 235 67 11
Email: info@imdc.be
Website: www.imdc.be
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Document Identificatie
Titel
Project
Opdrachtgever
Documentnaam
Documentref
Revisies/ Goedkeuring
Versie
1.0
Datum
September 14,2011
Omschrijving
Draft
Auteur
TVO/ABR/MHE
Nazicht
GVH
Goedgekeurd
Verdeellijst
0
X
Analoog
Digitaal
Abstract
In this document, we describe the process leading to a framework within an implicit numerical
scheme can be implemented in COHERENS . In a first part, an overview is provided of the phys
ical and numerical description of the dynamical equations describing the flow field in the ocean,
coastal zone and estuary. Using this overview, we list several possibilities to implement an im
plicit numerical scheme in COHERENS . Next, we describe the numerical and physical approach
presently used in COHERENS . Based on both the overview and the present formulation, we sug
gest a framework to develop an implicit code to model coastal and estuarine flow. Implications for
current users are listed.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Contents
Table of contents
Introduction
1.1
1.2
1.3
1.4
1
1
2
3
2.3
2.4
2.5
2.6
2.7
2.8
3.5
3.6
3.7
5
5
5
6
7
7
8
10
11
11
12
12
13
13
14
14
14
15
15
15
16
16
16
16
17
17
19
19
20
22
24
24
24
25
26
28
28
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
3.7.1
28
29
30
30
31
31
32
3.8
35
4.1
4.2
35
36
36
37
37
38
4.3
39
5.1
5.2
39
39
39
5.2.2 Subroutine
5.2.3 Structure of
5.2.4 Structure of
5.2.5 Structure of
Subroutines of the
5.3.1
Subroutine
5.3.2 Subroutine
5.3.3 Subroutine
5.3.4 Subroutine
hydrodynam ic_equations................................................................
the 2D hydrodyna m ics.....................................................................
the Predictor step ...........................................................................
the Corrector s t e p ...........................................................................
numerical scheme ..........................................................................
for 2D hydrodynam ics......................................................................
for the Predictor s t e p ......................................................................
for Corrector s t e p .............................................................................
for Scalar advection diffusion .......................................................
41
42
43
44
46
46
49
52
52
54
55
55
56
58
59
60
60
5.5.2 H a l o s .....................................................................................................................
5.5.3 C o m m u n ic a tio n s ..................................................................................................
5.5.4 Parallel processing implemented in numerical s c h e m e s ..............................
Conclusions and recom m endations................................................................................
61
62
64
64
5.3
5.4
5.5
5.6
Numerical framework
67
6.1
67
67
68
71
76
76
77
77
6.2
6.3
6.4
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
79
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
7.11
79
79
80
80
80
80
81
81
81
82
83
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
85
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
List of Figures
3.1
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
5.10
5.11
5.12
5.13
20
Structure of
subroutines in C O H E R E N S ...........................................................
40
Structure of
coherens_main ro u tin e ....................................................................
40
Structure of
coherens_main routine with definitions of arrays and the specification
of the dynamic mask f u n c tio n ..........................................................................................
41
Structure of
hydrodynamic_equations s u b r o u tin e ............................................
42
Structure of
current_2d subroutine ....................................................................
43
Structure of
current_pred s u b ro u tin e .................................................................
44
Structure of
current.corr su b ro u tin e ....................................................................
45
Structure of the
implementation of open boundary
conditions in
2D m o d e
Structure of the
subroutine update _2dobc_data.....................................................
57
Structure of the
implementation of open boundary
conditions in
3D m o d e
Structure of the
subroutine update_profobc_data .....................................................
59
C grid indices........................................................................................................................
61
Structure of coherens_main routine where calls to communications for parallel pro
cessing take p l a c e ............................................................................................................
64
56
58
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
viii
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
List of Tables
4.1
6.1
Advantages and disadvantages of the ADI scheme and the Conjugent Gradient
m ethod...................................................................................................................................
38
70
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Chapter 1
Introduction
1.1
1.2
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Port of Zeebrugge, the tidal dock Deurganckdok in the Port of Antwerp, the influence of geometri
cally complex infrastructures on water movement (such as the Current Deflection Wall, CDW), the
morphological impact of large scale use of dredged material and the influence of marshes and
dredge/dump activities on water quality of North Sea and River Scheldt. Based on this presump
tion, priorities have been given to the various required functionalities that have been identified in
the Inception Strategy (THV IMDC  Soresma, 2009).
From the Inception Strategy the following functionalities have been identified that support the main
goals for the development of the morphological module:
Implementation of an online suspension transport module (sand and silt)
a. Graded sediments
b. Hindered settling
c. Flocculation
d. Sediment turbulence interaction: Adjustment of turbulence damping for high concen
trations of suspended sediments
e. Effect of nonbreaking waves on the bed shear stress
Transport formulae for sand
Implementation of the morphological module
a. Morphological acceleration
b. Nonerodable layers
c. Scenarios (of e.g. wind and waves)
d. Dredging and dumping routines
The following functionalities were identified as of lower priority, but would have a surplus value:
(Dynamic) bed roughness predictors for hydrodynamics and / or sediment transport
Fluid Mud model KULeuven
Sandsilt mixtures and bed (consolidation) model
Effect breaking waves, wavedriven longshore transport
Besides these points, within the study, the development of an implicit numerical scheme for the
hydrodynamica! equations is put forward as an important achievement in order to realize large
gain in computational calculation time.
The goals of this specific task are:
1. Design of an implicit scheme in COHERENS
2. Implementation of the implicit scheme
3. Validation of the code
1.3
Based on the Inception Strategy a selection of seven tasks has been assigned to the THV IMDC
 Soresma to commence the study with. These are:
Task order 1 : Course COHERENS V2
Task order 2: Update and expansion of the manuals of COHERENS V2
Task order 3: Implementation of a verification procedure
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Task order 4: Conversion of the code from an explicit to an implicit numerical scheme
Task order 5: Development of an online sediment transport module
Task order 6: Development of a central input strategy, and
Task order 7: Development of inundation schemes.
During the course of this study for each of the various task orders (deelopdrachten) reports will
be submitted that together will cover all the activities. The following reports have been completed
and submitted to the client:
Report 1  Inception report (THV IMDC  Soresma, 2009). The report is the result of an
inventory of the desired developments of the COHERENS V2 software and presents the
various tasks that have been selected for implementation.
Report 41 : Design of the implicit scheme in COHERENS : this report
Report 51 : Literature review of suspended sediment transport, bottom transport and mor
phology.
1.4
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S o resm a
i.s.m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
Chapter 2
Introduction to the numerical modeling of Ocean/Coastal flow
2.1
Introduction
Physical and numerical modeling of the fluidmotion in the ocean and the coastal zone is an
appealing and demanding challenge. One of the main issues of this art follows from the large
extend of active length and time scales affecting the dynamics; ranging from global scales (e.g.
the thermohaline circulation, the Gulf Stream) to features with scales of tens of kilometers up
to kilometers, tens of meters and even meters; especially in the vertical (e.g. Agulhas rings,
tidal waves, internal wave breaking, wind and wave driven currents, convection). Furthermore,
important scale interactions occur over the entire spectrum giving rise to a complex nonlinear
system.
The aim of this Chapter is twofold. In the first part, we aim to provide the reader an overview of
the governing equations describing the addressed physical problem; formulating the main classes
of physical approximations applied to these basic (primitive) system of equations. A second part
concerns a description of the available numerical approaches to solve the equations, for non
commercial and commercial codes.
We will embark by discussing the main issues in ocean modeling after which the nearshore
hydrodynamic problem is addressed.
2.2
Ocean modeling
We start by considering the Reynolds averaged equations of motion and continuity, referred to a
Cartesian axis at rest relative to the rotating earth. The fluid is taken turbulent and viscous effects
are neglected, see e.g. Pedlosky (1979); Kowalik & Murty (1993).
^
dpu
dt
dpu
dpv?
dt
dx
dx
dpuv
^
dy
dpv
dw =
dy
dz
'
d p u iu
dp
UR ,1 1
dz
dx
dx
UR .1 2
^
dy
UR ,1 3
^
dz
'
(2.2)
dpuv
dt
dx
dpv2
^
dy
dpmv
dp
dz
dy
R .2 1
dx
R 2 2
^
dy
9R.23
^
dz
(2.3)
2pVLsm(4>)u ,
d p iu
dpmv
dpmv
d p i? 2
dp)
R 3 1
R 3 2
R 3 3
w + ^ r + ap + a r =  f"JY, + ^ ir +^ p + a r
l2A}
+ 2 p i l eos(4>)u.
Plere, the x axis is along the parallels, pointing east, while the y axis points North
meridian lines. The axis is vertical, pointing upward. We assume = 0 describes
water level. Furthermore, Q is the angular velocity of the Earths rotation and <f> is the
the origin of the coordinate system. The parameter p denotes the pressure, p is the
along the
the mean
latitude of
sea water
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
density and (u, v , w ) represent the velocity components along the x , y and axes, respectively.
The tensor R y (with i,j = 1,2,3) denotes the Reynolds stress tensor and represents correlations
between velocity fluctuations; i.e. denotes the turbulent mixing of momentum.
In addition, we consider conservation of salt (S is salinity), conservation of heat (0 is potential
temperature) and an equation of state
dpO
dpi!,S
dt
dx
dpuO
+
~dt
dpS
dpvS
^
dpvO
dx
dy
V J g ,
(2.6)
= p (0 ,S ,p ),
(2.7)
dy
P
(2.5)
dprwO
1
dy
d p iv S
dy
cp
where T e are nonadvective heat fluxes and cp represents the specific heat capacity at constant
pressure. Hence, our system describes the dynamics of seven dependent variables with seven
equations.
Note, that the system (2.1)  (2.7) does not exhibit a prognostic equation for pressure, though two
equations for density (one diagnostic and one prognostic). Reshuffling of the continuity equation
and the equation of state (see e.g. Marshall & Adcroft (2004)), we can write
D tp
= p V V + p a D t 9  p D t S
(2.8)
cs
where cs = cs (0, S , p ) is the speed of sound, a = a ( 0 , S , p ) is the thermal expansion coefficient and
= (0 , S , p ) is the haline expansion coefficient; D t is the total derivative with respect to time t.
Relation (2.8) illustrates the presence of acoustic modes in the system. As these features are not
of main interest, and (due to the fast phase speed) impose a severe restriction from computational
view; all ocean modeling efforts filter these features out of the system. Two approaches can
be considered to remove the acoustic modes from the system. A first method is to make the
hydrostatic approximation. In section 2.2.3, we address this approximation. A second approach is
to remove the density dependence on pressure. This can be done by considering the wellknown
Boussinesq approximation.
2.2.1
Boussinesq approximation
The idea of the Boussinesq approximation is to consider the fluid in rest defined by a mean density
Po and pressure po Then, motion will arise due to variations in the density p' and pressure p ' such
that
p = p 0( z ) + p \
P =
( u , V, l u )
Po + p ' ,
Substituting this expansion into the momentum equations and considering p' < p0, we find that
the only term which does not drop after linearization relates to the gravitational acceleration g p '.
Moreover, for consistency, also to the equation of state we apply this reasoning such that
(2.9)
p = p { 0 , S ,p o{z)).
dv
dx
dy ^
d iu
(2 .10)
dz
du
dv,
dt
dx
dy
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
du
1 dp
9R l
9R ;12
9R ;13
dz
po d x
Po
dx
dy
dz
M =
(2 .11)
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
2L2[cos(</>)w sin(<yi>)j] ,
dv
dt
dv
dx
dv
1 dp
io  =
dz
Po dy
dv
dy
9R'21
dx
po
9R'2 2
dy
9R.23
dz
(2 .12)
21sm(<f))u ,
diu
~dt
1
I  
Po
dia
dia
div
dx
dy
'l h =
>R3 2
> r 33
dy
dz
9R.31
dx
dS
dS
TTT +
dt
d0
t
dt
de
u
I
dx
dx
de
v
dy
(2.13)
po dz
21eos (<f>)u
dS
+
1 dp
P9_
Po
dS
dy
de
w =
dz
0,
(2.14)
Tg,
(2.15)
dz
poCp
Other than filtering out the acoustic modes as natural modes in the system, these set of equations
do not impose limitations on the physical description of the phenomena.
2.2.2
Traditional approximation
Next to the Boussinesq approximation, introduced above, a classical approximation is called the
Hydrostatic approximation
The hydrostatic approximation assumes that the inertial accelerations in the vertical momentum
equation can be neglected, leading to a direct relation between pressure and gravitational accel
eration. Hence, it is assumed that f = pg.
Applying the traditional and the hydrostatic approximation, in addition to the Boussinesq approxi
mation leads to a main stream set of equations, called HPEs, which consist of
du
dt
du
dx
du
dy
du
dv
dx
dy ^ dz
du
~d~z
diu
(2.16)
1 dp
Po dx
po
9R l
dx
9 R 12
dy
9 R 13
dz
9R'21
dx
<9R.2 2
dy
UR.23
(2.17)
+22 sm(<f))v ,
dv
dt
dv
dx
dv
dy
dv
W ~d~z
1 dp
Po dy
po
dz
(2.18)
21sm(<f))u ,
dp
(2.19)
T  = p g ,
dz
dS
TTT +
dt
de
"777 +
dt
dS
U 
dx
de
de
U + V 
dx
dy
dS
H  +
dy
de
h lt77  =
p = p (s,e ).
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
dz
dS
W
dz
= 0,
i ^
pocp
^
Tg
(2 .20)
(2 .21)
(2 .22)
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
Employing the hydrostatic approximation introduces a substantial set of limitations. Mainly the
flow field can be assumed hydrostatic if the hydrostatic parameter
(2.23)
^T) ^ 1 7
Ihi
where
denotes the aspect ratio of the flow ( ' , = h /L , with h and L the characteristic vertical
and horizontal length scale, respectively) and
is the Richardson number
= N 2h2/ U 2, with
U a characteristic velocity scale and N the BruntVaisala frequency, providing a measure of the
stratification). Although, using the hydrostatic approximation a broad range of phenomena can be
described, the requirement (2.23) is not always satisfied. In particular, in regions where the fluid
is not strongly stratified on small horizontal scales; i.e. with this approximation it is not possible
to capture convection in neutral conditions. Also, where depth variations are significantly, the
hydrostatic approximation does not provide an accurate description of the flow field. Therefore, in
the context of bedform dynamics, this approximation could become even problematic. Finally, we
note that the neglect of time derivatives in the vertical momentum equation, causes the problem
to be illposed at open boundaries, we refer to Norbury & Cullen (1985) for a discussion of this
problem.
Considering the limitations intrinsically contained in the governing equations while exploiting the
hydrostatic approximation and the traditional approximation, several models relax one of the two
introduced approximations. In summary, models that aim to describe the flow field in the coastal
zone and in estuaries usually relax the hydrostatic approximation while neglecting the horizontal
Coriolis terms leading to
p = p{0,S,p0{z)),
(2.24)
du
dx
du
H i
du
dx
du
dy
dv
dy
diu
dz
diu
dz
(2.25)
9R l
dx
9 R 12
dy
9 R 13
dz
U R 21
UR
UR.23
po
dx
1 dp
po dx
po
(2.26)
+2L2 sm(<f))v ,
dv
dv
dv
dt
dx
dy
dv
1 dp
W ~d~z
Po dy
22
dy
dz
(2.27)
21sm(<f))u ,
diu
H i
dw
dx
dw
dw
=? l
tw
dy
dz
Po
U R 31
Po
dx
dS
dt
>r 32
dy
dS
dx
~K7 + u
d0
de
de
H i
dx
dy
1 dp
po dz
(2.28)
9 R 33
dz
dS
dy
+ V
dS
w
dz
dS
dz
+ w
1 ^
p0Cp
0,
r
V T e.
(2.29)
(2.30)
Models developed to describe global oceanic and atmospheric fluid motion, on the other hand,
include the horizontal Coriolis terms while making use of the hydrostatic approximation, e.g. White
& Bromley (1995).
2.3
Moving from the open ocean towards the continental shelf and nearshore region, the action of
free surface oscillations (wind waves or gravity waves) on the fluid motion intensifies.
In order to model the hydrodynamica! circulation in the nearshore zone, keeping track of the
computational costs, one main approach has been developed by I. A. Svendsen and coworkers
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S o resm a
i.s.m. KU Leuven, UG ent, BMM en W LB
(2.31 )
where u a denote turbulent fluctuations, u wa is the wave orbital velocity, V da represents the depth
varying velocity and Vma the depth mean velocity. The latter is defined by considering the total
volume flux Q a and the wave volume flux Q w a:
= [
Qa
(2.32)
u a dz,
tin
Qwa
I
j c t
v ma =
^wadz,
(2.33)
(2.34)
where C is the crest amplitude, t is the wave trough amplitude, h 0 is the still water depth, h = h 0+
and the overbar denotes averaging over a wave period.
Conservation of momentum and mass, integrated over the depth, are now described by
X + da = o
at
d
dx.
dQ a
dt
dx
( Q a Q \
+
de
dxa
d x .k t
(2 35)
o x a_
u.
1 d
P dx
Sa 
I
71, l..
lh o
(2.36)
P
where S a , T a , r f and r f represent radiation stresses, turbulent stresses, bottom and surface
shear stress, respectively. Also in (2.35)  (2.36), we make use of the Einstein summation con
vention.
To drive the circulation model, the shortwave propagation model should be specified. Wave
propagation models as REF/DIF or SWAN can be used to this end. We refer to Kirby & Dalrymple
(1994) and Booij et al. (1999) for more details, respectively.
A different approach to describe the nearshore hydrodynamics consists of waveresolving mo
dels. Three groups can be identified which aim to model surface gravity wave hydrodynamics: the
Nonlinear Shallow Water Equations models, see Brocchini & Dodd (2008) for a recent overview,
Boussinesq models, e.g. Chen et al. (2003c) and a notable recent development proposed by Antuono e ta l. (2008) in which a hyperbolic dispersive model is proposed that is able to automatically
detect the breaker positions, without using any heuristic dissipative terms.
Finally, we discuss a recent development described by Warner et at. (2008) and Haas & Warner
(2009). Their approach consists of modifying the system of equations which has been derived to
describe ocean hydrodynamics, accounting for the effects of waves on the currents. In particular,
horizontal and vertical radiation stresses are included, coupling the governing set of equations
with a wave propagation model, see Warner et a!. (2008) for more details.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
2.4
Numerical modeling
Several methods have been developed to numerically solve the above introduced set of equa
tions. Three distinct approaches are by means of Finite Element Methods (FEM), Finite Differ
ence Method (FDM) and Finite Volume Method (FVM). Each of these approaches has particular
advantages with respect to the other methods, but also disadvantages:
Theres no such thing as a free lunch".
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
10
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
2.4.1
Mode splitting
A wellknown approach of solving numerically the governing set of equations consists of the splitexplicit  mode splitting approach. This method is mainly used while exploiting the hydrostatic
approximation. However, as described by Kanarska & Maderich (2003), the mode splitting tech
nique has also been used in the context of describing the nonhydrostatic flow field.
The mode splitting approach is motivated by the observation that the governing set of equations
allows for different internal modes which are characterized by distinct timescales. In particular,
surface gravity waves (external waves) propagate much faster than other phenomena like inter
nal waves or jets. As solving the full system of equations immediately, explicitly, would limit (for
stability) the time step too severely, the mode splitting technique suggests to split the governing
equations into subsystems that model the fast (barotropic) and slow (baroclinie) motions sepa
rately. Since the fast motions are approximately independent of the barotropic system is (quasi)
twodimensional and can be solved by considering the depthaveraged horizontal momentum
equations together with the free surface equation which follows from integrating the divergencefree continuity equation over the vertical, leading to
du
Uytl/
dt(y
dv
d
m + % d
dv
(2.37)
K_s
dx
dy
Gy'
(2.38)
(2.39)
Here, (&,G) is the depth average of all the term s in the full momentum equations. Since, these
equations are less complex, the explicit timestepping involved, even with a short timestep ( A s
due to the fast propagation of the free surface waves) still provides a reasonable competitive
scheme. Then, the free surface which is found after M time steps (n+1) should somehow be
coupled to the baroclinie equations which advance with a larger timestep (A ; = M A S). At this
point, care should be taken on the procedure.
First of all, simply using n+1 in the baroclinie equations essentially subsamples the high frequency
barotropic motions. Consequently, this would alias high frequency energy onto lower frequencies.
One solution is to average the free surface over the baroclinie timestep, for instance by moving
the barotropic equations forward over 2A and average over this period. This filters out the high
frequencies.
Moreover, integrating now the full equations using the long time step and the time averaged value
of , we would now find two different estimates of the depthaveraged velocities; i.e. one obtained
from the full equations with the long time step and one from the barotropic equations! The particu
lar details on the exact splitting depend from model to model, some of which have been intensively
studied, see e.g. Kamenkovich & Nechaev (2009). An approach to filter out the error associated
with this mode splitting is presented in Haidvogel e ta l. (2008), and applied to the ROMmodel.
As mentioned above, this method has been consistently applied to the hydrostatic set of governing
equations. One notable exception is described in Kanarska & Maderich (2003). These authors
suggest to split the pressure in a hydrostatic and a nonhydrostatic part, writing p = p hy + p nhy,
solving first the hydrostatic threedimensional flow and correcting afterwards the velocity com po
nents with the gradient of the nonhydrostatic pressure. Kanarska & Maderich (2003) obtain the
correction to the hydrostatic flow field by using the continuity equation to derive a poisson equa
tion for the nonhydrostatic pressure component p nhy. The latter approach is called the pressure
method and will be addressed in more detail below, see section 2.5.
2.5
As mentioned earlier, there is no prognostic equation for the pressure. Now, if the aim is to
derive a nonhydrostatic numerical code, with a divergencefree local velocity field, a prognostic
equation for the pressure can be derived which ensures the divergencefree character of the flow
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
11
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
field. Below, we provide a simple sketch of the method to illustrate the idea. Let us consider, the
threedimensional momentum equations, for instance written as
du
1 dp
~ZTT H
TT = G x
cit
po dx
dv
dt
1
+
dp
pa d y
(2.40)
(2.41)
diu
1 dp
777 H
T T = G~
dt
po dz
(2.42)
dv
1
TT7 HV P =
dt
po
(2.43)
or as
G,
Vp = v n + A tG
(2.44)
Po
(2.45)
(2.46)
Solving this equation ensures that the velocity at time t = n + 1 islocally divergencefree. However,
a numerical solution to (2.44) is quite costly and therefore is the main bottleneck in resolving the
nonhydrostatic flow field.
2.6
Instead of splitting the full threedimensional governing set of equations into a barotropic and
baroclinie part, to circumvent the severe explicit timestep restriction due to surface gravity waves;
a different approach consists of (semi) implicitly discretizing the primitive equations.
The main problem then, is that, for the present large set of equations, the matrix inversion involved
with the implicit description becomes too large to treat with direct methods. In particular, the
system
Ax = b
(2.47)
needs to be solved, in which x are the unknown variables. Several methods can be used to make
the solution procedure of (2.47) feasible.
2.6.1
Iterative methods
Iterative (Krylov) methods provide competitive approaches to solve (2.47). In the framework of
ocean modeling, the conjugate gradient method is probably the most used. We refer to Shewchuk
(1994), for a thorough introduction to this method. The main drawback of the method, however, is
that the equations need to be discretized such that the matrix can be written positivedefinite and
symmetric. Otherwise other iterative methods (GRMS, BiCGstab) need to be used. The concept
of the conjugate gradient method consists of the following. Consider x* as a unique solution of
the system and the vectors u and v such that both are conjugate w.r.t. A ,
ut
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
A v = 0.
(2.48)
12
T H V IM D C S o resm a
i.s.m. KU Leuven, UG ent, BM M en W LB
Note the uT A v represents an inner product < uv > A . Now, one should consider first a set of
vectors { p k } which is a sequence of n mutually conjugate directions such that they form a basis
in R n . Hence, we can write
n
x * = ] T Pi
(2.49)
i=l
n
Pkb = P kA x * =
a ip ? A p i
(2 5)
i= 1
a fcp T A p k ,
since
< P i, p k > = 0
(2.51)
leading to
a, =  5 _ .
(2.52)
The method therefore finds solutions of A x = b, once the basis { p k } is defined. The latter can
be evaluated most efficiently by means of iterative schemes, the details of which fall beyond the
scope of this note.
The iterative procedure does not always converge (fast) to a solution. A method to increase this
convergence is to precondition the matrix A . Examples of preconditioners are Jacobi precondi
tioner, successive over relaxation, sparse approximate Inverse method and Incomplete LU de
composition. Although the preconditioned conjugent gradient iteration method is often used, and
efficient, it should be noted that the implementation is quite elaborated, and the correct choice of
a preconditioner is not trivial.
The main reference for for the preconditioned conjugated gradient method in ocean modeling is
Casulli (1999). In the following, we summarize this approach.
A first step is to discretize (1) the gradient of the surface elevation in the horizontal momentum
equations, and (2) the horizontal velocity components in the freesurface equation by means
of the 6 (semiimplicit) method, see Casulli & Cattani (1994). Also, wind shear stress, vertical
viscosity and bottom friction are discretized implicitly. Convective and horizontal viscosity terms
are dicretized explicitly by using an EulerianLagrangian scheme, see Casulli & Cheng (1992).
In this step, the implicit contribution of the nonhydrostatic pressure is neglected, leading to a
provisional flow field v and free water surface . The provisional flow field is found by substituting
the discretized horizontal velocity components into the free surface evolution equation, which then
can be determined. Subsequently, the provisional flow field is computed.
In the second step the provisional flow field is corrected by including the nonhydrostatic pressure
terms. Substituting these expressions into the massconservation equation leeds to relations
which describes the nonhydrostatic pressure. Casulli (1999) solves this set of elliptic equations
by means of preconditioned conjugate gradient iterations.
2.6.2
ADI
A different implicit approach is to split the discretized equations such that each physical direction
is taken implicitly, subsequent to each other within intermediate steps. The advantage is that at
each intermediate step, a much simpler matrix inversion should be performed.
2.7
To follow the often complex bottom topography, several methods can be used. Considering the
s  coordinate as vertical leads to a stairstepped resolution of the bottom topography which can
invoke large errors. For example, the downslope flow is represented by a sequence of horizontal
motion and vertical mixing, and as such is represented in a very diffusive way. Using shaved
cells" (Adcroft et al. , 1997), this error, however, can be minimized. Traditionally, terrainfollowing
coordinates have been introduced such as a coordinates. Of course, the use of unstructured grids
also has the benefit of representing complex geometries smoothly. Nevertheless, these models
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
13
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
also have disadvantages. For instance, using the a coordinates leads to errors in the calculation
of the horizontal pressure gradient, especially where the topography is steep. Fully unstructured
meshes, on the other hand, can resolve topographical changes very well, however, have the
disadvantage, with respect to and a coordinates that the latter are able to store the entire water
column contiguously and therefore are more efficient from memory point of view.
2.8
In the following, we list the methods and approaches used in the present available (stateoftheart) models. Attention is given to the physical approximations, discretization method and
approaches.
SUNTANS
2.8.2
POM
modesplitting
the model of Kanarska & Maderich (2003) employs an explicit approach for the barotropic
mode and an implicit approach for the baroclinie mode.
the model of Kanarska & Maderich (2003) employs an Incomplete LU decomposition as
preconditioner to solve the threedimensional Poisson equation.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
14
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
2.8.3
ROMS
modesplitting
curvilinear grids possible
2.8.4
FINEL3D
2.8.5
MITgcm
Marschall e ta l. (1997) To some extend similar to the method of Casulli (1999) in that the pressure
is split into a hydrostatic and a nonhydrostatic part and free surface part. They then compute the
free surface pressure by (1) using the hydrostatic approximation (2) the pressure method, which
for the free surface pressure is only a two dimensional Poisson problem. The nonhydrostatic
correction is then computed, again using the pressure method, now leading to a threedimensional
Poisson problem. This is solved by means of preconditioned conjugategradient solution methods.
Nonhydrostatic
Structured grid
Finite volume
Preconditioned conjugate gradient iterations
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
15
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
2.8.6
ICOM
SELFE
FVCOM
B. Commercial Models
2.8.9
Delft3D
Delft3D is a finite difference model that solves the hydrostatic equations, but has also the option
to resolve the nonhydrostatic flow field. The model introduces curvilinear (Arakawa C) grid in the
horizontal and uses a or Z coordinates. The equations are solved implicitly with a ADI scheme.
Implicit, ADI  scheme
(Non)hydrostatic
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
16
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
Finite difference
Arakawa Cgrid
Both a and Z coordinates possible
2.8.10
TELEMAC
TELEMAC1 is based on finite element method with an unstructured grid of triangular meshes. The
model solves the nonhydrostatic flow field implicit (by means of a semiimplicit scheme). Several
options for solving the resulting discretized equations, such as the conjugate gradient method,
square conjugate method and the generalized minimum residual method are possible.
Implicit
Several iterative solvers possible
(Non)hydrostatic
Finite element
2.8.11
MIKE3
The MIKE3D model resolves the (non) hydrostatic flow field by means of an implicit scheme
on a staggered Arakawa Cgrid. The model uses the ADI technique for the momentum equa
tions, however, also makes use of the Artificial Compressibility Method. This method consists of
adding a timederivative of pressure to the continuity equation with the goal of transforming the
incompressible NSequations into a hyperbolic system and then apply schemes suitable for com
pressible flows. This method introduces a parameter /3 that relates to the speed of sound. Mainly
the method appears to be beneficial for steady state solutions. We refer to Flousman et al. (2004)
for more details.
Implicit
Artificial Compressibility Method using the ADI approach
Non hydrostatic
Finite difference
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
17
T H V IM D C S o resm a
i.s.m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
18
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
Chapter 3
An overview of the numerical schemes in Coherens V2
3.1
Introduction
In this chapter an overview is given of the numerical schemes that are currently implemented
in COHERENS . The aim of this overview is by no means to go provide an exhaustive and de
tailed description. Instead, its main purpose is to form a guide in the selection of the implicit
code to be implemented in COHERENS . Thus we will give some indication of the implication of
these schemes for the implementation of the implicit code. A complete overview of the numerical
schemes in COHERENS can be found in the Coherens V2 manual. COHERENS is very flexible
and generic. Thus multiple schemes and multiple different options can be set by the user, each
of them having a different implementation. We will not discuss all these options, but limit ourself
to the main points.
The numerical schemes are used to solve the 2D and 3D hydrodynamic equations and 3D scalar
advection equations. As equation of motion in 2D, the shallow water equations are used, assum
ing implicitly the hydrostatic pressure assumption. In 3D, the hydrostatic pressure assumption
is also used, leading to two equations for the horizontal velocity components, and a separate
equation (derived from the continuity equation) for the vertical velocity. Mode splitting is used
to allow a different time step to be used in 2D and 3D (hydrodynamics, scalar advection and
turbulence equations) calculations. The equations are transformed horizontally using orthogonal
curvilinear coordinates and vertically using scoordinates (which are basically spatially varying acoordinates). The indexes of the computational grid are shown in figure 3.1 (see the COHERENS
manual par. 6.2 for more details).
The 2D hydrodynamic flow field is described by respectively the continuity and momentum equa
tions in the 1 and 2 direction:
dt
dU
(3.1)
hiho
V
A h i( U ) + Ah2(U)
gH d(
TTZ
h \ di^i
H h th i
H dPa
,
p a h i 9m
r
TT,
1 ,
F 1 + H F 1  I ( r
pa
s l
T fc l )
A h l (V ) + A h2( V )
gHdC
r
(3.2)
 !i u ] + m u m a i
H h ih o
dPa
"o/" T ~ ?  r ^ 2
'
2I V s2 Tb2 )
P m h l { P ) + P m h 2 {P ) ~ 5 A ha + S D h2
(3.3)
Here, A is the advection operator, V is the diffusion operator,M and I D are correction terms
for the fact that the depth averaged advection and diffusion terms are not equal to the advection
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
Vertical
Horizontal
U V ( + 1 )
V ( + 1 )
sea s u rfa c e
U V ( i+ lj+ l)
s

nz+1
C 
nz
W 
U ( i+ lj)
Cftj)
c
w
c
w
c
w


 2
c  1
W U V ( r ilj)
V ( ij)
seabed
Figure 3.1: Schematic overview o f the indexing o f the com putational grid. Left: horizontal; Right: vertical.
and diffusion of the depth averaged velocity (see Coherens V2 manual, eq. 5.80 to 5.83). The
variable P a is the atmospheric pressure, F b the force due to baroclinie pressure gradient and F *
the tidal force. The angular velocity of the earths rotation is denoted by 0 . Further FL is the water
depth, U and V the depthintegrated velocities in ^ and 2 direction. The shear stress at the free
surface and at the bed are represented by rs and n respectively. Finally, h i,ho and h3 are metric
coefficients related to the grid spacing. The equations (in transformed coordinates) for the 3D
mode are (for respectively continuity, momentum in i direction and momentum in io direction):
1 dh3
/?3 dt
1 8 d
him('w ,)
1
hihohi
A h i(u )
d
t; i
( h i h 3v )
1 dio
/?3 d s
(3.4)
dho \
 A u ( u )
hi h2
h i di i
dhi
Ah^i'u)
dP
polii d i i
d
Ot;2
(hoh3u ) +
F t
F ?
v ( ll)
P m h l ( T l l )
P m h 2 { T l o )
(3.5)
1 d
1 777
fi3 o t
g d
ho d ^ o
dPa
pu h o d i o
F o
F ^
dho
i
v { v )
dhi \
) + 2 i' wsm<?>
u~
t
P m h l { T o i )
nih2
(^ "2 2 )
(3.6)
Flere C is the free surface elevation and u, v and cu represent the velocities in
3.2
^2 and s direction.
I/RA/11339/10.072/GVH
Version 1.0 31/01/2011
20
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
(3.7)
(3.8)
This leads to the following criterion for the maximum mode splitting that can be used:
\U
2v P
(3.9)
Hence the deeper the flow (lower value of \u\/2^fgH), the more gain can be obtained from modesplitting. Thus mode splitting is a very effective method in oceanography, but will not lead to a
high efficiency in rivers and estuaries. The time step of baroclinie (3D) mode is also determined
by the wave speed of the internal waves:
A T sjj <
=
2\/Ap/pgH
(3.10)
This leads to the following criterion for the amount of mode splitting that can be used:
(3.11)
Since the relative density difference (A p/p) is usually very small, this criterion is normally not
important in practical situations.
Mode splitting such as implemented in COHERENS has two different objectives:
To separate internal (baroclinie) and external (barotropic) motion. Therefore, the 3D equa
tions are decoupled from the 2D equations such that they can be solved separately. In
particular, this means that the 3D momentum equations are decoupled from the equation
for the free surface. In this way, the calculated water levels in a 2D time step are used as
input for a 3D time step. This function is also important when the 2D and 3D time step are
the same.
To decrease calculation time. This is done by using a larger time step for the baroclinie
motion (which is much more computationally expensive to calculate than the baroclinie time
step) than for the barotropic motion. Because of the different time steps that are used,
correction terms need to be added to the 2D and 3D equations.
A very brief overview of the order in which the different partial differential equations are solved in
a COHERENS calculation are given below. A more complete overview can be found in par. 6.6 of
the COHERENS manual.
1. Predictor time step (3D). At this time step, the following tasks are performed:
(a) The equations for the 3D turbulence equations are solved.
(b) The equations for the 3D current predictors are solved giving vP and vp.
2. Barotropic time step (2D). At this time step, the following tasks are performed:
(a) The 2D continuity equation is solved in order to obtain the new water depth H.
(b) The 2D momentum equations are solved to yield the depth integrated currents U and
V.
3. Corrector step (3D). At this step, the following tasks are performed:
(a) The 3D lateral open boundary conditions are applied.
(b) The 3D currents u and v are calculated from the current predictor while enforcing that
the discharges are equal to the depthintegrated currents U and V.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
21
T H V IM D C S oresm a
i.s.m. KU Leuven, UG ent, BMM en W LB
(c) The vertical currents are calculated from the continuity equation.
(d) Scalar advection (for temperature and salinity) is calculated.
These two different functions of the mode splitting must be taken into account when determining
how the COHERENS code will be converted to an implicit code. There are a few possibilities. It
is possible to limit the implicit code to the 2D mode. This will lead to a large speedup for the 2D
mode, but no speed up for the 3D mode. This will be advantageous for 2D calculations, but for the
3D calculation the gain in calculation time will be rather limited, because even using mode splitting
the 3D mode has been observed (e.g. in test case Bohai) to be responsible for the majority of the
calculation time. Further, the gain will be even less in shallow areas, where u /^ /g H is rather large
and the CFL criterion for the discretization of the advection quickly becomes dominant. Hence,
it seems at least necessary to make both modes (2D and 3D) implicit. It can be considered
to eliminate the mode splitting completely. In that case, the 2D mode and 3D mode become
separate routines for doing either 2D or 3D equations. The consequences for the 2D calculation
will be rather limited. However, the routines for the 3D equations need to be changed such that the
continuity equation can be solved simultaneously with the 3D momentum equations (for u and v).
This might give a considerable effort, but can lead to an additional increase in calculation speed,
because the 2D equations do not need to be solved anymore in a 3D calculation.
3.3
Here a brief description of the numerical methods for the 2D hydrodynamic equations is given.
A complete overview can be found in the COHERENS manual (par. 6.3.1.2 and 6.3.2.3)). The
twodimensional hydrodynamic equations are solved at every two dimensional time step. A first
order explicit Euler scheme is used for the time integration. This leads to the following equation
(from the continuity equation 3.1) for the water level elevations (at grid cell i j see figure 3.1):
/m+1
/m
^ AT9z/
( ^ i  U r )  v O'T+i  V f )
(3.12)
Here i and j are the index (in x and y direction respectively). Note that in order to simplify the
notation as much as possible, we have applied the following simplifications: subscripts in the
direction where no changes take place are omitted (like the j in the xgradient term) and terms
involving the size of the grid are dumped in a factor a . A detailed overview of the schemes (where
all terms depending on the grid are given exactly) can be found in the COHERENS V2 manual.
After the continuity equation is solved, the momentum equations are evaluated. Thus the continu
ity and momentum equations are decoupled in the numerical scheme that is used in COHERENS
. The momentum equations (using the depth integrated currents U and V) are also integrated with
a first order explicit Euler scheme (only the discretization for the U equation is given, the equation
for V is very similar):
1
JJ771
A T2 D
A d v e c tio n
kn/
D iffu s io n
Tjm + 1 _ u n / m
fV m
C o rio lis ; e x p lic it d is c re tiz a tio n
'''m
F l
b a ro c lin ie p re s s u re g ra d ie n t
+ a gradCm+1 +
tid a l fo rc e
s u rfa c e s tre s s
gradPQ
m+1
N/
V"
w a te r level g ra d ie n t
A tm o s p h e ric p re s s u re g ra d ie n t.
 A n + Dn
(3.13)
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
22
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Note that in these equations, data from three different time steps are used: m (explicit te rm s ),m + l
(implicit corrections) and n (3D corrections resulting from modesplitting using explicit information
from the 2D time step). The implicit corrections (at m + 1) are used to increase the stability
for the bed shear stress. The threedimensional correction terms in the 2D mode are coming
from the baroclinie pressure term (i.e. the pressure gradient generated by density differences)
and difference in the 2D and 3D horizontal advection (thus between dsdu2/d, and <92/<9)
and diffusion terms (thus between dsvH {s)du/d and i/nd/d). The implementation of the
baroclinie pressure gradient is discussed in paragraph 6.3.12 of the COHERENS manual. Note
that the diffusion term is only nonzero if the horizontal eddy viscosity varies over the depth,
which can only happen if the Smagorinsky turbulence model is used. The advection correction
term will be small if the velocity profile is relatively close to the depth averaged velocity (such
as when a logarithmic velocity profile is encountered), but might be large in case stratified flow
exist, where the flow direction changes in different parts of the water column. More details on
these terms can be found in par 6.3.5 and 6.3.9 of the COHERENS manual. With respect to
changing the code to an implicit code, this dependence on two different time steps seems to be
a unwanted complication. The most important complication is related to the baroclinie (density
induced) pressure gradient. In order to make this term implicit, the density at time step m + 1
has to be known. This can only be done by solving the scalar advection equation for salinity and
temperature simultaneously with the 2D momentum equations, rather than consecutively as it is
currently implemented. This is a significant drawback. However, it may not be needed to make
this term implicit. It has already been shown that internal waves move rather slowly. Thus the CFL
stability criterion for these waves is rather low and thus an explicit discretization may be sufficient.
Because the calculation of the water levels is decoupled, the water level gradient in the calculation
is included at time step m + 1. In case of an implicit code, it is not possible anymore to decouple
these equations, and the momentum equations becomes coupled through the water level gradient
term. In that case the continuity equation becomes coupled to the momentum equations, they
also become coupled to each other. Presently, the coupling is through the Coriolis term, but
this is circumvented, because an implicit correction is used for this term rather than a completely
implicit discretization (as explained later on). This means that the three equations of the 2D
mode (continuity, x momentum and y momentum) need to be solved simultaneously, rather than
consecutively.
The atmospheric pressure is already known beforehand, thus the atmospheric pressure gradient,
can be applied at the new time step. The gradients (which are needed at U and V points) are
obtained easily from the water level and atmospheric pressure values, which are defined at Cpoints.
With respect to the bottom friction, the precise discretization depends strongly of the options that
are used. In this discretization, k is a coefficient. When quadratic bottom friction is used, this
coefficient depends on the velocity. Two options are available. The same bottom friction as in the
3D mode can be used. In this situation, k depends on the 3D velocity field at 3D time step n.
In case the 2D option is used, k depends on the 2D velocity at the 2D time step n. Note that in
case the 2D option is used, the bottom friction does not depend on up  jp), but rather the depth
integrated velocities velocities U m and V m are used.
The Coriolis term is only included in an explicit way in equation 5.2. In order to increase the
stability, an implicit correction is applied to the Coriolis force after the momentum calculation is
calculated (COHERENS manual paragraph 6.3.1.2 ). The corrected velocities u n+1'c and v n+1'c
are given by:
(3.14)
(3.15)
This correction bears a great similarity with the semiimplicit scheme (it would have been semiimplicit if v m+1c were used instead of V m+1), but has the advantage that the equations are
explicit, and thus they can be calculated rapidly.
The advection operator A is discretized using either an upwind, LaxWendroff or TVD scheme
for horizontal advection and upwind, central or TVD scheme for vertical advection (see the CO
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
23
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
HERENS manual 6.3.4 for the precise discretization). It also includes a correction term for the
curvilinear grid. The upwind discretization is 1st order in space, the LaxWendroff and central
schemes 2nd order. In this discretizations, the TVD scheme is a nonlinear combination of up
wind and either central or LaxWendroff schemes, using an upwind scheme for steep gradients
(in order to prevent wiggles) and the more accurate central or LaxWendroff schemes elsewhere.
The used discretization has a stencil that occupies three adjacent points in space in case of the
central scheme. As an example, for advection in the x direction, the stencil uses the velocities at
i  i, i and i + 1. More details on the advection terms (specifically the vertical ones) are given in
paragraph 3.7.2. The diffusion terms (see par 6.3.8 of the COHERENS manual) are discretized
using a central scheme, which are a linear combination of the concentrations at locations (for
diffusion in the x direction) i  I, i and i + 1.
It seems that the used spatial discretizations for the advection and diffusion terms can be used
also in an implicit code. However, the advection terms have to be linearized, in such a way that
the new stencil is linear in the velocity at the new time step m,+ 1 in order to obtain a linear system
of equations.
Here we focus on the integration of the equations without using operator splitting (see par 3.7.1).
This operator splitting is applied when the TVD scheme is used for integration of the advection
terms. If the upwind (the default scheme) or the LaxWendroff scheme is used for the advection
terms, no operator splitting is used. The operator splitting (also called fractional step method) is
discussed in paragraph 3.7.1.
3.3.1
Drying and flooding is presently implemented in COHERENS using the method of Burchard et al.
(2004). In this method, drying areas are represented by a layer of water with a small depth dmin
(by default 2 cm). In this small layer, the source terms masked out using a parameter a , which
decreases linearly from 1 to 0 between a critical depth dcrit and dmin. The only terms that are not
masked out using a are the water level gradient and bottom shear stress. Thus in a dry area,
there is an equilibrium between bottom shear stress and water level gradient. Because the drag
coefficient (in the bottom friction term) in such small water depths become very high, the velocity
will be very low (approximately 0) in dry areas. There is also a land mask implemented, which
works as an absolute mask. Any cell that is zero in this mask will be always dry, and therefore
it will not take place in the hydrodynamic and sediment calculations. It seems that this method
for drying and flooding does not present strong limitations, when the code is made implicit, this
should be investigated any further. Note that currently, alternative drying and flooding schemes
are being implemented, which may have a stronger dependence with the implicit code.
3.4
3.4.1
Predictor step
During the predictor step, the threedimensional momentum equations are solved for the hori
zontal currents u and v. This is done using a first order Euler time integration scheme (see
COHERENS manual par 6.3.1.1 for more details). However, the method that is used depends
on various options. Here, the complete integration method is discussed, which is used when the
upwind or LaxWendroff scheme are used for the advection terms. In case the TVD scheme is
used, a fractional step method is used for the integration of the momentum equations. This is
discussed in paragraph 3.7.1.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
24
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
A T3 D
M in
H o riz o n ta l a d v e c tio n
h {v n
H o riz o n ta l d iffu s io n
 0 D v ( i , n + 1 ) + (1  0 ) A v ( u n ) + 0 D v ( u n + 1 ) + (1  0 ) A v ( i
V e rtic a l a d v e c tio n ; s e m iim p lic it
agrad C "
w a te r level g ra d ie n t
Tgrad"
a tm o s p h e ric p re s s u re g ra d ie n t
F1
B a ro c lin ie p re s s u re g ra d ie n t
F [ l+1
T id a l fo rc e
fv ^
(3.16)
From this equation it can be seen, that only terms at time steps n and n + 1 (thus only 3D time
steps) are used. Thus there is no coupling with the 2D mode, except that the calculated water
levels from the 2D calculation are used. The meaning of the terms is similar as in the 2D equation.
The same discretizations are used for the horizontal advection terms (upwind, LaxWendroff or
TVD scheme; including an extra term for the curvilinear grid; see paragraph 6.3.3 and 6.3.6 in the
COFIERENS manual) and the horizontal diffusion (central differences; see par 6.3.7 and 6.3.10
in the COHERENS manual). After the calculation of the velocities, an implicit correction for the
Coriolis terms is applied:
U n + l,c _ u n + l =
f O S T 3 D (l>"+ 1  V n )
(3.17)
The vertical terms (advection and diffusion) are discretized using a semiimplicit scheme for larger
stability. Note that for vertical advection the default is 6 = 0.501 and for vertical diffusion the default
is 0 = 1. The semiimplicit terms in the vertical direction are solved using a tridiagonal matrix
solver that is using the Thomas algorithm.
The terms that were needed in the 2D equations to correct for 3D effects are (of course) not
included in the 3D equations. The shear stresses at the free surface and the bed are now applied
as boundary conditions, rather than source terms. For the bed shear stress (that is used as a Von
Neumann boundary condition), a semiimplicit discretization is used:
n = kn (dun+1 + {1  0)un)
(3.18)
Here kn is a friction coefficient, which for quadratic friction depends on the velocities at time step
n. There is also an option in COHERENS to use the bed shear stresses calculated from the 2D
mode. In this case, an explicit discretization is used (using the velocity U m).
As for the 2D mode, the largest problems in converting the code from explicit to implicit are related
to the coupling to other equations, viz. the baroclinie pressure gradient (which is coupled to
the scalar advection equations of temperature and salinity). However, as was discussed for the
2D mode, it might be sufficient to keep this term explicit, since it does not provide a very large
restriction on the time step. The coupling with the 2D mode comes through the water levels and
the water levelelevation gradient, which are calculated in the 2D mode (see paragraph 3.2). In
the corrector step, the velocity fields calculated in the 3D mode are adapted in order to agree with
the continuity equation from the 2D mode.
3.4.2
Corrector step
One 2D time step after the 3D current is calculated, a correction step is applied (see paragraph
6.3.1.3 and 6.3.1.4 of the COHERENS manual). In this time step, the 3D currents are corrected,
such that the mass balance of the 3D flow field agrees with the one from the 2D flow field. Fur
thermore, the 3D open boundary conditions are applied, the vertical velocity is calculated from
the continuity equation and filtered velocities (Deleersnijder, 1993) are calculated for application
in the scalar advection equation.
In the correction step the velocities at the open boundaries are replaced by those calculated
from the boundary condition. They then serve in the advection and diffusion terms of the 3D
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
25
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
momentum equations at the next time step. When the code is made implicit, the 3D boundary
conditions cannot be decoupled anymore from the solution of the momentum equations. For
the two most used boundary conditions (a specified profile, or zero gradient condition), it does
not seem to be a large problem to integrate these in an implicit solution scheme. Flowever, for
radiation boundary conditions, this might be somewhat more difficult.
Then the mass balance is corrected. Flere, the 3D velocities are changed, such that the depth
integrated current calculated from the 3D velocity field is equal to the depthintegrated velocities
in the 2D mode. This is done by adding the difference between the two velocity fields to the 3D
velocity field:
= g , " F + ( c ' ,; : T E ^
(3.19)
The filtered current (necessary for the calculation of scalar advection) is calculated by adding the
difference between the time average (between two 3D time steps) of the 2D current and the depth
average of the 3D current to the 3D velocity field (here M is the number of 2D time steps per 3D
time step):
Un+ 1 =
+ (
^ m 
(3 20)
yyn+1
'
'
'
Note that this is only necessary if the 2D and 3D time step are different. In case mode splitting is
removed, the calculation of the filtered currents are not necessary anymore.
Finally the transformed vertical velocity is calculated from the continuity equation. The continuity
equations does not contain any time derivatives, thus the integration is only performed in the
vertical direction. This leads to:
u^+^O
(3.21)
and
k 1
, n + l
,n  \ 1
w k+1 = w k
Nk
J2
f+J2f>
=i
fc+i
(3 2 2 )
With:
h n+1
7711+1
g ra d ,^  +
I+ n +
h n+1
g ra d ^ ^ 
(3.23)
Here Su denotes the baroclinie velocity component, (thus the difference between the 3D velocity
and the depth average of the 3D velocity) and a are geometric terms, depending on the grid
spacing. The physical velocity is calculated from the transformed velocity field (using an explicit
expression).
3.5
The numerical solution of the scalar advectiondiffusion equation is described below. More details
can be found in the COHERENS manual paragraph 6.4. It is to be noted, that the same CFL
criterion must be fulfilled for scalaradvection as for advection of momentum. Hence, the stability
criterion is:
A Tscaiar < u
(3.24)
Since this will lead to rather small time steps, in seems necessary to solve the scalar advectiondiffusion equation implicitly. Otherwise, an increase in the computational time step can only be
obtained for hydrodynamic calculations, and any calculation using scalar advection (either salinity,
temperature or the future suspended sediment transport module) will obtain no benefit from the
presence of the implicit code. These equations are currently used for the advectiondiffusion of
temperature and salinity on the one hand and turbulence quantities (such as k and e) on the other
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
26
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
hand. Later on, it will also be used for suspended sediment transport and biological quantities. In
the present paragraph, the advection diffusion module such as used for the advection of salinity
and temperature are discussed. The implementation used for the transport of turbulent quantities
is discussed in the next paragraph.
The scalar advectiondiffusion equation is very similar to the momentum equation. However, the
scalars are defined at the C nodes, rather than the U and V nodes, thus less interpolation needs
to be used. The same schemes are used for advection (upwind, LaxWendroff or a combination
(TVD) horizontally; upwind or central scheme or a combination (TVD) vertically) and diffusion
(central scheme) are used for the momentum equation (see par 6.4.4 of the COHERENS manual).
It is solved using a semiimplicit scheme for the vertical terms and a first order Euler scheme for
the horizontal terms. Source and sink terms are included in a explicit way. Extra terms, called the
corrector terms are added. These correct the advectiondiffusion equations for the changes in the
cell sizes due to the motion of the free surface:
/?3 dt
dt
(3.25)
/?3 dt
In this equation, the continuity equation is substituted (in the second term on the right hand side),
in order to get terms that are separated in the three directions (a term for x, y and z). In this way,
the corrector term in x direction becomes (and similar for the two other directions; see par 6.4.2
of the COHERENS manual for details):
(hohs'Uf)
(3.26)
This is discretized (using the filtered velocities; see paragraph 3.4.2) as:
^ '.i !"v )
1 Tw i !!f./
(3.27)
1c !!f. / )
V>n+1  ipn

A h( r ) + D h( r )
dAv( r +1) 
(i 
o)Dv( r )
S e m i im p lic it v e rtic a l te rm s .
C(r)
C o rre c to r te rm s , e x p lic it
S '(T n )
(3.30)
S o u rc e te rm , e x p lic it
The advection and diffusion terms are discretized similar as in the momentum equations. For
advection, the upwind, LaxWendroff (replaced by a central scheme for vertical advection) or TVD
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
27
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
scheme can be used. A central difference scheme is used for the diffusion terms (see par 6.4.6.
of the COHERENS manual). Both these schemes lead to numerical stencils for the operators A h
and D h that extend over three cells, from i  1 to i + 1.
It seems that the source term, that is discretized explicitly, might lead to a restriction on the used
time step, but this depends very much on the specific use of the advectiondiffusion module. In
the present salinity module the source term is zero. In the temperature module, it depends on the
solar radiation. There might also be influences for the sediment transport module, where these
sources can be nonzero.
3.6
Turbulence models
Various turbulence models are implemented in COHERENS (see par 5.3 of the COHERENS
manual). These include algebraic turbulence models (such as PacanowskiPhilander or MunkAnderson), in which the eddy viscosity and eddy diffusivity are calculated directly from the cal
culated velocity and density fields using an algebraic equation. Further, one and twoequation
models are implemented (such as the ke and kl model). In these models, the eddy viscosity and
eddy diffusivity are calculated from turbulence quantities (such as k and I), which on its term are
calculated using a scalar advection diffusion equation.
The numerical method used for the advection diffusion of turbulence quantities is similar to the one
used for the scalar advection diffusion module described in the previous paragraph (see par 6.5
of the COHERENS manual for a detailed description of the numerical solution of the turbulence
equations). However, it differs from those in the following aspects:
All turbulence quantities are defined at Wnodes, rather than Cnodes. Thus the equations
and schemes are shifted half a grid cell in the vertical.
The turbulence equations are solved at the predictor timestep (before the hydrodynamic
equations are solved), other scalar equations are solved at the corrector time step. In this
way, the eddy viscosity is calculated just before the 3D momentum equations are solved.
The source terms S are discretized quasiimplicitly using Patankars (1980) method:
S '(V ,n +
1) = ^ T ^ S ' ( V n ) . This method has the advantage that it guaranties that the turbulence
quantities cannot become negative. However, the disadvantage is that this method is not
exactly conservative (thus an extra dissipation of turbulence quantities can occur).
Only a zero gradient boundary condition can be used as an open boundary condition for
turbulence quantities.
Note that advection and horizontal diffusion terms are switched off by default in the advection
diffusion equations for the turbulence quantities (such as k). In that situation, the turbulence
model reduces to a 1DV point model at each grid point in the model. Such an 1DV model poses
less severe restriction on the used time step, since CFL criterion for horizontal advection does not
apply anymore. The vertical terms are discretized using a semiimplicit scheme and thus do not
lead to restrictions on the time step.
3.7
3.7.1
Operator splitting
If the TVD schemes are used for advection, operator splitting is used in the solution of the momen
tum equations. This is used for the twodimensional momentum equations, the threedimensional
momentum equations and the scalar advectiondiffusion equation (see for more details paragraph
6.3.2.2, 6.3.2.3 and 6.4.3.3 of the COHERENS manual).
When operator splitting is used, the equations are split in three different equations for the three
different spatial directions (x, y and z). All source term s are added to the equation in the
direction. For the twodimensional equation, no zterms are included, but the source terms are
solved at the fractional time step when in the 3D calculations the z equation is solved. Then the
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
28
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
three equations are solved first in x, then in y and finally in z direction. This is followed by a second
calculation where first the z direction is used, then the y direction and finally the x direction. The
final value for a quantity is obtained by taking the average of the first and the second sweep.
Thus in the case of scalar advection, which we will use as an example, the solved equations are
respectively:
^n+l/3 _
m r ) + Dx( r ) + c u r )
A TiD
(3 .31 )
^lyi+2/3 0n+1/3
(3 .32)
=  A y( r +1/S) + D y( r + 1/S) + c m
A T3D
r +10n+ 2/ 3 =
AT:3D
 d A z( r + 1) + o D m 1)
 (i  e)Azm
V3) + c m
+sru
(3 .33 )
Followed by:
In + 1/3 _
in
\rp
AL3D
=  e A zm

ffpn\2/3
(i 
1/3) + e D z m
e ) A m
1/3)
+ (i  e ) D m
+ c
+ s r u
( 3 . 34 )
^n+1/3
AL3D
=  A ym
i/3 ) + D ym
i/3 ) + c y( r )
r +l
r +~/3 = _ A x { r + 2/3) + D x { r + V 3) + c u r
AL3D
0 .35)
(3.36)
Flere, A, D , C and S are respectively the advection, diffusion, corrector and source terms (see
paragraph 3.5). Note the use of the semiimplicit scheme for the vertical direction. Also note that
the corrector terms are all determined by the value of at the original time step n rather than that
they are updated.
The presence of operator splitting is important, because ADI based implicit schemes use this kind
of fractional step approach. This means that the algorithm used here can be extended to such
approaches using the code for the TVD schemes as a building block.
3.7.2
In the three dimensional mode, the vertical advection and diffusion terms in the horizontal mo
mentum and scalar equation are solved using a semiimplicit scheme. This is done, because an
explicit scheme would require a very small time step (due to the very small vertical grid spacing).
The semiimplicit scheme (here given as an example for vertical scalar advectiondiffusion) has
the following form (see the detailed explanation for scalar advection in paragraph 6.4.3 and 6.4.8
of the COHERENS manual)):
l!)n+ 1 i/;71
Arr
AL3D
(3.37)
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
29
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
(1
a m
Vt(v k ) ) F Up k T D ( r k ) F c e )
(1
Q>(rk ) )Fwp:k i T L ( r k ) F c e i )
1)
(3.38)
(3.39)
(3.40)
(3.41)
Here, h3k is the vertical size of cell k\ a and parameters related to the geometry of the grid, and
s is the sign function, yielding 1 if w k > 0 and  1 otherwise. Further F up and F ce are the advection
fluxes at the edge a grid cell using an upwind or a central discretization. Note that the vertical
velocity used here is the transformed velocity in s coordinates and not the physical velocity. Finally
note that the same scheme is used for the horizontal advection, but that a LaxWendroff scheme
is used there, rather than a central scheme.
It is important that in this discretization, the concentration at location k depends on those at
locations k  1, k , and k + 1. This leads in the numerical implementation to a tridiagonal matrix,
which can be solved efficiently (see paragraph 3.9). This scheme depends nonlinearly on ip if the
TVD scheme is used (thus if Q = f ( r k )). Therefore, the time influence has been linearized in this
equation (thus preventing the need to solve a nonlinear system of equations), by using a value of
f i ( r ) , which depend on the flux at time step n for the calculation of the flux at time step n + 1 as
well at time step n. In this equation for both A z(4>n ) and A z(ipn+1), the fluxes (F up and F ce) are
calculated using the velocity w n+1 that has already been calculated before.
For the diffusion terms, the fluxes in the discretizations are linear functions of the ip, and thus they
can be directly added to a tridiagonal matrix (see par 6.3.17 and 6.4.8 of the manual for more
details how the tridiagonal matrix is defined and solved). For the vertical advection of momentum,
the most important difference is that the vertical velocity has to be interpolated to the velocity
points, because it is defined at Cpoints.
3.8
3.8.1
In the implemented finite volume scheme, a momentum flux needs to be prescribed at the open
boundaries in the 2D mode. There are 14 different options implemented for these boundary
conditions. An overview of these boundary conditions is given in par 5.9.1 of the COHERENS
manual. Their numerical implementation is described in paragraph 6.3.15 . We will not discuss
all these options in detail. Most important is the general structure, which is that they apply a local
value of the depth integrated velocity (either U or V) at the location of the boundary conditions.
These depth integrated values are calculated from the variables that are applied at the boundaries,
which can be in the form of (depth integrated) velocities, water depths or a combination of both.
In some instances the gradient of water level or fluid velocity can also be used. Depending on the
type of boundary condition used, the normal velocity at the new time step is calculated from data
at the previous time step or from data at an adjacent grid cell, in combination with the prescribed
data. Cross stream velocities and diffusive terms are set to zero at the boundary.
The following additional remarks should be made:
If only water levels or water level gradients (thus no velocities) are applied to the boundary,
an approximate (explicit) momentum balance is applied to convert these to a velocity value.
In two types of boundary conditions (Orlanski 1976, and Camerlengo & O Brien 1980), the
velocity at a previous time step (m  1) is also required.
An additional option exist to prevent spurious instabilities near ragged boundaries. If this
options is applied, the advection terms that depend explicitly on the values of U and V at
the boundaries are set to zero. Also the diffusive flux at the open boundary is made exactly
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
30
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
equal to the diffusive flux one cell to the interior of the grid (such that the gradient of the
diffusive flux is zero there).
The general way in which this is implemented is that a momentum balance is applied locally, in
which the prescribed boundary condition is substituted. This momentum balance is then solved
to give the depth integrated velocity at the boundary point, which is then applied.
In the current implementation of COHERENS , which uses an explicit scheme for time integration,
the application of the open boundary conditions is decoupled from the solution of the momentum
equations. The open boundary conditions are applied at the end of a 2D time step. Then the
calculated velocities are replaced by the ones obtained from the boundary conditions. The calcu
lated values are then used in the numerical schemes (for the advection and horizontal diffusion
terms) in the next 2D time step.
In case an implicit scheme is used in COHERENS , this decoupling of boundary conditions from
the momentum equations can not be used anymore. Conceptually, this is not problem. This
seems relatively straightforward for those boundary conditions, where the boundary condition is
either applied using a local momentum balance (which can be solved simultaneously with the
global momentum balance) or using a direct relation with adjacent cells (such as a zero volume
flux or a clamped boundary; d U /d t = 0 ). It might be somewhat more difficult for boundary
conditions using the characteristic method, where it may be necessary to linearize the boundary
conditions, because they are a nonlinear function of both C and U or V. However, it appears that
the implementation of the open boundary conditions have to be recoded completely.
3.8.2
Only four types of 3D boundary conditions are implemented in COHERENS (see par 5.9.2 and
6.3.16 of the manual): the use of zero gradient condition, a specified external profile, radiation
condition and Orlanski condition. All these boundary conditions are applied to the baroclinie
component of the velocity (thus to the deviation of the velocity from the depth averaged velocity).
The three dimensional boundary conditions in the current explicit scheme in COHERENS are
evaluated at the corrector time step. Just as in the 2D mode, they are decoupled from the solution
of the momentum equations, and used in the advection and diffusion terms used to calculate the
following time step. In an implicit code, the application of the open boundary conditions needs to
be coupled with the solution of the momentum equation. The consequences are similar as for 2D
boundary conditions.
3.9
In implicit numerical models, a system of linear equations needs to be solved. Two techniques
can used for this, direct solution methods and iterative solution methods. In COHERENS three
different methods to solve systems of linear equations are built in, all of them are direct solution
methods.
Solution of a linear system of equations using Cholesky decomposition. This is a direct
method for the solution of equations with square symmetric (a = ,,) positive definite
matrices. It is used in performing the harmonic analysis.
Solution of a linear system of equations using LU decomposition. This is a direct method
for solving equation with square matrices. It is used to solve a 3x3 matrix when determining
the surface exchange coefficients using MoninObukhov similarity profiles.
Solution of a linear system of equations using the Thomas sweep algorithm. This is a highly
efficient algorithm (based on LU decomposition) to solve tridiagonal matrices. It is used in
the solution of the semiimplicit vertical step transport equations for momentum and scalar
transport.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
31
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
3.10
In this chapter, a review was given of the numerical schemes that are currently implemented in
COHERENS , from the point of view of the implementation of an implicit code. From the schemes
presented in this review the following conclusions and recommendations can be drawn.
It was shown that especially for shallow water, the velocity of the long waves ( \fg ) and
the advection velocity are of the same order. Thus the gain that will be obtained from only
implementing an implicit scheme in the 2D mode will be rather limited. It therefore seems
necessary to make the 2D mode as well as the 3D mode and the scalar advection equation
(whose time step depends on the same CFL criterion as the 3D momentum equations)
implicit.
A decision should made, whether the implemented modesplitting scheme should be re
tained. The gain obtained from a mode splitting scheme seems rather limited in an implicit
code (especially when applied to shallow water such as rivers and estuaries). The used
mode splitting algorithm yields some additional complexity in making the code implicit for
the 2D mode, where terms are presently implemented that depend both on the last 2D and
the last 3D time step. This might however be overcome to some extend by neglecting some
of the terms (due to the differences between the depthaveraged advection and diffusion
and the advection and diffusion of the depth averaged quantities), which are usually small
corrections. However, it makes the solution for the 3D momentum equations easier, be
cause they are decoupled from the continuity equation. Note that it should be investigated
in the literature whether a mode splitting schemes with both modes (2D and 3D) implicit are
stable, or that instabilities can exist due to the coupling between the two modes, when large
time steps are used.
The fractional step method that is implemented seems rather easy to extend to implicit
fractional step methods such as ADI (alternating direct implicit).
The spatial discretizations that are used for advection and diffusion terms seems suited to
use in an implicit code, without adaptation, except that some linearization may be needed
(to prevent nonlinear systems of equations at the new time step).
The time integration schemes in COHERENS are only first order accurate in time (except
the semiimplicit scheme for the vertical advection and diffusion terms). This does not lead
to severe accuracy restrictions, because the time step needs to be very small because of the
explicit scheme that is used. If an implicit scheme is used, the time step can be increased,
which might possibly lead to a decreased accuracy. Therefore, in case of an implicit code,
the use of higher (second) order time integration might be advantageous. Note that Picard
linearization is used to linearize the nonlinear terms in the semiimplicit vertical terms is
COHERENS . This type of linearization leads to first order accuracy Wesseling (2001). Thus
changing the order of accuracy might also lead to the need of more complicated linearization
(such as Newtons method of linearization) and hence iterative solutions of the equations.
The sources of momentum due to external forces (tide, atmospheric pressure, and wind
stresses) seem straightforward to make implicit in the calculation scheme. The Coriolis
force and bed shear stress term are already implemented with respectively an implicit cor
rection, and a quasiimplicit term. It should be investigated whether these terms lead to time
step restrictions, although this does not seem very likely. In the scalar advection diffusion
equation, the corrector term and source term are discretized explicitly. The latter might also
lead to restrictions of the time step, but it will depend on the application.
Only direct matrix solvers are currently implemented in COHERENS . For many types of
implicit implementations, these might not be sufficient. However, there is a tridiagonal algo
rithm implemented (used for the solution of the implicit vertical terms), which can be very
useful in certain types of implicit schemes (such as ADI).
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
32
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
An additional complexity of an implicit code is that some equations that are uncoupled in the
explicit implementation of COHERENS become coupled in an implicit implementation. The
most important of these are:
 The continuity and momentum equations in the 2D mode will become coupled. Hence
these equations have to solved simultaneously rather than consecutively (as it is done
presently). In case the mode splitting is removed, this coupling also exists between
continuity and the 3D momentum equations.
 The scalar equation and momentum equations become coupled in case of an active
scalar, (thus if the baroclinie pressure is included in the momentum equations). In
that case, the scalar advection equation needs to be solved simultaneous with the
momentum equation, rather than after it. However, it seems not to be very necessary
to make the baroclinie pressure gradient implicit, because this term does not lead to
very severe stability restrictions, since internal baroclinie waves move rather slow.
 The open boundary conditions become coupled with the momentum equations. Hence
they need to be solved simultaneously with the momentum equations (rather then be
ing applied after the momentum equations are solved). In principle, this is not a prob
lem (although it depends on the type of boundary condition that is used). Boundary
conditions using radiation criteria or flow characteristics may need to be linearized. A
consequence will be that a sufficient part of the boundary condition code have to be
recoded.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
33
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
34
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Chapter 4
Towards an implicit scheme
The aim of this Chapter is to narrow down the abundance of numerical and physical modelling
possibilities, described in Chapter 2, to a framework within the numerical model will be developed.
Within this process, the numerical and physical path considered in COHERENS , described in
Chapter 3, is taken into account. In a first part, we discuss the physical equations we aim to
tackle within this project, after which the numerical approach is considered.
4.1
Physical equations
In Chapter 2, we pointed out that, in general, three approximations are applied to the ReynoldsAveraged equations of motion and continuity:
Boussinesq, traditional and hydrostatic approximations.
The first and second approximation do not impose severe restrictions to the physical description
of the flow field. Mainly, the Boussinesq approximation filters the acoustic modes, while the tradi
tional approximation implies that the flow field in regions near the Equator will be described less
accurately. On the other hand, the hydrostatic approximation is known to describe the flow field
only crudely when depth variations are significant. A situation which occurs occasionally in the
coastal zone and in estuaries.
Nevertheless, within this project, it is chosen to apply all three approximations such that our gov
erning set of equations consists of hydrostatic momentum equations combined with the continuity
equation, an equation of state and equations describing the transport of the scalars: temperature
and salinity; i.e. we consider equations (16)  (22) of Chapter 2.
As pointed out above, the first two approximations do not impose severe restrictions. Therefore,
we do not discuss the motivation to apply these approximations thoroughly. On the other hand,
applying the hydrostatic approximation could be questionable. For this project, the primary moti
vation to apply also the hydrostatic approximation is that the aim of the project is more to provide a
timeefficient code which describes the flow field reasonably in a large range of situations instead
of a code that is more accurate in some special cases but more timeconsuming. In this respect,
it is obvious that a code which tackles also the nonhydrostatic correction to the flow field is much
more time demanding. Furthermore, we point out that, the general approach to describe also the
nonhydrostatic flow field is first to calculate the hydrostatic flow and then to correct this flow field
with the nonhydrostatic pressure; i.e. by means of the pressure method described in Chapter
2. Hence, our choice of applying the hydrostatic approximation, does not limit us to extend the
model, in future projects, with a nonhydrostatic correction part.
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
(35)  (36) of Chapter 2. The second possibility is to take into account the effects of the short
waves by introducing additional terms into the equations we presently take into account (Warner
e ta l. , 2008).
Research (Haas & Warner, 2009) has been done to compare both approaches which illustrates
that, in general, the model results are comparable. Differences being primarily the result of a
distinct approach to the representation of radiation stresses. Haas & Warner (2009) also describe
that the first approach, probably, will be computationally faster, while the second approach has
the advantage to be able to describe the flow field over a broader range of processes.
Here, we point out that, an effort to improve the description of the flow field, taking into account
the action of short waves, has been done and is currently under taken within a BELSPO project,
see Van Lancker et al. (2009). The merging of this work with the current project appears an
interesting future prospective.
4.2
Numerical approach
To narrow down the numerical approach we will follow in this project, at this point, we need to
make some decisions on the following points:
1. Grid: unstructured  structured,
2. General discretization method: FEM  FVM  FDM,
3. Modesplitting or not?
4. (Semi)implicit method.
Each of these points will be addressed subsequently, leading to a general framework which we will
use to build the implicit numerical code. Here, it is worth to point out that, in our decisionmaking
we consider (1) the efficiency, accuracy and robustness of the method and (2) the feasibility of
implementing the code, taking into account the structure of the present COHERENS code.
4.2.1
As these two points are somewhat related, we discuss them together. The main advantage of
unstructured grids is that they provide flexibility, which is beneficial for complex domains. Both
finite volume and finite element methods allow the use of unstructured grids, while finite difference
methods are restricted to a structured grid.
Although unstructured grids have the intrinsic advantage of flexibility, since the present COHE
RENS code is structured, we suggest, within this project, to keep this feature and develop an
implicit code on a structured grid. Next to the motivation that the present COHERENS code is
structured, it is worth to point out that the disadvantage in flexibility can be reduced by applying
a coordinate transformation; in the horizontal into curvilinear coordinates and into scoordinates
in the vertical. This coordinate transformation is already used in COHERENS and we propose
to retain this feature in the upcoming implicit code. Remark that presently COHERENS uses
orthogonal curvilinear coordinates, which enhances already the flexibility of the code. A further
reduction of the limitations due to the use of structured grids could be achieved by introducing
general curvilinear coordinates. This could be an interesting enhancement in future projects.
Chosing for a structured grid, the main advantage of the finite element method drops such that,
taking into account that the finite element method generally results in large size matrix calculations
(and therefore is less efficient), we foresee to implement the model equations by means of a finite
volume method (FVM) and/or finite difference method (FDM). The choice between these two
methods is not yet made at this point, since on a structured grid these methods do not differ much
from each other. Moreover, it could be beneficial to use FVM for a particular set of equations and
FDM for another. In Chapter 5, this point will be discussed.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
36
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
4.2.2
Modesplitting or not
As pointed out in Chapter 2, the primary numerical motivation to use the modesplitting approach,
is that it provides a relatively competitive scheme when explicit timestepping methods are used.
This is because the system of equations which suffers the most severe timestepping restriction
(the barotropic mode) is less complex than the full threedimensional equations. Therefore, solv
ing the barotropic mode explicitly (even with very little time steps A s) is still feasible. Then, cou
pling the free surface evolution derived from the barotropic equations with the threedimensional
set of equations, and solving the latter also explicitly with a larger time step A provides, as a
whole, still a reasonable scheme.
The gain of this approach is quantified in Chapter 3. In particular, it is described that the maximum
mode splitting that can be used is
S
T A p2 D2 < H M
<4 1>
indicating that the modesplitting is efficient when deep water conditions are considered, while
in rivers and estuaries the approach will provide only a limited gain. Therefore, as discussed in
Chapter 2, retaining the modesplitting approach and making only the barotropic mode implicit
would not improve the calculation time considerably. This suggests that within the modesplitting
scheme both the barotropic and the baroclinie mode should be made implicit to reduce signifi
cantly the calculation time.
In addition to this remark, we point out that the difference in workload between making the
barotropic mode implicit and making immediately the full threedimensional equations implicit is
not excessive. This can be understood by considering that both the barotropic mode and the full
threedimensional hydrostatic equations consist of three equations; i.e. two horizontal momentum
equations and an equation that describes the free surface elevation.
Finally, it is remarked that introducing an implicit timediscretization to the barotropic mode, could
induce some nontrivial issues when the barotropic mode is coupled to the baroclinie mode.
Taken together the above described considerations, we suggest to discretize the full threedimensional
hydrostatic equations implicitly. Thus, to eliminate the modesplitting while introducing an implicit
timediscretization. Nevertheless, remark that, when modifying the code, we intend to retain for
the user an option to use the modesplitting scheme (with explicittime stepping). The advan
tage of this suggestion is that backward compatibility is assured. The disadvantage, however, of
maintaining both approaches in the code is that it may lead to a double maintenance of the code,
and will induce a significant larger effort when new developments are implemented. Therefore,
we suggest that a future project concentrates on the comparison of the performance of both ap
proaches for several cases. If, from this study, it appears that one of the two models performs
better in most of the cases, we suggest to remove the other at that stage.
4.2.3
Two conceptual approaches are available to solve numerically the flow field we consider. Sche
matically, after discretizing the equations we will have to solve the system Ax = b. One approach
consists of applying advanced iterative methods to solve the inversion of the matrix A like the conjugent gradient method. A second method is to split the governing set of equations into several
subsets of discretized equations which are subsequentially solved. In each subset only one phys
ical direction is taken implicitly such that the matrix inversion can be performed more efficiently.
This approach is called the ADI method. In Table 4.1, we summarize the advantages and disad
vantages of each approach. It appears that both the ADI and the iterative methods have particular
advantages for certain aspects. Mainly, iterative methods have as advantage that they are more
accurate, probably more efficient and provide an easier scheme to parallelize the code, in future
projects. On the other hand, the ADI method essentially is more transparent to implement. From
both approaches, we choose to pursue the iterative approach. The primary motivation for this
is that iterative methods will allow an easier implementation of the parallelization of the code. In
fact, the performance of the ADI method and iterative methods can be comparable w rt accuracy
and efficiency. Also, we note that the efficiency of an iterative solver highly depends on the use of
appropriate preconditioners, a choice which is not trivial and requires much attention.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
37
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
+
+
+
ADI
easy to implement
available experience to
implement this scheme
available libraries
in COHERENS
+
+
Iterative solver
more accurate
efficient solver (less
computation time for
each computation time step)
better adapted
to parallelize
difficult to implement
Table 4.1: Advantages and disadvantages o f the A D I scheme and the C onjugent Gradient method.
Finally, we remark that the implementation of an iterative method is not straightforward and a
challenging task. Nevertheless, we choose for the iterative method as it will provide a more
advanced tool to reduce computation time by parallelization, next to the implementation of the
implicit description of the free surface gradient.
4.3
In this section we have presented several arguments to narrow down the abundance of numerical
and physical modeling possibilities to the framework within we will develop the numerical model.
In summary, we will describe the flow field by means of
1. Reynoldsaveraged momentum and continuity equations (together with scalaradvection
equations and an equation of state) which apply the Boussinesq, traditional and hydrostatic
approximation.
2. The discretization on a structured grid, by means of orhogonal curvilinear and scoordinates
will be maintained.
3. The choice to discretize the terms with Finite Volume Methods or Finite Difference Methods
will be done in upcoming sections.
4. It is intended to implement the full 3D flow and remove the mode splitting. For backcompatibility, the modesplitting option, nevertheless, is suggested to remain present in the
code, for the moment. If, from further studies, it is found that the modesplitting option is
less performant, we propose to remove this option for the user.
5. From a comparison between implicit methods to resolve numerically the flow field, it is found
that an iterative method is more appropriate.
Although in this Chapter, we have taken a substantial step to narrow down our approach to de
scribe numerically the flow field, in the upcoming Chapter still some steps need to be taken.
Primarily, it should be specified how each term is discretized. Besides, attention should be given
on how the boundary conditions will be taken into account.
Finally, in this Chapter, some interesting suggestions for future development of the code came
apparent:
1. It appears an interesting prospective to account for the influence of short waves on the flow
field.
2. An evaluation of the performance of the present model with the foreseen code is an appeal
ing future task.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
38
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Chapter 5
An overview of the code implementation in Coherens V2
5.1
Introduction
In this chapter an overview is given of the implementation of numerical schemes into the COHE
RENS code. This overview is by no means meant to be exhaustive or very detailed. Instead, its
main purpose is to form a guide in the selection of the implicit code to be implemented in CO
HERENS and a guide to the proper implementation into the code. Some indications will be given
concerning the implication of the current structure regarding the implementation of the implicit
code. A complete and very detailed overview of the numerical schemes and the code structure of
COHERENS can be found in the Coherens V2 User and Reference Manuals.
The main structure of the code related to the numerical schemes is described starting from the
general structure up to the details of the specific routines, including a brief description of their
aims and composition.
5.2
The COHERENS code is structured in several subroutines focusing on several objectives (e.g.
numerical scheme, reading of input data, writing of output, etc). The following description is
strictly oriented to the numerical schemes present in the current version of COHERENS , they are
listed as follows:
coherens_main
hydrodynamic.equations
current_2d
current_pred
currentcorr
This structure is illustrated in Figure 5.1, where it is possible to observe the degree of depen
dencies of the main subroutines used for the calculation of the hydrodynamic equations. Starting
from the subroutines for the solution of the hydrodynamic equations, up to the subroutines for the
solution of the advection diffusion terms.
5.2.1
coherens_main is the main routine of the model. This routine is oriented to call all the subroutines
of COHERENS , from the opening of input files, up to the printing of results. The structure of this
routine is depicted in Figure 5.2.
The main subroutine related with the numerical schemes is hydrodynamic_equations. This sub
routine is called in all the processes, depending on the flags or switches activated by the user (2D
or 3D simulation), this subroutine will call three other subroutines for the numerical calculations:
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
current_2d, current_pred and current_corr. The main feature of the general scheme of COHE
RENS , is the definition of a time loop for the solution of the hydrodynamic equations (where nt
is the number of time steps). Before the the initialisation of the time loop, COHERENS defines
arrays and variables to be used during the whole simulation (see Figure 5.3).
The subroutines called before the time loop are described as follows:
default_grid
: Mean water depth flows (bathymetry data) are read from the data provided by
the user and assigned to the global array depmeanglb. This array is used for
uniform and varying bathymetries.
defineJocaLgrid: Mean water depth flows are read from the global array depmeanglb and as
signed to the specific arrays for C and U V nodes: depmeanatc, depmeanatuv.
pointer_arrays
: Land mask functions are initialised in order to determine if the grid cells are wet
or dry, with the objective to mask out dry grid cells. They are a function of a
minimum water depth defined by the user. These functions are defined for CU and ynodes: nodeatc, nodeatu and nodeatv.
depth_at_nodes : Reads the specific array of mean water depth flow defined at Cnodes and as
signs its values to arrays for the U and ynodes: depmeanatu and depmeanatv.
water.depths
: Initialisation and calculation of the total water depths, and their assignations
to global arrays for total water depth at C U V  and U V nodes: deptotatc,
deptotatu, deptotatv and deptotatuv.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
40
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
tim e _ a v e ra g e s
In itia lis e m o d e l o u tp u t
ia rm o n ic _ a n a ly s is
u s r d e f_ o u tp u t
w r ite _ p h s ic s
u p d a te _ tlm e
yes
m e te o _ in p u t
e q u a tlo n _ o f_ s ta te
yes
p re d s te p ?
b a ro c lln lc _ g r a d le n t
current_pred
hydrodyna mi c_ equations
yes
te m p e ra tu re _ e q u a tlo n
s a lin ity _ e q u a tlo n
M o d e l O u tp u t
n t < nstep
Inside the time loop, the subroutine m askJunction is called. This subroutine focuses on the dy
namic updating of the mask funtion defined previously, with the aim of activating or deactivating
grid cells during the simulation. The objective of the dynamic activation/deactivation is the sim
ulation of flooding/drying processes. This mask is defined in function of the kind of simulation.
For 2D simulations, this subroutine is called at the beginning of the time loop, while for 3D simu
lations, it is called after the predictor step. This difference is related to the use of different time
steps (splitting mode).
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
41
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
d e fa u lt_ g r ld
d e fn e _ lo c a l_ g r ld
p o in t e r_ a rra y s
d e p th _ a t_ n o d e s
a te r_ d e p th s
u p d a te _ tim e
c u re n t_ p re d
hydrodynamic_eqi
a te r_ d e p th s
M o d e l O u tp u t
n t < nstep
Figure 5.3: Structure o fc o h e re n s .m a in routine with definitions o f arrays and the specification o f the dynamic
m ask function
5.2.2
Subroutine hydrodynamic_equations
This subroutine is located in the Hydrodynamic.Equations.f90 file, and is called by the coherens_main routine. Depending on the selection made by the user, this subroutine is oriented to
call the three main routines for 2D and 3D simulations. The structure of this subroutine is depicted
in Figure 5.4
The specification of the switches iopt_mode_3D and iopt_mode_2D will determine the type of simu
lation. For the case of a 3D simulation, the mode splitting technique is applied, and the calculation
is performed in two steps: the predictor step and the corrector step.
5.2.3
This subroutine is located in the Hydrodynamic.Equations.f90 file, and is called by the hydrodynamic_equations subroutine. The twodimensional hydrodynamic equations are solved by this
subroutine, following the numerical scheme explained in the previous chapter. The general struc
ture of this subroutine is depicted in Figure 5.5.
This subroutine performs internal calculations to solve some of the terms of the continuity and
momentum equations for 2D. On the other hand, makes external calls for other terms (advection
diffusion) which need further calculations. As ilustrated in Figure 5.5, red frames refer to internal
calculations while black frames refer to external calls of subroutines. The details are given as
follows:
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
42
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
hydrodynamic_equations
yes
iopt_mode_3D = 1
current _pred
no
yes
no
yes
iopt_mode_3D = 1
no
RETURN
Initialisation
update_2dobc_data
Data for open boundary conditions in 2D mode are read from the
arrays provided by the user.
surface.elevation
Atm ospehric pressure gradient Calculates the atmospheric pressure gradient term of the mo
mentum equations.
Surface slope
Baroclinie
Bottom stress
Surface stress
transport_at_U_2d
transport_at_V_2d
open_boundary_conds_2d
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
43
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
m a s k a tu
m a s k a tv
m a s k a r r a y s f o r la n d b o u n d a r i e s
u p d a te _ 2 d o b c _ d a t
a tm o s p h e ric p re s s u re g ra d ie n t
s u rfa c e slo p e
b a ro c lin ie
a s tro n o m ic a l tid a l force
b o tto m s tre s s
s u rfa c e s tre s s
tr a n s p o r t _ a t_ U _ 2 d
tr a n s p o rt_ a t_ V _ 2 d
E x c h a n g e h a lo s e c tio n s (M P I)
E x c h a n g e h a lo s e c tio n s (M P I)
2d
E x c h a n g e h a lo s e c tio n s (M P I)
D e p th m ean c u rre n ts
F ilte re d c u rre n ts
C o rre c to r s te p fo r 2D
>pt_nests
u p d a te _ n e s t_ d a ta _ 2 d
RETURN
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
44
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Filtered currents
bottom_stress
surface .stress
update_nest_data_2d
5.2.4
This subroutine is located in the Hydrodynamic.Equations.f90 Fortran file, and is called by the
hydrodynamic_equations subroutine. The threedimensional hydrodynamic equations are solved
by this subroutine following the numerical scheme explained in the previous chapter. The general
structure of this subroutine is depicted in Figure 5.6.
This subroutine performs internal calculations to solve some of the terms of the momentum equa
tions for 3D in the predictor mode. In addition, it makes external calls for other terms like the
advection diffusion terms, which need further calculations. As ilustrated in Figure 5.6, red frames
refer to internal calculations while black frames refer to external calls of subroutines. The details
are given below:
Initialisation
update_1 sur.data
: Data for open boundary conditions in 1D mode are read from the
arrays provided by the user.
Surface slope
Baroclinie
Bottom stress
transport_at_U_3d
transport_at_V_3d
5.2.5
This subroutine is located in the HydrodynamiCEquations.f90 Fortran file, and is called by the
hydrodynamic_equations subroutine. The threedimensional hydrodynamic equations are solved
by this subroutine, following the numerical scheme explained in the previous chapter. The general
structure of this subroutine is depicted in Figure 5.7.
This subroutine performs internal calculations to solve some elements of the momentum equa
tions for 3D in the corrector mode. Like in the previous step, makes external calls for other
elements which need further calculations. As ilustrated in Figure 5.7, red frames refer to internal
calculations while black frames refer to external calls of subroutines. The details are given as
follows:
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
45
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
c u rr ent_pred
m a s k a tu
ma s k a r r a y s f o r l and b o u n d a r i e s
m a skatv
update_ldsur_data
s u rfa c e slo p e
a s tro n o m ic a l tid a l force
b a ro c lin ie p re s s u re
transport_at_U_3d
tr a n s p or t _ a t _ V _ 3d
E x c h a n g e h a lo s e c tio n s (M P I)
E x c h a n g e h a lo s e c tio n s (M P I)
D e p th in te g ra te d c u rre n ts
RETURN
Initialisation
update_profobc_data
: Data for open boundary conditions in 3D mode are read from the
arrays provided by the user.
open_boundary_conds_3d
define_profobc_spec
update_profobc_spec
: Data for open boundary conditions in 3D mode are read from the
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
46
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
u p d a te _ p ro fo b c _ d a ta
o p e n _ b o u n d a ry _ c o n d s _ 3 d
open boundaries
d e fin e _ p r o fo b c _ s p e c
p h y s ic a l_ v e r tic a l_ c u r r e n t
u p d a te _ p ro fo b c _ d a ta
yes
u p d a te _ n e s t_ d a ta _ 3 d
u p d a te _ n e s t_ d a ta _ 3 d
Baroclinie current
Open boundaries
Relaxation schemes
transf_vertical_current
physicaLverticaLcurrent
bottom_stress
surface .stress
5.3
5.3.1
The current_2d subroutine solves the continuity and momentum equations for 2D.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
47
T H V IM D C S o resm a
i.s .m. KU Leuven, UG ent, BMM en W LB
/m
^ AT9Z/
( ^ 1  U i1)  % (^+1  V f )
(5.1)
where the variables and arrays used by the Fortran code are defined by:
C = zeta
A T 2D = delt2d
a x = delxatc
oty = delyatc
U = udvel
V = vdvel
The complete sequence of the solution is described as follows:
1. Calculation of the surface elevation for Xdirection
2. Calculation of the surface elevation for Ydirection
3. Exchange of data for parallel computing through the exchange of halo sections
4. Updating of the total water depths by calling the subroutine water.depths
5. Calculation of the alphafactor for flooding/drying processes based on the water depths
Solution of the momentum equations
The next step is the solution of the momentum equations, here is given the discretized equation
of momentum for U\
T jm
\1
T jm
= _ ( ^ ) + (L T ")
A d v e c tio n
D iffu s io n
Hm
T JP '\
TJp
U
+
ry r>
HnJ
C o rio lis ; e x p lic it d is c re tiz a tio n
Fn
+ pm + 1 +
b a ro c lin ie p re s s u re g ra d ie n t
tid a l fo rc e
+ a gradCm+1 +
^
gradPQ
m+1
w a te r level g ra d ie n t
s u rfa c e s tre s s
A tm o s p h e ric p re s s u re g ra d ie n t.
 5 A n + 5D n
' 
V '
(5.2)
where the variables and arrays used by the Fortran code in the subroutine are defined by:
A (U m) = solved by transport_at_U_2d
D (U m) = solverd by transport_at_U_2d
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
48
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
k n/ m = bfricatu
f v m = coriolatu
= sourceatu
f +1 = sourceatu
r 1 = usstresatu
PQ
m+1 = atmpres
Time integration without operator splitting, this is performed with the following items:
Initialisation
Calculation of the advection term (calls the subroutine Xadv_at_U_2d)
Calculation of the diffusion term (calls the subroutine Xdif_at_U_2d)
Calculation of explicit terms
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
49
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
50
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
5.3.2
u n
= 
a t 3D
A h (un )
D h(un )
H o riz o n ta l a d v e c tio n
0Dv(i,n+1) +
(1 
H o riz o n ta l d iffu s io n
0)Av(un) + 0Dv(un+1) +
 o g r a d i"
w a te r level g ra d ie n t
(1 
0)Av(i
/grade"
a tm o s p h e ric p re s s u re g ra d ie n t
B a ro c lin ie p re s s u re g ra d ie n t
F1+1 +
T id a l fo rc e
fv ^
(5.3)
where the variables and arrays used by the Fortran code in the subroutine are defined by:
A h ( u n ) = solved by transport_at_U_3d
D h ( u n ) = solverd by transport_at_U_3d
A T 3D = delt3d
u n = uvel
Vn = w e l
f v m = coriolatu
= sourceatu
f +1 = sourceatu
The complete sequence of the solution is described as follows:
1. Allocate of arrays
2. Initialisation of masks and arrays and update of boundary conditions
3. Calculation of the atmospheric pressure gradient
4. Calculation of the surface slope term, taking into account the presence of flooding/drying
processes
5. Calculation of the astronomical tidal force term
6. Calculation of the baroclinie pressure term
7. Calculation of the explicit part of the Coriolis term
8. Calculation of the bottom stress term
9. Solution of the advection diffusion terms
10. Calculation of the implicit part of the Coriolis term
11. Exchange of data for parallel computing through the exchange of halo sections
12. Addition of implicit corrections
13. Exchange of data for parallel computing through the exchange of halo sections
14. Calculation of the depthintegrated currents
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
51
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Calculation
Calculation
Calculation
Application
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
52
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
53
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
5.3.3
This subroutine is called after the calculations performed by the predictor step and the 2D equa
tions. The complete sequence of the calculations performed in this subroutine is described as
follows:
1. Allocate of arrays
2. Initialisation of open boundary conditions on the first call, this operation is performed before
entering the time loop
3. Opening of boundary conditions, this computation is performed inside the time loop
4. Initialisation of masks based on the status of the grid cells for wet/dry conditions
5. Calculation of the corrected baroclinie current
6. Calculation of the corrected and filtered currents
7. Exchange of data for parallel computing through the exchange of halo sections
8. Calculation of the transformed and physical vertical currents
9. Update of the bottom and surface stresses
10.
5.3.4
Scalar transport equations (temperature and salinity) are solved after the computation of the hy
drodynamic equations (see Figure 5.2, they are performed by the subroutines temperature_equation
and salinity_equation, both of them are being called by the main program. These subroutines are
located in the DensityEquations.F90 Fortran file.
The discretized equation of the scalar advection diffusion is used for the calculation of the scalar
values (e.g. temperature and salinity). This equation (without operator splitting) is described as
follows.
Lll+l _ L11+ 1
w
w
=
A T3 D
 A h( r ) + D h( r )
H o riz o n ta l a d v e c tio n a n d d iffu s io n .
S e m i im p lic it v e rtic a l te rm s .
CW 2
C o rre c to r te rm s , e x p lic it
(5.4)
S o u rc e te rm , e x p lic it
The calculation for salinity and temperature differs slightly for the calculation of some terms.
However, the main calculation of the advection diffusion is performed by the subroutine transport_at_C_3d.
The complete sequence of the solution for salinity is described as follows:
1. Initialisation of boundary conditions for the first call, this is performed before entering
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
54
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
6. Exchange of data for parallel computing through the exchange of halo sections
7. Writing at nest location when nesting is required
The complete sequence of the solution for temperature is described as follows:
1. Initialisation of arrays and boundary conditions for the first call, this is performed before
entering to the time loop
2. Opening of the boundary conditions, this is performed inside the time loop
3. Calculation of the radiative source term, this is performed by the subroutine solar_irradiance
4. Application of the surface boundary conditions for: Neumann and Dirichlet conditions
5. Solution of the advection diffusion terms  calling of subroutine transport_at_C_3d
6. Application of the freezing point limit
7. Exchange of data for parallel computing through the exchange of halo sections
8. Writing at nest location when nesting is required
The complete sequence of the solution for the advection diffusion term (subroutine transport_at_C_3d) is described as follows:
1. Initialisation of arrays and boundary conditions for the first call, this is performed before
entering to the time loop
2. Calculation of the corrector term, this is performed by the subroutines Xcorr_at_C,
Ycorr_at_C and Zcorr_at_C
3. Time integration without operator splitting, this is performed with the following items:
 Initialisation
 Calculation of the time derivative
 Calculation of the source term
 Calculation of the advection term by calling the subroutines: Xadv_at_C, Yadv_at_C
and Zadv_at_C
 Calculation of the diffusion term by calling the subroutines: Xdif_at_C, Ydif_at_C
and Zdif_at_C
 Update of the scalar quantity
4. Time integration with operator splitting step A, this is performed with the following
items:
 Calculation of the Xderivative terms (calls the subroutines Xadv_at_C and Xdif_at_C)
 Calculation of the Yderivative term (calls the subroutines Yadv_at_C and Ydif_at_C)
 Calculation of the Zderivative source terms: time derivative, vertical advection
(subroutine Zadv_at_U) and vertical diffusion (subroutine Zdif_at_U)
5. Time integration with operator splitting step B, this is performed with the following
items:
 Calculation of the Zderivative source terms: time derivative, vertical advection
(subroutine Zadv_at_U) and vertical diffusion (subroutine Zdif_at_U)
 Calculation of the Yderivative term (calls the subroutines Yadv_at_C and Ydif_at_C)
 Calculation of the Xderivative terms (calls the subroutines Xadv_at_C and Xdif_at_C)
6. Update of the scalar quantity
7. Application of a relaxation scheme
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
55
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
5.3.5
The discretization of equations for turbulence are quite similar to the equations for scalars. One
of the main differences is that turbulence equations are solved before the momentum equa
tions. According to the structure of the main routine of COHERENS , the equations for tur
bulence are solved by the subroutine vertical_diff_coefs, this surboutine is located in the Diffusion.Coefficients.F90 Fortran file. The objective of this subroutine is the selection of the turbu
lence model (turbulence equations) to be used in the calculation of the vertical diffusion term.
The present review is oriented to make a description of the k  e turbulence model, considering
that this model is the most complex present in the current version of COHERENS .
The k  e turbulence model is solved by the subroutine dissipation.equation, this subroutine is
located in the Turbulence.Equations.F90 Fortran file. This file contains all the turbulence models
used in COHERENS .
The complete sequence of the calculations for the mentioned turbulence model is described as
follows:
1. Allocate of arrays
2. Initialisation of diffusion coefficients
3. Calculation of the vertical diffusion coefficient
4. Application of the boundary conditions at the bottom and surface
5. Calculation of the source/sink terms
6. Solution of the transport equation by calling the subroutine transport_at_W
7. Calculation of the dissipation at the bottom and surface
8. Application of lower limits for the calculation of the dissipation
9. Exchange of data for parallel computing through the exchange of halo sections
The transport_at_W subroutine is oriented to solve the advection diffusion equation for turbulence
models. This subroutine is located in the Transport.Equations.F90 Fortran file. Here is presented
the complete sequence of computations:
1. Initialisation, this procedure is performed with the following sequence:
Initialisation of array shapes
Initialisation of time integration terms
Initialisation of allocatable arrays
Initialisation of mask for land boundaries
Initialisation of dirichlet boundary conditions at the surface and at the bottom
Initialisation of local arrays
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
56
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Initialisation
Calculation of the time derivative
Calculation of the source and sink terms
Calculation of the advection term by calling the subroutines: Xadv_at_W, Yadv_at_W
and Zadv_at_W
Calculation of the diffusion term by calling the subroutines: Xdif_at_W, Ydif_at_W and
Zdif_at_W
Update of the scalar quantity
4. Time integration with operator splitting step A, this is performed with the following items:
Calculation of the Xderivative terms (calls the subroutines Xadv_at_W and Xdif_at_W)
Calculation of the Yderivative term (calls the subroutines Yadv_at_W and Ydif_at_W)
Calculation of the Zderivative source terms: time derivative, vertical advection (sub
routine Zadv_at_W) and vertical diffusion (subroutine Zdif_at_W)
5. Time integration with operator splitting step B, this is performed with the following items:
Calculation of the Zderivative source terms: time derivative, vertical advection (sub
routine Zadv_at_W) and vertical diffusion (subroutine Zdif_at_W)
Calculation of the Yderivative term (calls the subroutines Yadv_at_W and Ydif_at_W)
Calculation of the Xderivative terms (calls the subroutines Xadv_at_W and Xdif_at_W)
6. Update of the scalar quantity
5.4
The numerical implementation of open boundary conditions in COHERENS extends from the
specification of general setups for open boundaries to the definition of open boundary conditions
for 2D mode and 3D mode. However, the specification of coastal boundary conditions, takes
place internally, according to the specification of dry and wet grid cells, where dry grid cells will
correspond to land zones.
5.4.1
General parameters are referred to general input data read by the model to setup the open boun
dary conditions in a specified area. Three main routines are used for the specifications: usrdef_mod_params, usrdef_grid and usrdef_phsics. They are part of the main file Usrdef.Model.f90.
usrdef_mod_params: Here are defined the number of open sea boundaries at U and Ynodes
(nosbu,nosbv), and the number of river boundaries at U and Ynodes (nrvbu,nrvbv).
usrdef.grid
: Here are defined the grid indices in the Xdirections of open boundary points
at U and Ynodes (iobu,iobv), and the grid indices in the Ydirections of
open boundary points at U and Ynodes (jobu,jobv).
usrdefphsics
: Here are defined the storage arrays used in case the boundary conditions
at specific nodes require the solution of a differential equation in time. For
2D mode they are given by obc2uvatu(nobu,2) and obc2uvatv(nobv,2) for
U and Yopen boundaries respectively. For 3D mode they are given by
obc3uvatu(nobu,2) and obc3uvatv(nobv,2) for U and Yopen boundaries
respectively.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
57
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
5.4.2
Two main groups are identified for the implementation of open boundary conditions in 2D mode.
The first one refers to the specifications and boundary data provided by the user in the UsrdeLM odel.f90 Fortran file, and the second refers to the internal variables and arrays used to
solve the hydrodynamic equations.
The variables and arrays provided by the user, are defined in two subroutines: usrdef_2dobc_spec
and usrdef_2dobc_data. The former refers to the specification of the type of the boundary condi
tions for 2D mode, and the latter refers to the input of open boundary data for the 2D mode.
The attributes of open boundary data are stored in modfiles(io_2uvobc,ifil,1) where ifil takes values
of 2 up to nofiles (number of files) if more than one open boundary data file is needed. For the
external values of currents and flow depths, the nonharmonic part is defined in usrdef_2dobc_data
usually as time series, while the amplitudes and phases are timeindependent and should be
defined in usrdef_2dobc_spec.
The general structure of the implementation of open boundary conditions in 2D mode is illustrated
in Figure 5.8. Two parts are identified in the structure, the initialisation of the data and the appli
cations of boundary data on the solution of hydrodynamic equations. The initialisation is specified
as follows:
>d_p;
d e p th _ a t_ n o d '
depths
ip d a te _ 2 d o b c _ d a t;
( flo o d in g 2d)
i p d a te _ 2 d o b c _ d a ta
h y d ro d y i
M o d e l O u tp u t
n t < nstep
Figure 5.8: Structure o f the implem entation o f open boundary conditions in 2D mode
Usrdef_Model.90
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
: Flere, all the parameters, specifications and data of the open boundaries in
2D mode are provided by the user. The variables and arrays are called by
58
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
The number of open boundaries are read and assigned to the global vari
ables nobu and nobv, which are the total (open sea and river) number of
open boundary points at U and Vnodes respectively.
default.grid
Mean water depth flows are read from the data provided by the user and
assigned to the global array depmeanglb, for uniform varying bathymetries.
defineJocaLgrid
Mean water depth flows are read from the global array depmeanglb and
assigned to the specific arrays for C and U V nodes: depmeanatc, depmeanatuv.
open_boundary_arrays: Variables and arrays read from the input are assigned to local processes
by the specification of internal variables/arrays for the locations of the
open boundaries and the number of open boundary points.
pointer_arrays
Land mask functions are initialised, in function of the minimum water depth
already defined, for C U and Vnodes: nodeatc, nodeatu and nodeatv.
The orientation of the open boundary cell faces is determined and as
signed to variables westobu and soutobv.
depth _at_nodes
Mean water depth flows are read from the specific array of mean water
depth flow at Cnodes and assigned to arrays for U and Vnodes: depmeanatu and depmeanatv.
water.depths
Initialisation and calculation of the total water depths, and their assigna
tions to global arrays for total water depth at C U V  and t/V nodes:
deptotatc, deptotatu, deptotatv and deptotatuv.
update_2dobc_data
Data for open boundary conditions in 2D mode are read from the arrays
provided by the user and stored previously. A general structure of this rou
tine is depicted in Figure 5.9. Flere the specifications and data of boun
dary conditions provided in usrdef_2dobc_spec and usrdef_2dobc_data are
read and updated in function of the solution of the hydrodynamic equa
tions. Two routines are called: define_2dobc_spec and define_2dobc_data.
Besides, This routine is called by current_2d, for the solution of the hydrodynamic equations.
define_2dobc_spec
define_2dobc_data
Arrays modfiles(io_2uvobc,ifil,1) for (ifil > 1) are open on first call and read
the data provided by the user, assigning specifications for outflow condi
tions at river boundaries.
open_boundary_conds_2d: Applies the open boundary conditions for 2D mode, verifying the type
of boundary condition assigned to each open boundary point. This routine
is called by current_2d, for the solution of the hydrodynamic equations.
5.4.3
Like in the previous mode, two main groups are identified for the implementation of open boundary
conditions in 3D mode. The first one refers to the specifications and boundary data provided by
the user in the UsrdeLModel.f90 file, and the second refers to the internal variables and arrays
used to solve the hydrodynamic equations.
Variables and arrays provided by the user, are defined in two subroutines: usrdef_profobc_spec
and usrdef_profobc_data. The former refers to the specification of the type of the open boundary
conditions for 3D mode, and the latter refers to the input of open boundary data for the 3D mode.
The attributes of open boundary data are stored in modfiles(io_3uvobc,ifil,1) where ifil takes values
of 2 up to nofiles if more than one open boundary data file is needed. For the external values
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
59
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
update_2dobc_data
yes
define_2dobc_spec
Al locate arrays
Initialise
Checks:
Data in h a r m o n i c f o r m ?
Extern al data pr ovi ded ?
Data a v a i l a b l e i f n e e d e d ?
L o o p : i f il, no f i l e s
Read:
Prescribed transport
Elevation s at U,V nodes
ye s
Evaluate data
of currents and flow depths, the nonharmonic part is defined in usrdef_profobc_data usually as
time series, while the amplitudes and phases are timeindependent and should be defined in
usrdef_profobc_spec.
The general structure of the implementation of open boundary conditions in 3D mode is illustrated
in Figure 5.10. Two parts are identified in the structure, the initialisation of the data and the
applications of boundary data for the solution of hydrodynamic equations. The subroutines are
detailed as follows:
The main difference with 2D mode is the calling of the subroutine current_corr at the initialisation
procedure. This subroutine is divided in two parts, the initialisation part and the application of the
open boundary conditions to the solution of the hydrodynamic equations. The first part is called at
the initialisation stage, to define the arrays for the boundary conditions and for an update at initial
time. Thus, two subroutines are called: define_profobc_spec and update_profobc_data.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
60
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
d_p;
depth_at_
ipdate_profobc_
( f l o o d i n g 2d)
M o d e l O u tp u t
n t < nstep
: Arrays modfiles(io_3uvobc,ifil,1) for (ifil > 1) are open on first call and read
the data provided by the user.
update_profobc_data : Data for open boundary conditions in 3D mode are read from the arrays
provided by the user and stored previously. A general structure of this rou
tine is depicted in Figure 5.11. Flere the specifications and data of boun
dary conditions provided in usrdef_profobc_spec and usrdef_profobc_data
are read and updated in function of the solution of the hydrodynamic equa
tions. The two previous subroutines are called: define_profobc_spec and
define_profobc_data.
open_boundary_conds_3d: Applies the open boundary conditions for 3D mode, verifying the type
of boundary condition assigned to each open boundary point. This sub
routine is called by current_corr, for the solution of the hydrodynamic equa
tions.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
61
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
updateprofobcdat
Read:
P rescribed transport
L o o p : i fil, n o f i l e s
E le v a tio n s at U ,V nodes
no
defineprofobcdat
yes
defineprofobcdat
E v a lu a t e data
5.4.4
Coastal boundaries are imposed internally by the model. The definitions are made by routines
called for the solution of the hydrodynamic equations. Here is analyzed the case for 2D mode.
For 3D mode, the structure is analogous.
The solution of hydrodynamic equations in 2D mode is made by the subroutine current_2d. The
calculation of U and V currents is made by the subroutines transport_at_U_2d and transport_at_V_2d.
The advection and diffusion terms of the hydrodynamic equations are solved by the above men
tioned subroutines. Four specific subroutines are called for the solution process: Xavd_at_U_2d,
Yavd_at_U_2d, Xdif_at_U_2d and Ydif_at_U_2d for Unodes; and, Xavd_at_V_2d, Yavd_at_V_2d, Xdif_at_V_2d
and Ydif_at_V_2d for ynodes.
The main characteristic of these subroutines is the use of logical flags, which depend on the
status of Land Mask Functions. These flags become TRUE for grid cells defined as w et, where
the Land Mask Function is equal to one.
Thus, these flags (maskatu, maskatv and maskatc) are used to perform further calculations. In
the present case, at the initialisation process, it is imposed for land cells (where flags are FALSE)
that fluxes are set to zero.
5.5
The basic elements for parallel computing are referred mainly to the use of the MPI external library
, the implementation of this library presents the following features:
W ork load is divided among a given number (Np) of processes.
It uses nonshared memory, i.e. each process does not share its own memory with the other
processes.
The global domain is divided in N p horizontal subdomains (no decomposition in the verti
cal).
To solve the discretised equations in the horizontal, communications need to be set up
between neighbouring domains.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
62
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Communication is handled by the routines of the MPI (Message Passing Interface) library.
Current implementation is Version 1.1.
MPI routine calls are only found in commsMPI.F90 (with one exception). Each MPI routine
call (starting with MPL) has a corresponding alias (starting with comms_). This allows a
more efficient implementation of future MPI versions.
5.5.1
Domain decomposition
The second element is referred to domain decomposition, which presents the following features:
Process domains are arranged as 2D grid with dimensions nprocsx and nprocsxy where
nprocsxxnprocsy (total number of processes).
Domains with land points only can be excluded from the grid so that nprocsxxnprocsy>nprocs.
Each domain has a process id number between 0 and nprocs1 and two domain grid indices
(i,j) where 1<i<nprocsx, 1<j<nprocsy. Dummy (land) domains are defined with a NULL
process id (MPI_proc_null).
W ork load is evenly partioned between the subdomains (except that the domains are not
of the same size). Exception is the master process which is the only one with write access.
Reading is performed by all processes (except defined otherwise by the user).
For local grid indexing system, grid cells are indexed in the same way as the global grid. The
local grid dimensions are ncloc and nrloc. The most eastern column and most northern row are
no longer composed of dummy land points.
Local computational grid
nrloc
ncloc
si
Figure 5.12: C grid indices.
The local grid dimensions and indices are related to the global ones through the following definifions:
ncloc
nrloc
n d lo c
nc2loc
n rllo c
nr2loc
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
63
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
nc1 procs(nprocs) Array with values of nc1 loo for each domain (global)
nc2procs(nprocs) Array with values of nc2loc for each domain (global)
nr1 procs(nprocs) Array with values of nr1 loo for each domain (global)
nr2procs(nprocs) Array with values of nr2loc for each domain (global)
Domain decomposition is uniquely defined by these last 4 process arrays. Two options are
available:
1. Simple decomposition: the user specifies the values of two of the three parameters nprocs,
nprocsx, nprocsy. The arrays are defined internally.
2. The arrays are defined externally by the user.
Global and local indices (at any node) are then related by
iglb = iloc + nclloc  1
jglb = jloc + nrlloc  1
5.5.2
Halos
Numerical discretisations may require the availability of values of a model array located at grid
points within a neighbouring subdomain.
These values are calculated, not inside the domain itself, but within its neighbours. They are
obtained by means of (MPI) communications between the domain and its neighbours. Each
neighbour sends a section of the array which is received and stored by the domain in one of the
arrays halo sections.
A halo is created by adding extra columns and rows to the model array. Most arrays have halo
sizes all equal to the parameter nhalo = 2, e.g.
uvel(1nhalo:ncloc+nhalo,1nhalo:nrloc+nhalo,nz)
The W est/East/South/North sizes are usually given by a 4element vector. The halo sizes of the
3 arrays above are respectively
(nhalo,nh alo,n h alo,nhalo), (1,1,1,1),
5.5.3
(1,0,1,0)
Communications
A MPI communication consist of a send operation on one process (say A) and a receive operation
on another process (say B). COHERENS uses only socalled blocking send and receive opera
tions. The implementation in COHERENS is based upon the following communication modes:
1. Synchronous send.
A send a message with the data to B.
B receives the message and the data, sends a message back to A and completes
afterwards.
A receives the message from B and completes.
Most robust mode.
2. Bufffered send.
A sends a message to B, sends the data to a buffer, and completes afterwards.
B receives the message, retrieves the data from the buffer and completes afterwards.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
64
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Standard send.
The operation is performed either synchronously or in buffered mode. The choice is
made internally by MPI.
Less robust than synchronous mode but usually more efficient.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
65
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
5. Exchange operations.
Send subsections of local model arrays to a corresponding section within the halo of
each neighbouring domain. Receives data from each neighbouring domain and stores
these data in one of its halo sections.
Since each subdomain has 8 neighbours (including dummy domains outside the com
putational domain), the operation requires in general 8 sends and 8 receives on each
subdomain. However, this number can be reduced by specification of the halo sec
tions for which an exchange is needed or when component(s) of the halo size vector is
(are) zero.
The operation is symmetric.
Exchange operations are an essential part of the parallel code and are mainly for im
plementation of numerical algorithms for horizontal advection and diffusion and for ho
rizontal averaging.
6. Collect operations.
Stores all local arrays into one global array with an extra dimension of size nprocs.
The operation involves A ^ 1 sends and A ^ 1 receives on each domain.
This is a alltoall operation and therefore symmetric.
The operation is not frequently used.
Remarks:
The root process is by default the master process.
The communication routines are programmed using the MPLsend and MPLrecv routines
either in standard or synchronous mode.
There are options to use MPI collective calls instead for some operations: MPLbcast for
copy and MPLallgather for collect operations.
For exchange operations there is an alternative option to use the MPLsendrecv utility routine
which combine a send and a receive operation into one call.
5.5.4
Parallel processing is present in the subroutines of numerical schemes, with the main goal to
transfer the information from the main processor to the other ones. This is done through the
Communications subroutines.
In figure 5.13, is illustrated the main structure of COHERENS , where the subroutines, which
consider parallel processing, are highlighted.
5.6
In this chapter, a review was given of the implemented numerical schemes in the COHERENS
code. From the schemes presented in this review the following conclusions and recommendations
can be drawn in order to fulfill the implementation of an implicit numerical scheme.
The main structure of COHERENS depicts that the subroutine hydrodynamic_equations is
used for the application of the numerical schemes. In addition, three main subroutines are
used for 2D and 3D simulations considering the mode splitting as well. Therefore, in the case
of an implementation of an implicit scheme, it is necessary to consider the implementation
of a new subroutine (e.g. hydrodynamic_equation_implicit). Thus, it would be more feasible
to use a switch or flag to select which scheme is going to be used in the solution of the flow
equations.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
66
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
1 g rid
:e r_ d e p th s
h y d ro d y i
:e r_ d e p th s
Figure 5.13: Structure o/coherens_main routine where calls to communications for parallel processing take
place
The structure of the new subroutine for the implicit scheme should be analyzed based on
the scheme to be implemented. Anyhow, the definition of separate subroutines for 2D and
3D simulations (e.g. implicit_2d and implicit_3d) could be considered.
One important element to be considered is the intialization of the model (initialise_model). At
this stage all the input data is read from the input files {Usrdeffiles), and all the arrays to be
used during the simulation process are initialised. This stage is performed outside the time
loop. Therefore, the implementation of a new scheme, must make use of the variables and
arrays defined at the initialisation step. These variables are recognized as global variables
and can be transferred in parallel processing.
The solution of the equations for turbulence and scalars are performed before and after
the call of the subroutine hydrodynamic_equations respectively. Therefore, the implemen
tation of the implicit scheme has to consider this feature as well. The new scheme can be
implemented at the beginning of the time loop, specifically after the call of the subroutine
monitorJiles (see Figure 5.2). A similar structure of subroutines for the solution of turbulence
and scalar equations could be considered.
The definition of land boundaries should be taken into account for the implementation of a
new numerical scheme. Since these boundaries are not defined by the user in a direct way
(all the assignation are made internally), the definition of dry and w et grid cells should be
present. COFIERENS verifies at the initialisation stage the status of grid cells based on the
bathymetry data and assigns masks to all the grid cells of the domain. The status of this
mask is verified all the time in all the subroutines related with the numerical scheme. This
verification has the aim to separate dry grid cells from the solution (definition of land grid
cells). Therefore, the use of this mask is strongly recommended. Thus, the new scheme
has to verify in the same way the status of the grid cells.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
67
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
The definition of open boundaries is performed at the initialisation stage, all the arrays and
variables to be used are based on the assignations made by the user at the setup stage. Two
kind of open boundaries can be assigned, for 2D and 3D cases. The subroutines related
to the assignation of boundaries for the solution of flow equations are performed inside the
time loop. Therefore, for the implementation of the implicit scheme, new subroutines for the
open boundaries should be developed and implemented inside the time loop. This should be
done because the current subroutines for open boundaries are based on explicit schemes.
However, the use of the arrays and variables defined at the initialisation is compulsory. This
operation will allow a full backward compatibility with the current version of COHERENS .
The implementation of the implicit scheme should consider the use of parallel processing,
since this feature allows faster applications of COHERENS in complex cases. Moreover,
considering the reviewed elements of parallel processing and domain decomposition, it is
possible to conclude that parallel processing can be implemented. Besides, all the neces
sary elements for domain decomposition and communications are present in COHERENS
as standard code. These standard subroutines can be called and used for many applica
tions facilitating the addition of new computations inside the code.
The present review of the current structure of COHERENS gives more details and guidelines
for the further implementation of an implicit numerical scheme. In conclusion, new code will
be added, and these new additions should respect the current structure and make use of
the variables and arrays recognized by COHERENS . Nevertheless, further discussions are
advisable in order to define the architecture of the new scheme.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
68
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
Chapter 6
Numerical framework
The aim of this Chapter is to describe the framework in which the numerical code will be devel
oped; i.e. to define the general approach and the discrezation schemes we plan to use. These
suggestions take into account, the structure of COHERENS and the discussions provided in the
previous Chapters.
In the following, we first discuss our approach to the threedimensional hydrodynamica! equations.
In a second part, we present the framework in which we intend to solve the depthintegrated flow
field.
For each part, the equations of motion we aim to solve are first recalled, after which the numerical
approach that will be considered is discussed in detail and the numerical scheme is presented. In
a final part, some notes, conclusions and recommendations are given.
6.1
6.1.1
Physical equations
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
du
~dt
du
du
v +
io
du
y
V e rt. Adv.
1 dP.a t m
A tm . P res.
Free S u rf
B a ro c lin . P res.
2 sin(</>)'i
C o rio is
V e rt. D
Hor. D
(6.2)
V e rt. Adv.
Hor. Adv.
1 dP.a t m
A tm . P res.
Free S u rf
B a roch n. P re s
2 Q sin(</>)
Hor. Diff
du
dv
div
dx~^~dy
dz
V e rt. D
(6.3)
C o rio is
(6.4)
The appropriate boundary conditions which are applied to this set of equations is described in
section 6.1.3.1. In (6.1)  (6.4), U and V are the depthintegrated horizontal velocities in the x and
y directions, respectively. The xaxis is along the parallels, pointing east, while the yaxis points
North along the meridian lines. The axis is vertical, pointing upward, with = 0 describing the
mean water level. The angular velocity of Earths rotation is denoted by Q and 4> is the latitude
of the origin of the coordinate system. The variable P atm describes the atmospheric pressure,
the free surface elevation and (u, v, w) the velocity components in the x, y and directions,
respectively. Finally, the tensor R;j (with i,j = 1,2,3) represents the Reynolds stress tensor.
6.1.2
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
70
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
the stability related to these terms. In space, we suggest to discretize these terms making use
of the methods already developed in COHERENS . We refer to Luyten et al. (1999b) for a more
detailed description.
4. Vertical diffusion:
The vertical diffusion terms are suggested to be discretized in space by means of a central
scheme. In time, we propose a semiimplicit {9dvfactor) scheme.
5. Horizontal advection:
In space, we intend to retain the possible horizontal advection schemes presently available in CO
HERENS in the development of the new code; i.e. an upwind, LaxWendroff and TVD scheme.
As for the vertical advection, the focus will be on the TVD scheme. The discretization of the hori
zontal advection in time is discussed in more detail below.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
71
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
6. Horizontal diffusion:
Horizontal diffusion terms will be discretized explicitly centrally in space.
Explicit
efficient solver
each step
easy to implement
+
+
Implicit
larger time steps
more stable
Table 6.1: Advantages and disadvantages o f the explicit or im plicit time discretizations.
Hence, it appears that both approaches yield certain advantages. At this moment, we foresee
that when relatively coarse horizontal grid sizes are used ~ 0 (1 0 0 m), the explicit approach
will be sufficient since in this case the timestep limitation  0(1 minute) is about the same as
the physical timestep restriction. However, when finer horizontal spacings are necessary, we
suspect that an implicit time discretization of the horizontal advection and diffusion terms could
be beneficial.
Taking together the above considerations, a third option, recently described by Kramer & Stelling
(2008), is put forward. This approach suggests to introduce a function such that over most of the
domain advection terms are considered explicitly, however, that the cells which exceed locally the
CFL criterion are taken implicitly. Hence, the deviation of the resulting matrix from the tridiagonal
one is not excessive and can still be solved reasonably efficient. This option therefore provides
the benefit of the explicit discretization (efficiency) and the implicit discretization (stability).
All in all, we suggest the implementation of the third option as an aim for future developments of
the code. As a first step, within this project, we set as goal to complete the model with horizontal
advection terms discretized explicitly. Hereafter, the approach of Kramer & Stelling (2008) could
be implemented. This is feasible since, the implicit code can be achieved as a direct extension to
the explicit approach. Moreover, this has as an additional advantage that the development of the
code can be performed as an sequence of two steps which can be tested halfway. Also, we intend
to maintain the numerical code that addresses the horizontal advection explicitly as an option for
the future users. In this context, an interesting future prospective would be also to evaluate the
performance of both approaches for different test cases.
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
72
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
6.1.3
To describe the details of the numerical scheme, let us first we rewrite (6.1)  (6.4) into:
d
dU
dV
dt
dx
dy
(6.5)
0,
du
dv
diu
dx
dy
dz
(6.6)
du
du
~dt
dz
'~d~z
9 dx
d
dx
du
u u  2vh
dx
du
u v  vh
dy
dy
1 dPatm
d f\
7.L t t  / oclz + j v ,
po o x
ox Jz
dv
dv
dt
dz
~dz _
d
dx
u v  vh
1 d P atm
Po
dy
dv
dx
dy
= ~9
(6.7)
3?
(6.8)
dy
dv
v v  2vh
c)y.
d
+ tt / bdz f u, .
dy
1 dh3
/?3 d t
d(hoU)
d ( h\ V)
dt
hi ho
96
36
d( hoh3u)
hihoh3
96
1 d (h 3 u)
h3
dt
dPatn
puhi 9 6
f :? +
]_ d _
vv d u
h3 d s
h3 d s
96
hihoh3
1
hih%h3
96
hzhoh3
F* +
2 Q .V s in
dt
dPatn
paho
9 6
4> 
hiho
9 6
dho
v 36
h3 d s
9 6
hihoh3
d(h%h3T2i)
hlllr,h3
36
h\hoh3
g d
ho 9 6
d ( h o h 3uv)
(6 .12)
9 (hoh3 v v)
96
d(h2
ih3Too)
dho
hi ho
(6 .11)
36
dv
+ F t + F i 2Q u s in <f>
g 3
hi 9 6
(6 .10)
9 ( ^ f t . 3 r 12)
3 6
(6.9)
3 (hoh 3v u )
dhi
h3 d s
h i hoh 3
d (hoh3 uu
d(h%h3Tn)
h3 d s
1 d ( h 3v)
h3
1 diu
36
hihoh3
d ( h i h 3 v) I
0,
( r 6 6
36
flh
u  ^
v 36 u 36
Then, our approach consists of two subsequential steps. Conceptually, in the first, the horizontal
momentum equations are integrated with the 6 method, leading to:
6? dun+1
d n + 1
h * B I:
(6.13)
36
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
73
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
with
9 Pn
B% = u n + A <1 ; ^
Po h i
di
dho\
dh\
u
V
9i J
/?i /?2 V
1
d (hnhym)
h ih o h i
d i
h ih o h i
9 ( /? /? 3 r n ) n
d (hn hyii)
92
d { h \h  iT i2)
h i [
d^ d i i l
(6.14)
for the X momentum balance. A similar expression for the y momentum balance is found:
(hy
\n + l
d v n+1
Ai
9avw nvn+1  i
' h ^ +1
9cn+ 1
ds
B Pn
A <1 ;^
p 0h 2 9^2
(6 .1 5 )
+ Fy
b'n + F ' n  2 Q u n sin <j>
u
9A 2
h i h 2 \ VW i
d (hnhyiv)
h ih o h i
9i
h ih o h i
~ U d&
9 (hnhyv)
92
d {h \h iT 22)
9 (/?/?.3r 2i ) n
h ih^h^
9^i
h\h2h%
p ((1
9/?i
9^2
^ 9n" \
 (1
(6.16)
/?3 9 s
Remark that, for convenience, we have multiplied the momentum equations with /?3 , before dis
cretization.
Then, the set of equations (6.13) and (6.15) can be solved by substituting
9cn+ 1
u n+1 = + u '^z
di
and
vn+1
,9 n+1
V +
(6.17)
9&
h%+ 1  A
9s
ht+^u:
1 / 1 A
9s
9ol,w n+1  I
du'
h%+1 9s
h%+1 9s
/'2
/ :
A ^ J 7 .l+ 1 .
*i
(6.18)
(6.19)
Both (6.18) and (6.19) lead to tridiagonal matrices since the equations are only coupled in the
vertical and the numerical stencil is confined to the adjacent cells. Therefore, both can be solved
by means of the Thom as algorithm. A similar set of equations is found for the y momentum
balance and is omitted for the sake of space.
Then, we proceed with the second step and substitute u n+1 and vn+1 into the free surface eleva
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
74
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
* 1*2
d fi
y > + v
hih2
(6 .20)
which consists of a five diagonal matrix that can be solved by means of a preconditioned iterative
method. As preconditioner we foresee to implement the Incomplete LU factorization. Further
more, the matrix is symmetric and positivedefinite such that we can use the conjugate gradient
method as iterative method, which has the advantage to guarantee conversion. We foresee to
take advantage of the numerical library PETSc1 to solve, with an iterative method, the constructed
matrix. The advantage of this open source library is that it (1) contains a list of iterative solvers
that (2) solve sparse matrices with (3) the possibility to work in parallel.
Once n+1 is computed also un+1 and vn+1 can be evaluated. After which also the (transformed)
vertical current is obtained by integrating over the baroclinie continuity equation from the bottom
to the free surface. Finally, we remark that throughout the solving algorithm, next to the unknowns
n+i un+i anc j,n+i aS0 /7 + 1 s an unknown. Indeed, the system of equations that needs to be
solved is, in fact, nonlinear. To tackle this problem, we suggest the following approach, based on
Zijlema & Stelling (2005):
1. Replace hn+1 with /?"
2. Evaluate n+1 and, subsequentially compute hn+1
3. Check if  /?n+1  /?n   < e, with e a user defined residual
4. If so, proceed to the next timestep, otherwise substitute hn+1 into hn and repeat the compu
tation.
As indicated previously, the implicit treatment of the horizontal advection terms, fully implicit or with
the method of Kramer & Stelling (2008) could be an interesting feature for future developments.
Below, we describe, schematically, the impact of this enhancement on the code.
A coupling in both the horizontal directions and the vertical directions will be introduced
while solving the momentum equations; equations (6.13) and (6.15). Therefore, both will
have to be solved by means of an iterative method instead of the direct Thomas algorithm.
Moreover, instead of solving the horizontal velocities locally (in the horizontal) decoupled
from each other, the velocities are now coupled such that the all velocities in the three
directions need to solved together. An appropriate iterative method in order to solve these
equations still needs to be identified.
The introduction of an implicit implementation of the horizontal advection terms will deteri
orate the symmetric properties of the free surface evolution equation (6.20). Therefore, the
conjugate gradient method can not be used anymore to solve (6.20) and a different iterative
method needs to be used.
The impact on the efficiency of the algorithm of these adjustments can not be properly assessed
without testing. However, it could by that the overall CPU time will not be decreased since the first
point will require a substantial amount of extra computation time. On the other hand, the second
point will not influence the largely the computation time.
1http ://www. mes.ani .gov/petsc/petscas/
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
75
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
6.1.3.1
Boundary conditions
( r 61, r 62):
( n i , T b2) = (0,0)
2.
lia
i"
!ib
b) 
(6.23)
with Cdb a drag coefficient that is expressed in terms of the bottom roughness
vertical grid spacing. In particular,
(6.24)
and the
(6.25)
in which zr is a reference height taken at the grid centre of the bottom cell.
Our focus will be to implement the latter boundary conditions as it describes the physical flow field
less crudely. Also, at the bed, we impose the vertical velocity to vanish such that w is set zero.
The boundary condition at the free surface is obtained by specifying the surface stress as a
function of the wind components leading to
Povh ( I t  I t ) = Pa.Cd,Ww {Um Vw )
(6.26)
where { lh n, Vm) are the components of the wind vector at a reference height of 10 m, Win =
+ V{0) is the wind speed amplitude and pa = 1.2 kg/m3 denotes the air density. Further
more, at the free surface the vertical fluid velocity is set zero.
Open boundary conditions
The threedimensional open boundary conditions are suggested to be imposed in two steps, as is
currently applied in COHERENS . In particular, first open boundary conditions are imposed on the
depthintegrated horizontal velocities (U, V ) after which conditions are specified for the deviations
of the flow field to the depthintegrated velocities (the baroclinie parts).
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
76
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
1. Clamped: with this boundary condition the transports are uniform in time and determined by
the initial conditions. Hence, we impose
dU
 = 0
dV
or 
= 0.
(6.27)
This boundary condition can be used as land boundary. Moreover it is presently default in
COHERENS and we suggest to maintain this feature.
2. Specified transport: by setting
U
= U e or V = V e,
(6.28)
dU
a i =
or ^
= 
(6'29>
and is proposed since it will be a necessary tool for the developments in subtask 11.
4. Specified elevation: This boundary condition calculates a velocity that is applied from a local
momentum balance using a specified elevation. Although in many situations, user experi
ence has illustrated that the use of this boundary condition provides rather peculiar velocities
at the boundaries, the implementation of this boundary condition appears desirable for the
validation of the implicit code for some test cases. However, as discussed below, attention
to this boundary condition should be given in future projects.
Also the following boundary conditions appear interesting, however, as discussed below, they are
(1) not straightforward to implement and (2) not fully investigated such that they are only listed as
a secondary option. In particular, we mention these boundary conditions since they are appealing
and interesting challenges for future projects or as a part of subtask 12.
1. Specified elevation: As discussed above, this is an interesting boundary condition to imple
ment although in some cases, it leads to rather peculiar results. This result probably arises
since the free surface boundary condion is immediately translated into a velocity condition
by means of a linearized equation of motion. Therefore, it seems advisable to develop other
methods for applying a water level boundary condition. However, this appears not feasible
within subtask 5 and should be done in a separate subtask.
2. Zero slope condition: this boundary condition applies a zero water level slope and calcu
lates the depth integrated velocity from the slope using a local momentum balance. Hence,
the 2D momentum equations are solved without advection, horizontal diffusion, pressure
gradients and astronomical forcing. For practical applications, it seems necessary to extend
this boundary condition, such that any water level slope (rather than only a value of zero)
can be applied. This seems to be another subject that could be evaluated in a separate
subtask.
3. Characteristic method with specified elevation and transport: this boundary condition is
currently used within COHERENS to allow the nesting with different models. However, due
to complexity of the implementation, the application of this boundary condition should not
be considered as a priority in the development of the implicit scheme. It seems appropriate
to evaluate also this boundary condition in a separate subtask.
4. Radiation condition using shallow water speed: To allow the propagation of waves approach
ing the open boundary, radiation conditions can be implemented imposing
dU
dU
dU
or =
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
d V __________________________ ______
a rT cai =
(6'30)
77
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
in which c is the appropriate wave speed. The notation or =f represents for the upper
(lower) part the signs applied at the western/southern (eastern/northern) boundaries. This
boundary, however, only admits wave propagating with a normal incidence with the boun
dary.
Finally, it is necessary to mention that during the development of the subtask 11, there is the
possibility that the list of boundary conditions should be modified. On the other hand, the im
plementation of the implicit numerical scheme could redefine the use of the current types of
boundary conditions, this possibility will be clarified during the implementation process. There
fore, it is advisable that further discussions and coordinated works will be arranged in order to
assure a compatibility between the present work and subtask 11.
dv
z =
or
 w = 
(6'31>
2. Specified external profile: this boundary condition can be used together with a predefined
profile and/or in combination with a nested model by setting
= ue
5u
or
v = v e,
(6.32)
6.2
6.2.1
The equations
As presently COHERENS has an option to run only the barotropic equations, it is desirable that
the foreseen code is able to run also only the depthintegrated hydrodynamic equations. In the
following, an outline of the implementation of this feature is presented. Integrating the ReynoldsAveraged equations of momentum and continuity over the depth, yields
9
d V _______________________________________________ ______
dU
m + d^ + ^ 
dU
dUU
dt
dx
+
fV
dy
//
p0
dPatm
o
OX
dUV
dt
dx
fU
'Tl,, )
po
IK rx
dy
d P a tm
Po
dy
(6.34)
dVV _
^
dx
(Xsj
'
/'; I I I " , l J r
dV
(6'33)
9
dVU _
dy
{l~sy
7b y )
po
F + H F + D a y l + D ay2.
(6.35)
In (6.33)  (6.35), (U, V ) are the depthintegrated velocity components in the x and ydirection,
H is the total water depth and (Ts x , Ts y ) and ( n x , Tby) the shear stresses at the free surface
and the bottom, respectively. Furthermore, ( F x , F y ) denote the depthintegrated components
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
78
T H V IM D C S oresm a
i.s .m. KU Leuven, UG ent, BMM en W LB
of the baroclinie pressure, {F .,F *) the components related to the astronomical tidal force and
( Dsxi, D syi), ( D SX2 , D Sy2) represent the depthintegrated turbulent dissipation of momentum.
Similar to the threedimensional flow field, we discretize the momentum equations with the semiimplict 0 method. Furthermore, we linearize the bottom friction term and treat it fully implicit. All
the other terms are taken explicit. The depth integrated x momentum equation is then given by
9n+1
1 + A t ) U n+1 =  g H n + ie,
dx
Po
d U nU n
d V nU r> f y
with B
dx
dy
H n dPatr
+ + F x,n + H nF i ,n +
! + D\
Po dx
Po
(6.36)
Writing U n+1 = + ^ F d } ( j anq \ j are readily determined. The same approach can be applied
to the y momentum equation, considering V n+1 = V + V a^ +1.
Substitution into the free surface elevation equation then provides
d
( ~
< 9 n + 1 \
m + th;{L + u ^ ^ )
( y
 d n+i
+ d ^iv + v ^ ~
(6.37)
At
d f d n+l
dx V
dx
d i  9 n+1
dy V
dy
A du
a dv
 At  A t .
dx
dy
(6.38)
Equation (6.38) has a similar structure as the discretized free surface elevation equation following
from the threedimensional problem and can be solved in the same fashion; i.e. by means of a
preconditioned conjugate gradient iterative method.
Finally, we remark that the same spatial discretizations as for the threedimensional case are
used. Also, it is worth to point out that similar considerations upon the implicit discretization of
the horizontal advection terms can be made for the depthintegrated case as those made for the
threedimensional problem.
6.2.1.1
Boundary Conditions
The boundary conditions we suggest to implement in the barotropic implicit numerical scheme are
the same as specified in Section 6.1.3.1 ; e.g. clamped, specified transport and zero volume flux.
6.3
Testing the implementation of the implicit scheme of the free surface as planned in the concept
note is not straightforward. Mainly because the barotropic boundary conditions which are planned
to be implemented are not sufficient to test the code with respect to the test cases set up in the
previous version of COHERENS . Therefore, it should be a goal for future developments of the
code to implement all the boundary conditions necessary to run all the test cases. Also, it should
be foreseen to validate the model output with reallife data, a good example could be the Western
Scheldt. Moreover, it should be planned to test the implicit scheme with respect to accuracy,
increasing the time step.
6.4
The numerical framework within the implicit time discretization is described. We suggest to dis
cretize the governing equations with finite differences taking advantage of the spatial discretization
l/RA/11339/10.072/GVH
Version 1.0 31/01/2011
79
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
schemes already present in COHERENS . In time, we use a semiimplicit method based on the
6 method. Furthermore, a framework to describe also the depthintegrated governing equations
implicit is suggested, taking advantage of the approach for the threedimensional hydrodynam
ica! equations. Finally, boundary conditions which will be imposed at the open boundaries are
given. A primary list of boundary conditions is provided and also suggestions are made to further
interesting advancements.
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
80
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
Chapter 7
Impact on current users/modules
7.1
Introduction
In this chapter, the consequences of the transformation of the existing explicit COHERENS code to
an implicit code will be discussed. In this part, the discussion will be directed at current and future
subtasks in the project. For the different subtasks that are or will be performed, the consequences
of the implicit code will be discussed.
7.2
The suspended sediment transport module will calculate suspended sediment transport in the
form of sediment concentrations using the scalar advection diffusion module. As discussed be
fore, it is necessary that the scalar transport module is made implicit in order to be able to use
a sufficiently large time step. Apart from the stability of the advection and diffusion terms, which
will be made implicit, the stability of the advectiondiffusion equation depends on the implemen
tation of the source and sink terms. These source terms are used in two ways in the suspended
sediment transport module: as user defined sediment sources in order to simulate special situa
tions (such as dredging plumes) and in twodimensional calculations to account for erosion and
deposition of sediment from the bed. In the implementation of these source terms, it is important
that the balances are calculated exactly, thus that no sediment is lost from the calculation. These
kind of losses are known to occur if certain types of implicit sink terms are used (such as the
quasiimplicit discretization of Patankar). However, for sediment transport the source terms that
are used near the bed have the form S = w s ( C eq  C ) for sand and similarly S = E  H { 9 d) w sC
. Thus they are linear functions of the sediment concentration. Considering this, it is proposed
to change the source term that is used in the solution of the advection diffusion equation. The
advection diffusion equation has the following form:
dtp
dtp
dtp
dtp
~dt = ~ Ul h : ~ Vl h j ~ W l h
d
+
tz
dx
dtp
D
dx
dtp
h z z ~ D H
dy
dy
dtp
h ~ zzD v
dz
+ S (x ,y ,z ,t)
dz
( 7 .1 )
( 7 .2 )
This equation isstill linear in the variable C. Therefore, it can be included in thematrix that is
used to solve thisequation in an implicit solver without any extra work.Moreover, in thisway the
sediment transport can be solved implicitly without the need to Patankars method (which may
lead to errors in the sediment mass balance). Note that nonlinear source terms in future routines
(such as the biology module) can still be solved using a combination of explicit and implicit by using
the correct linearisation (i.e a proper formulation of S 0 and a ) at the programmers discretion.
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
7.3
The bed load module will be implement in COHERENS . In this module, equation for bed load or
total load will be implemented. This sediment transport equations are explicit algebraic relations,
in which the sediment transport rate depends on the calculated bed shear stresses as well as
on sediment parameters as grain size and sediment density, and on the bed slope. Since this
module only uses explicit equations, it will not have to use one of the already present modules
(such as scalar advection diffusion). The only input parameters to this module that are currently
present in the model are the bed shear stress and the bed elevation. Given the fact that only
explicit relations are used, there is no stability criterion on the calculated sediment transport rates.
Thus as longs as bed shear stresses remain available in the implicit code (at the same locations
as in the present code; U,V and C nodes)1, no effects of the implicit code on this module are to
be expected. Note that the availability of bed shear stresses is also required for the boundary
conditions in the suspended sediment transport module.
7.4
The bed morphology module calculates changes in morphology due to the calculated sediment
transport (from the bed load and the suspended sediment transport module). This module only
uses the results of the two sediment transport modules as input, but is not directly using one of
the programmed numerical routines. In this way, there is no direct impact of the change to implicit
conditions on this module.
Morphological changes normally occur on much slower time scale than the hydrodynamic pro
cesses, and therefore a larger time step can be used. In the development of this module, it has
to be decided whether an implicit or an explicit scheme is used to calculate changes in the bed
morphology. If it is decided to use an implicit code, it would be advantageous if parts of the implicit
code used for the hydrodynamic equations (such as the matrix solvers) could be reused. There
fore, it is recommended to write the implicit code (when feasible) in a general and modular way,
(similar as is done in the current COHERENS code).
7.5
It is the intension to extend COHERENS with a module in which the bed roughness is calculated
dynamically as function of the occurring flow conditions and sediment. In this way, the influence
of the occurrence of bed forms (such as ripples and dunes) under varying flow conditions can
be simulated. In general this is done by calculating the bed form dimensions as function of the
sediment characteristics and the calculated flow field. From this bed form dimensions, a new
roughness predictor is calculated, which is used to update the flow field.
In principal, the bottom roughness module can be implemented separately, using input from the
sediment transport and flow modules. In this way, it can serve independently from the fact whether
or not the code used to solve the flow and sediment transport is implicit or explicit. It might however
be necessary to include an iteration loop in the above process of determining the roughness as
function of the flow depth, in case large time steps are used. This has to be considered during
the implementation of this module, and hence it is at present not influencing the development of
the implicit code.
7.6
Fluidmud module
A fluid mud module is currently being developed at the KU Leuven. This module will simulate the
near bed processes on the basis of a low Reynolds number ke model. It is the intention to use this
module in COHERENS when it is finished. Then, it will provide bed load rates, as well as near bed
1it is currently intended to com pute the bed load at the U and V nodes. However, it might be necessary for computational
stability of the m orphology m odule to evaluate this at the C nodes
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
82
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
boundary conditions for sediment concentration and flow velocity. Thus when it is implemented,
this will lead to some additional near bed boundary conditions that need to be implemented.
It seems that the implementation of the fluid mud module might be influenced. The precise con
sequences cannot be assessed at this moment, because they depend on the precise form that
these boundary conditions take. It may be possible that additional implicit near bed boundary
conditions will have to be coded during the implementation of the fluidmud module.
7.7
This module simulates processes that occur within the bed. On the one hand the erosion of sandmud mixtures is calculated, which is influenced by the composition of the bed. Therefore, it must
solve the mixture of sand and mud within the bed. On the other hand, consolidation of mud or
sand mud mixtures in calculated.
Because both these processes occur within the bed, no direct influence of the change from explicit
to implicit code is to be expected for this module.
7.8
Verification procedure
For completeness, the verification procedure is discussed here. In this subtask, a set is scripts is
used that can be used to automatically verify the distributed COFIERENS model. This script runs
the existing test cases that are distributed with COFIERENS and produces a report in which the
results are compared to those from a reference version. Thus in this way, it is verified that the
results of COHERENS are consistent with previous versions and no bugs have entered the new
version of the COHERENS code.
There are no direct consequences of the implicit code on the procedures that are developed for
the verification procedure. However, once the implicit code is working, this extensions should be
included in the automatic verification procedure (as should happen for all the new functionalities
that are currently developed in COHERENS ). To this end, some minor modifications to the existing
test cases might be necessary. Examples could be the use of different switches or the inclusion of
an extra run with a larger time step. In case new tests are developed for validation or verification of
the implicit module, these should be included in the test bank used for the verification procedure.
7.9
The central input file strategy (CIF) is a new functionality in COHERENS aimed to deliver input to
the program outside the source code. The input in the current version of COHERENS takes place
through a set of UsrdeLfiles where input information such as flags, parameters, files and even the
read/write routines are hard coded.
The data in the enhanced version of COHERENS (with CIF) can be introduced to the program
by means of data located in external files and not in the code. These files contain the flags,
parameters, and filenames refering to more information. Therefore, the operation of recompiling
the source to modify the input data is no longer required. However, in order to allow backward
compatibility with the current version, the use of UsrdeLfiles is still possible.
Since the CIF facility focuses on the management of input and output data (performing computa
tions outside the numerical subroutines), it is expected that further enhancements to the COHE
RENS code will add more data to be managed. Thus, the implementation of an implicit numerical
scheme will generate additional data such as flags, switches or parameters, which have to be
supplied by the user.
Taking into account the conclusions and recommendations pointed out in the review of the code,
the explicit numerical scheme should be implemented as an independent module, apart from the
subroutines of the explicit scheme. For this purpose, a by pass technique should be imple
mented within the time loop. Therefore, the selection of the numerical scheme falls in the users
criteria. This selection can be performed by the addition of a switch or flag to choose the neces
sary scheme. Moreover, considering the feasibility that more than one implicit scheme would be
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
83
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
D e s ig n o f th e im p lic it s c h e m e in C O H E R E N S
implemented, the selection switch should be able to choose among the explicit and the implicit
schemes. A preliminar example is presented below:
Selection of numerical scheme
iopt_num_scheme = 0
! 0 = explicit numerical scheme
! 1 = implicit numerical scheme N1
! 2 = implicit numerical scheme N2
On the other hand, depending on the implicit scheme to be implemented, it is expected that
additional input should be defined, such as coefficients and/or parameters. Moreover, following
the current structure of COHERENS , several switches can be defined by the user in order to
setup the solution of the numerical scheme: 2D or 3D model, neglect of diffusion, deactivation of
Coriolis, etc. Thus, it is advisable that the implementation of the implicit scheme follows as much
as possible the same structure and the use of the same switches.
Finally, as a conclusion, the new input datashould be listed anddescribed in detail in order
to facilitate the modifications in the Cl F code.Nevertheless, theCl F facility is able toreceive
additional data due to further enhancements to the code.
7.10
Inundation schem es
In the framework of subtask 10, the current drying/wetting scheme of COHERENS has been
enhanced with alternative drying/wetting schemes with a dynamic framework. Therefore, COHE
RENS will be able to simulate flooding processes where grid cells of the computational domain
will become wet/dry in a dynamic way.
The current structure of COHERENS considers two main points: the definition of coastal bounda
ries and the drying/wetting process. Coastal boundaries are defined by the application of mask
functions (nodeatc). They are applied to grid cells in order to determine if they are wet or dry.
Thus, dry cells are removed from the computational domain because they are considered as land
cells. Following, the drying/wetting process in the current version of COHERENS does not con
sider the movement of coastal boundaries and makes use of an alpha factor for the solution of the
momentum equations. This factor is described below.
The alpha factor is a multiplying factor applied to some terms of the momentum equations:
Qw d ( D f t
S A h
(7.3)
S D h )
This factor is equal to unity in regions where a critical water depth is exceeded, and approaches
to zero, tending to a minimum water depth. The multiplying factor is defined by:
&wd
n ic i'X [n iin (
1,
II
d m in ) / ( d crit
dm in
)? 0 ]
(7.4)
This artifice is applied when water depths aproach to zero. Therefore, it is advisable to apply
this factor in the same maner as for the explicit scheme. Likewise, further problems related to
excessive drying processes can be avoided.
The inundation schemes (with a dynamic framework) implemented in COHERENS make use of
the arrays and variables already recognized by COHERENS . All of these variables are initialized
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
84
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
at the beginning of the simulation, outside the time loop. Therefore, further implementations of
new numerical schemes have to make use of the arrays and variables that have been initialized
and are recognized as standard COHERENS variables.
The mask function nodeatc is used in all the subroutines related to the solution of the hydrody
namic equations. The status of grid cells is constantly verified by the use of the mentioned mask
function. Then dry grid cells are removed from the solution of the equations. As a consequence,
the implementation of the implicit numerical scheme should make use of the mask function and
make the same verification of the status of grid cells. This action will ensure that the implemented
numerical scheme is backward compatible.
Furthermore, the inundation scheme makes use of the previously described mask function. The
current version of COHERENS defines mask functions only once at the beggining of the simulation
and outside the time loop. Therefore, to turn the mask function into a dynamic one, it is redefined
after each time step, based on the updated status of grid cells. Then, it is possible to simulate
flooding processes with varying coastal boundaries. Moreover, this dynamic mask function is
defined in two different places in the code, depending if the simulation is 2D or 3D (mode splitting).
Thus, the implementation of an implicit numerical scheme by the by pass technique, will have an
impact on this dynamic mask function. It is advisable that the update of this function takes place
after each time step, once the status of the grid cells has changed.
Finally, the new drying and wetting scheme makes use of the same definitions of open boundaries,
since these arrays and variables are initialized before the time loop. It is advisable to use the same
arrays and variables for the implementation of the implicit scheme.
7.11
Structures module
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
85
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
86
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
Chapter 8
Conclusions and outlook
In this report the process which lead to the numerical framework within we intend to develop an
implicit hydrodynamica! code is discussed. This process consists of the following steps:
1. An overview of the stateoftheart physical and numerical description of the flow field in
oceans, coastal zones and estuaries. Three main physical approximations have been iden
tified: Boussinesq, traditional and hydrostatic approximations; and their limitations are des
cribed. Numerically, two main approaches are found to solve the equations describing the
hydrodynamics; i.e. with iterative methods and using an Alternating Direction Implicit (ADI)
approach. A list of the approaches and methods used in presently available models is pre
sented.
2. A discussion of the numerical schemes presently used in COHERENS is provided. In par
ticular, an outline of the physical approximations and the numerical approach considered in
the current version of COHERENS is presented. Suggestions towards the implicit imple
mentation, taking into account the present code are put forward and the computational gain
of the possibilities is quantified.
3. A first decision step, in which the abundance of numerical and physical modeling possibilities
is narrowed down, is described. This part motivates the approach to apply also the hydro
static approximation, next to the Boussinesq and traditional approximations. Furthermore,
it is decided that the model will solve the threedimensional flow field (without the modesplitting approach) on a structured grid. Finally, we motivate the use of iterative methods to
solve numerically the flow field as this method appears to allow an easier parallelization of
the code and seems more efficient. Also, for our applications, the method seems sufficiently
accurate and robust.
4. An overview of the code implementation in COHERENS is presented as a guide for the
upcoming implicit implementation. This part describes the general structure up to the details
of specific routines, leading to recommendations and pointing out some pitfalls which should
be avoided.
5. The numerical framework in which the code will be developed is described in detail. In
particular, the temporal and spatial discretization schemes of each term are addressed;
and a detailed outline of the numerical semiimplicit scheme is provided. We suggest to
discretize the governing equations with finite differences taking advantage of the spatial
discretization schemes already present in COHERENS . Finally, the boundary conditions
that we intend to implement are listed.
6. In a final part, we describe the consequences of the implementation of the implicit scheme
for the current users/modules.
During the writing of this report several issues were encountered which we list as essential addi
tions to the present task or appealing challenges for future development of the numerical code (in
order of priority):
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
1. Several interesting boundary conditions have been listed which are not scheduled to be
implemented within the current subtask. It should be investigated if the implementation of
these boundary conditions can be included in the present task.
2. An evaluation of the performance of the present code with respect to the implicit code ap
pears a necessary task. It should be investigated if an evaluation based on the available
test cases in COHERENS can be included in the present task.
3. The present scheme foresees to consider horizontal advection terms explicitly. Although this
does not yield a severe global time step restriction, locally, this approach could be restrictive.
In order to solve this, we suggest to implement the scheme proposed by Kramer & Stelling
(2008). It should be investigated if the implementation of the (partly) implicit horizontal
advection terms, as well as the implicit treatment of the horizontal advection/diffusion terms
in the scalar transport equations, can be included in the present task.
4. The application of the hydrostatic approximation on the dynamics of bedforms should be
investigated and the limitations of this approximation should be quantified. Based on this
analysis, it could be interesting to extend the present approach with a nonhydrostatic coun
terpart.
5. The parallelization of the code falls beyond the scope of the present code development.
Nevertheless, we expect that a significant additional computational gain could be achieved
by implementing schemes which allow the code to run in parallel. Therefore this point seems
a key prospective task.
6. The influence of short waves on the flow field seems an interesting prospective.
7. For future developments, the implementation of the possibility to run the code with a nonorthogonal grid is an attractive goal.
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
88
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
Bibliography
Adcroft, A., Chris, H., & Marschall, J. 1997. Representation of topography by shaved cells in a
height coordinate ocean model. Month. Weather Rev., 125, 22932315.
Antuono, M., Liapidevski, V., & Brocchini, M. 2008. Dispersive Nonlinear ShallowWater Equa
tions. Stud. Appli. Math., 122, 128.
Blumberg, A .F., & Melior, G.L. 1987. A description of a threedimensional coastal ocean circulation
model. In: Heaps, N.S. (ed), Three dimensional coastal ocean models.
Booij, N., Ris, R.C., & Holthuijsen, L.H. 1999. A thirdgeneration wave model for coastal regions.
Part 1, Model description and validation. J. Geophys. Res., 104, 76497666.
Brocchini, M., & Dodd, N. 2008. Nonlinear Shallow Water Equation Modeling for Coastal Engi
neering. J. WPCO. Eng., 104.
Burchard, H., Bolding, K., & Villarreal, M.R. 2004. Threedimensional modelling of estuarine
turbidity maxima in a tidal estuary. Ocean Dynamics, 54(2), 250265.
Casulli, V. 1999. A semiimplicit finite difference method for nonhydrostatic, freesurface flows.
Int. J. Num. Meth. Fluids, 30.
Casulli, V., & Cattani, E. 1994. Stability, accuracy and efficiency of a semiimplicit method for
threedimensional shallow water flow. Comput. Math. Appl., 27, 99  112.
Casulli, V., & Cheng, R.T. 1992. Semiimplicit finite difference methods for threedimensional
shallow water flow. Int. J. Numer. Methods Fluids, 15, 629  648.
Chen, C., Liu, H., & Beardsley, R.C. 2003a. An Unstructured Grid, FiniteVolume, ThreeDimensional, Primitive Equations Ocean Model: Application to Coastal Ocean and Estuaries.
Journal of Atmospheric and Oceanic Technology, 159  186.
Chen, C., Haosheng, H., Beardsley, R.C., Liu, H., Xu, Q., & Cowles, G. 2007. A finite volume
numerical approach for coastal ocean circulation studies: Comparisons with finite difference
models. J. Geophys. Res., 112.
Chen, Changsheng, Liu, Hedong, & Beardsley, Robert C. 2003b. An Unstructured Grid, FiniteVolume, ThreeDimensional, Primitive Equations Ocean Model: Application to Coastal Ocean
and Estuaries. Journal of Atmospheric and Oceanic Technology, 20(1), 159186.
Chen, Q., Kirby, J.T., Dalrymple, R.A., Shi, F., & Thornton, E.B. 2003c. Boussinesq modeling of
longshore currents. J. Geophys. Res., 108.
Deleersnijder, E. 1993. Numerical mass conservation in a freesurface sigma coordinate marine
model with mode splitting. Journal of Marine Systems, 4(5), 365370.
Ford, R., Pain, C.C., Goddard, A.J.H., de Oliveira, C.R.E., & Umpleby, A.P. 2004. A Nonhy
drostatic FiniteElement Model for ThreeDimensional Stratified Oceanic Flows. Part 1: Model
Formulation. Mon. Wea. Rev., 132, 2 81 6 2 8 3 1 .
Fringer, O.B., Gerritsen, M., & Street, R.L. 2006. An unstructeredgrid, finitevolume, nonhydro
static, parallel coastal ocean simulator. Ocean Modelling, 14, 139137.
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
Haas, K. A., & Warner, J. C. 2009. Comparing a quasi3D to a full 3D nearshore circulation model:
SHORECIRC and ROMS. Ocean Modelling, 26, 91103.
Haas, K. A., Svendsen, I. A., Haller, M. C., & Zhao, Q. 2003. Quasithreedimensional modeling
of rip current systems. J. Geophys. Res., 108, doi:10.1029/2002JC001355. C73217.
Haidvogel, D. B., Arango, H., Budgell, W.P., Cornuelle, B.D., Curchitser, E., Lorenzo, E. D., Fennel,
K., Geyer, W.R., Hermann, A.J., Lanerolle, L., Levin, J., McWilliams, J. C., Miller, A.J., Moore,
A.M., Powell, T.M., Shchepetkin, A.F., Sherwood, C.R., Signell, R.P., Warner, J.C., & Wilkin, J.
2008. Ocean forecasting in terrainfollowing coordinates: formulation and skill assessment of
the Regional Ocean Modeling System. J. Comput. Phys., 227, 35953624.
Housman, J., Kiris, C., & Kwak, D. 2004. Comparison of artificial comprssibility methods. Comp.
Fluid Dynamics, 13, 483488.
Kamenkovich, V.M., & Nechaev, D.A. 2009. On the timesplitting scheme used in the Princeton
Ocean Model. J. Comput. Phys., 228, 28742905.
Kanarska, Y., & Maderich, V. 2003. A nonhydrostatic numerical model for calculating freesurfac
stratified flows. Ocean Dynamics, 53, 176185.
Kirby, J.T., & Dalrymple, R.A. 1994. A parabolic equation for the combined rfractiondiffraction of
stokes waves by mildly varying topography. J. Fluid Mech., 136, 453466.
Kowalik, Z., & Murty, T. S. 1993. Numerical modeling of ocean dynamics.
Kramer, S. C., & Stelling, G. S. 2008. A conservative unstructured scheme for rapidly varied flows.
International Journal for Numerical Methods in Fluids, 58, 183212.
Labeur, R. J., & Pietrzak, J. D. 2005. A fully three dimensional unstructured grid nonhydrostatic
finite element coastal model. Ocean Modelling, 10, 5167.
LonguetHiggins, M.S., & Stewart, R.W. 1962. Radiation stress and mass transport in gravity
waves with applications to surfbeats. J. Fluid Mech., 8, 565583.
LonguetHiggins, M.S., & Stewart, R.W. 1964. Radiation stress in water waves, a physical discus
sion with application. Deep Sea Research, 11, 529563.
Luyten, P. 2009. Coherens version 2, user manual (in prep.).
Luyten, P., Jones, E., Proctor, R., Tabor, A., Tett, P., & WildAllen, K. 1999a. Coherens, a coupled
hydrodynamicalecological model for regional and shelf seas. MAS3CT970088, pp914.
Luyten, P.J., Jones, J.E., Proctor, R., Tabor, A., Tett, P., & WildAllen, K. 1999b. COHERENS  A
Coupled HydrodynamicalEcological Model for Regional and Shelf Seas: User Documentation.
Page 991 of: MUMM Report.
Marschall, J., Hill, C., Perelman, L., & Adcroft, A. 1997. Hydrostatic, quasihydrostatic, and non
hydrostatic ocean modelling. J. of Geophys. Res., 102, 57335752.
Marshall, J., & Adcroft, A. 2004. Lecture notes on Atmospheric and oceanic modelling. Massachusetss Institute of Technology.
Norbury, J., & Cullen, M.J.P. 1985. A note on the properties of the hydrostatic equations of motion.
Q. J. R. Meteoro!. Soc., 111,11351137.
Pedlosky, J. 1979. Geophysical Fluid Dynamics.
Shewchuk, J. R. 1994. An introduction to the conjugate gradient method without the agonizing
pain. Tech. rept. School of Computer science, Carnegie Mellon University.
Svendsen, I. A. 2006. Introduction to nearshore hydrodynamics. World Scientific, Singapore.
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
90
T H V IM D C S o re s m a
i.s .m. K U L e u v e n , U G e n t, B M M e n W L B
THV IMDC  Soresma. 2009. Uitbouw numeriek modelinstrument voor de Noordzeehavens Deelrapport 1  Aanvangsstrategie, opgesteld voor afdeling Maritieme Toegang, Departement
Mobiliteit en Openbare Werken, Vlaamse Overheid, l/RA/11339/09.059/GVH, september 2009.
Van Lancker, V.R.M., Du Four, I., Degraer, S., Fettweis, M., Francken, F., Van den Eynde, D.,
Devolder, M., Luyten, P., Monbaliu, J., Toorman, E., Portilla, J., Ullmann, A., Verwaest, T.,
Janssens, J., Vanlede, J., Vincx, M., Rabaut, M., Houziaux, J.S., Mallaerts, T., Vandenberghe,
H., Zeelmaekers, E., & Gttin., A. 2009. Quantification of Erosion/Sedimentation patterns
to Trace the natural versus anthropogenic sediment dynamics Q U E S T 4 D Tech. rept. Final
Report Phase 1. Brussels: Belgian Science Policy. 135 pp.
Warner, J. C., Sherwood, C. R., Signell, R.P., Harris, C. K., & Arango, H.G. 2008. Development of a
threedimensional, regional, coupled wave, current, and sedimenttransport model. Computers
and geosciences, 34, 12841306.
Wesseling, P. 2001. Principles of computational fluid dynamics. Springer Verlag.
White, A.A., & Bromley, R. A. 1995. Dynamically consistent, quasihydrostatic equations for global
models with a complete representation of the Coriolis force. Q. J. R. Meteoro!. Soc., 121, 3 99418.
Zhang, Y., & Baptista, A. M. 2008. SELFE: A semiimplicit EulerianLagrangian finiteelement
model for crossscale ocean circulation. Ocean Modelling, 21, 7196.
Zijlema, M., & Stelling, G. S. 2005. Further experiences with computing nonhydrostatic freesurface flows involving water waves. International Journal for Numerical Methods in Fluids, 48,
169197.
l/RA/11339/10.072/GVH
V e rs io n 1.0 3 1 /0 1 /2 0 1 1
91
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
23 6
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
Appendix G
Note on hydrodynamic algorithm
COHERENS
A C o u p le d H y d ro d y n a m ic a lE c o lo g ic a l M o d e l
fo r R e g io n a l an d S h e lf Seas
H y d ro d y n a m ic A lg o r ith m O v e rv ie w
V e rs io n 2.0, M a r c h 2011
P ieter Rauwoens
G hent University
Faculty of Engineering and A rchitecture
D epartm ent of Civil Engineering
Division of Roads, Bridges and C oastal Engineering
Technology P ark C am pus Ardoyen, Building 904
B9052 G hent, Belgium
C o n ten ts
A lg o r it h m O v e r v ie w
1.1
1.2
1.3
Governing Equations
One Step Algorithm
Iterative algorithm
CO NTEN TS
C h a p te r 1
A lg o rith m O v e rv ie w
1.1
G overnin g E q u ation s
dV
dx
dy
dt.
du
dv
dx + +
1 dhsu
h*
dt.
du
u. t
dx
du
dy
dw
+ dz
du.
w zr~
dz
0,
( 1.1)
0,
( 1.2)
d P,a t m
po
dx
dx
<9Rl
<9R12
<9R1 3
dy
dz
dx
Po
+211 sin ((p) V,
dhsv
hs
dt.
dv
udx
dv
dy
d_
 i i i
bdz
dx
d(
g + /
(1.3)
dv
r\
po d y
1 <9R.21
dz
Po
2 Q
dx
sin ((p) u,
r\
dy
'
+
/V
dy Jz
I
d R 22
<9R.23
dy
dz
(1.4)
treatm ent of the advection and diffusion term s (implicit or explicit), however,
does not interfere w ith the algorithm described in the present document
(apart from a possible higher am ount of subiterations needed).
1.2
O ne S tep A lg o rith m
dU
dV
d t + d + ~S
du
dv
dw
T V lh , + x =
h m3
'
(L 6 )
A d v (u, v, w )
D i f ( u , V, w )
S)
gj 9^x ,,
(1.7)
A dv(u,v,w )
+'
D i f ( u , V, w )
SQ
U Q y
(1.8)
V/
Semidiscretizing the equations (in tim e only), one can w rite w ith super
scripts n and n + 1 for the old an new tim e level respectively:
+i _
d U n+l
d V n+l
dx
dy
d u n+1
d v n+1
d w n+1
dx
dy
dz
At
h%
0,
(1.9)
0,
( 1.10)
7) + 1 ? /ra+ 1 h n n n
. = A d v { u n , v n, w n , un+1 )
At
v
;
+ D i f ( u n , v n , w n , u n+1)
h n+1
r ! t n+ l
+s<> V 9V 1
/ ) + 1 7ira + 1 _
(lu)
h n 71
ffd l)(t/ra,Dra,u:ra,l)ra+1)
v
;
r ! t n+ l
(1 1 2 )
From this notation, we clearly see th a t equation 1.10 decouples from the
other equations and merely serves as a postprocessing step to evaluate the
vertical velocity component after each tim e step. Equations 1.9, 1.11, 1.12
can be decoupled by introducing th e free surface correction
C
C +1  C .
(113)
h%u* 
h%un
at
hn t n
+ s  h 9W 
h%v* 
h%
h%vn
T~
( 1  1 4 )
hn t n
(U 5 )
+ s { ) ~ T k 9W
after which, by assuming knowlegde of the free surface correction, the pre
dicted values are corrected:
m +1u n+1 = E X
(1.16)
h n + i v n+1 = h l v * 
(1.17)
h s+1g ^ j .
The values for ( ' follow from inversion of the elliptic equation th a t arises by
introducing 1.16 and 1.17 into the 2D continuity equation 1.9, yielding:
('
k
At.
dU*
dV*
dx
dy
dx \
dC \
dx J
(eq.
1.14)
vpredictor
(eq.
1.15)
(eq.
1.16)
vcorrector
(eq.
1.17)
end do
dC \
+ hdy \ ^ 7 7 d7y
1.18)
(118)
A num ber of secondary errors have been introduced by this algorithm , which
can be im portant or not:
1.
has been retained at the old tim e level in the buildup of the elliptic
equation, here, h+1 m ust be used, which is not known yet, because
dependent on ,
hs
2. the implicit advection and diffusion term s in the predictor equation are
calculated w ith the old (value. It is doubtful w hether this approach
is valid, since the values of the free surface change more rapidly (due
to characteristic wave speed) th a n the currents themselves. Schemes
th a t include this dependency up to a cerain level are, am oungst others,
SIM PLE, SIM PLEC, SIM PLER, and  for transient sim ulations  PISO
or PIM PLE.
The two remarks m ade above indicate the urge of an iterative procedure to
tackle the problem. This will be the subject of the next section.
1.3
1.3. IT E R A T IV E A LG O R ITH M
step uses the latest values for
and
(:
A d v ( u n, v n , w n , u * )
At.
+ D i f ( u n,v n, w n,u*)
+ S ()
1 /3+mV 
h%v
tis+1M
d ( n+1M
h%
dx
(1 19)
A d v { u n, v n , w n , v * )
T~
+ D i f ( u n,v n, w n,v*)
+ S ()
('
hn
+1'a d C +1M
^ o+ 
+
dy
( 1.20)
7_
_7i+l,it+l _
_7i+l,
( 1.21)
a
7i+l,+l n+lj+l
"3
i n + l.it+ l
113
y
( 1.22)
7
ra
+
M
*_ 7
n+l,H
l
' *'3
"'3
(1.23)
dy"1
w ith
^7+l,+l
R n\l,it _
_ t
(1.24)
p m + l,it + l
7
7 7 + l,+ l
and
7 + 1 ,
R n + lM
(1.25)
A /7

At.
)[/*
y /
At.
9
dx
f/*
1 =
dy
..rr n + U t9 C \
ox \
ox J
f T j n + l , d <'
oy \
7
1
+
1
,it
+ 1
Oy
(1.26)
8
jjn + l, it
1 1 l
in + l,it
''3
+ 1
upredictor
(eq. 1.19)
vpredictor
(eq. 1.20)
^/ra+l.+l
jjn + l, it
7 ' + 1 . + 1
h 3
1.26)
^ra+l. __
_ _
f j n + l,it + l j f
H n + 1 ,it
h
i +
/
1
,it
ucorrector
(eq. 1.22)
vcorrector
(eq. 1.23)
if(converged) return
end do
yU
y 'n + 1
u n + l,it+ l
v 'n + l,it+ l
jjn \l,it+ l
h3 + 1
^ ra + 1
K +hit+1
n + l,it+ l
end do
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
24 8
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
Appendix H
Report on meeting between Pieter Rauwoens and Patrick Luyten
UMDC
SORESMA
COHERENS II
VERSLAG :
Datum:
Aan:
Inhoudstafe
1. INLEIDING..........................................................................................................................................1
2. BESPREKING UITGEVOERDE IMPLEMENTATIE..................................................................... 1
2.1. HYDRODYNAMIC ALGORITHM OVERVIEW............................................................................1
2.2. IMPLEMENTATIE IMPLICIETE C O D E ....................................................................................... 1
2.3. BESLUIT......................................................................................................................................... 2
3. PORTABILITEIT................................................................................................................................2
3.1. PETSC............................................................................................................................................ 2
3.2. BESLUIT......................................................................................................................................... 2
4. ACTIEPUNTEN.................................................................................................................................2
1.INLEIDING
Deeltaak 5 betreft de omvorming van het in COHERENS aanwezige expliciete numerieke
oplossingsschema naar een impliciet schema, waarbij geacht wordt grote tijdsbesparingen te
kunnen realiseren in benodigde rekentijd.
Het voorliggende verslag betreft een neerslag van de discussie tussen Pieter Rauwoens
(UGent) en Patrick Luyten (BMM) dd. 23/03/2011. Hierbij werd het verrichte implementatiewerk
besproken, alsook nog eventueel te nemen stappen in de portabiliteit van de code.
2.BESPREKING UITGEVOERDE IMPLEMENTATIE
2.1 .Hydrodynamic algorithm overview
Het document "Hydrodynamic Algorithm Overview", P. Rauwoens, Maart 2011, beschrijft het
gemplementeerde algoritme en werd gebruikt ais leidraad bij het overlopen van de
implementatie.
2.2.Implementatie impliciete code
In de huidige implementatie werd getracht zoveel mogelijk routines uit de modesplitting code te
behouden en te incorporeren in de impliciete code. Dit heeft geleid tot een aantal aanpassing in
te behandelen door
datum
controle implementatie
PLU
asap
verderzetten implementatie
PIR
conform planning
Dt5
aanpassing makefile
PIR
31/07
PIR
asap
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
25 2
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix I
Presentation on the Technical Workgroup
11/ 29/2011
UNIVERSITEIT
GENT
Implementation of a semiimplicit
scheme in COHERENS
Pieter Rauwoens
Scope of subtask 5
It is expected that there will be a large gain in CPU time
by solving the hydrodynamic equations implicitly
Time step restrictions:
convective:
A <
u
diffusive:
A f< ^ ^
2.V
\x
At < .
Jo"
internal gravity waves, ...
barotropic:
11/ 29/2011
Scope of subtask 5
Two ways of handling the barotropic time step restriction:
MODE SPLITTING
solve 3d equations related to convective CFLcriterion
solve a number (F r1) of explicit 2d barotropic steps
UNIVERSITEIT
GENT
im .
&
Overview
Scope of subtask 5
Mode splitting
Semiimplicit method (basic)
will sem iim plicit m ethod y ie ld higher efficiency?
Progress of subtask 5
T e chn isch e W e rk g ro e p C o h e re n s  P ie te r R a uw oe n s  23/05/2011
F a cu lty o f E n g in e e rin g a n d A rc h ite c tu re  D e p a rtm e n t o f C ivil E ngineering
11/ 29/2011
Mode splitting
Explicit time stepping scheme:
3dequations:
du dv dw _
+ + =0
dx dy dz
J _dhy _ ^ (] v^u V'
h3 dt
+ Djff(u Viw) + S Q  g
dx
J dh^ _
h3 dt
~\y
Integrated equations:
V'
+ V U = 0
= Adv(U) + Diff(U) + S  gHV
dt
, uNtNEMftsT
^ + Qiff(U'V'
+ 5Q_gdy_
h3 dt
dx
_1_
current_2d()
(always)
h3 dt
dy
c u r r e n t _ c o r r ()
d_
= Adv(U) + Diff(U) + S  gHV (
dt
dil
dx
dv
dy
dw _o
dz
11/ 29/2011
+ + !^}L = o
dx dy <)z
1 d h 3U _ a ^ , , , , aA , n;ff
, ca <*
= Adv(u, V, w ) + Diff(u, V, i/i/) + SO  g
h3 dt
dx
J dhjV _
h3 dt
Integrated equations:
V'
+ V U = 0
= Adv(U) + Diff(U) + S  ghNC
dt
11/ 29/2011
L.n+'\..n+'\ _
33
h"
At
y n +1 _
Adv(u, V, w) + Diff{u, V, w) + SQ 
h"
<)y
yn
i + V . L/n+1 = 0
At
dun+^ dvn+^ dwn+i n
+
+
= 0
dx
dy
dz
un^
rweit
le 0 + SO
1 h* v* hnvn
3
3  = Adv(u, V, w) + Diff(u, V, w) + S()
At
hi
yny1 ftn
2.
corrector step:. h
At
rim 1
 +. fVr L/n
+1 = 0
d f n+1
dx
fn+l fn
= i f A t.g
?
At
jM j
_
f I  At.gH.VTn+1) = 0
+i 7
V (( L/*
11/ 29/2011
Typical stencil (1 d) :
1
Fr2
1_
+ Fr2
Fr2
710
11/ 29/2011
UNIVERSITEIT
GENT
Overview
Scope of subtask 5
Mode splitting
Semiimplicit method (basic)
will sem iim plicit m ethod y ie ld higher efficiency?
Progress of subtask 5
T e chn isch e W e rk g ro e p C o h e re n s  P ie te r R a uw oe n s  23/05/2011
F a cu lty o f E n g in e e rin g a n d A rc h ite c tu re  D e p a rtm e n t o f C ivil E ngineering
+^ +^ = q
dy <)z
1 dh3U _ /1Wi/Ai ,,
, n ,w , , 1/laA , CA d
= Adv(u, V, w) + Diff{u, V, w) + SQ  g
h3 dt
dx
J_ dt\V^ _
V'
Diff(u V'vv) + 5Q _
h3 dt
Integrated equations:
dy
+ V U = 0
d0
f = Adv(U) + Diff(U) + S  gHV
11/ 29/2011
+1 = U + U~5 r +1
>
dX
2.
un+^ = + ^ dx
11/ 29/2011
2.
3.
n+
C"+1' = C"
H"+1,* = Hn
= /'S
for niterations do :
it = it  f 1
upredictor (eq. 1.19)
vpredictor (eq. 1.20)
solve free surface correction (eq.
1.26)
n  \ l,it __ r
Hn+1.H1=
+ '
n + l . i + l _ J ? n + r,tt+ l kT O + l.a
3
^ n + l. ii+ l
v n +^ jn + l, i+ l
JJn+ l _
J jn + l,it + l
h"+l = h~+1M+l
n+l _
n + l,it+ l
end do
UNftraaiHT
11/ 29/2011
^ + Qjff(U'
+ 5Q_ gjh_
h3 dt
_1_
dx
^
+ Qjff(UiV:
+ 5Q_ g^.
h3 dt
c o r r e c t _ f r e e _ s u r f ()
dy
c u r r e n t _ c o r r ()
tffif
' UNMRSTOT
dx
dy
dz
=o
1S
10
11/ 29/2011
save old time level statements are extracted from (all) subroutines
and put in separate subroutines:
s to re _ z e ta _ o ld
store_old_tim e_2d
store_old_tim e_3d
store_old_obc_arrays
obc2uvatv_old,
zeta_old,
deptota tu _pre v,
deptotatv_jprev
gmres
ICC
l e 5
11
11/ 29/2011
2.
lif f ir
12
11/ 29/2011
UNIVERSITEIT
GENT
Overview
Scope of subtask 5
Mode splitting
Semiimplicit method (basic)
will sem iim plicit m ethod y ie ld higher efficiency?
Progress of subtask 5
T e chn isch e W e rk g ro e p C o h e re n s  P ie te r R a uw oe n s  23/05/2011
F a cu lty o f E n g in e e rin g a n d A rc h ite c tu re  D e p a rtm e n t o f C ivil E ngineering
Progress of subtask 5
implementation is (almost) "ready"
successful tests for scalar transport test cases
o f course, no hydrodynam ics involved!
successful tests were done for cases with open boundary conditions
test case r iv e r
time step could be raised up to convective stability limit.
13
11/ 29/2011
X c o m p o n e n t_ o f_ e u r r e n t ( m / s )
14
11/ 29/2011
> w h y is the
X c o r a p o n e n t_ o f_ e u rr e n t ( m / s )
15
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix J
Acomen Paper
A b s tra c t
We present the m odification of the 3D hydrostatic free surface flow solver C O H EREN S. The
original solver uses the explicit m odesplitting technique, in w hich the stepping o f the surface grav
ity w aves is decoupled from the stepping of the hydrodynam ic 3D currents. A s such, C PU tim e is
gained by adopting few er 3D current solutions than 2D depthintegrated gravity w ave solutions.
Since the CFL lim it for the 2D m ode is inversly proportional to the root m ean square o f the depth,
the m odesplitting technique becom es less efficient for larger w ater depths. Treating the term s re
lated to gravity im plicitly avoids gravity w ave tim e step restriction and the use of m ode splitting,
w hile the stability o f the code is still guaranteed. On the other hand, it requires an iterative inversion
o f a system . We present an iterative version of the sem iim plicit algorithm . A com parison of the
results reveals the equivalence o f both algorithm s in term s o f accuracy. D ue to coding inefficiency,
the expected gain in C PU tim e is not y et obtained for the test case presented. However, w ith the
m odifications presented, the robustness o f the C O H EREN S m odel is increased, allow ing larger tim e
steps for com plex m odel applications.
Introduction
In the framework of the study Expansion of the numerical modeling tools for the North Sea harbors
assigned by the Maritime Access division (aMT) of the Department of Mobility and Public Works of
the Flemish Government, various software developments are carried out by T H V I M D C  Soresma,
supported by the universities of Ghent and Leuven.
The assignment consists of the development of mathematical, hydrodynamical and morphological
software in collaboration with Flanders Hydraulics Laboratory (WLB, Flemish government) and the
Management Unit of the North Sea Mathematical Models ( M U M M , federal government). The point
Research funded by project Development o f a FlemishBelgian numerical model o f the North Sea Ports, ToR
16EF/2008/02 assigned by the Maritime Acces Division (aMT) o f the Department o f M obility and Public Works o f the
Flemish Government.
of departure for the developments in this study is the current version of the C O H E R E N S version 2
hydrodynamic model that has been developed by the M U M M [1, 2],
The developed software aims to simulate currents and tidal propagation in seas, estuaries and rivers,
including the simulation of sediment transport and morphological bed changes caused by these currents
or human interference and will be used to study the hydrodynamic and morphological challenges during
the development of harbor extensions, alternative dredging and pumping strategies and sediment influx
reducing measurements for the Flemish North Sea Ports.
Besides morphological changes and implementation of additional physics, such as sediment trans
port, also changes, with respect to the starting version C O H E R E N S V2, are made to the hydrodynamical
core in order to increase the codes efficiency as much as possible. In this respect, the development of an
implicit numerical scheme for the hydrodynamical equations is put forword as an important achievement
to realize large gain in computational calculation time.
In this paper, the conversion of the original C O H E R E N S V 2 hydrodynamical module is described.
The original solver uses the explicit modesplitting technique, in which the stepping of the gravity waves
is decoupled from the stepping of the hydrodynamic 3 D currents, by using two different time steps cor
responding to the time scales of the barotropic and baroclinie mode respectively. The modification
presented here, treats the terms related to gravity implicitly and renders the use of mode splitting super
fluous, while the stability of the code is still guaranteed.
The paper is organized as follows. Section 2 describes the equations that govern the 3D hydrostatic
environmental free surface flow under study. The conversion into a semiimplicit algorithm is described
in section 3, after which numerical examples (section 4) serve to illustrate the algorithms properties.
The conclusions section summarizes the findings of the paper.
Governing Equations
Taking advantage of the hydrostatic, traditional and Boussinesq approximations, the dynamics of a fluid
with mean density po is governed by:
du
dv
dx
dy
du
du
dw
dz
du
(D
fc
du
M + u d i + " y + w a ; .   g d i + d i Jz
dv
dv
dv
dv
9Rn
9 R i2
9R i 3
dx
dy
dz
9 R 2i
dx
9R22
/ bdz' H
d(
m + U d i : + V d y + W d~z= ~ 9 y + y
Po
fC
1
/ bdz H'z
Po
dy
9 R 23
dz
+ fv ,
(2)
 fu .
(3)
Here, {u, v, w ) describe the velocity components in the x, y and 2 directions, respectively. The axis is
along the parallels, pointing east, while the yaxis points North along the meridian lines. The 2 axis is
vertical, pointing upwards, with 2 = 0 describing the mean water level. The variable b = (p po) g / po
represents the buoyancy, the tensor Ry, (with i , j = 1, 2, 3) denotes the Reynolds stress tensor, is the
Coriolis parameter and g the gravitational acceleration. In addition, integrating (1) over the depth and
using the kinematic condition at the free surface leads to an equation which describes the dynamics of
the free surface elevation ( ,
d(
dU
dV
dt + i h
+ d  0'
(4)
in which U and V are the depthintegrated horizontal velocities. Atthefree surface and bottom bound
ary,the horizontal fluid stresses are related to a surface stress induced by wind and aprescribed bottom
shear stress, respectively.
It is c o m m o n to discretize the equations with an Arakawa C'grid [3] such that scalars (e.g. water
depth, surface elevations) are defined in the center of a grid cell while vector quantities (e.g. velocities
and stresses) are assigned to cell faces. In the vertical direction, the movement of the grid with the free
surface boundary is treated by using scoordinates.
Introducing the notations AV), D v(), /I/,() and /)/,() for the vertical and horizontal advective and
diffusive terms, and by denoting all source terms, except those related to the free surface elevation by S,
we can write the discrete momentum equations (in conservative form) as
= Ah^
+ A v^
+ Dh^
+ D v^
+ Sx~ 9 f a
ot
(6)
oy
SemiImplicit Algorithm
3.1
Algorithm Description
In the semiimplicit version of the algorithm, the above equations are solved using a segregated ap
proach. In time, the vertical advection and diffusion terms are considered implicitly. In addition, also
the free surface gradient is taken implicitly such that the time step is not restricted to the C F L criterion
related to the propagation of surface gravity waves. All the other terms are discretized explicitly. Using
A t to denote the time step and superscripts n and n + 1 for the old and new time levels, repectively, the
governing equations are semidiscretized (only in time) as:
ATi+1 _ A
At
u n + l
n + l
A
g u n+ l
QVn + l
+ ~ T +  +
y n
r =
(7)
r)+ n + l
 = h? [A v (u n , u n + l) + D v (u n , u n + l) +
A h{un)+
D h (u n ) + Sx]  ha+ 1 g ^ ^ ,
%)
u n + l
A
n + l
y ji.n
 3 _ = hn [M v n^ ^n+1) +
^n+1) +
a / n + l
_ ^n+ l g ^ _ _
(9)
Considering the nonlinearity in the timediscretized equations of the momentum due to ti^ + 1 u n + 1
and IF 11v " 11, and the coupling of the continuity and momentum equations, an iterative algorithm is
adopted. For clarity, a new superscript is introduced, indicating the iteration level; i.e. <>+M*+i denotes
the value of the variable <fi at the new time step n + l obtained after performing iteration it . Introducing
the free surface correction
C
(^ T l+ 1 > + 1
i+ l, it
Q Q )
equations (7)  (9) are now decoupled and the system (at a certain iteration level, it) can be solved by
computing first a predictor velocity ( u * ,v * ) considering:
, n + l,it
i n
u 3
3 a
At
a f n + l,it
h 'n A
n,n
n
n,n
n,n \
n
n,n \
o
1
= h%
[A v ((u
n , u *) +i D
v ((u
n , u *) +i AA h ((v
n ) +i D
h ((un
) +i Sx}
 hr , ra +^ M ui g
77
dx
(11)
i n + l, it
A
At
i n . n
= ^
fi+ n + l,it
Both (11) and (12) consist of a tridiagonal system that is readily solved using the Thomas algorithm.
The horizontal velocities are then given by
//
+
At
At
g y *
Q u*
+
T W
dx
^ f g A t H n + 1 a ^ f ) +
i g A t H n + 1 a ? f ) .
d
ox \
ox )
oy \
ay )
dy
(15)
The inversion of (15) is computed using preconditioned Krylov methods, taking advantage of the open
source scientific computation library PETSc [4],
In summary, the iterative algorithm consists of:
n =
it = it + 1
ra+l,it + I '
H n + l,it+ l =
(u,v)corrector (eq.
if(converged) return
end do
un+ 1 _
u n + l,it+ l
yn+l _
^n+l,ii+l
(eq.
H n + l,it +
15)
/
and
13 & 14)
ggn+l _
g g n + l,it+ l
and Cn+1 =
end do
In the convergence check the Loonorm of (' is compared with a treshold value e: 11' 
< e.
3.2 Discussion
The purpose of elaborating algorithms for free surface flows is to increase efficiency. Standard explicit
algorithms are inefficient due to the disparity in time scales of the barotropic and baroclinie modes. Two
com m o n solutions exist: semiimplicit treatment of the equations [5] and the modesplitting technique
[6]. With both methods, the 3D momentum equations are solved in time with a time step related to
the convective CFLcriterion. With the semiimplicit method, the determination of the free surface
height is done once every time step by inverting the elliptic equation (15), whereas the modesplitting
technique involves a number, inversely proportional to the Froude number (Fr),of explicit solutions of
the depthintegrated (2D) momentum and continuity equations. As such, one can expect that the modesplitting algorithm becomes less efficient for deeper water (higher Fr) and the use of a semiimplicit
might become more advantageous. One has to note, however, as the matrix becomes less diagonally
dominant for higher Fr, that the solution of the elliptic system also becomes harder for the iterative
solver invoked. Relying on recent advances in linear algebra, the semiimplicit algorithm is expected to
be most efficient. N o w having the two algorithms within the same C O H E R E N S code, allows to check
whether this is true. W e come back to this point later in this paper.
The semiimplicit algorithm, used in the examples, uses a correction method to obtain higher ac
curacy (see also [7]) and hence differs from the projection method, described in [5], Also, the extra
iteration loop allows to achieve h% fully implicit and is useful in combination with implicit advection
and/or diffusion terms in the momentum equation. The advantage of the extra iteration loop is illustrated
below.
Numerical Tests
Preliminary results of the model performance are presented. Hereto, w e analyse the ability of the nu
merical model to describe the circulation and evolution of a tidally modulated estuarine salinity front.
(b) tw o days
Figure 1: Residual salinity and current field analysed after (a) one, (b) two and (c) three days.
90
E x p lic it
Im p lic it
80
=
O
70
CL
O
=3
O
=
O
60
50
<75
CL
40
30
10
20
30
40
50
60
70
80
tim e [h o u rs]
Figure 2: The time development of the distance between the left boundary and the point where the
salinity front outcrops the surface considering the free surface gradient implicitly (full line) and explicitly
(dashed line).
riv e r
A twodimensional (in horizontal and vertical directions) channel of uniform depth is considered.
The channel is 140 k m long and 20 m deep. Initially, a vertical uniform salinity front is considered by
imposing a salinity distribution given by
r 30
S =
if
I 0.25( [35
< 25
25) + 30if
25 < x < 45
(16)
if x > 45.
Here, S is the salinity in P S U and x the distance from the left boundary of the channel in km. The
propagation of a tidal wave is induced by specifying a periodic (incoming) Riemann variable at the left
boundary such that
R+ = 2cAcos(uit +
7t /2 )
(17)
y/gH is the barotropic wave speed, ui the frequency of the tidal wave (semidiurnal),H the
water depth and A the forcing amplitude. At the right boundary, the normal gradient of the incoming
Riemann variable //_ is set zero (i.e. dR /d x = 0) such that the tidal wave can propagate freely
where c =
from left to right. In addition, a zero normal gradient condition is assumed for salinity at the two open
boundaries. The simulation is caried out in two phases. First, a spinup phase of 2 days is considered
without salinity. In the second part, the salinity front is introduced and the modulation of the salinity
front is simulated for three days.
In figure 1 the residual salinity and current field after one, two and three days is plotted. The figure
shows that a circulation is generated with a surface flow to the right and a bottom flow to the left; together
with downwelling at the right edge and upwelling at the left edge of the front. The current is generated
by a balance between the baroclinie pressure gradient and the vertical diffusion term, induced by tidal
friction [1],
Figure 2 plots the location of the point where the salinity front outcrops the surface, h f r , during
the tidal cycle. h f r is measured by the distance i k m of the 34 P S U contour line (taken at the first grid
0.02
A h fro n t
A re s v e lo c ity
0.015
0.01
0.005
0.005
1e06
1e05
0.0001
0.001
0.01
0.1
tre s h o ld v a lu e e
Figure 3: Sensitivity of the model results with respect to the treshold value t[m],
cell below the surface) to the left boundary. It is found that the front moves to the right with an almost
uniform speed on which tidal modulations are superimposed. The position of the outcrop is presented in
figure 2 considering the free surface gradient implicitly (full line) and explicitly (dashed line). A good
agreement is found indicating the equivalence of both algorithmic approaches.
The sensitivy of the results and the performance of the model with respect to the treshold value e is
analysed in figures 3 and 4. In figure 3, A h f r(mt and Ares velocity is plotted for several treshold values
with
a7
h f rconv\
i a
i a
r^res(^) ^res.conv
/1 o\
A hfro nt = j
and Ares velocity = J: L.
(18)
" f r.ronr
Ures,conv
In (18), u res represents the residual surface horizontal current and the underscript 'c o n v ' denotes the
value to which h f r and u res converge descreasing the treshold value. It is found that the relative differ
ence for both output parameters is smaller than 2%, indicating that the obtained accuracy by decreasing
the treshold value is not substantial. Here, it is worth to point out that for the largest value of e consid
ered (t = 0.1), the norm of ( ' turns out smaller than the treshold value at the first check; i.e. only one
iteration is performed. Considering that a decrease from e equal 0.1 to 1.05 triples the computational
time (see figure 4), the results suggest that the use of a very small value of e is not necessary. Depending
on the desired accuracy, for these simulations a value of e equal to 0.01 or 0.07 seems appropriate.
Finally, in figure 4, also the computational time to complete the simulation using the explicit (modesplitting) scheme is presented (red horizontal line). For stability, the mode splitting scheme requires
10 2D substeps, each time step. It is found that the implementation of the implicit algorithm sligthly
decreases the computational cost of the numerical model when the treshold value is large. For decreasing
values of e, it turns out that the numerical simulation with the free surface gradient implicit becomes
more expensive than using the modesplitting scheme. The only slight increase in efficiency does not
correspond to the expectations and is probably due to the way PETSc is coupled to the main source code.
It is expected that a more efficiently coded matrix fillup will result in higher efficiencies. In the future,
a linear solver will be coded within the source code, yielding faster calculations.
32
im plicit
explicit
30
28
26
ITT
24
22
TD
0)
0)
20
I 18
16
14
12
++
10
1e06
1e05
0.0001
0.001
0.01
0.1
treshold value e
Figure 4: The time necessary to complete the simulation for different values of t[m]. The necessary
computational time, using the explicit scheme, is represented by the red line.
Conclusions
W e presented the modification of a modesplitting algorithm into a semiimplicit free surface correction
algorithm for free surface flows within the framework of the hydrodynamical flow solver C O H E R E N S .
By virtue of the modifications made, the codes robustness is increased, allowing larger time steps for
complex model applications. In order to cope with the nonlinearity in the governing equations, an
iterative algorithm was adopted. The influence of the amount of iterations, controlled by means of a
convergence criterion for the free surface correction, was investigated with the test case of a tidally
modulated estuarine salinity front. W e concluded that accuracy increases as the convergence treshold
becomes smaller. O n the other hand, also simulation time increases. Comparing the efficiency of the
semiimplicit method and the modesplitting algorithm, the expected efficiency increase was not ob
tained. ft will be investigated whether further code optimization is capable of obtaining the predicted
efficiency gain.
References
[1] P.J. Luyten. Coherens, a coupled hydrodynamicalecological model for regional and shelf seas: User
documentation, version 2.0. Technical report, R B 1 N S  M U M M , Royal Belgian Institute of Natural
Sciences, to be published on http://www.mumm.ac.be/coherens,2011.
[2] P. Luyten, 1. AndreuBurillo, A. Norro, S. Ponsar, and R. Proctor. A new version of the european
public domain code coherens, ln H. Dahlin, N.C. Fleming, P. Marchand, and S.E. Petersson, editors,
European O perational Oceanography: Present and future. Proceedings o f the fourth EUROGOOS
Conference, pages 474481, E U R O G O O S Office, Norrkping, 2006.
[3] A. Arakawa and V. Lamb. Computational design of the basic dynamical processes of the ucla general
circulation model. In Methods in Computational Physics, volume 17, pages 174267. Academic
Press, 1977.
[4] Satish Balay, William D. Gropp, Lois Curfman Mcinnes, and Barry F. Smith. Efficient management
of parallelism in object oriented numerical software libraries. In E. Arge, A. M. Bruaset, and H. P.
Langtangen, editors, M odern Software Tools in Scientic Computing, pages 163202. Birkhuser
Press, 1997.
[5] V. Casulli and E. Cattani. Stability, accuracy and efficiency of a semiimplicit method for threedimensional shallow water flow. Computers and M athematics with Applications, 27(4) :99 112,
1994.
[6] A.F. Blumberg and G.L. Melior. A description of a threedimensional coastal ocean circulation
model. In N.S. Heaps, editor, Three dimensional coastal ocean models, American Geophysical
Union, Washington, 1987.
[7] X. Chen. A free surface correction method for simulating shallow water flows. Journal o f Compu
tatio na l Physics, 189:567578, 2003.
T H V IM D C S o resm a
in coi. w ith KU Leuven, UG ent, BM M en W LB
Appendix K
Acomen presentation
11/ 29/2011
UNIVERSITEIT
GENT
A C O M E N  P ie te r R a uw oens  16/11/2011
F a cu lty o f E n g in e e rin g a n d A rc h ite c tu re  D e p a rtm e n t o f C ivil E ngineering
'iMVHtsHT
A C O M E N  P ie te r R a uw oens  16/11/2011
F a cu lty o f E n g in ee rin g and A rc h ite ctu re  D e p a rtm e n t o f C ivil E ngineering
11/ 29/2011
F nnnmpprnn
anri
A rc
r rh
itpcrti
E
g in e e rin g a
nd A
h ite
tuirp
re  D e p a rtm e n t o f C ivil E ng in ee ring
a t<
u
diffusive:
barotropic:
Ax
At < ,
Jo"
internal gravity waves, ...
f lf f if
K / unwersiibt
A C O M E N  P ie te r R a uw oe n s  16/11/2011
F a cu lty o f E n g in e e rin g a n d A rc h ite c tu re  D e p a rtm e n t o f C ivil E ngineering
11/ 29/2011
fjjy
tffllT
nun
,r
UNIVERSITEIT
GENT
i
FACULTY OF ENGINEERING AND
ARCHITECTURE
Overview
Introduction
COHERENS before
mode splitting algorithm
COHERENS after
semiimplicit algorithm
Test Cases
2D and 3D tests with emphasis on computing time
simulation results vs. theoretical reasoning
Conclusion and Prospects
ACOMEN  Pieter Rauwoens  16/11/2011
Faculty of Engineering and Architecture  Department of Civil Engineering
11/ 29/2011
COHERENS before
Starting point = COHERENS v. 2.0
Hydrodynamic core:
Governing equations
Explicit time stepping scheme:
3dequations:
+ + !^}L = o
dx dy <)z
1 d h 3U _ a^ , , , , aA , n;ff
, ca
< *
= Adv(u, v, w) + Diff(u, v, i/i/) + SO  g
h3 dt
dx
J dhjV _
h3 d t
Integrated equations:
r tf'
V'
+ V U = 0
11/ 29/2011
t_diyj_ _
h3 dt
+ 5Q_gdy_
dx
u =o
current_corr ()
(every #th time step)
rescale 3d velocity field to match 2d fields
apply 3d boundary conditions
calculate vertical velocity
ffi/fy Ttffrr
J i p / uMivERsrrEiT
dx
dy
dz
=o
Wj ' /
US
^ ^ /ifN^asiTHT
ACOMENPieter Rauwoens16/11/2011
Faculty of Engineering and Architecture  Department of Civil Engineering
10
11/ 29/2011
COHERENS after
Destination point = COHERENS v. 3.0
Hydrodynamic core:
+ + !^}L = o
dx dy <)z
1 d h 3U _ a^ , , , , aA , n;ff
, ca
< *
= Adv(u, v, w) + Diff(u, v, i/i/) + SO  g
h3 dt
dx
J dhjV _
h3 d t
Integrated equations:
V'
+ V U = 0
= Adv(U) + Diff(U) + S  gHS/
dt
11/ 29/2011
i_/?+1 ^
33
h"
At
y n +1 _
Adv(u, V, w) + Diff{u, V, w) + SQ  g
h"
<)y
yn
i+ V . L/n+1 = 0
At
dy
dz
un^
rweit
le 0 + SO
1 h* v* hnvn
3
3  = Adv(u, V, w) + Diff(u, V, w) + S()
At
hi
2.
corrector step:.
f^n+1 ftn
S
At
rim 1
 +. fVr L/n
+1 = 0
Jz=0
= i f A t.g
d fn+1
dx
fn+l fn
?
At
_
f I
+i 7
V (( L/*
 At.gH.VTn+1) = 0
11/ 29/2011
( gH V C n+1)
= Cn  A tv O'
Typical stencil (1 d) :
F r2
1_
+ F r2
F r2
11/ 29/2011
2.
1,* = H n
= /'S
for niterations do :
it = it  f 1
1.26)
n  \ l,it __ r
H n + 1.H1
n+l.i+l _
+ '
Jfn+l.tt+1 ^ n + 1 ,i t
l^n+l _
v n+^
JJn+ l _
m + l,it+ l
h"+l = h~+1M+l
n+l _
n + l,it+ l
end do
UNftraaiHT
11/ 29/2011
_1_
Qjff(U'
+ 5Q _
gjh_
dx
h3 dt
dy
correct_free_surf()
solve 2d continuity equations
^ +V U =0
dt
current_corr()
rescale 3d velocity field to match 2d fields
apply 3d boundary conditions
calculate vertical velocity
J
Vffl/fy
tiffir
jp/ jNivERsrrEiT
A
dxv
.41/
dy
A7
dz
=o
UNIVERSITEIT
GENT
Overview
Introduction
COHERENS before
mode splitting algorithm
COHERENS after
semiimplicit algorithm
Test Cases
2D and 3D tests with emphasis on computing time
simulation results vs. theoretical reasoning
10
11/29/2011
R e s i d u a l S a l i n i t y (PSU)
A C O M E N  P ie te r R auw oens  16/11/2011
Faculty o f E n ginee ring and A rc h ite ctu re  D e pa rtm e n t o f C ivil E ngineering
0.015
0.01
im p licit
e xp licit
0.005
0
0.005 1e06
1e05
0.0001
0.001
0.01
0.1
treshold value e
1e05
0.0001
0.001
0.01
treshold value e
11
11/ 29/2011
12
11/ 29/2011
"implicit
20
explicit
15
10
5
0
1,E04
J  p / un^ rweit
1,E03
1,E02
1,E01
1,E+00
nun
p jT
UNIVERSITEIT
GENT
v /i
Overview
Introduction
COHERENS before
mode splitting algorithm
COHERENS after
semiimplicit algorithm
Test Cases
2D and 3D tests with emphasis on computing time
simulation results vs. theoretical reasoning
Conclusion and Prospects
ACOMEN  Pieter Rauwoens  16/11/2011
Faculty o f Engineering and A rc h ite c tu re  Department of Civil Engineering
13
11/ 29/2011
Conclusions
Prospects
ffl/ty
^U N ra in B T
14
11/ 29/2011
UNIVERSITEIT
GENT
15
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
Appendix L
Test cases for validation
UMDC
SORESMA
COHERENS II
RAPPORT :
Datum:
Aan:
Inhoudstafe
1. INLEIDING..........................................................................................................................................1
2. VOORGESTELDE TEST CASES................................................................................................... 1
2.1. LINEAR PROGRESSIVE WAVES THROUGH A FLUME..........................................................1
2.2. 2.
TIDAL FLOW OVER AN IRREGULAR BED...................................................................... 2
2.3. 3.
TWO SEICH OSCILLATIONS.............................................................................................2
3. BESLUIT............................................................................................................................................ 2
4. REFERENTIES..................................................................................................................................2
1.INLEIDING
Conform actiepunt 13.2 van de technische werkgroep werd UGent gevraagd enkele test cases
voorop te stellen ter validatie van de impliciete code. Na literatuuronderzoek bleek het aantal
geschikte test cases eerder minimaal: veel cases dienen ter validatie van niethydrostatische
codes, anderen zijn geschikt om een schema te testen dat beschikt over een dryingwetting
procedure. Deze laatste reeks test cases kunnen eventueel worden aangewend om de merging
van de impliciete code met de inundatieschema's te valideren.
Hoewel het aanwezige testschema in COHERENS reeds een afdoende test vormt voor de
correcte implementatie van het impliciete schema, worden hieronder nog 3 extra test cases
voorgesteld, allen academisch van aard.
2.VOORGESTELDE TEST CASES
2.1.
The linear progressive wave is a simple 1D problem, having an analytical solution. It is used to
assess the frequency dispersion and wave damping. One setup can be used, with different
boundary conditions, providing details of the incoming wave. A comparison is to be made
between the semiimplicit scheme and the explicit scheme, and accuracy is to be tested for a
number of time steps.
The test case resembles the river test case, but without focus on the salinity front.
The tidal flow is a simple 1D problem, having an analytical solution. It is used to assess the bed
slope source term, and thus to check whether the code has correct conservation properties.
With this respect, since the same 3D momentum equations are solved, no difference is expected
for the implicit and explicit code. On the other hand, in the explicit scheme, also integrated 2D
momentum equations are solved, so there might be an issue there.
Further details in Zijlema et al, 2011. Test case by Bermudez et al, 1994.
Claim: the model applies the correct conservation properties, such thatno artificial waves are
created, both in the semiimplicit formulation and the explicit formulation.
2.3.3.
This test case can be seen as an extension of the first test case. Again there is an analytical
solution (of the linearized equations), but now the (horizontal) 2D aspect of the flow is assessed.
Comparison between implicit and explicit scheme might clear out the difference in accuracy
between the two methods.
This test case was used as an academic test case to prove the validity of the free surface
correction scheme of Chen, 2003. The implemented scheme in COFIERENS is very similar.
Flence, this test case seems appropriate.
Claim: the model is able to capture wave dispersion for waves generated in two dimensions.
3.BESLUIT
Er werden 3 test cases voorgesteld, die relatief eenvoudig te modelleren zijn in COFIERENS,
om het impliciete schema te valideren.
4.REFERENTIES
Bermudez A., Vazquez M.E., Upwind methods for hyperbolic conservation laws with source
terms. Computers and Fluids 23, 10491071, 1994.
Chen X., A free surface correction method for simulating shallow water flows. Journal o f
Computational Physics 189, 557578, 2003.
Zijlema M., Stelling G., Smit P., SWASFI: An operational public domain code for simulating wave
fields and rapidly varied flows in coastal waters. Coastal Engineering 58, 9921012, 2011.
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
E x p a n s io n o f n u m e ric a l m o d e lin g to o ls
T a sk o rd e r 4 : D e s ig n o f th e im p lic it s c h e m e in C O H E R E N S
29 8
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
Appendix M
Revised manual (extracts)
We highlight the revised parts of the manual. All revisions are marked in red in the uploaded full
manual on the svnserver.
The user can choose the type of hydrodynamic scheme: the modesplitting technique can
be applied to solve the 2D and 3D momentum and continuity equations; or the semiimplicit
scheme can be chosen to solve the 2D and 3D continuity and 3D momentum equations.
a compiled PETSC library which is needed (only) to solve the 2D continuity equation when
the semiimplicit algorithm is choosen
The PETSC compiler option is needed to solve the linear system formed in the semiimplicit
mode. An error will occur by the compiler if the PETSC library is not installed and linked to
the main source code.
Using PETSc solver library is as follows:
1. Make sure that the PETSC library (Version 3.1 or later) is properly installed.
2. Insert the appropriate library options in compilers.cmp.
3. Insert DPETSC in options.cpp.
4. Export the PETSCdirectory, using the command
export PETSC_DIR = $ H 0 M E / p e t s c  3 .*p*
2D mode equations: In case of the semiimplicit scheme, the 2D momentum equations are
not needed and the CFL limit is resolved by treating the free surface implicitly.
Two options are available to solve the hydrodynamic equations. The original implemen
tation in COHERENS used the modesplitting technique as in the model of Blumberg &
Melior (1987) to solve the momentum equations. This method consists in solving the depthintegrated momentum and continuity equations for the external or barotropic mode with a
small time step to satisfy the stringent CFL stability criterium for surface gravity waves, and
the 3D momentum and scalar transport equations for the internal or baroclinie mode
with a larger time step. A predictor and a corrector step are applied for the horizontal
momentum equations to satisfy the basic requirement that the depthintegrated currents
obtained from the the 2D and 3D mode equations, have identical values. Recently, the
possibility to solve the momentum equations semiimplicitly as in the model of Chen (2003),
based on the original work of Casulli & Cheng (1992) was implemented. With this method,
there is no longer need to solve the depthintegrated momentum equations. The stringent
CFL stability criterium is relaxed by treating the terms that provoke the barotropic mode in
an implicit manner. After an explicit predictor step, velocities are corrected with the implicit
free surface correction in hte corrector step. In this method, the free surface correction
follows from the inversion of the elliptic free surface correction equation obtained from the
2D continuity equation.
T H V IM D C S o re s m a
E x p a n s io n o f n u m e ric a l m o d e lin g to o ls
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
T a sk o rd e r 4 : D e s ig n o f th e im p lic it s c h e m e in C O H E R E N S
The semiimplicit hydrodynamic scheme only uses one (3D) timestep. In this case, M t = 1
and A t = A t Because of the implict treatment of the free surface wave, for stability, there is
no 2D CFL time step restriction. The convective CFL criterion does need to be satisfied in
all cells at all times.
There is a possibility to perform the hydrodynamic solution more than once every time step.
Particularly in case of the use of the semiimplicit free surface correction method, the accu
racy can be enhanced by applying extra iterations. The values at these extra iteration levels
are addressed with the following superscrips :
 it:
it
Within the framework of the semiimplicit method for free surface correction, steps 1 to 6
are repeated, according to the convergence criterion for the free surface correction and the
maximum number of iterations specified by the user.
semiimplicit free surface correction:
1. The 2D continuity equation, written in terms of the free surface correction is solved:
At
( A c
At
( A t h t j g H n+
M7.2 V V
/? i /?2
hi{
( A w u m) +
(h iv n )
X^J
y\
At the level of the equation itself, open boundary conditions for the depth integrated
velocities are already introduced.
2. The free surface elevation is updated
n + l,it+l
_ n + l, i t __ /
2)
+ 1,it
(M.3)
and interpolated values are calculated. Also the third grid spacing at the new iteration
level is evaluated.
4. The depthintegrated velocity fields are corrected:
+
Lj n + l , i t + l = Ljp _
(M .4)
(M.5)
V f = V n +1'it+1
The iteration loop is broken, once one of the two following criteria are met:
1. The maximum amount of iterations is exceeded:
i t > i t max
m a x (CO
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
<
e,
300
T H V IM D C S o re s m a
E x p a n s io n o f n u m e ric a l m o d e lin g to o ls
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
T a sk o rd e r 4 : D e s ig n o f th e im p lic it s c h e m e in C O H E R E N S
2. Uvelocity fluxes
For the determination of the contribution of the fluxes to the linear system, the fluxes are
calculated at a certain cell face (Unode). In the finitevolume context, the contribution
of the flux is the same (but with opposite sign) for the two adjacent cells. For the velocity
flux at the western face of cell i j, the contributions are:
(M.9)
h \h o
3.
Vvelocity fluxes
For the velocity flux at the southern face of cell ij, the contributions are:
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
( ^ )
hiho h%
n + 1 , i t ;v
(M.11)
301
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
E x p a n s io n o f n u m e ric a l m o d e lin g to o ls
T a sk o rd e r 4 : D e s ig n o f th e im p lic it s c h e m e in C O H E R E N S
l/R A/11339/10.072/GVH
V e rs io n 2 .0 0 9 /0 8 /2 0 1 2
30 2
T H V IM D C S o re s m a
in c o i. w ith KU L e u v e n , U G e n t, B M M en W L B
Bibliography
Blumberg, A.F., & Melior, G.L. 1987. A description of a threedimensional coastal ocean circulation
model. Pages 116 of: Heaps, N.S. (ed), Threedimensional Coastal Ocean Models. Coastal
and Estuarine Sciences. Washington D.C.: Americal Geophysical Union.
Casulli, V., & Cheng, R.T. 1992. Semiimplicit finite difference methods for threedimensional
shallow water flow. International Journal for Numerical Methods in Fluids, 15, 629648.
Chen, X. 2003. A freesurface correction method for simulating shallow water flows. Journal of
Computational Physics, 189, 557579.