# SMS:CGWAVE Math Details: Numerical Solution

Equation (5) is generally solved using the boundary element method, the finite-difference method, or the finite element method. In general, finite-difference discretizations are not well-suited to represent the complex domain shapes described, for example, in Fig. 1. Not only are the boundaries distorted, but the number of uniformly spaced grids may also be excessively large. (Adequate resolution, typically 10 points per wavelength, demands that the spacing be determined from the smallest wavelength.) Most studies with the finite-difference method have been limited to largely rectangular domains (e.g. Li 1994a, 1994b; Panchang et al. 1991; Li and Anatasiou 1992). Boundary element models can handle arbitrary shapes and require minimal storage since only the boundaries are discretized; however, they are limited to subdomains with constant depths only (e.g. Isaacson and Qu 1990; Lee and Raichlen 1972; Lennon et al. 1982). Finite element models, on the other hand, allow the construction of grids with variable sizes (based on the local wavelength) and give a good reproduction of the boundary shapes. Most finite element models (e.g. Tsay and Liu 1983; Tsay et al. 1989; Kostense et al. 1988; Demirbilek and Panchang 1998; Panchang et al. 2000) have used triangular elements, and modern graphical grid generating software permits efficient and accurate representation of harbors with complex shapes. The Surface Water Modeling System can be used to conveniently generate as many as 1,000,000 elements of varying size, based on the desired (user-specified) resolution, and to specify the desired reflection coefficients on various segments of the closed boundary. The solution of (1) by the finite element method is described in detail by Mei (1983) and by Demirbilek and Panchang (1998) when different types of open boundary conditions are used.

Whether one uses finite differences or finite elements for discretization, the numerical treatment of (1) with appropriately chosen boundary conditions leads to system of linear equations:

${\displaystyle [A][\phi ]=[B]\ }$ (28)

where [φ] represents the vector of all the unknown potentials. For solving (5), a similar system results as long as W is prespecified. The matrix [A] is usually extremely large. In earlier models (e.g. Tsay and Liu 1983; Tsay et al. 1989; Chen, 1990; Chen and Houston, 1987) the solution of (28) was accomplished by Gaussian Elimination, which requires enormous memory and is prohibitive when the number of wavelengths in the domain is large (i.e. short waves or a large domain). Pos and Kilner (1987) were able to alleviate this difficulty somewhat by using the frontal solution method of Irons (1970).

In recent years, the solution of (28) has been obtained with minimal storage requirements for [A]. This is due to the development by Panchang et al. (1991) and Li (1994a) of iterative techniques especially suited for (1). These techniques, based on the conjugate gradient method, guarantee convergence and have been found to be extremely robust in a wide variety of applications involving both finite differences and finite elements for several kinds of boundary conditions. For a review of other methods, see Panchang and Demirbilek (2000). Options based on the work of both papers, viz. Panchang et al. (1991) and Li (1994a), are available in CGWAVE. It is found that the latter often leads to faster convergence, but in an oscillating fashion. The former leads to a monotonically decreasing error which can be more reassuring while the iterations are in progress.