1. Introduction
The Taylor–Goldstein (T-G) equation describes the stability of a Boussinesq stratified shear flow under inviscid and nondiffusive conditions (Taylor 1931; Goldstein 1931; Liu 2010; Smyth and Carpenter 2019). It is a second-order ordinary differential equation whose solutions exhibit singularity at critical levels (where the speed of the mean current matches the phase velocity). The singular behavior arises from the neglect of viscosity, diffusion and nonlinearity in the equations of motion (Maslowe 1986), and makes the T-G equation a challenge to solve numerically. Several well-known theorems, such as the Rayleigh inflection point criterion (Rayleigh 1880), Fjørtoft’s condition (Fjørtoft 1950), the Miles–Howard theorem (Miles 1961; Howard 1961), and Howard’s semicircle theorem (Howard 1961), allow us to predict certain aspects of instability without solving the T-G equation, but the information they give is far from complete. One alternative is to use a numerical shooting method together with asymptotic matching to cross singularities (Hazel 1972; Smyth and Peltier 1989; Rees and Monahan 2014). Another is to retain the viscous and diffusive effects. Liu et al. (2012) extended the T-G equation to include vertical and horizontal eddy coefficients of viscosity and diffusivity, allowing those coefficients to vary with height. The resulting viscous T-G (vT-G) equation set (described below) is useful for modeling naturally occurring flows. It is nonsingular, but it is higher order than the T-G equation.
The focus of this paper is numerical methods for the vT-G equations, specifically matrix-based methods. Matrix methods are slower than shooting methods for a given accuracy but are useful in practice because they do not rely on an initial guess. We will compare several commonly used methods to seek the most efficient way to get a solution with a prescribed level of accuracy.
2. The viscous Taylor–Goldstein problem
Specification of the problem is completed by the imposition of boundary conditions at the upper and lower boundaries, which may in principle be at infinity. Each boundary is assumed to be impermeable
3. Numerical methods
Numerical methods for determining
In global methods, computing the derivative at any point involves all the N nodes in the domain. Here,
It is important to recognize that higher-order finite-difference methods are designed to be more accurate in the limit Δ → 0, where Δ is the grid spacing defined in appendix A. In practice, we make Δ as small as we can with the available resources, but often we are interested in marginally resolved flow features, for example, a layer of strong shear that extends over just a few data points. In this case, there is no guarantee that a higher-order method will be more accurate. This failure of higher-order methods to improve accuracy has been noted previously, for example, by Putrevu and Svendsen (1992).
In some applications, our aim is to approximate the solution of the differential eigenvalue problem as accurately as possible, while in others we try to attain acceptable accuracy while minimizing processing time and memory. Therefore, we will compare methods based on two criteria:
How quickly does the error of the growth rate (or phase speed) go to zero as N → ∞?
What is the smallest N needed to achieve a predetermined accuracy, for example, a relative error of 1% in the growth rate?
4. Shear instabilities in idealized model flows
Our first goal in solving the vT-G equations is to identify unstable normal modes, or instabilities. We will begin with a profile that is often used in modeling geophysical flows, the hyperbolic tangent shear layer.
a. Case 1: A homogeneous, inviscid shear layer
In the homogeneous, inviscid limit the vT-G equation reduces to the Rayleigh equation (Rayleigh 1880; Smyth and Carpenter 2019). We consider a hyperbolic tangent shear profile U = tanh(z) with boundary conditions
The growth rate is purely real, and is a maximum when k = 0.46. As a ground truth for testing the various numerical methods, we use the Fourier–Galerkin method (appendix C) with high resolution N = 801 to find the corresponding growth rate σ0 = 0.184 561 95. This is used as a ground truth, or “target value” to define the relative error, |σ − σ0|/σ0, for each of the other methods tested.
Figure 1 shows the relative error in the growth rate for five methods: the second-, fourth-, and sixth-order finite-difference methods (labeled FD2, FD4 and FD6, respectively) and the Fourier and Chebyshev methods. The number of grid points N ranges from 11 to 265. Not surprisingly, all methods become more accurate as N is increased. The error in the finite-difference methods decreases according to the order of the method, giving very accurate results at high N. At low N, however, the difference vanishes. To achieve 1% accuracy in the growth rate requires N = 39, 21, and 19 with FD2, FD4, and FD6, respectively. The global methods become extremely accurate at large N, but do not perform as well at small N (the Chebyshev method especially). The standard of 1% accuracy requires N = 29 and 19 with the Chebyshev and Fourier methods, respectively. An investigator desiring <1% error in the growth rate with high efficiency might do well to choose FD6 or the Fourier method. However, FD4 is simpler while giving nearly the same accuracy.
We now show that clustering the grid points in regions of high shear using the methods described in appendix A can improve accuracy significantly, especially when the resolution is coarse (Fig. 2). In general, the clustered grid delivers greatly improved accuracy for all orders of finite-difference methods. The difference is particularly striking at low N, where the 1% standard is achieved even for the lowest-order method FD2c, where “c” denotes clustering (not to be confused with the phase speed of internal waves in section 6) and at the lowest resolution tested (N = 11).
To illustrate the method, we examine the dependence of ϒ on a at N = 113 (Fig. 3a). Using method FD2c, accuracy improves steadily as a is increased, reaching a maximum at a = 0.85. We identify this as the optimal value for FD2c. With method FD4c, the increase is faster and the maximum improvement is found at a = 0.60. With method FD6c, maximum improvement is also found at a = 0.60, but for higher values of a, the rate of improvement decreases approaching zero as the clustering becomes extreme.
We next examine the optimal value of a for a range of N (Fig. 3b) using second-, fourth-, and sixth-order methods. It is found that the optimal value of a for FD2c is constant; for FD4c and FD6c, the optimal value of a increases when N is small. These results are important because the advantage of the clustered grid method is greatest for coarsely resolved features.
While the above results might suggest using larger values of a, one should recall that setting a too large can degrade accuracy (Fig. 3a). Conservatism is especially well justified when analyzing observational data, where one may not know a priori the flow structures that the code will encounter. On that basis, we tentatively choose the lower values a = 0.85 for FD2c, and a = 0.60 for FD4c and FD6c, as in Fig. 2.
b. Case 2: A stably stratified, inviscid, nondiffusive shear layer
We turn now to an inviscid, nondiffusive, stably stratified fluid for which the parallel shear flow problem reduces to the Taylor–Goldstein equation (Taylor 1931; Goldstein 1931; Smyth and Carpenter 2019). Different numerical methods were tested with a simple case of a shear layer in homogeneous fluid in the previous section. Earth’s oceans and atmosphere, however, tend to be density stratified. It is thus critical to make sure these methods also work well for stratified shear flows.
We now repeat the calculations for which results were shown in Figs. 1–3. In this case the FDc methods are always more accurate than the FD methods. We therefore neglect the latter and compare the different order FDc methods with the Fourier and Chebyshev methods in Fig. 5. Except at high N, FDc methods achieve higher accuracy than the Fourier and Chebyshev methods, with the FD4c method performing best. The optimal values of a are similar to those found in the unstratified case, though not exactly the same (Fig. 5, legend). Once again, high-order FDc methods work best with smaller a.
c. Case 3: A homogeneous, stratified shear layer with variable eddy viscosity and diffusivity
Figure 6 shows the results. Again, the target growth rate is smaller than that in case 1. This reveals another stabilizing mechanism: shear instability damped by eddy viscosity and diffusion. The clustered finite-difference methods give better accuracy than the global methods at low N. At high N, the global methods converge rapidly, with the Fourier method outperforming the Chebyshev.
d. Case 4: Plane Poiseuille flow in homogeneous, viscous fluid
The Chebyshev method with resolution N = 101 is used to compute the growth rate as a function of k and Re (Fig. 7). For Re > 105, the maximum growth rate increases with decreasing Re, that is, with increasing viscosity. This is the Tollmien–Schlichting instability (Schlichting and Gersten 2016), an example of a mode that is destabilized by viscosity. The growth rate maximum is found at Re = 105 and k = 1.55. Figure 8 shows relative errors of the growth rate at the Reynolds number Re = 105. In this case, both the FDc and Chebyshev methods cluster the grid points in the boundary layers. When resolution is coarse, the strongly clustered FD methods (a ≥ 0.9) achieve higher accuracy than the Chebyshev method. The FD6c method performs better than the others. At large N, the Chebyshev method converges rapidly. (The Fourier method is omitted because it cannot represent the rigid boundary conditions in the form used here).
To summarize, the numerical methods tested in this paper (see appendixes) compute the growth rate of idealized models of shear instability with varying degrees of accuracy. The accuracy of the finite-difference methods depends on the order of the approximation. When resolution is coarse, clustering the grid in regions of strong shear can confer even higher accuracy than the global Fourier and Chebyshev methods. Most often, higher-order FD methods work best with less clustering (i.e., lower a). At high N, the Fourier and Chebyshev methods converge most rapidly. Before we make a final assessment of all these methods, tests will be carried out with an observed geophysical flows.
5. Shear instabilities in observed oceanic flows
We now demonstrate the application of these methods to observed geophysical flows. Observed flow profiles are considerably more complicated than the idealized models discussed above (e.g., Sun et al. 1998; Liu 2010; Smyth et al. 2011; Liu et al. 2012; Smyth et al. 2013). In what follows, we consider two cases of increasing complexity.
a. Case 5: Clyde Sea, observed profiles with single shear maximum
Note that the shear profile has five local maxima (excluding boundaries). Only two of these have Ri < 1/4, z = 16 m and z = 8 m. Eddy viscosity is strong at the latter, likely damping shear instability. We therefore anticipate a single dominant mode with critical level near z = 16 m.
To obtain a target value for evaluating different numerical methods, we use the Fourier method with very high resolution, N = 801, and thus obtain the following values for the FGM: θ0 = −54°, λ0 = 30.880 m (k0 = 2π/λ0 = 0.2035 m−1), and σ0 = (6.295 821 + 4.879 614ι) × 10−3 s−1. The critical level is located at 15.8 m, within the single maximum shear layer.
Figure 11 shows the comparison between the FD methods and the global methods (i.e., the Fourier and Chebyshev methods). At low N, no difference is visible between the Fourier and FD methods. The Fourier and FD6 method have higher accuracy than the others at large N. The Chebyshev method performs worst, even compared with FD2. This is because the Chebyshev method clusters the grid points near the boundaries, which is inefficient for this case.
We cluster the grid points in the single shear layer and compare the accuracy of the FDc methods of different orders with the FD method on a uniform grid. The FDc method achieves higher accuracy than the FD method (Fig. 12), indicating that the clustered grids work for observed flows. At large N, FD6c with a = 0.30 performs the best.
b. Case 6: Clyde Sea, observed profiles with multiple shear maxima
Observed profiles are often more complex than the one shown above, for example, Fig. 13. Conditions for shear instability are evident at several depths; that is, shear magnitude reaches a local maximum (red curve in Fig. 13b), Ri < 1/4 (black dots), and turbulent coefficients are not too large (Fig. 13c). In this case the stability analysis at each (k, θ) may deliver two or more unstable modes with critical levels close to one of the shear maxima shown in Fig. 13b. We describe a method for dealing with this additional complexity. At each (k, θ), rather than retain only the fastest growing of the 2N eigenmodes, we collect all modes having positive growth rates. After scanning the k–θ plane, we are typically left with several thousand modes.
Following Smyth et al. (2013), we compute the critical level for each mode and plot a histogram of the results (Fig. 13d). For the case analyzed here, the histogram reveals eight peaks, each of which corresponds roughly to one of the shear maxima shown Fig. 13b. Local minima of the histogram (blue triangles in Fig. 13d) conveniently delineate the set of modes corresponding to each shear maximum. We call these sets mode families. Each mode family has its own fastest-growing mode (e.g., pentagrams in Fig. 14a) and critical level (Fig. 14c). The depth of the critical level for each family is approximately independent of wavelength. Eight depths are found and shown by horizontal lines on Fig. 14c. The shallowest critical level, located at z = 49 m, is denoted as mode 1. Successive mode families with critical levels at z = 45, 31, 23, 19, 12, 7, and 1 m are denoted as modes 2–8, respectively. These mode families represent distinct physical processes (Sun et al. 1998). For example, the uppermost mode family may represent shear at the base of the surface mixed layer, while others might represent breaking depths of the internal wave field. The growth rates of these mode families are shown on Fig. 14a. Three mode families stand out are mode 1, mode 5 and mode 6. The growth rates of their FGMs are 39.31, 39.76, and 34.21 h−1, respectively, so their amplitudes grow by a factor e = 2.718 in about 2 min. The corresponding wavelength are 7.78, 12.04, and 25.43 m, about 7 times the thickness of their shear layer, that is, 1, 2, and 4 m.
Figure 15 shows the eigenfunctions of the three dominant modes. The solutions were normalized by scaling the maximum magnitude to unity. The vertical structure of eigenfunctions have significant magnitude at their critical-level depth, while the magnitude decreases to zero away from these layers.
We use mode 6 to test the accuracy of different numerical methods in computing the growth rate of fastest-growing mode σ, the wavelength λ, the wave vector direction θ, and the critical-level height zc. All methods converge to the same values (blue arrows in Fig. 16). At large N, the FD4c method performs as well as the Fourier–Galerkin method and even better than the Chebyshev method. At low N, FD4c achieves the highest accuracy.
6. Internal gravity waves in inviscid, nondiffusive fluid
Internal gravity waves arise from the same Eqs. (1) and (2) that describe instabilities. The phase speed of internal gravity waves is c = ισ/k = cr + ιcι, where σ is the eigenvalue of Eq. (5). Here, we look for the stable wave solutions (cι = 0) and test the abilities of various numerical methods to approximate the phase speed cr in the long-wave (or hydrostatic) limit k → 0.
We consider a viscous stratified fluid with stratification given by (11) as in case 3 but with Rib = 1 and no background flow, U = 0. Eddy coefficients are uniform and equal: Aυ = Kυ = Ah = Kh = 1/Re with Re = 1010.
Figure 17 shows the relative error of phase speed. The accuracy of high-order finite-difference methods and global methods is high. Unlike the behavior in Fig. 1, the Fourier method works very well at low N. To achieve 1% accuracy, only 12 grid points are required. The FD4, FD6, and Chebyshev methods have similar accuracy at low N. These methods all outperform FD2, which requires N > 80 to achieve 1% accuracy.
The optimal value of a (Fig. 18b) is generally smaller than the values computed for the homogeneous shear layer (case 1; Fig. 2). The phase speed of internal waves does not seem to require highly clustered grid points; in fact, the FD6 method gives better results with no clustering except when the resolution is very coarse (Fig. 18b; compare green and yellow diamonds). We understand this by recalling that, for shear instability, a high value of a ensures high resolution around the critical level, where the instability is most likely to occur. The neutral modes found here are not singular and are therefore less tightly localized than the instabilities discussed previously. The Fourier method (black curve on Fig. 17) provides reliably accurate solutions.
7. Summary
The conventional Taylor–Goldstein equation is extended to include effects of turbulence represented by the eddy viscosity and diffusivity. The resulting “viscous T-G” (vT-G) equation, together with appropriate boundary conditions, is a linear eigenvalue problem that can be solved using matrix-based methods. We have tested the most commonly used matrix methods including the second-, fourth-, and sixth-order finite-difference methods, the Chebyshev-collocation method, and the Fourier–Galerkin method. The accuracy of the finite-difference method is greatly improved by using adaptive grid spacing.
We have tested these methods using both idealized models and observational data. At high resolution, the global methods (i.e., the Fourier–Galerkin and Chebyshev-collocation methods) converge most rapidly. At coarse resolution, however, the finite-difference methods with optimal grid spacing can achieve higher accuracy than the global methods. The optimal value of clustering strength depends on the order of the methods. High-order finite-difference methods usually need only slight clustering. Overall, we recommend the FD4c method with a = 0.6 or the FD6c method with a = 0.4 for sheared flows. If shear is judged to be unimportant, the Fourier–Galerkin method is a reliable alternative.
Acknowledgments
This work was supported by the National Natural Science Foundation of China (41622601, 91858201, and 41721005), the National Key R&D Program of China (2016YFC1401404), and the U.S. National Science Foundation (OCE-1537000). The project has benefited from discussions with Shuwen Tan and Larry Pratt.
Data availability statement: The codes developed in this study are available on request from W.D.S (bill.smyth@oregonstate.edu) or Z.L. (zyliu@xmu.edu.cn).
APPENDIX A
Creation of an Efficient Clustered Grid
Efficient solution of Eqs. (1)–(4) requires an efficient means of discretization; that is, grid spacing can vary with z such that the spacing is fine in regions where the solution is expected to vary most rapidly. Since instability tends to be focused in high-shear layers, it is natural to seek for a discretization with clustering in these regions.
APPENDIX B
The Finite-Difference Method
APPENDIX C
The Chebyshev-Collocation Method
We find that the collocation method is nothing other than the barycentric Lagrange interpolation based on the Chebyshev collocation points. The boundary conditions can be incorporated using the same approach discussed in the last section.
APPENDIX D
The Fourier–Galerkin Method
APPENDIX E
List of Symbols
k | Wave vector |
k | Wave vector magnitude |
U | Background flow parallel to the wave vector |
Bz | Squared buoyancy frequency |
ρ | Density |
ρ0 | Characteristic value of density |
Mean density | |
ρ′ | Density perturbation |
b | Buoyancy |
b′ | Buoyancy perturbation |
w′ | Vertical velocity perturbation |
Complex vertical structure function of vertical velocity | |
Complex vertical structure function of buoyancy | |
σ | Exponential growth rate of instability |
Rib | Bulk Richardson number |
Re | Reynolds number |
REFERENCES
Abramowitz, M., and I. A. Stegun, 1964: Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Vol. 55. U.S. Government Printing Office, 1046 pp.
Berrut, J.-P., and G. Klein, 2014: Recent advances in linear barycentric rational interpolation. J. Comput. Appl. Math., 259, 95–107, https://doi.org/10.1016/j.cam.2013.03.044.
Bickley, W., 1941: Formulae for numerical differentiation. Math. Gaz., 25, 19–27, https://doi.org/10.1017/S002555720007008X.
Fjørtoft, R., 1950: Application of integral theorems in deriving criteria of stability for laminar flows and for the baroclinic circular vortex. Geofys. Publ., 17 (6), 1–52.
Fornberg, B., and J. Zuev, 2007: The Runge phenomenon and spatially variable shape parameters in RBF interpolation. Comput. Math. Appl., 54, 379–398, https://doi.org/10.1016/j.camwa.2007.01.028.
Goldstein, S., 1931: On the stability of superposed streams of fluids of different densities. Proc. Roy. Soc. London, 132A, 524–548, https://doi.org/10.1098/rspa.1931.0116.
Gregg, M., E. D’Asaro, J. Riley, and E. Kunze, 2018: Mixing efficiency in the ocean. Annu. Rev. Mar. Sci., 10, 443–473, https://doi.org/10.1146/annurev-marine-121916-063643.
Hazel, P., 1972: Numerical studies of the stability of inviscid stratified shear flows. J. Fluid Mech., 51, 39–61, https://doi.org/10.1017/S0022112072001065.
Howard, L. N., 1961: Note on a paper of John W. Miles. J. Fluid Mech., 10, 509–512, https://doi.org/10.1017/S0022112061000317.
Klein, G., and J.-P. Berrut, 2012: Linear rational finite differences from derivatives of barycentric rational interpolants. SIAM J. Numer. Anal., 50, 643–656, https://doi.org/10.1137/110827156.
Liu, Z., 2010: Instability of baroclinic tidal flow in a stratified fjord. J. Phys. Oceanogr., 40, 139–154, https://doi.org/10.1175/2009JPO4154.1.
Liu, Z., S. A. Thorpe, and W. D. Smyth, 2012: Instability and hydraulics of turbulent stratified shear flows. J. Fluid Mech., 695, 235–256, https://doi.org/10.1017/jfm.2012.13.
Maslowe, S. A., 1986: Critical layers in shear flows. Annu. Rev. Fluid Mech., 18, 405–432, https://doi.org/10.1146/annurev.fl.18.010186.002201.
Miles, J. W., 1961: On the stability of heterogeneous shear flows. J. Fluid Mech., 10, 496–508, https://doi.org/10.1017/S0022112061000305.
Putrevu, U., and I. A. Svendsen, 1992: Shear instability of longshore currents: A numerical study. J. Geophys. Res., 97, 7283–7303, https://doi.org/10.1029/91JC02988.
Rayleigh, L., 1880: On the stability or instability of certain fluid motions. Scientific Papers, Vol. 3, Cambridge University Press, 594–596.
Rees, T., and A. Monahan, 2014: A general numerical method for analyzing the linear stability of stratified parallel shear flows. J. Atmos. Oceanic Technol., 31, 2795–2808, https://doi.org/10.1175/JTECH-D-14-00034.1.
Schlichting, H., and K. Gersten, 2016: Boundary-Layer Theory. Springer, 805 pp.
Smyth, W. D., and W. R. Peltier, 1989: The transition between Kelvin–Helmholtz and Holmboe instability: An investigation of the overreflection hypothesis. J. Atmos. Sci., 46, 3698–3720, https://doi.org/10.1175/1520-0469(1989)046<3698:TTBKAH>2.0.CO;2.
Smyth, W. D., and J. R. Carpenter, 2019: Instability in Geophysical Flows. Cambridge University Press, 338 pp.
Smyth, W. D., J. N. Moum, and J. D. Nash, 2011: Narrowband oscillations in the upper equatorial ocean. Part II: Properties of shear instabilities. J. Phys. Oceanogr., 41, 412–428, https://doi.org/10.1175/2010JPO4451.1.
Smyth, W. D., J. N. Moum, L. Li, and S. A. Thorpe, 2013: Diurnal shear instability, the descent of the surface shear layer, and the deep cycle of equatorial turbulence. J. Phys. Oceanogr., 43, 2432–2455, https://doi.org/10.1175/JPO-D-13-089.1.
Sun, C., W. Smyth, and J. Moum, 1998: Dynamic instability of stratified shear flow in the upper equatorial Pacific. J. Geophys. Res., 103, 10 323–10 337, https://doi.org/10.1029/98JC00191.
Taylor, G. I., 1931: Effect of variation in density on the stability of superposed streams of fluid. Proc. Roy. Soc. London, 132A, 499–523, https://doi.org/10.1098/rspa.1931.0115.
Trefethen, L. N., 2000: Spectral Methods in MATLAB. Society for Industrial and Applied Mathematics, 165 pp.