A Numerical Technique for Coupling the Momentum and the Continuity Equations for Semi-Implicit 3D Ocean Models
Abstract
Semi-implicit methods are powerful and efficient tools for the three-dimensional modeling of coastal and oceanic processes. A semi-implicit finite difference method for 3D hydrostatic primitive equations is presented in this paper. The governing equations are time-discretized with an implicit treatment of barotropic pressure gradient and vertical viscosity. The discretized momentum equations along a water column are coupled with the depth-integrated continuity equation of the column to construct a linear system for free-surface elevations. The novelty of this work lies in formulating an efficient method with the order of complexity O(N) for coupling the momentum and the continuity equations. In this method, the horizontal velocity components are expressed in terms of neighbor free-surface elevations by some simple recursive formulas and then are substituted in the integrated continuity equation.
Keywords free-surface flow shallow water finite difference semi-implicit hydrostatic pressure three-dimensional
1 Introduction
Numerical modeling of free-surface flows has been widely used to study the hydrodynamics and the transport processes of oceans, coastal waters, and rivers. Many of the geophysical flow models are based on Hydrostatic Primitive Equations (HPE). The HPEs relax the assumption of hydrostatic pressure, which reduces the vertical momentum equation to the hydrostatic pressure distribution. Large-scale phenomena in the free-surface flows are accurately described by the HPEs [14]. Several three-dimensional hydrostatic models have been developed and applied successfully to various practical problems. Different numerical methods, horizontal and vertical grid systems, and time discretization approaches have been employed to develop models.
In geophysical flow modelling, a reasonable balance between accuracy, stability, and computational efficiency is generally achieved when time discretization of the barotropic pressure gradient and the vertical eddy viscosity in momentum equations are implicit. This is due to the severe stability limitations that arise from these terms [21]. Different solution methods have been presented yet for the HPEs.
Some models (e.g., POM [2], ROMS [17], and FVCOM [9]) utilize mode-splitting technique [13], in which the pressure gradient terms are not often treated implicitly. However, in order to retain computational efficiency, the free-surface elevations are determined externally from the depth-integrated equations (external mode) and the velocity components are calculated from the main three-dimensional equations (internal mode). Therefore, a large time-step can be used for the internal mode because it is no longer limited by CFL stability conditions. Nevertheless, models using this technique have errors associated with using two systems of equations. Recent efforts in this field have led to the development of more schemes to solve the three-dimensional hydrostatic systems.
A free-surface correction method developed by Chen presents a predictor-corrector method for the HPEs [10]. In this method, first an intermediate free-surface is obtained with the explicit and implicit treatment of the pressure gradient and the vertical viscosity terms. Then the intermediate free-surface is corrected by solving a five-diagonal linear system for free-surface changes over the time step.
A semi-implicit finite difference method has been first presented by Casulli and Cheng which solves the three-dimensional HPEs directly with an implicit treatment of the pressure gradient and the vertical viscosity [4]. The semi-implicit algorithm is accurate, stable, and straightforward. It calculates the free-surface elevations and the horizontal velocity components simultaneously. This method has been also used to develop quasi-hydrostatic [6], non-hydrostatic [11], unstructured grid [8], and isopycnal coordinate [5] models. In recent years, semi-implicit methods have been used in several studies. The semi-implicit models such as TRIM-3D [4], UnTRIM [8], ECOM-si [3], SUSTAN [11], and ELCIRC [22] have enjoyed great success in simulating geophysical flows.
In the semi-implicit methods, the solution approach is to couple the horizontal momentum equations with the depth-integrated continuity equations in a way that a linear system is constructed for the free-surface. For this purpose, the horizontal velocity components should be derived in terms of neighbor water elevations. By substituting them in the depth-integrated continuity equation, a five-diagonal (or sparse in case of unstructured grid) linear system for free-surface is achieved. In the discretized momentum equation, each horizontal velocity component is related with both the neighbor water levels and the neighbor horizontal velocities (along the column). A basic way to solve such a system for the horizontal velocity is to arrange all the momentum equations along a water column in a tridiagonal linear system and inverting the coefficient matrix. Doing so is however computationally expensive and unjustified in practice.
In this paper, an algorithm is presented to construct a linear system for free-surface elevations. A three-dimensional shallow water model is developed to illustrate the details and validate the algorithm. The governing equations are discretized by finite difference method. In the proposed method, the horizontal velocity components are determined in terms of the free-surface elevations by some simple recursive formulas. The derived formulas are then substituted in the depth-integrated continuity equation to calculate the free-surface elevations.
2 Governing Equations
The conservation laws of mass and momentum that describe the fluid motion are known as Reynolds-Averaged Navier-Stokes equations (RANS). The three-dimensional hydrostatic primitive equations (HPE) are derived from the Navier-Stokes equations by involving the Coriolis force and applying the hydrostatic approximation. Provided that the density is constant, a conservative form of the equations is expressed as:
(1) |
(2) |
(3) |
where , , and are the velocity components in the , , and directions respectively, is the time, is the free-surface elevation measured from the still water level, is the gravity constant, is the Coriolis parameter, and , are the horizontal and vertical viscosity coefficients. Because of the small effects of the horizontal viscosity terms in shallow water environments, it is justified to use a constant coefficient for the horizontal viscosity [21]. The vertical eddy viscosity coefficient is calculated using the Prandtl’s mixing-length theory [18].
The mathematical expression for the kinematic boundary condition at the impermeable bottom is:
(4) |
where is the water depth measured from the still water level. At the moving free surface, the kinematic boundary condition is:
(5) |
The depth-integrated continuity equation is derived by using the kinematic boundary conditions and integrating the continuity Eq. (3) over the water depth giving:
(6) |
The dynamic boundary condition at the free surface is determined by wind shear stress giving:
(7) |
where and are the prescribed wind stress components [19]. Similarly, at the impermeable bottom boundary, the dynamic boundary condition is specified by the bed shear stress and is expressed as:
(8) |
where is the bed shear stress. The bed shear stress can be represented in the form of a quadratic friction law giving:
(9) |
where is Chezy’s roughness coefficient.
3 Description of Proposed Algorithm
A finite difference method is used to discretize the governing equations and the boundary conditions on a staggered grid layout in a Cartesian coordinate system. The computational domain is discretized by , , and cells in the , , and directions, respectively. , , and are the cell sizes in , , and directions. In the and directions, a uniform cell size is used, while in the vertical direction varies with . The height of top layer cells also varies with time and horizontal location to simulate the free-surface. Each cell is denoted by at center and the cell faces are denoted by , and , as shown in Figure 1. The scalar quantities are defined at the cell centers, while the velocity components are located at the faces.

