<<

Modelling 40 (2011) 72–86

Contents lists available at ScienceDirect

Ocean Modelling

journal homepage: www.elsevier.com/locate/ocemod

Physical vs. numerical dispersion in nonhydrostatic ocean modeling ⇑ Sean Vitousek , Oliver B. Fringer

Environmental Fluid Mechanics Laboratory, Stanford University, Stanford, CA 94305, United States article info abstract

Article history: Many large-scale simulations of internal are computed with ocean models solving the primitive Received 11 September 2010 (hydrostatic) equations. Under certain circumstances, however, internal waves can represent a dynamical Received in revised form 29 May 2011 balance between nonlinearity and nonhydrostasy (dispersion), and thus may require computationally Accepted 1 July 2011 expensive nonhydrostatic simulations to be well-resolved. Most discretizations of the primitive equa- Available online 14 July 2011 tions are second-order accurate, inducing numerical dispersion generated from odd-order terms in the truncation error (3rd-order derivatives and higher). This numerical dispersion mimics physical dispersion Keywords: due to nonhydrostasy. In this paper, we determine the numerical dispersion coefficient associated with Dispersion common discretizations of the primitive equations. We compare this coefficient to the physical disper- Nonhydrostatic effects Internal waves sion coefficient from the Boussinesq equations or KdV equation. The results show that, to lowest order, 2 Ocean modeling the ratio of numerical to physical dispersion is C = Kk , where K is an O(1) constant dependent on the dis- Grid resolution requirements cretization of the governing equations and k is the grid leptic ratio, k Dx/h1, where Dx is the horizontal

Leptic ratio grid spacing and h1 is the depth of the internal interface. In addition to deriving this relationship, we ver- Lepticity ify that it indeed holds in a nonhydrostatic ocean model (SUNTANS). To ensure relative dominance of physical over numerical effects, simulations require C 1. Based on this condition, the horizontal grid

spacing required for proper resolution of nonhydrostatic effects is k < O(1) or Dx < h1. When this condi- tion is not satisfied, numerical dispersion overwhelms physical dispersion, and modeled internal waves exist with a dynamical balance between nonlinearity and numerical dispersion. Satisfaction of this con- dition may be a significant additional resolution requirement beyond the current state-of-the-art in ocean modeling. Published by Elsevier Ltd.