Discretization of the governing equations is based on the semi-implicit method [4] in which the barotropic pressure gradient and the vertical viscosity terms are discretized implicitly. However, the convective, the Coriolis, and the horizontal viscosity terms are finite differenced explicitly. A central difference scheme is used for spatial discretization. Notably, the nonlinear advection terms are solved based on the method described in [16] The general discretized form of the Eqs. (1) and (2) can be expressed as:
(10) |
(11) |
where is the time step and is an explicit operator including the explicit terms. There are several ways to discretize the explicit terms. We have used a second-order upwind explicit method for the convection terms and a central explicit method for the horizontal viscosity in the model.
By applying the dynamic boundary conditions, the discretized momentum equations for top layer cells take the form:
(12) |
(13) |
and for the bottom layer cells, the equations become:
(14) |
(15) |
where the velocities in the time step are used to calculate and .
A detailed description of the algorithm is presented below. For brevity, the and indices are not shown if they are unnecessary. The Eqs. (12)-(15) can be written in the following form:
(16) |
(17) |
where
wherein the coefficients are:
(18) | ||||
Now applying the dynamic boundary conditions yields to:
(19) | ||||
The proposed algorithm for solving Eqs. (16-17) consists of three steps. First, a forward sweep eliminates the lower diagonal of the coefficients matrix. Second, the right-hand side entries are partitioned into the known and unknown parts and each part is formulated recursively. Third, a backward sweep solves the system for and .
3.1 Step 1: Forward Sweep
In the first step, the lower diagonal is eliminated by a forward sweep. This step is similar to the well-known double-sweep algorithm [1]. By applying the forward sweep, the Eqs. (16) and (17) become as follows:
(20) |
(21) |
where
wherein the entries are:
(22) |
(23) |
3.2 Step 2: Decomposing
In the second step, the right-hand side matrix entries, i.e. Eq. (23), are partitioned into two parts in a way that each part can be defined recursively.
Lemma 1. The Eq. (23) can be defined as follows for the and directions respectively:
(24) |
(25) |
where the recursive coefficient for both and directions is:
(26) |
and for and directions are:
(26b) |
(26c) |
Proof. Using mathematical induction, the Eq. (24) is proved and likewise the Eq. (25) can be proved. In the basis step, it is proved that the Eq. (24) holds for . From the Eq. (23), is:
In the inductive step, it is proved if the Eq. (24) holds for , then it holds for . We have:
Substituting (**) into (*) gives:
3.3 Step 3: Backward Sweep
In the third step, a backward sweep produces the horizontal velocities in terms of the free-surface elevations.
Lemma 2. The horizontal velocity components can be expressed as follows:
(27) |
(28) |
where the coefficients and are defined as:
(29) |
(29b) |
Proof. A backward induction is used to prove Eqs. (27) and (28). In the basis step, it is proved that the Eq. (27) holds for . The Eq. (20) for is:
In the inductive step, it is shown if the Eq. (27) holds for , it holds for . the -th row of the Eq. (20) is:
and Eq. (27) holds for is:
Substituting (**) into (*) yields:
The Eq. (28) can be also proved similarly. Finally, the horizontal velocity components are determined in terms of free-surface elevations as follows (matrix form):
(30) |
(31) |
In order to determine , the Eqs. (30) and (31) are substituted into the depth-integrated continuity equation. The discretized form of the Eq. (6) in a matrix notation takes the form:
(32) |
where is a five-diagonal matrix and is the right-hand side vector.
Substitution of the Eqs. (30) and (31) into the Eq. (32) yields:
(33) | ||||
which is a symmetric positive definite and diagonally dominant five-diagonal system. This system can be solved efficiently by a conjugate gradient method [4].
In summary, the proposed algorithm to calculate takes the following simple steps:
-
1.
Calculate and from the Eqs. (21) and (22).
-
2.
Calculate from the Eq. (25).
-
3.
Calculate and from the Eqs. (29).
-
4.
Calculate and from the Eqs. (32).
-
5.
Solve the five-diagonal linear system (36).
3.4 Calculating Velocity Field
Once the new free-surface elevations have been determined, the new horizontal velocity components are directly determined by substituting the new free-surface elevations in the Eqs. (27) and (28). Eventually, the Eq. (3) is directly applicable to calculate the vertical velocity components. This equation is discretized as follows:
(34) |
Using the boundary condition (4) that implies and starting from the bottom layer cells, the vertical velocity components are determined.
4 Method Validation and Efficiency
Two classical test cases have been undertaken to validate the proposed algorithm and to verify the mass and momentum conservation of the developed model.
4.1 Standing Wave in a Rectangular Basin
In the first test case, a standing wave in a rectangular basin was simulated. The analytical solution for a small amplitude standing wave is given by the following relations [15]:
(35) |
(36) |
(37) |
where is the wave amplitude, which in this test and are taken as the basin dimensions, , is the mean water depth, is the vertical position, and . Figure 2 shows the initial condition for the free-surface elevation. The analytical solution is derived in an ideal condition that the fluid is inviscid and the bottom friction is zero. These conditions have been also applied in the model. The wave amplitude and the basin dimensions have been taken as 0.1m and m. The computational space has been discretized with the cells of dimensions m, m, m, and the time step was 0.05s.