1. Introduction and de-Vries, 1895). These equations represent the depth-averaged conservation of mass and momentum and include dispersive Dispersion, a characteristic of nonlinear or nonhydrostatic effects due to nonhydrostasy by retaining the lowest-order effects waves, occurs when the speed is a non-constant of of integrating the nonhydrostatic pressure over the depth. The KdV the wave or wave (or similarly ) equation reduces conservation of mass and momentum to a single (Whitham, 1974). Distinction is sometimes made between these equation which is valid only for unidirectional . two types of dispersion, namely amplitude dispersion and In this paper, we rely heavily on the Boussinesq equations and frequency dispersion, respectively (LeBlond and Mysak, 1978). KdV equation as models that faithfully represent nonlinear and The two are synonymous with nonlinearity and nonhydrostasy in nonhydrostatic behavior in more complicated natural systems, in studies of gravity waves, and hence are typically called nonlinear- this case, oceanic internal gravity waves. ity and dispersion. Many researchers have relied on weakly nonlinear, weakly non- Interesting wave phenomena exist when both nonlinearity and hydrostatic KdV theory to understand both qualitative and quanti- dispersion occur together and with approximately equal magni- tative details of internal waves (Helfrich and Melville, 2006). tude. Under such circumstances, nonlinear steepening balances dynamics have been examined using the KdV dispersive spreading, and propagating waves of constant form framework which shows good comparison of internal wave pro- known as ‘‘solitary’’ waves are possible (Korteweg and de-Vries, files with the analytical result from the KdV equation (Liu et al., 1895). The most common equations satisfying the balanced motion 1998; Stanton and Ostrovsky, 1998; Duda et al., 2004; Warn- include the Boussinesq equations (Boussinesq, 1871, 1872; Pere- Varnas et al., 2010). Developments extending KdV theory to fully grine, 1967) and the Korteweg–de Vries (KdV) equation (Korteweg nonlinear dynamics have made significant contributions to the literature, a complete list of which is given in Helfrich and Melville

⇑ Corresponding author. (2006). However, weakly nonlinear, weakly nonhydrostatic scaling E-mail addresses: [email protected] (S. Vitousek), [email protected] (O.B. of many internal wave problems justifies use of traditional KdV Fringer). theory.

1463-5003/$ - see front matter Published by Elsevier Ltd. doi:10.1016/j.ocemod.2011.07.002 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 73

Many oceanic internal waves are long relative to the depth and ing equations. Often second-order central differences are used, hence are nearly hydrostatic. Therefore, modeling waves of such implying that the dominant numerical dispersion coefficient is pro- scale with a hydrostatic model may be appropriate (Kantha and portional to the horizontal grid spacing squared. In this paper, we Clayson, 2000). In many other cases, near continental shelves and determine the numerical dispersion coefficient from the modified ocean ridges, internal waves can be highly nonlinear and nonhy- equivalent partial differential equation given from a particular dis- drostatic, often appearing as rank-ordered solitary-like wave trains cretization (Hirt, 1968). Such analyses would be of limited use with- (Hunkins and Fliegel, 1973; Apel et al., 1985; Liu et al., 1998; Scotti out, as a point of comparison, the physical dispersion coefficient. For and Pineda, 2004). Thus, simulations of internal waves may require internal waves, as mentioned previously, this is provided by the fully nonhydrostatic models (such as MITgcm (Marshall et al., Boussinesq equations or the KdV equation. Realistic nonhydrostatic 1997), SUNTANS (Fringer et al., 2006), nonhydrostatic ROMS simulations require that the physical dispersion is much larger than (Kanarska et al., 2007)). The drawback of fully nonhydrostatic the numerical dispersion. Because the physical dispersion for a gi- models is the computational cost associated with solving a 3-D ven problem is typically fixed, the problem of minimizing numerical elliptic equation for the nonhydrostatic pressure, which may re- dispersion in nonhydrostatic ocean models reduces to the problem quire an order of magnitude increase in computational time (Frin- of providing adequate horizontal resolution. As we will show, this ger et al., 2006). The prohibitive computational cost requirement as adequate horizontal resolution is Dx < h1 where Dx is the horizontal well as the nearly hydrostatic scales make primitive (hydrostatic) grid spacing and h1 is the depth of the internal interface. ocean models the preferred method for simulating internal waves The remainder of this paper is divided into four sections. Sec- in the ocean. Although not as computationally expensive, the prim- tion 2 presents the governing equations for modeling dynamics itive equations do not resolve physical dispersion resulting from of internal waves used in our analysis and derives the ratio of nonhydrostatic effects. However, this may not be a problem when numerical to physical dispersion and associated resolution require- physical dispersion is negligible. An excellent discussion concern- ments of a model. Section 3 presents numerical simulations of the ing the application of hydrostatic models to the problem of simu- KdV equation and the fully nonhydrostatic ocean model SUNTANS lating internal waves is presented in Hodges et al. (2006). They and illustrates how both models are prone to numerical dispersion. propose that future use of primitive ocean models is justified due Finally, Sections 4 and 5 present the discussion and conclusions of to the clear hydrostatic scaling of most problems of interest. How- the methods in this paper, respectively. ever, they also point out issues that modelers must contend with when simulating processes which include internal waves with 2. Governing equations hydrostatic models. As we will show, it is not only the lack of phys- ical dispersion that adversely influences model results of internal We begin with the nondimensional two-layer Boussinesq equa- waves, but the presence of numerical dispersion. tions representing the weakly nonlinear and weakly nonhydrostat- The concept of numerical dispersion is not particularly new. ic motion of the two-layer system depicted in Fig. 1. In this paper, Long has it been known that even if the governing equations are we indicate nondimensional quantities with a ⁄. Following Lynett nondispersive, their discrete model may be (artificially) dispersive and Liu (2002), the governing nondimensional momentum and (Trefethen, 1982). In early work, some authors referred to this as continuity equations in one horizontal dimension which retain ‘‘spurious dispersion’’ (Vichnevetsky, 1980; Vichnevetsky and Bow- the first-order nonlinear and nonhydrostatic effects are given by les, 1982). Numerical dispersion generally refers to the class of oU oU og h2 o2 oU essentially unavoidable spurious oscillations that result from 1 þ dU 1 þ 2 1 1 ¼ O 2d; 4 ; ð1Þ numerical discretization. In other fields, particularly electrodynam- ot 1 ox ox 3 ox2 ot ics and acoustics, dispersion–relation–preserving numerical o o schemes (Tam and Webb, 1993) have received significant attention. n h dn U ¼ OðÞDq ; ð2Þ The effects of numerical dispersion have received limited atten- ot ox 1 1 tion in the literature on gravity waves. One instance is from Burwell 2 2 et al. (2007), who examine the numerically diffusive and dispersive oU oU 1 o h o oU 2 þ dU 2 þ q g þ n þ 2 2 2 properties of models and find the horizontal grid resolu- ot 2 ox q ox 1 6 ox2 ot 2 tion is critical to accurately simulate the dispersive behavior. They o2 o 2 h U 2 4 suggest a method, based on the concept in Shuto (1991), in which 2 h 2 ¼ O d; ; ð3Þ 2 ox2 2 ot the grid resolution and thus the numerical dispersion can be tuned to replicate the physical dispersion not resolved in the (hydrostatic) model. Gottwald (2007) show that discretization of the inviscid Burgers equation can result in the KdV equation as its correspond- ing modified equivalent partial differential equation, where the (purely numerical) dispersive term is generated from truncation er- ror. Schroeder and Schlünzen (2009) derive a numerical for an atmospheric internal model. Their relation naturally tends toward the true dispersion relation as the horizontal grid spacing approaches zero. In simulations of internal waves, numerical dispersion is particularly adverse because it may create an artificial balance with the nonlinear steepening ten- dency of the wave and produce solitary-like waves that are physi- cally unrealistic or impossible. Both Hodges et al. (2006) and Wadzuk and Hodges (2009) speculate that this is the problem with inconsistencies arising in hydrostatic ocean models. In this paper, we will demonstrate that this is indeed the case. Numerical dispersion typically results from odd-ordered derivatives (3rd-order and higher) in the truncation error of finite- difference approximations to first-order derivatives in the govern- Fig. 1. Basic dimensional setup of the problem after Lynett and Liu (2002). 74 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 on o form of these equations while maintaining the same order of accu- þ h þ dn U ¼ 0: ð4Þ ot ox 2 2 racy in the asymptotic approximation by self-substitution of the The nondimensional horizontal in the upper and lower first-order relation of the momentum equation, viz: layers are given by U ¼ U =U and U ¼ U =U , respectively, where oU on 1 1 0 2 2 0 O 2; d; D : 11 ¼ þ q ð Þ U0 is the characteristic flow velocity. The nondimensional densities of ot ox the upper and lower layers are given respectively by q1 ¼ q1=q0 and This was recognized by Peregrine (1967) although the common q2 ¼ q2=q0, where q2 > q1 and typically q0 = q2, and it is assumed form (9) was retained. Substitution of the first-order balance (11) ⁄ that Dq =(q2 q1)/q0 1. The nondimensional height of the free into the dispersion term in the momentum Eq. (9) gives, to ⁄ ⁄ ⁄ 2 4 ⁄ surface above the still level is g = g/(a0Dq ), and n = n/a0 is O( d, ,Dq ): the nondimensional height of the internal interface above the still o o o 2 o3 U U n n interface level and a0 is a measure of the interface deflection. þ dU ¼ þ ; ð12Þ |{z}ot |fflfflfflffl{zfflfflfflffl}ox |{z}ox |fflfflfflffl{zfflfflfflffl}3 ox3 h1 ¼ h1=h0 and h2 ¼ h2=h0 are the nondimensional depths of the upper and lower layers, respectively, where the characteristic water acceleration advection of hydrostatic nonhydrostatic momentum pressure gradient pressure gradient depth is given by where the terms are identified to illustrate the related terms in the h1h2 h ¼ ; ð5Þ fully nonhydrostatic and nonlinear equations from which they arise. 0 h þ h 1 2 Recall that the sign of the pressure gradient terms are positive be- ⁄ and h1 and h2 are the dimensional layer depths in quiescent condi- cause of the definition of n from Eq. (8). Eq. (12) is more convenient tions i.e. g = n =0. than (9) because it does not contain mixed time and space deriva- Two nondimensional parameters, d and , play important roles tives. This will facilitate direct comparison between the physical in the behavior of the equations, since they represent the degree of dispersion arising from the nonhydrostatic pressure and the numer- nonlinearity and nonhydrostasy of the wave solutions, respec- ical dispersion arising from discretization errors. tively. These parameters are given by Eqs. (10) and (12) admit bidirectional wave solutions. We re- strict our study to unidirectional waves by projecting Eqs. (10) a0 d ¼ ; ð6Þ and (12) onto one of their linear characteristics. This gives the h0 KdV equation (derivation of which is given in Zauderer (1989)) h0 ¼ ; ð7Þ governing the evolution of the interface height. The KdV equation, L w to O(2d,4,Dq⁄), is given by where Lw is the internal wave horizontal length scale. Eqs. (1) and o o 2 o3 (3) are derived under the assumptions of weak nonlinearity and n 3 n n þ 1 dn þ ¼ 0; ð13Þ weak nonhydrostasy, viz. O(d)=O(2)

2 x 1 n n c2 ¼ ¼ 1 ðkÞ2; ð25Þ nnþ1 nn1 3 n n 2 3 i i þ 1 dnn iþ1 i1 k qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2Dt 2 i 2Dx ðkÞ2 which gives the phase speed c ¼ 1 . Without dispersion, 2 1 nn nn þ nn 1 nn 3 þ 2 iþ2 iþ1 i1 2 i2 ¼ 0; ð31Þ ? 0, the dispersion relation reduces to that of the nondimen- 6 Dx3 sional , x2 = k2, which gives the phase speed c = ±1. Eqs. (24) and (25) can be compared to the true where the superscript n represents the time index and the subscript nondimensional Airy dispersion relation (LeBlond and Mysak, i represents the spatial index or individual grid point of the numer- 1978): n ical solution on a discrete grid, i.e. ni ¼ n xi ; tn ¼ n ðiDx ; nDt Þ. The second-order accurate spatial discretization of the dispersion k 1 2 17 x2 ¼ tanhðkÞ¼k2 1 ðkÞ2 þ ðkÞ4 ðkÞ6 þ ; term in Eq. (31) ensures that truncation errors are O(2(Dx⁄)2) and 3 15 315 thus numerical error associated with this term is much smaller than ð26Þ the retained terms. with The modified equivalent partial differential form of the spatial gradient term in Eq. (31), as obtained by expansion of the numer- 2 2 x 1 1 2 2 4 17 6 ical solution in a Taylor series, is given by c ¼ 2 ¼ tanhðkÞ¼1 ðkÞ þ ðkÞ ðkÞ þ: k k 3 15 315 n n n n n o n 2 o3 4 o5 6 o7 niþ1 ni1 n Dx n Dx n Dx n 8 ð27Þ ¼ þ þ þ þ O Dx : 2Dx ox 6 ox3 120 ox5 5040 ox7 i i i i These show that the Boussinesq equations recover the Airy disper- ð32Þ sion relation to O((k)4). The third-order derivative term in the momentum equation (12) appearing from the first-order nonhydro- Therefore, to O(Dx⁄2), the second-order accurate, central finite- o3 n static effect, ox3 , called the dispersion term, is aptly named because difference approximation is consistent with the first derivative at it is responsible for deviation from shallow-water behavior. Fur- the grid point i and time-level n. To derive the modified equivalent thermore, the coefficient in front of this term is the lowest-order partial differential equation (MEPDE) of the KdV equation (13) we physical dispersion coefficient. use expansions similar to Eq. (32) for all finite-difference terms in 76 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86

Eq. (31). Furthermore, the linear Eq. (28) can be used to convert the tions. The primary source of numerical dispersion for the KdV higher-order time derivatives to spatial derivatives. To O(2,d), Eq. equation (13), based on the central discretization (31), is the spatial (28) gives: discretization of the horizontal pressure gradient. The spatial dis- cretization of this term in Eq. (31) provides the 1 in the constant omn omn ¼ð1Þm ; ð33Þ K, while the time-discretization reduces K by C2. If the time discret- otm oxm ization were carried out to 3rd-order or greater, while using sec- where m is the order of the partial derivative. Thus the MEPDE of ond-order central differences on the linear gradient term, then the discrete KdV equation (31) after removing subscript i and super- the constant would be K = 1. If instead of leap-frog we employ the script n (since the equation holds for all discrete space and time), is semi-implicit h-method (Casulli and Cattani, 1994) for the temporal given by discretization of the KdV equation (13), we obtain the same MEPDE 2 as Eq. (35), but with K ¼ 1 þ C . Therefore, for most popular second- on 3 on 2 o3n 2 1 dn b order accurate methods (in either space or time) the ratio of numer- þ þ þ 3 ot 2 ox 6 ox ⁄ ical to physical dispersion should be of the form C = K(Dx /)2, ¼ O 2Dx2; dDx2; Dx4; Dt4 ; ð34Þ where for most practical implementations K is an O(1) constant.

2 In terms of dimensional parameters, the ratio of numerical to where b ¼ð1 C2Þ Dx and C Dt is the Courant number (see 6 Dx physical dispersion is given by Appendix A for derivation). This shows that the modified form of  2 Dx the KdV equation resulting from second-order accurate, central fi- 2 2 Dx Lw Dx  2 nite-difference approximation in time and space differs from the C ¼ K ¼ 2 ¼ K ¼ Kk ; ð39Þ h1 h1 original KdV equation (13) due to the addition of numerical disper- Lw sion of magnitude b. Here, b is the lowest-order numerical disper- where k Dx/h is the grid leptic ratio (Scotti and Mitran, 2008), or sion coefficient arising from the discretization of the linear 1 lepticity. To ensure relative dominance of physical over numerical pressure gradient term. Note that a Courant number satisfying effects, simulations require C 1. Since the ratio of numerical to C2 >1+(/Dx⁄)2 may lead to negative dispersion and instability. physical dispersion is given by C = Kk2, the condition C 1is met when k < O(1) or Dx < h . 2.3. Comparison of numerical and physical dispersion 1 If instead we redimensionalize the nonhydrostatic parameter appearing in the KdV equation with the general two-layer expres- We can rewrite Eq. (34) after factoring the physical dispersion sion given in Eq. (17), then the form of C for a general two-layer coefficient, 2/6, as: system is given by   2 3 2 2 on 3 on o n Dx Dx 2 2 þ 1 dn þð1 þ CÞ Dx Lw Lw Dx ot 2 ox 6 ox3 qffiffiffiffiffiffiffiffi k k ; C ¼ K ¼ K 2 ¼ K h h ¼ K ¼ K 1 2 ð40Þ h h 1 2 h h 2 2 2 4 4 1 2 2 1 2 2 ðLwÞ ¼ O Dx ; dDx ; Dx ; Dt ; ð35Þ ðLwÞ where C, the ratio of numerical to physical dispersion, is given by where k1 Dx/h1 and k2 Dx/h2. In this case, the requirement that

2 1 is met when k k 1. Equivalently, this condition is met 2 Dx 2 2 C 1 2 b ð1 C Þ 6 2 Dx Dx C ¼ ¼ ¼ð1 C Þ ¼ K ; ð36Þ when both k1 < O(1) and k2 < O(1), or when Dx < min (h1,h2). For a 2 2 2 6 6 general stratification, Eq. (19) can be used to show that:  2 2 Dx with K =1 C . We write Eq. (35) in this form to show that numer- 2 2 Dx Lw Dx ical discretization of the governing equation increases the magni- 2 C ¼ K ¼ K sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiR !2 ¼ K 2 ¼ Kke ; ð41Þ 0 tude of dispersion by a factor of 1 + C, due to the presence of /2dz he 3 R d 2 0 o 2 numerical dispersion. The modified dispersion relation of the line- ðLwÞ / ðÞoz dz arized version of Eq. (35),toO((k)4,(kDx⁄)4), is given by d ! where ke Dx/he, and the equivalent depth in a continuously-strat- ðkÞ2 ified fluid of depth d is given by x ¼ k 1 ð1 þ CÞ ; ð37Þ vffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 6 u R u 0 2 t3 d / dz he ¼ R : which gives: 0 o/ 2 d oz dz ðkÞ2 c ¼ 1 ðÞ1 þ C : ð38Þ Forp affiffi linearly-stratified fluid, / = sin (pz/d), which gives 6 3 he ¼ p d 0:55d. In the presence of linear stratification, the hori- Eq. (38) shows that both physical and numerical dispersion (assum- zontal grid resolution must therefore be less than roughly one-half ing C2 6 1+ (/Dx⁄)2) reduce the speed of the waves. Comparing the water depth in order for the numerical dispersion to be less than Eqs. (35) and (37) to (29) and (30), respectively, shows that the the physical dispersion. numerical solution will be consistent with the true solution when The MEPDE analysis has identified the dominant numerical dis- C is small, meaning that the numerical effects of dispersion are persion term for second-order accurate methods that is propor- small in comparison to the physical effects. When C P O(1), the tional to (kDx⁄)2. The parameter kDx⁄ can be interpreted as the phase speed of short waves (k P O(0.1)) may be significantly af- degree to which the variability of a wave is resolved on a discrete fected by the additional (artificial) dispersion. The ratio C, as seen grid. Slowly-varying waves on fine grids result in small values of in Eq. (36), becomes zero when the Courant number is 1, and all er- kDx⁄ and little numerical error. On the other hand, short waves on ror in the MEPDE is eliminated. This is an ideal case and in general, coarse grids give large values of kDx⁄ and result in significant error. the Courant number will not be 1. However, a Courant number near 1 for this discretization decreases the magnitude of C since as 2.4. Modeled solitary wave widths C ? 1,K ? 0. For moderate and low Courant numbers the coefficient K has little effect on the order of magnitude of C. The presence of numerical dispersion affects the width of mod- It is important to note that the constant K in Eq. (36) is deter- eled solitary-like waves. The analytical length scale derived mined by both the spatial and temporal discretization of the equa- from the analytical solution to the KdV equation (13) is given by S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 77 rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 4 2 KdV equation (13) as the ‘‘nonhydrostatic equation’’, and refer to L : ð42Þ 0 3 da the KdV equation without dispersion ( = 0) as the ‘‘hydrostatic equation’’. We will show that the results of the two models can Modeled soliton length scales can be derived from the analytical be almost identical when the numerical dispersion, present in both solution to the modified equivalent KdV equation (34), which is models, is much larger than the physical dispersion in the nonhy- similar to analytical solution of the KdV equation (15) and is given drostatic model, and hence dominates the solution of both by equations. x ct The numerical experiments are performed with the second-or- n ¼ a sech2 ; ð43Þ L der accurate discretization of the KdV equation given in Eq. (31).A grid-refinement convergence analysis verifying that the method is where the modeled soliton length scale is: rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi indeed second-order accurate is given in Appendix B. The following 2 2 pffiffiffiffiffiffiffiffiffiffiffiffiffi 2 simulations use the parameters = 0.1 and d = 0.2, which are cho- =6 þ b 4 ðÞ1 þ C 4 L ¼ 8 ¼ ¼ 1 þ C sen to approximately match the internal wave scales given in Apel da 3 da 3 da pffiffiffiffiffiffiffiffiffiffiffiffiffi et al. (1985). An Asselin filter (Asselin, 1972), popular with several ¼ L0 1 þ C: ð44Þ ocean models using the leap-frog time discretization, with the In hydrostatic simulations, the artificial soliton length scale is given nominal coefficient of 0.05 is also employed. The Asselin filter pre- by vents the onset of high error. For simulations of short rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi duration, the model results (not shown) are identical with and ffiffiffiffi ffiffiffiffi b C2=6 p 4 2 p without the filter. The simulations are performed in a periodic do- L 8 8 L ; 45 h ¼ ¼ ¼ C ¼ 0 C ð Þ da da 3 da main of length Ld ¼ 10, and the number of equispaced grid points that are used to discretize the domain is varied to study the effects which primarily depends on the form of the numerical dispersion of C. The initial condition is given by coefficient, b, and thereby depends on the grid resolution (recall ⁄ 2 "# b (Dx ) ). We note that the soliton length scales given above are 2 x 2 approximately half of the half-width, or more precisely half of the n x; t 0 exp ; 50 ðÞ¼¼ ð Þ 2 r sech (1) 42%-width. Based on the scaling of Lh, we can determine a relationship between the grid spacing and the length scale of the where r⁄ = 0.85. The Courant number is given by C ¼ Dt ¼ 0:01. artificial soliton, which is given by Dx Fig. 2 shows the result when N = 1000 grid points are used ffiffiffi x Dx Dx Dx Dx p which gives C = 0.01. Both the hydrostatic (solid, red line) and non- ¼ qffiffiffiffiffiffiffiffiffiffiffiffiffi qffiffiffiffiffiffiffiffiffiffi ¼ qffiffi ¼ d: ð46Þ 2 Lh b ðDxÞ 1 hydrostatic (dashed, blue line) results lead to trains of solitary 8 Dx da d d waves that emerge from the initial Gaussian of depression. How- Therefore, as the nonlinearity increases, the widths of numerical ever, since the numerical dispersion is 100 times smaller that the approach the grid scale. We can determine a similar rela- physical dispersion, the nonhydrostatic simulation is very close tionship between the grid spacing and the length scale of the ana- to the exact solution. Having considerably less dispersion (all of lytical solitons, which is given by which is numerical), the hydrostatic simulation forms a number rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi of sharp and narrow numerically-induced solitons. These arise Dx Dx 3 da Dx 3 Dx qffiffiffiffiffiffiffiffiffiffiffiffiffi from the balance between nonlinearity and weak (numerical) ¼ ¼ Dx 2 ¼ da ¼ k: ð47Þ L0 4 2 4 4 dispersion. 3 da Fig. 2 also shows the leading solitons from the hydrostatic and This equation provides an alternative interpretation of the parame- nonhydrostatic simulations compared to the analytical solitons. 2 ter k. When k is large, the grid does not resolve the analytical soliton The analytical solitons are given by n ¼ a sech x x0 =Lth , length scale, and error ensues. where a⁄ is the amplitude of the leading soliton centered at Assuming that the ratio of numerical to physical dispersion x ¼ x0. For the nonhydrostatic result, Lth ¼ L0 from Eq. (42) (since 2 scales like the grid lepticity squared, viz. C = Kk , we can investi- C 1), while for the hydrostatic result Lth ¼ Lh from Eq. (45).In gate how soliton widths scale with the grid lepticity. Substituting addition to the specified values of d and ; L0 and Lh require compu- 2 ⁄ C = Kk into Eq. (44), we obtain: tation of a and x0. These are obtained with a quadratic polynomial qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi fit to the three points nearest the maximum value (in absolute va- 2 ⁄ ⁄ L =L0 ¼ L=L0 ¼ 1 þ Kk : ð48Þ lue) of the interface deflection n . The amplitude a is given by the maximum of this polynomial and x is the location of this maxi- 2 0 Substituting C = Kk into Eq. (45), we obtain: mum. The figure shows that the theoretical solitons with scales pffiffiffiffi L0 and Lh both agree with the simulation results for the nonhydro- Lh=L0 ¼ Lh=L0 ¼ k K: ð49Þ static and hydrostatic simulations, respectively. Also noteworthy Therefore, for hydrostatic models, the numerical soliton widths scale in Fig. 2 is the weak dependence of L0 and Lh on the wave ampli- linearly with the grid lepticity. We note that since the nondimen- tude as demonstrated by the similar widths of the individual soli- sional variables are all normalized by the same length scale, Eqs. tons in the wave packets.

(48) and (49) hold for dimensional models. In the following numer- Fig. 3 shows the same calculation as in Fig. 2 but with Nx =32 ical experiments, we compare modeled (dimensional) soliton widths grid points and C = 10. In this simulation, the dispersive character- to the theoretical soliton length scales derived above, i.e. L0, L, Lh. istics are primarily numerically-induced and thus the results of the hydrostatic and nonhydrostatic simulations are virtually identical. 3. Numerical experiments Furthermore, the length scale of the solitary waves, pffiffiffiffiffiffiffiffiffiffiffiffiffi L 0:25 1 þ C 0:85, is approximately the same as the length 3.1. Assessing numerical dispersion in the discrete KdV equation scale of the initial Gaussian function and thus the initial wave form propagates as a (single) solitary wave. We present numerical simulations of the KdV equation to illus- Fig. 3 also compares the leading solitons to the analytical soli- trate some similarities and differences between hydrostatic and tons. The numerical soliton of width Lh compares very well with nonhydrostatic behavior. In what follows, we refer to the standard the results from both the hydrostatic and nonhydrostatic models. 78 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86

−2 * t = 10 Γ = 0.01 −1.5 Hydrostatic −1 Nonhydrostatic Soliton of width L* −0.5 0 Soliton of width L* 0 h −2 Initial Waveform * t = 20 −1.5 −1.8 * ξ −1 −1.6

−0.5 −1.4 −1.2 0

−2 * −1 ξ t* = 30 −1.5 −0.8 zoom −0.6 −1 −0.4 −0.5 −0.2

0 0 5 10 6.5 7 7.5 8 x*−c* t* x*−c* t* 0 0

Fig. 2. The results of a nonhydrostatic simulation (dashed blue line) vs. a hydrostatic simulation (solid red line) for the case when C = 0.01. The plot in the lower-right depicts a zoomed-in view of the simulation along with a comparison between the theoretical sech2 profiles and the numerical results. Recall that the nondimensional linear wave speed is c0 ¼ 1. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

"# These solitons are approximately three times larger than the ana- x 2 lytical soliton of width L . The length scales of the solitons are a nðx; t ¼ 0Þ¼G0 exp ; ð52Þ 0 wq good indicator of the form of dispersion, and thus we can see that in this simulation the magnitudes of dispersion in each model are with G0 = 250 m and wq = 15 km. The boundary conditions are roughly equivalent. closed at x = 0 and x = Ld and the bottom at z = d is free-slip with a free surface at the upper boundary. The domain is discretized uni-

3.2. Assessing numerical dispersion in the nonhydrostatic SUNTANS formly in the vertical with Nz = 100 grid cells, and we perform six model simulations each with a different uniform horizontal resolution

containing Nx = 150, 300, 600, 1200, 2400, and 4800 cells, such that We simulate the evolution of an internal solitary-like wave the grid lepticity k = Dx/h1 varies from 0.25 to 8, and where Dx = Ld/ train using the nonhydrostatic SUNTANS model (Fringer et al., Nx. We did not change the vertical resolution because this has little 2006) in a two-dimensional x-z domain. The parameters are chosen influence on the results as long as the stratification is reasonably re- to approximately mimic the evolution of solitary-like waves in the solved. The time step is determined with the horizontal Courant South China , which evolve from internal generated at the number which is held fixed for all simulations, and is given by 1 Luzon Strait at its eastern boundary (Zhang et al., 2011). Simula- Ch = c0Dt/Dx = 0.11, where c0 = 1.4 m s is the first-mode eigen- tions are performed on a domain of length Ld = 300 km and depth speed obtained from a linearized modal analysis. The simulations d = 2000 m that is initialized with approximate two-layer stratifi- are run for a total time of 145,600 s (roughly 1.7 days), so that the cation as an idealized representation of the South China Sea so as finest grid requires Dt = 5 s for a total of 29,120 time steps. to simplify our analysis. Despite the idealized stratification, the Although rotational effects lead to added linear dispersion which simulated solitary-like waves are similar to those that form in has a tendency to broaden waves that propagate over inertial time the South China Sea, particularly from the point of view of relevant scales (Helfrich and Melville, 2006), rotation is ignored in the pres- length scales. ent simulations. To stabilize the central-differencing scheme for The initial stratification is given by momentum advection, the horizontal and vertical -diffusivities 2 1 4 2 1 "#are constant and are given by mH = 0.1 m s and mV =10 m s , qðx; z; t ¼ 0Þ 1 Dq 2tanh1a respectively, and no scalar diffusivity is employed. ¼ tanh ðz nðx; t ¼ 0Þþh1Þ ; In what follows we compare the results of the hydrostatic to the q 2 q dq 0 0 nonhydrostatic versions of SUNTANS. Since the nonhydrostatic ð51Þ code essentially computes a correction to the hydrostatic dynam- ics, switching between the two codes is straightforward although where the upper-layer depth is h1 = 250 m, the a = 99% interface the nonhydrostatic code incurs more overhead particularly for thickness (see Fringer and Street (2003))isdq = 200 m, and the den- low values of the grid lepticity. Fig. 4 shows the computational sity difference is given by Dq/q0 = 0.001. The initial Gaussian of overhead associated with using the nonhydrostatic model as mea- depression that evolves into a train of solitary-like waves is given by sured by the ratio of the total wallclock simulation time for the S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 79

−2 * t = 10 Γ = 10 −1.5 Hydrostatic −1 Nonhydrostatic Soliton of width L* −0.5 0 Soliton of width L* 0 h −2 Initial Waveform * t = 20 −1.2 −1.5 * ξ −1 −1

−0.5 −0.8 0

−2 * ξ −0.6 t* = 30 −1.5 zoom −0.4 −1 −0.2 −0.5

0 0 0 5 10 2 3 4 5 6 7 x*−c* t* x*−c* t* 0 0

Fig. 3. The results of a nonhydrostatic simulation (dashed blue line) vs. a hydrostatic simulation (solid red line) for the case when C = 10. The plot in the lower-right depicts a zoomed-in view of the simulation along with a comparison between the theoretical sech2 profiles and the numerical results. Recall that the nondimensional linear wave speed is c0 ¼ 1. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

nonhydrostatic model to that for the hydrostatic model. For large 10 grid lepticity there is relatively little overhead because the precon- ditioner for the nonhydrostatic pressure solver performs well 9 when the grid aspect ratio Dz/Dx is small (Fringer et al., 2006). 8 However, the preconditioner is not as effective for larger grid as- pect ratios, or equivalently smaller grid leptic ratios. Therefore, 7 for the smallest lepticity the nonhydrostatic code requires roughly 6 8 times as much wallclock time than the hydrostatic simulation (the most well-resolved nonhydrostatic run took 2 s per time step 5 using 16 cores on four quad-core Opteron 2356 QC processors). It is 4 interesting to note that the nonhydrostatic overhead diverges sharply around k = 2, which is effectively the limit above which 3

physical nonhydrostatic effects are overwhelmed by numerical Nonhydrostatic overhead nonhydrostatic effects. Marshall et al. (1997) show that, due to 2 the performance of the preconditioner, nonhydrostatic algorithms 1 in the hydrostatic limit are no more computationally expensive 0 than hydrostatic models. They describe the nonhydrostatic pres- 0 1 2 3 4 5 6 7 8 sure solver and preconditioner as ‘‘an algorithm that seamlessly λ moves from nonhydrostatic to hydrostatic limits’’. We note, how- ever, that a nonhydrostatic model does not behave correctly until Fig. 4. Relative workload associated with computing the nonhydrostatic pressure it resolves the magnitude of dispersion, that is, k < O(1). Further- as a function of the grid lepticity k = Dx/h1. The overhead is computed as the ratio of the total wallclock time for the nonhydrostatic simulation to that of the hydrostatic more, as shown in Fig. 4, truly resolving nonhydrostatic effects is simulation. more computationally expensive. To infer the behavior of the numerical dispersion in the SUNTANS simulations, we first show that the SUNTANS results where aS ¼ G0=a0 ¼ 1:136 and rS ¼ wq=Lw ¼ 10:446. In this exam- are accurately represented by the KdV equation. We compare the ple, the results from the SUNTANS model are nondimensionalized results of the highest resolution SUNTANS model (Nx = 4800) with with a0 = 220 m and Lw = L0 = 1436 m, which are the amplitude the KdV model with Nx = 800, so that C 0.25 in both models. The and length scale, respectively, of the leading solitary wave at the nondimensional initial condition for the SUNTANS model is given end of the highest resolution simulation. If we approximate the by SUNTANS initial condition as a two-layer stratification, Eqs. (16) "# x 2 and (17) give the KdV parameters d = 0.754 and = 0.461. The con- nðÞ¼x; t ¼ 0 a exp ; ð53Þ tinuous stratification parameter estimates from Eqs. (18) and (19) S S r S give similar values of d = 0.756 and = 0.494. Because the KdV 80 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 equation only admits right-propagating waves, the initial condition should be C = Kk2 as is the case for the KdV equation. With this for the KdV model needs to be adjusted to produce the same waves in mind, we compare the results of hydrostatic and nonhydrostatic as the SUNTANS model. The SUNTANS model produces right-prop- simulations using SUNTANS at various resolutions as we did for the agating waves because its initial condition is given by a half-Gauss- KdV equation in Figs. 2 and 3. ian of depression at the left no-flux boundary. The initial condition Fig. 6 shows the nonhydrostatic SUNTANS result compared to for the KdV model is therefore given by the hydrostatic result for the finest grid (Nx = 4800), or the smallest "# leptic ratio k = Dx/h1 = 0.25. In the figure, time is normalized by 2 x DxK Ts = Lw/c0, where Lw = L0 = 1436 m is the leading solitary wave nK ðÞ¼x ; t ¼ 0 aK exp ; ð54Þ rK width at the end of the simulation. As expected, the nonhydrostatic result leads to a train of rank-ordered solitary-like internal gravity waves of depression that move faster than the linear phase speed where aK ¼ 0:536; rK ¼ rS ¼ 10:446, and DxK ¼ 1:253. Due to the different initial conditions, the parameters required to produce a (as indicated by the vertical dashed lines in Fig. 6). Owing to ampli- match between the KdV result and the SUNTANS model are given tude dispersion, the hydrostatic wave train also propagates faster by d = 0.572 and = 0.585. As shown in Fig. 5, the agreement be- than the linear phase speed c0. However, due to a lack of physical tween the KdV equation and the SUNTANS model is excellent. The dispersion, the wave steepens into a train of very short solitary-like only significant deviation between the two models arises from the waves (see the inset plot at t = 141.5 Ts). These short waves repre- tail of the wave train which is produced by numerical diffusion in sent a balance between nonlinear steepening and numerical dis- the SUNTANS model that is not present in the KdV model. The slight persion that results from the second-order error in the mismatch between the theoretical parameters, d and , given by discretization of the baroclinic pressure gradient in SUNTANS. Eqs. (16)–(19) and the best fit parameters is due to higher-order Due to the high grid resolution, the relatively small lepticity of nonlinearity and the finite-thickness of the interface, which are k = Dx/h1 = 0.25 is the cause of the weak numerical dispersion. Un- not accounted for in the KdV theory. like the results from the KdV simulations in Section 3.1, the SUN- The excellent agreement between the models highlights the TANS results also possess numerical diffusion. Therefore, the power of the relatively simple KdV equation for modeling complex nearly grid-scale length of the numerically-induced solitary-like phenomena. Of course, there are many situations in which the KdV waves results in numerical diffusion that leads to amplitude loss equation does not adequately capture the dynamics of the fully in the leading solitary-like waves as well as a thickening of the nonlinear and nonhydrostatic model for a continuously stratified stratification in the lee of the wave train. The amplitude loss leads system. However, this result shows that the dominant of to weaker amplitude dispersion for the hydrostatic case and causes internal waves at the limits of weakly nonlinear, weakly nonhydro- the hydrostatic packet to propagate more slowly than the nonhy- static characterization can still be represented by the KdV equa- drostatic packet. The problem of excess numerical diffusion associ- tion. We make this comparison to argue that the analysis ated with high-resolution hydrostatic models was recognized by performed for the KdV equation with regard to numerical vs. phys- Hodges et al. (2006), who hypothesized that formation of numeri- ical dispersion should hold for fully nonhydrostatic models for cer- cal ‘‘soliton-like’’ waves leads to numerical diffusion and dissipa- tain problems of interest. That is, for weakly nonlinear, weakly tion. Our results support this hypothesis. However, we add that nonhydrostatic internal wave phenomena even in a continuously the lack of dispersion (physical or otherwise) in high-resolution stratified system modeled with a (second-order accurate) nonhy- hydrostatic models is the cause of problems with numerical diffu- drostatic model, the ratio of numerical to physical dispersion sion and dissipation. When the lepticity is increased to k = 8, numerical dispersion is so large relative to physical dispersion that the nonhydrostatic and

hydrostatic results are nearly identical, as shown in Fig. 7. This re- −1 KdV sult agrees with Marshall et al. (1997) who conclude that at coarse SUNTANS

0 horizontal resolution, hydrostatic and nonhydrostatic models give

/a −0.5 ξ essentially the same numerical solutions. Although the results look t = 5.5 T qualitatively similar, the nonhydrostatic result is far too dispersive 0 due to the numerical dispersion, and so the width of the leading −1 wave is larger than the ‘‘exact’’ result shown in Fig. 6.

0 As shown in Fig. 8, increasing the grid lepticity causes the width

/a −0.5 ξ of the leading solitary-like waves to grow in both the hydrostatic t = 44 T and nonhydrostatic solutions. The width of the nonhydrostatic 0 −1 wave, however, converges to the correct value upon decreasing the lepticity, while that for the hydrostatic waves continues to de- 0 crease toward zero. This decrease leads to more numerical diffu- /a −0.5 ξ sion which causes the hydrostatic wave to propagate more t = 87 T slowly. These results indicate that the width of the leading soli- 0 −1 tary-like wave in the wave packets is a good indicator of the zoom numerical dispersion. Since the dispersion in the hydrostatic mod- 0

/a −0.5 el is strictly numerical, then progressively weaker dispersion with ξ grid refinement leads to shorter solitary-like waves, while the t = 131 T 0 waves in the nonhydrostatic model converge to the correct solu- 0 50 100 150 200 tion with grid refinement. Increased grid spacing leads to larger x/L 0 solitary-wave widths in both models, although the width of the waves in the nonhydrostatic model will always be larger than Fig. 5. Comparison of the KdV equation to the nonhydrostatic SUNTANS ocean those in the hydrostatic model due to the presence of physical model. The KdV solution is for the interface height in a two-layer system. SUNTANS dispersion. While always present, the relative magnitude of the models a continuously stratified system in which the q = q0 density contour represents the solution. The cutout in the bottom subplot shows a comparison of resolved physical dispersion decreases with increasing grid the leading soliton. lepticity. S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 81

0

0 −2 z/a t=0.0 T −4 s 0

0 −2 z/a t=32.7 T −4 s 0

0 −2 z/a t=59.9 T −4 s 0

0 −2 z/a t=87.1 T −4 s 0

0 −2 z/a t=114.3 T −4 s 0

0 −2 z/a t=141.5 T −4 zoom s 0 20 40 60 80 100 120 140 160 180 200 x/L 0

Fig. 6. Comparison of the evolution of a solitary-like internal gravity wave train as computed by SUNTANS with Nx Nz = 4800 100 grid cells (k = Dx/h1 = 0.25) with

(upper blue contours) and without (lower red contours) the nonhydrostatic pressure. The horizontal distance is normalized by Lw = L0 = 1436 m, the width of the leading nonhydrostatic wave at the end of the simulation, and Ts = Lw/c0 is the wave propagation time scale. Density contours are shown for q/ q0 =(0.4, 0.2,0,0.2,0.4)Dq/q0. A zoomed-in view of the dashed box around the leading wave in the hydrostatic wave train is depicted in the inset plot at t = 141.5 Ts. The vertical dashed line moves at the linear wave speed c0 for reference. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

0

0 −2 z/a t=0.0 T −4 s 0

0 −2 z/a t=32.7 T −4 s 0

0 −2 z/a t=59.9 T −4 s 0

0 −2 z/a t=87.1 T −4 s 0

0 −2 z/a t=114.3 T −4 s 0

0 −2 z/a t=141.5 T −4 s 0 50 100 150 200 x/L 0

Fig. 7. Comparison of the evolution of a solitary-like internal gravity wave train as computed by SUNTANS with Nx Nz = 150 100 grid cells (k = Dx/h1 = 8) with (upper blue contours) and without (lower red contours) the nonhydrostatic pressure. The horizontal distance is normalized by Lw = L0 = 1436 m, the width of the leading nonhydrostatic wave that is computed with Nx = 4800 grid cells at the end of the simulation, and Ts = Lw/c0 is the wave propagation time scale. Density contours are shown for q/q0 =(0.4, 0.2,0,0.2,0.4)Dq/q0. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.) 82 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86

0 0 −0.5 z/a λ=8.00 −1 0 0 −0.5 z/a λ=4.00 −1 0 0 −0.5 z/a λ=2.00 −1 0 0 −0.5 z/a λ=1.00 −1 0 0 −0.5 z/a λ=0.50 −1 0 0 −0.5 z/a λ=0.25 −1 −12 −10 −8 −6 −4 −2 0 2 4 (x−x )/L 0 0

Fig. 8. Effect of grid lepticity k = Dx/h1 on the leading solitary-like waves (centered at x0) in the wave packets as computed by the hydrostatic (faint solid red lines) and nonhydrostatic (thick solid blue lines) SUNTANS models (these are the q = q0 isopycnals at t = 141.5 Ts). The thin dotted line is the best-fit leading soliton for the hydrostatic result, while the thick dashed line is that for the nonhydrostatic result. The results are normalized by the analytical soliton length scale L0 = 1436 m. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

3.3. Numerical dispersion and the scaling of solitary wave widths ticity, that is for k < O(1). The agreement is not as good for k > O(1) because the theoretical relationships assume 1st-order As mentioned previously, the widths of simulated solitons are a numerical dispersion. For k > O(1), higher-order numerical disper- good indicator of the magnitude of dispersion. Returning to the sion also affects the soliton length scales. Even with the deviations form of the numerical soliton given in Eqs. (48) and (49), we see due to higher-order effects when k > O(1), the agreement of the that the simulated soliton scale of a second-order accurate nonhy- drostatic model relative to the analytical soliton scale is given by ffiffiffiffiffiffiffiffiffiffiffiffiffi pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi p 2 L=L0 ¼ L =L0 ¼ 1 þ C ¼ 1 þ Kk . Likewise, for a second-order 5 Hydrostatic Soliton Scaling (lowest order) accurateffiffiffiffi hydrostaticffiffiffiffi model, the ratio is given by Lh=L0 ¼ Nonhydrostatic Soliton Scaling (lowest order) p p Hydrostatic KdV Model Lh=L0 ¼ C ¼ k K. In this paper we have highlighted the form of 4.5 Nonhydrostatic KdV Model C = Kk2 = K(Dx⁄/)2. Verification of the correct form of C as determined in this paper is possible by comparing the scaling of 4 modeled solitons to the theoretical relationships for the hydro- 3.5 static and nonhydrostatic simulations, respectively, as the grid * lepticity increases. This analysis is shown in Fig. 9 for the KdV 0 3 equation and Fig. 10 for the SUNTANS model. /L

sim 2.5

The analysis in Fig. 9 uses the numerical method from Eq. (31), L 2 which has K =1 C = 0.9999, since C = 0.01. The simulations are 2 performed with identical conditions to the simulations above in 1.5 Section 3.1 with tmax ¼ 30 and a variety of different resolutions, namely Nx = 1000, 800, 600, 500, 400, 300, 250, 220, 210, 180, 1 150, 125, 100, 80, 60, 50, 40, 35, 30, 25. For each simulation, the simulated soliton width, Lsim, is calculated as the length from the 0.5 location of the parabolic maximum, x0, to the horizontal location, 0 xc, (on the right) where the soliton obtains an amplitude of 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 2 * asech (1). This length scale Lsim = xc x0 corresponds approxi- λ=Δ x /ε mately to half of the 42%-width. The horizontal location, xc,is determined by fitting a quadratic polynomial to the three points Fig. 9. The relationship between the grid lepticity, k, and the deviation from the theoretical soliton length scales for the KdVp equation.ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi The theoretical prediction for nearest to the soliton peak and inverting the location. 2 the model performance is Lsim=L0 ¼ L =L0 ¼ffiffiffiffi 1 þ Kk for the nonhydrostatic model As shown in Fig. 9, the computed soliton widths compare very p (solid blue line) and Lsim=L0 ¼ Lh=L0 ¼ k K for the hydrostatic model (dashed red well with the theoretically-expected soliton widths. The close line) where K = 0.9999. (For interpretation of the references to colour in this figure agreement is particularly notable for small values of the grid lep- legend, the reader is referred to the web version of this article.) S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 83

(i.e. d 2 = O(1)) dynamical problems in the ocean are important Hydrostatic Soliton Scaling (lowest order) 2.5 Nonhydrostatic Soliton Scaling (lowest order) but confined to small-scale turbulent motions. In modeling such SUNTANS Hydrostatic Model situations, the dispersive error from nonlinear advection terms SUNTANS Nonhydrostatic Model with magnitude O(dk2) may exceed the dispersive error from the 2 2 linear terms with magnitude O(Kk ). Thus ensuring small values of the grid lepticity, k, may be even more important in such cases. Typically, in highly nonlinear problems the motion is governed by a balance between nonlinear advection and the nonhydrostatic 0 1.5

/L pressure gradient. Large-eddy-simulation (LES) is the preferred ap-

sim proach under such circumstances. LES models seek to minimize the L numerical dissipation to capture the correct turbulent dissipation. 1 Ocean models, on the other hand, should seek to minimize numer- ical dispersion, particularly when modeling wave phenomena. For internal wave simulations, the dominant source of numerical dis- 0.5 persion arises from the discretization of the baroclinic pressure gradient. For simulations (i.e. tsunami modeling), the dominant source of numerical dispersion is the discretization 0 of the barotropic pressure gradient. 0 1 2 3 4 5 6 7 8 9 λ When C 1, or when the grid lepticity is large, i.e. k > O(1), simulations produce an overly dispersive result because the Fig. 10. The relationship between the grid lepticity, k, and the soliton length scale, physical dispersion is negligible in comparison to the numerical pLsimffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi/L0 for the SUNTANS model. The theoretical predictions are Lsim=L0 ¼ L=L0 ¼ffiffiffiffi 2 p dispersion. This implies that a nonhydrostatic simulation is indis- 1 þ Kk for the nonhydrostatic model (solid blue line) and Lsim=L0 ¼ Lh=L0 ¼ k K for the hydrostatic model (dashed red line), where K = 0.075. (For interpretation of tinguishable from a hydrostatic simulation when the grid spacing the references to colour in this figure legend, the reader is referred to the web is large relative to the relevant depth scale. Such a large grid version of this article.) spacing may therefore give a false impression that nonhydrostatic physics must be unimportant. Scotti and Mitran (2008) developed models and the theoretically-predicted soliton length scales is an approximated method to reduce the computational cost of quite remarkable. computing the nonhydrostatic pressure in thin domains which We test the SUNTANS model to determine the scaling of the sol- converges when k > O(1). However, when this condition is satis- iton widths using the analysis presented in Fig. 9. Fig. 10 shows fied, the solution is contaminated by numerical dispersion and that the theory for the dependence of the soliton length scale on the computational overhead associated with solving the full the grid lepticity (Eqs. (48) and (49)) is valid for the continuously nonhydrostatic problem is small, as shown in Fig. 4. Elliptic stratified system when simulated with both a hydrostatic and a approximation methods must therefore be combined with nonhydrostatic ocean model. The soliton widths are determined higher-order discretization techniques which minimize numerical using the same method as above for the q = q density contour. 0 dispersion if they are to be viable. The nonhydrostaticpffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi SUNTANS model computes solitons with 2 Lsim=L0 1 þ Kk , while the hydrostaticpffiffiffiffi SUNTANS model com- putes solitons with Lsim=L0 k K, where K = 0.075 as obtained with a least-squares fit (L is computed using the same technique sim 5. Conclusions as that for the KdV simulations). We have determined the magnitude of physical and numerical 4. Discussion dispersion coefficients from asymptotic approximations for weakly nonlinear, weakly nonhydrostatic models. The ratio of numerical to For weakly nonlinear, weakly nonhydrostatic waves, discretiza- physical dispersion, C, for nonhydrostatic ocean models that are tion of the linear problem, that is, acceleration balancing a pressure second-order accurate in time and/or space is given by C = Kk2, gradient, gives rise to most of the numerical dispersion. For weakly where k Dx/h1 is the grid leptic ratio or lepticity, and K is typi- nonhydrostatic waves, water wave theory gives the lowest-order cally an O(1) constant. Simulations of internal waves using the physical dispersion as proportional to (k)2. The numerical discret- SUNTANS nonhydrostatic ocean model are well-reproduced by ization of the linear problem using second-order, central finite-dif- the KdV equation, thereby validating its use to quantify the magni- ferencing produces, to lowest order, numerical dispersion tudes of physical and numerical dispersion. proportional to (kDx⁄)2. The ratio of these two effects is the ratio For hydrostatic models, the ratio C is infinite because there is of numerical to physical dispersion, C, which is proportional to no resolved physical dispersion. However, when the leptic ratio the grid lepticity squared, viz. C = Kk2, where K is typically an is large, numerical simulations based on either hydrostatic or non- O(1) constant. Scotti and Mitran (2008) showed that the nonlinear hydrostatic models will be dominated by numerical dispersion. For advection term introduces an artificial term in the dispersion rela- simulations of internal waves, the amount of physical dispersion is tion of magnitude O(dk2). However, we have shown that the dis- critical to resolving the correct behavior, and thus a well-resolved cretization of the linear problem and not the nonlinear advection nonhydrostatic model or approximation thereof is required. term is responsible for the dominant source of dispersion for Numerical solutions of internal waves when modeled with sec- weakly nonlinear, weakly nonhydrostatic waves. The relative mag- ond-order accuracy in time or space will be realistic only when 2 nitudes of the numerically dispersive effects of the linear problem k < O(1) or D x < h1. The relationship C = Kk is primarily due to vs. the nonlinear advection problem depend on the relative magni- the second-order accurate discretization of the baroclinic pressure tudes of K and d. Typically K = O(1) and d O(1) due to the weakly gradient. The severity of this condition may be loosened using nonlinear scaling of most oceanic problems of interest. Thus the higher-order differencing schemes or schemes with better disper- numerical dispersion induced by the linear term is typically one or- sive properties such as Padé schemes (Lele, 1992). Adaptive mesh der of magnitude larger than the numerical dispersion induced by refinement (AMR) methods, which allow additional resolution the nonlinear advection term. Highly nonlinear and nonhydrostatic when necessary, also present a possible solution. 84 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 ! n n n 2 3 n 2 3 The condition that k < O(1), or Dx < h1, is consistent with the o o o o n ðÞDt n 3 n n ðÞDx n þ þ 1 dn þ scaling of nonhydrostatic effects, since they occur when vertical o o 3 i o o 3 t i 6 t 2 x i 6 x scales of motion are roughly equal to the horizontal scales. There- i ! i n n  fore, accurate simulation of nonhydrostatic effects requires that 2 o3n ðÞDx 2 o5n þ þ ¼ O ðÞDx 4; ðÞDt 4 : ðA:7Þ horizontal scales of O(h1) must be resolved. This constraint may 6 ox3 4 ox5 be a significant additional resolution requirement beyond the cur- i i rent state-of-the-art in ocean modeling. Since each term is at time level n and spatial index i, and this equa- tion holds for all space and time, we can remove the subscripts and Acknowledgments write Eq. (A.7) as: "# 3 Sean Vitousek gratefully acknowledges his support as a DOE on 3 on 2 o n þ 1 dn þ Computational Science Graduate Fellow. Sean Vitousek and Oliver ot 2 ox 6 ox3 "# B. Fringer gratefully acknowledge the support of ONR as part of the ðÞDt 2 o3n 3 ðÞDx 2 o3n 2ðÞDx 2 o5n YIP and PECASE awards under grants N00014-10-1-0521 and þ þ 1 dn þ 6 ot3 2 6 ox3 24 ox5 N00014-08-1-0904 (scientific officers Dr. C. Linwood Vincent, Dr.  Terri Paluszkiewicz and Dr. Scott Harper). We thank Alberto Scotti ¼ O ðÞDx 4; ðÞDt 4 ; ðA:8Þ for numerous discussions which contributed to the ideas in this manuscript. We also thank two anonymous reviewers for their where the first set of bracketed terms represents the terms in the comments and suggestions which led to a significant improvement original PDE and the second set of bracketed terms represents the of the manuscript. additional terms in the MEPDE that result from the discretization. Recalling that O(d)=O(2) < 1, Eq. (A.8) can be written as: Appendix A. Modified equivalent partial differential equation "# "# on 3 on 2 o3n ðÞDt 2 o3n ðÞDx 2 o3n analysis þ 1 dn þ þ þ ot 2 ox 6 ox3 6 ot3 6 ox3  We show how the modified equivalent partial differential equa- O 2 Dx 2; d Dx 2; Dx 4; Dt 4 : A:9 tion (MEPDE) (34) of the discretization (31) is obtained. MEPDE ¼ ðÞðÞðÞðÞ ð Þ analysis begins with the expansion of the adjacent grid points in We ignore the truncation error terms in the MEPDE created from Taylor series usually about the central point. In this case these the nonlinear advection and dispersion terms because they are expansions are given by approximately one order of magnitude smaller than the terms n n o n 2 o2 3 o3 resulting from the linear problem. Using the first-order, linear n n n ðÞDx n ðÞDx n n ¼ n þ Dx þ þ þ ðA:1Þ iþ1 i ox 2 ox2 6 ox3 relation: i i i on on ¼ þ O 2; d ; ðA:10Þ n n o o o n 2 o2 3 o3 t x n n n ðÞDx n ðÞDx n n ¼ n Dx þ þ ðA:2Þ 2 i1 i ox 2 ox2 6 ox3 we have, to O( ,d): i i i o2 o2 n n n n 3 n ¼ ; o o2 o3 2 2 n n n 2 n 4ðÞDx n ot ox n ¼ n þ 2Dx þ 2ðÞDx þ þ ðA:3Þ iþ2 i ox ox2 3 ox3 o3n o3n i i i ¼ : o 3 o 3 t x n n o n o2 3 o3 n n n 2 n 4ðÞDx n This result generalizes to Eq. (33). Using this relation, we can re- n ¼ n 2Dx þ 2ðÞDx þ; i2 i o o 2 o 3 x i x 3 x write Eq. (A.9) as: i i "# "# ðA:4Þ on 3 on 2 o3n ðÞDx 2 o3n ðÞDt 2 o3n þ 1 dn þ þ n o o o 3 o 3 o 3 where, n ¼ n x; t ¼ n ðiDx; nDtÞ. Using these expressions, the t 2 x 6 x 6 x 6 x i i n  form of the truncation error of the second-order, central finite-dif- ¼ O 2ðÞDx 2; dðÞDx 2; ðÞDx 4; ðÞDt 4 ; ðA:11Þ ference approximation to the spatial derivative is given in Eq. (32). Similarly, the truncation error for the second-order, leap-frog or: time derivative is given by "#"#  o o 2 o3 2 o3 n n n 3 n n 2 ðÞDx n nþ1 n1 n 2 3 4 5 1 dn 1 C o o o þ þ 3 þ 3 ni ni n ðÞDt n ðÞDt n ot 2 ox 6 ox 6 ox ¼ þ þ o o 3 o 5  2Dt t i 6 t 120 t i i ¼ O 2ðÞDx 2; dðÞDx 2; ðÞDx 4; ðÞDt 4 ; ðA:12Þ n 6 7  ðÞDt o n 8 þ þ O ðÞDt : ðA:5Þ ⁄ ⁄ 7 where C Dt /Dx . This gives the numerical dispersion coefficient 5040 ot 2 i 2 ðDxÞ b ¼ð1 C Þ 6 in Eq. (34). The second-order accurate, centered 3rd-order spatial derivative is given by Appendix B. Convergence analysis for the KdV discretization

n n 1 n n n 1 n o3 2 o5  n n þ n n n ðÞDx n 6 In this section we perform a grid-refinement convergence anal- 2 iþ2 iþ1 i1 2 i2 ¼ þ þ O ðÞDx : Dx 3 ox3 4 ox5 ysis of the discrete KdV equation (31) to verify that the numerical ðÞ i i method is indeed second-order accurate. Fig. B.11 shows that the ðA:6Þ centered finite-difference method given in Eq. (31) is second-order Substitution of Eqs. (32), (A.5), and (A.6) into the complete discret- accurate in time. The temporal convergence analysis shown in ization (31) gives: Fig. B.11 is performed for the evolution of an initial Gaussian hump S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86 85

tion method and the norm of the difference between the solutions at various resolutions provides the measure of convergence. Unlike the temporal convergence, spatial convergence is not as

0 well-behaved. The nonhydrostatic method, as shown in Fig. B.12, 10 converges with spatial-refinement with approximately second-or- der accuracy. However, the hydrostatic model does not converge with spatial-refinement. Lack of convergence results from the mag- ⁄ −1 nitude of (numerical) dispersion which is a function of D x . There- 10 fore, numerical solitons appear with increasingly smaller widths Error that are always proportional to the grid spacing via Eq. (46). The lack of convergence is a common problem arising from invalid assumptions of hydrostatic models. For example, when calculating −2 10 a lock-exchange flow, Fringer et al. (2006) show that the hydro- static model yields exceedingly large vertical . This occurs hydrostastic nonhydrostatic because of the ill-posedness of the hydrostatic model which causes an inverse dependence of the vertical velocity on Dx. Horizontal −3 second−order accuracy 10 −2 grid refinement leads to unbounded increase in the vertical veloc- 10 ity when a hydrostatic model is used to simulate an inherently Δ t* nonhydrostatic problem.

Fig. B.11. Temporal convergence of the numerical KdV solution given in Eq. (31). The convergence analysis shows that all methods converge with second-order accuracy, O((Dt⁄)2), with refinement of the time step size, Dt⁄. References

Apel, J., Holbrook, J., Liu, A., Tsai, J., 1985. The Sulu Sea internal soliton experiment. J. Phys. Oceanogr. 15, 1625–1651. Asselin, R., 1972. Frequency filter for time integrations. Mon. Weather Rev. 100, 487–490. Bleck, R., Rooth, C., Hu, D., Smith, L.T., 1992. Salinity-driven transients in a wind- and thermohaline-forced isopycnic coordinate model of the North 0 10 Atlantic. J. Phys. Oceanogr. 22, 1486–1505. Blumberg, A.F., Mellor, G.L., 1987. A description of a three-dimensional coastal ocean circulation model. In: Heaps, N. (Ed.), Three-Dimensional Coastal Ocean Models. American Geophysical Union, pp. 1–16. Boussinesq, J., 1871. Thorie de l’intumescence liquide, applele onde solitaire ou de translation, se propageant dans un canal rectangulaire. C.R. Acad. Sci. 72, 10−1 755759.

Error Boussinesq, J., 1872. Thorie des ondes et des remous qui se propagent le long d’un canal rectangulaire horizontal, en communiquant au liquide contenu dans ce canal des vitesses sensiblement pareilles de la surface au fond. J. Math. Pure Appl. 17, 55108. Burwell, D., Tolkova, E., Chawla, A., 2007. Diffusion and dispersion characterization

−2 of a numerical tsunami model. Ocean Modell. 19, 10–30. 10 Casulli, V., Cattani, E., 1994. Stability, accuracy and efficiency of a semi-implicit hydrostastic method for three-dimensional shallow water flow. Comput. Math. Appl. 27, 99– nonhydrostatic 112. second-order accuracy Cushman-Roisin, B., Beckers, J., 2010. Introduction to Geophysical : Physical and Numerical Aspects. Academic Press. 10−3 10−2 Duda, T.F., Lynch, J.F., Beardsley, R.C., Irish, J.D., Ramp, S.R., Chiu, C.S., Tang, T.Y., Δ x* Yang, Y.J., 2004. Internal and nonlinear internal wave behavior at the continental slope in the Northern South China Sea. IEEE J. Ocean. Eng. 29, 1105– 1130. Fig. B.12. Spatial convergence of the numerical KdV solution given in Eq. (31). Fringer, O.B., Street, R.L., 2003. The dynamics of breaking progressive interfacial waves. J. Fluid Mech. 494, 319–353. Fringer, O.B., Gerritsen, M., Street, R.L., 2006. An unstructured-grid, finite-volume, nonhydrostatic, parallel coastal ocean simulator. Ocean Modell. 14, 139–173. Gottwald, G., 2007. Dispersive regularizations and numerical discretizations for the of the form given in Eq. (50), with identical parameters as in Sec- inviscid burgers equation. J. Phys. A. Math. Theor. 40, 14745. tion 3.1, on a grid with Nx = 200 grid points and with a Courant Grimshaw, R., 2007. Solitary Waves in Fluids. WIT Press, Boston. Dt ⁄ Helfrich, K.R., Melville, W.K., 2006. Long nonlinear internal waves. Annu. Rev. Fluid number C ¼ Dx, for various time step sizes Dt = 1/512, 1/256, 1/ Mech. 38, 395–425. 128, 1/64, 1/32 with tmax ¼ 10. Recall that the ⁄ notation refers to Hirt, C., 1968. Heuristic stability theory for finite-difference equations. J. Comput. nondimensional variables. The measure of convergence of the solu- Phys. 2, 335–339. tion (Figs. B.11, B.12) is obtained by: Error = k solution (Dx⁄ or Hodges, B., Laval, B., Wadzuk, B., 2006. Numerical error assessment and a temporal ⁄ ⁄ ⁄ horizon for internal waves in a hydrostatic model. Ocean Modell. 13, 44–64. Dt ) solution (Dx /2 or Dt /2)k2, where ‘‘solution’’ means the Hunkins, K., Fliegel, M., 1973. Internal undular surges in Seneca Lake: A natural ⁄ ⁄ numerical solution of n on a grid of size Dx or with a time step occurrence of solitons. J. Geophys. Res. 78, 539–548. of Dt⁄. As shown in Fig. B.11, the numerical solution obtains Kanarska, Y., Shchepetkin, A., McWilliams, J., 2007. Algorithm for non-hydrostatic O((Dt⁄)2) convergence, as expected. dynamics in the regional oceanic modeling system. Ocean Modell. 18, 143–174. Kantha, L., Clayson, C., 2000. Numerical Models of and Oceanic Processes. Convergence with respect to spatial resolution is shown in Academic Press. Fig. B.12. This analysis is performed for identical initial conditions Korteweg, D., de-Vries, G., 1895. On the change of form of long waves advancing in a as the temporal convergence analysis, with grid spacing given by rectangular canal, and on a new type of long stationary waves. Philos. Mag. 39, ⁄ 422–443. Dx = 1/600, 1/500, 1/400, 1/300, 1/200, 1/100. Each simulation is LeBlond, P., Mysak, L., 1978. Waves in the Ocean. Elsevier, Amsterdam, The ⁄ performed with a time step of Dt = 0.00005 and with tmax ¼ 5. Netherlands. The measure of convergence of the solution is obtained using the Lele, S., 1992. Compact finite difference schemes with spectral-like resolution. J. Comput. Phys. 103, 16–42. method explained above. The coarse-grid solution is interpolated Liu, A.K., 1988. Analysis of nonlinear internal waves in the New York Bight. J. onto the highest resolution domain using a cubic-spline interpola- Geophys. Res. 93, 12317–12329. 86 S. Vitousek, O.B. Fringer / Ocean Modelling 40 (2011) 72–86

Liu, A.K., Yang, Y.S., Hsu, M.K., Liang, N.K., 1998. Evolution of nonlinear internal Shuto, N., 1991. Numerical simulation of its present and near future. Nat. waves in the East and South China . J. Geophys. Res. 103, 7995–8008. Hazards 4, 171–191. Lynett, P.J., Liu, P.L.F., 2002. A two-dimensional, depth-integrated model for internal Stanton, T.P., Ostrovsky, L.A., 1998. Observations of highly nonlinear internal wave propagation over variable . Wave Motion 36, 221–240. solitons over the . Geophys. Res. Lett. 25, 2695–2698. Marshall, J., Adcroft, A., Hill, C., Perelman, L., Heisey, C., 1997. A finite-volume, Tam, C., Webb, J., 1993. Dispersion–relation–preserving finite difference schemes incompressible Navier Stokes model for studies of the ocean on parallel for computational acoustics. J. Comput. Phys. 107, 262–281. computers. J. Geophys. Res. 102, 5753–5766. Trefethen, L.N., 1982. in finite difference schemes. SIAM Rev. 24, Marshall, J., Hill, C., Perelman, L., Adcroft, A., 1997. Hydrostatic, quasi-hydrostatic, 113–136. and nonhydrostatic ocean modeling. J. Geophys. Res. 102, 5733–5752. Vichnevetsky, R., 1980. Propagation properties of semi-discretizations of hyperbolic Mei, C., 1983. Theory and Applications of Ocean Surface Waves. World Scientific, equations. Math. Comput. Simulat. 22, 98–102. Singapore. Vichnevetsky, R., Bowles, J., 1982. Fourier Analysis of Numerical Approximations of Pacanowski, R., Griffes, S., 1999. The MOM 3 Manual. Geophysical Fluid Dynamics Hyperbolic Equations. SIAM. Laboratory/NOAA, Princeton. Wadzuk, B.M., Hodges, B.R., 2009. Hydrostatic versus nonhydrostatic Euler- Peregrine, D., 1967. Long waves on a beach. J. Fluid Mech. 27, 815–827. equation modeling of nonlinear internal waves. J. Eng. Mech. 135, 1069–1080. Schroeder, G., Schlünzen, K., 2009. Numerical dispersion of gravity waves. Mon. Warn-Varnas, A., Hawkins, J., Lamb, K., Piacsek, S., Chin-Bing, S., King, D., Burgos, G., Weather Rev. 137, 4344–4354. 2010. Solitary wave generation dynamics at Luzon Strait. Ocean Modell. 31, 9– Scotti, A., Mitran, S., 2008. An approximated method for the solution of elliptic 27. problems in thin domains: Application to nonlinear internal waves. Ocean Whitham, G., 1974. Linear and Nonlinear Waves. Wiley-Interscience, New York. Modell. 25, 144–153. Zauderer, E., 1989. Partial Differential Equations of Applied . Wiley, Scotti, A., Pineda, J., 2004. Observations of very large and steep internal waves of New York. elevation near the Massachussetts coast. Geophys. Res. Lett. 31, L22307. Zhang, Z., Fringer, O.B., Ramp, S.R., 2011. Three-dimensional, nonhydrostatic Shchepetkin, A., McWilliams, J., 2003. A method for computing horizontal pressure- numerical simulation of nonlinear internal wave generation and propagation gradient force in an oceanic model with a non-aligned vertical coordinate. J. in the South China Sea. J. Geophys. Res. 116, C05022. doi:10.1029/ Geophys. Res. 108. 2010JC006424.