Figure 3(a) shows the numerical prediction of the free-surface elevations compared with the analytical solution at . As shown in this figure, wave damping after six oscillations is small and acceptable. In figure 3(b), numerical and analytical solutions of the free-surface elevation are presented at . Figure 3(c) shows the predicted and analytical values of the horizontal velocity at m, . It can be seen that the simulated free-surface and horizontal velocity agree well with the analytical solution.

4.2 Wind-Driven Circulatory Flow
The second test case was a wind-driven circulatory flow in a closed rectangular basin. In this test, the advection and the horizontal diffusion were neglected and a linearized bottom friction was used. The analytical solution for a constant vertical eddy viscosity and a linearized bottom friction is [12]:
(38) |
(39) |
where is the water depth and is the linearized bottom friction coefficient. In this test, was set to 0.1 N/m2 in both numerical and analytical solutions. The other parameters were: m, m2/s, m/s, and Kg/m3. The basin dimensions were 2500×2500×40m, which were discretized into the cells with m, m, m, and the time step was 2s. A comparison of the horizontal velocity profile between the numerical model and the analytical solution is shown in Figure 4.

4.3 Efficiency of the Method
Assuming that the number of horizontal layers is , any methods employed to couple the momentum and the continuity equations will finish at , , etc. Generally, the smaller the order of complexity of the algorithm, the faster it will run. The standing wave test case in section 4.1 was repeated for a different number of horizontal layers to investigate the order of complexity of the method and all CPU times were recorded.
Figure 5(a) shows the simulation time for a different number of horizontal layers. As shown in this figure, the simulation time increases linearly and the method is of the least order of complexity .

For the purpose of comparison, a fast tridiagonal matrix inversion algorithm [20] with the order of complexity was also used to couple the equations in the test case. The result shows how important is the order of complexity of the employed coupling method in the computational efficiency of the model.
5 Summary
A semi-implicit model is developed to simulate three-dimensional HPEs. The pressure gradient terms and the vertical viscosity terms are discretized implicitly in the horizontal momentum equations, while the other terms are treated explicitly with respect to time. A method is presented to couple the horizontal momentum equation and the depth-integrated continuity equation which constructs a linear system to calculate the free-surface elevations. In the proposed algorithm, some simple recursive formulas have been formulated to express the horizontal velocity components in terms of the neighbor free-surface elevations which allows them to be directly substituted in the depth-integrated continuity equation.
The algorithm was validated by two idealized classical test cases: a uni-nodal standing wave in a rectangular basin and a wind-driven circulatory flow in a closed rectangular basin. It has been shown that the computation time increases linearly when the number of horizontal layers increases. It means that the order of complexity of the method is . Although the most expensive part of computations in each time step is to solve the five-diagonal linear system of the free-surface, it has been shown that the order of complexity the employed method to couple the equations considerably affects the computational efficiency of the model.
References
- [1] Anderson J. (1995). Computational Fluid Dynamics (Vol. 206). New York: McGraw-Hill. doi:https://doi.org/10.1201/9781351124027.
- [2] Blumberg A. F., & Mellor G. L. (1987). A description of a three-dimensional coastal ocean circulation model. Three-dimensional coastal ocean models, 4, 1-16. doi:https://doi.org/10.1029/CO004p0001.
- [3] Blumberg A. F. (1994). A primer for ECOM-si. Technical report of HydroQual 66.
- [4] Casulli V., & Cheng R. T. (1992). Semi-implicit finite difference methods for three-dimensional shallow water flow. International Journal for Numerical Methods in Fluids, 15(6), 629-648. doi:https://doi.org/10.1002/fld.1650150602.
- [5] Casulli V. (1997). Numerical simulation of three-dimensional free surface flow in isopycnal coordinates. International Journal for Numerical Methods in Fluids, 25(6), 645-658. doi:https://doi.org/10.1002/(SICI)1097-0363(19970930)25:6%3C645::AID-FLD579%3E3.0.CO;2-L.
- [6] Casulli V., & Stelling G. S. (1998). Numerical Simulation of 3D Quasi-Hydrostatic Free-Surface Flows. Journal of Hydraulic Engineering, 124(7), 678-686. doi:https://doi.org/10.1061/(ASCE)0733-9429(1998)124:7(678).
- [7] Casulli V. (1999). A Semi-Implicit Finite Difference Method for Non-Hydrostatic Free-Surface Flows. International Journal for Numerical Methods in Fluids, 30(May 1998), 425-440. doi:https://doi.org/10.1002/(SICI)1097-0363(19990630)30:4%3C425::AID-FLD847%3E3.0.CO;2-D.
- [8] Casulli V., & Walters R. A. (2000). An unstructured grid three-dimensional model based on the shallow water equations. International Journal for Numerical Methods in Fluids, 32(3), 331-348. doi:https://doi.org/10.1002/(SICI)1097-0363(20000215)32:3%3C331::AID-FLD941%3E3.0.CO;2-C.
- [9] Chen C., Liu H., & Beardsley R. C. (2003). An unstructured finite volume three-dimensional primitive equation ocean model: Application to coastal ocean and estuaries. Journal Atmospheric and Oceanic Technology, 20, 159-186. doi:https://doi.org/10.1175/1520-0426(2003)020%3C0159:AUGFVT%3E2.0.CO;2.
- [10] Chen X. (2003). A free-surface correction method for simulating shallow water flows. Journal of Computational Physics, 189(2), 557-578. doi:https://doi.org/10.1016/S0021-9991(03)00234-1.
- [11] Fringer O. B., Gerritsen M., & Street R. L. (2006). An unstructured-grid finite-volume nonhydrostatic parallel coastal ocean simulator. Ocean Modelling, 14(3-4), 139-173. doi:https://doi.org/10.1016/j.ocemod.2006.03.006.
- [12] Huang, H. & Spaulding, M. (1995). A three-dimensional numerical model of estuarine circulation and water quality induced by surface discharges. Estuarine, Coastal and Shelf Science, 40, 357-380.
- [13] Madala R. V., & Piacseki S. A. (1977). A semi-implicit numerical model for baroclinic oceans. Journal of Computational Physics, 23(2), 167-178. doi:https://doi.org/10.1016/0021-9991(77)90119-X.
- [14] Marshall J., Hill C., Perelman L., & Adcroft A. (1997). Hydrostatic, quasi-hydrostatic, and nonhydrostatic ocean modeling. Journal of Geophysical Research: Oceans, 102(C3), 5733-5752. doi:https://doi.org/10.1029/96JC02776.
- [15] Mei C. C. (1989). The applied dynamics of ocean surface waves. Singapore: World Scientific.
- [16] Shahabi, A. and Ghiassi, R. (2022). A robust second-order godunov-type method for Burgers’ equation. International Journal of Applied and Computational Mathematics, 8(2), 82. Springer. doi:https://doi.org/10.1007/s40819-021-01171-7.
- [17] Shchepetkin A. F., & McWilliams J. C. (2005). The regional oceanic modeling system (ROMS): a split-explicit, free-surface, topography-following-coordinate oceanic model. Ocean Modelling, 9(4), 347-404. doi:https://doi.org/10.1016/j.ocemod.2004.08.002.
- [18] Smagorinsky J. (1963). General Circulation Experiments With the Primitive Equations. Monthly Weather Review, 91(3), 99-164.
- [19] Taylor G. I. (1916). Skin friction of the wind on the earth’s surface. Proc. R. Soc. Lond. A, 92(637), 196-199.
- [20] Usmani R. A. (1994). Inversion of a tridiagonal jacobi matrix. Linear Algebra and Its Applications, 212-213, 413-414.
- [21] Vreugdenhil C. B. (1994). Numerical methods for shallow-water flow (Vol. 13). Springer Science & Business Media.
- [22] Zhang Y., Baptista A. M., & Myers E. P. (2004). A cross-scale model for 3D baroclinic circulation in estuary–plume–shelf systems: I. Formulation and skill assessment. Continental Shelf Research, 24(18), 2187-2214. doi:https://doi.org/10.1016/j.csr.2004.07.021.