ISRN Applied MathematicsVolume 2012 (2012), Article ID 871538, 17 pagesdoi:10.5402/2012/871538

Research Article

Numerical Implementations for 2D Lid-Driven Cavity Flow in Stream Function Formulation

K. Poochinapan1,2

¹Department of Mathematics, Faculty of Science, Chiang Mai University, Chiang Mai 50200, Thailand²Centre of Excellence in Mathematics, CHE, Si Ayutthaya Rd., Bangkok 10400, Thailand

Received 25 July 2012; Accepted 31 August 2012

Academic Editors: M.-H. Hsu, M. Langthjem, and M. Mei

Copyright © 2012 K. Poochinapan. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract.

The aim of this paper is to study the properties of approximations to nonlinear terms of the 2D incompressible Navier-Stokes equations in the stream function formulation (time-dependent biharmonic equation). The nonlinear convective terms are numerically solved by using the method with internal iterations, compared to the ones which are solved by using explicit and implicit schemes (operator splitting scheme Christov and Marinova; (2001)). Using schemes and algorithms, the steady 2D incompressible flow in a lid-driven cavity is solved up to Reynolds number Re with second-order spatial accuracy. The schemes are thoroughly validated on grids with different resolutions. The result of numerical experiments shows that the finite difference scheme with internal iterations on nonlinearity is more efficient for the high Reynolds number.

1. Introduction

There are many finite difference methods for the solution of the Navier-Stokes equations (NSEs) representing incompressible viscous flows. Some of these are schemes utilizing primitive variables (velocity-pressure) [1–4], vorticity-stream function [5–9], and stream function formulation [10, 11]. The practical estimation of any schemes may be different from the theoretical estimation because of the nonlinearity of the NSEs and the implicit characteristic of the continuity condition. There is no single method which is most suitable for all aspects. The solution of the full-nonlinear set of discretized fluid flow equations is usually obtained by solving a sequence of linear equations. The type of linearization which is used can significantly affect the rate of convergence of the iterations to the solution.

The primary difficulty in obtaining numerical solutions with primitive variable formulation is that there is no evolution equation for pressure variable. The pressure function can be removed from the equations by means of vorticity-stream function, but an explicit boundary condition for vorticity function is missing. The simplest way to avoid the case is to eliminate the vorticity and turn to a single nonlinear biharmonic equation for the stream function.

The condition of stability of an explicit scheme imposes very restrictive limitations on the time increment with the artificial time. For the fourth-order derivative, it is . That is why the problem of constructing an implicit scheme is of great significance. The straightforward implementation of an implicit scheme results in the very large linear system whose solution needs very large computer capacity. One of the most efficient approaches to reduce the computational time without compromising the stability of the scheme is the method of operator splitting [12]. The application of the splitting method to the NSEs in stream function formulation is not straightforward because of the fact that they are not a Cauchy-Kowalevska system and there is no time derivative of the stream function. What is present in the equation is the term which cannot serve as a basis for splitting [1].

The new scheme combines the computational simplicity of the implicit scheme in linear terms with semiexplicit approximation of nonlinear terms. The general idea when treating the nonlinear term is to represent it as implicit approximation and then to linearize it and to conduct internal iterations. After the inner iterations converge, one obtains, in fact, the solution for the new time stage. The explicit approximation of nonlinear terms accomplish severe requirement on time step. A single internal iteration on nonlinear terms induces sense of implicit approximation and reduce very severe band on time step. To improve stability properties of explicit approximation of nonlinear terms we require only 3 internal iterations and call such algorithm as a method with internal iteration.

As to the question of which method to be used, the answer is that it depends on the type of problems that to be solved. The objective of the present study is to validate the efficiency and accuracy of numerical implementations for the NSEs in term of stream function. The content of this paper is organized as follows. Section 2 contains the mathematical formulation of the problem. Section 3 deals with the discretization of the equations and detailed description of numerical algorithms. The methods are applied to the test problem of lid-driven cavity flow up to . Results and discussions of numerical solutions are presented in Section 4, where we make a detailed comparison with available numerical data.

2. Mathematical Formulation

Consider a closed 2D domain with a piecewise smooth boundary . The NSEs for a viscous incompressible flow in the terms of stream function are where .

Boundary and initial conditions are the following: where is a vector normal to domain boundary, and the Reynolds number is defined as , where is the characteristic velocity, is the characteristic length, and is the kinematic viscosity.

3. Difference Schemes

The lid-driven flow occupies the region (the cavity) No-slip boundary conditions take the following form: For the sake of simplicity, we assume a uniform grid with and spacing in and -direction, respectively, for and .

The mesh is staggered in direction on and in direction on with respect domain boundaries. The boundary conditions are approximated on two-point stencils with the second order of approximation as follows: where with .

3.1. Explicit Scheme in Nonlinear Terms

The simplest method is explicit in which all nonlinear terms are evaluated using known values at . The biharmonic operator is approximated by the Crank-Nicolson scheme. Thus, one has linear system to calculate the new value of the unknown at each node. It is clear that each term in (2.1) can be approximated using central-difference operators for all derivatives. The explicit finite difference scheme for (2.1) is where and . The difference formulas to be used are given in Table 1.

Table 1: Second-order central difference approximations.

To combine equation (3.5) as a single linear system with band matrix, we introduce the new system of index as follows: Each node of grid associates with index . It is easy to see that Now we introduce a new grid function , which is defined on the composite grid. Substituting in lieu of in (3.5), we recast the algebraic system as follows: According to this idea, can be rewritten as follows: The general sequence of the algorithm is as follows: (i)Set the values of and choose an initial guess .(ii)Consider as known entities and calculate from the system of the algebraic equation (3.8) by the direct method to the solution-banded linear system. We used standard subroutines DGBSV and DGBSVX of LAPACK.(iii)If the following criterion is satisfied then the calculations are terminated. Otherwise the index of iterations is stepped up, and the computation is returned to step (ii). A disadvantage of explicit method is that convergence can be very slow if a small nonlinear residual is required.

3.2. An Operator Splitting Scheme

We use the operator splitting scheme developed in [12, 13]. In the paper [13], a new fully implicit unconditionally stable iterative scheme for the unsteady NSEs in terms of stream function has been developed.

3.3. The Method with Internal Iteration in Nonlinear Terms

The general idea when treating the nonlinear term is to represent it as implicit approximation and then to linearize it and to conduct internal iterations. After the inner iterations converge, one obtains, in fact, the solution for the new time stage. The explicit approximation of nonlinear terms accomplished severe requirement on time step. A single internal iteration on nonlinear terms induced sense of implicit approximation and reduced very severe band on time step. An improvement in accuracy is achieved at small additional expense. The internal iteration scheme may be viewed as a modification of the explicit scheme (3.5). For the beginning, the internal iteration scheme used only 3 iterations. The reason behind our choices is that a single iteration is equivalent to one step of explicit scheme so, in order to take the economies of the explicit scheme, it is desirable not to perform to many iteration (we choose 3 internal iteration). The method with internal iteration of nonlinear terms can be recasted in the following form: Substituting in lieu of in (3.11), we recast the algebraic system as the following: The general sequence of the algorithm is as follows: (i)Set the values of and choose an initial guess . (ii)Let(a) then calculate from the system of the algebraic equation (3.12) by the direct method to solution-banded linear system. We used standard subroutines DGBSV and DGBSVX of LAPACK,(b) then calculate from the system of the algebraic equation (3.12),(c) then calculate from the system of the algebraic equation (3.12).(iii)If the following criterion is satisfied then the calculations are terminated. Otherwise the index of iterations is stepped up, or and the computation is returned to step (ii). Note that the linear system for the problem can be written as the following multidiagonal system for the composite grid function : where . The matrix of the algebraic system equation (3.14) is banded with lower and upper diagonals.

4. Results and Discussion

The results from numerical simulations of the 2D lid-driven cavity flow are presented and compared with published observations. The standard benchmark problem for testing 2D plane NSEs is the driven cavity flow. The fluid contained inside a square cavity is set into motion by the upper wall which is sliding at constant velocity from left to right. The domain is the unit square cavity, and the viscous incompressible flow is governed by the 2D time-dependent incompressible NSEs and driven by the upper wall as seen in Figure 1. An unexpected balance of viscous and pressure forces makes the fluid turn into the square cavity. The properties of these forces depend upon the Reynolds number, a hierarchy of eddies develops, the large clockwise-rotating primary, whose location occurs toward the geometric center of the square cavity, and several small eddies: the counter-clockwise rotating secondary eddies, the clockwise rotating tertiary eddies, whose locations occur at the three relevant corners of the square cavity: bottom left, bottom right, and top left.

Figure 1: Sketch of the basic features in the 2D flow problem.

4.1. Convergence

To evaluate grid dependence on spatial variables the solution is obtained on a sequence of grids with , , and nodes. The finest grid is used as a reference solution. The rate of convergence is computed using two grids according to the formula In Tables 2 and 3   (appeared at the center of primary eddy) and (appeared at the center of bottom right-hand side eddy) are computed as minimum and maximum values of stream function, respectively. Parameters and correspond to the rate of convergence received from (4.1). Table 2 represents steady state. The solutions are qualified as steady when the absolute error between two time steps is less than . As shown in Tables 2 and 3 on particular choice of the parameters, the estimated rate is close to the theoretically predicted second rate of convergence. Figure 2 shows the absolute error versus the number of iterations when the largest value of time-step is used and It shows that the rate of convergence to solution of the method of internal decreased faster than that of explicit and the operator splitting method.

Table 2: Convergence rate at and .

Reference
Grid

Explicit scheme

2.284
2.265

Operator splitting

2.384
2.372

Internal iteration

2.285
2.265

Table 3: Convergence rate at , and .

Reference
Grid

Explicit scheme

2.251
2.498

Operator splitting

2.343
2.122

Internal iteration

2.250
2.253

(a)

(b)

Figure 2: Convergence history: (a) on 122 × 122 grid, (b) Re = 2000 on 102 × 102 grid.

4.2. Time-Step Independence

For fixed values of , and , the number of iterations is needed for convergence to steady state depends on . For definiteness, we select for presentation a genuinely moderate and . The results for the number of iterations to steady state are shown in Tables 4 and 5 where the minimal number of iteration for each resolution is shown in bold face. In the case of , we minimal numbers of iterations on grid are 5276 iterations, 3581 iterations, and 1588 iterations for case explicit, operator splitting, and internal iteration schemes, respectively. We see that the minimal number of iterations of the method of internal iteration is less than other methods.

Table 4: The number of iterations to steady solution at on grid.

Explicit scheme
Operator splitting
Internal iteration

0.0030
—
—
108

0.0010
243
—
243

0.0005
458
458
458

0.0001
1986
1985
1986

Table 5: The number of iterations to steady solution at on grid.

Explicit scheme
Operator splitting
Internal iteration

0.00008
—
—
1588

0.00005
—
—
2404

0.00003
—
3581
3757

0.00002
5276
5082
5340

0.00001
9606
9174
9667

0.000005
17251
16365
17312

Figures 3 and 4 show the largest value of time-step for which it is possible to reach a steady solution which corresponds to other investigators. Figure 3 shows that the present schemes converge to correct solutions in all cases of 3000 considered. If the grid spacing is too coarse, then the operator splitting scheme will not compute a correct solution for . Moreover, the internal iteration method requires slightly larger time-step. An important feature of the internal iteration method is that it allows coarsening of the grid depending on the flow solution and this feature is extremely useful for accuracy in predicting flow fields in region with high Reynolds number and it is compared with the operator splitting scheme.

Figure 3: Largest value of time-step on grid.

Figure 4: Largest value of time-step on grid.

The following Figure 5 shows that the modification of explicit scheme can reduce the number of iterations for the higher Reynolds number. Figure 6 shows CPU time needed to find solution at instant of time with the largest value of parameter . From comparison, it is observed that the internal iteration method seems to be performing better than the other two methods. Computation was carried out on a personal computer with 2.4 GHz CPU and the CPU time per one time step (/one iteration) on the grid was about 2.22031, 2.20781, and 6.61875 sec for case explicit, operator splitting, and internal iteration scheme, respectively. The numerical results are demonstrating that the internal iteration is one method to compute the characteristic of flow for the high Reynolds number. We found that the largest time increment of 3 internal iterations gives convergence to solution roughly 3 times as explicit scheme.

Figure 5: Minimal number of iteration on grid at .

Figure 6: CPU time to reach instant of time on grid.

4.3. Grid Independence

Figures 7 and 8 show the steady state at the secondary vortex at the bottom right corner of the cavity at . Figures 3–8 clearly illustrate the grid independence of the computational solution. The minimum and maximum of stream functions are listed in Tables 6–9 which includes a comparison to the high-accuracy solution of previous literatures. Tables 6 and 7 show the values of , and the space location of the primary vortex. As can be seen from Table 6, three finite-difference schemes give very similar quantities on the grid. The values of , , and their locations are in accordance with results observed in the literature [1, 4, 14, 15]. Table 7 shows the values of , and the space location of the primary eddy for . On the grid for , the method of operator splitting reaches steady solution, but this solution does not agree with the numerical solutions obtained by other authors ([1, 4, 14, 15]). At the same time, explicit and internal iteration schemes reach “correct” solution. For the primary eddy, results of operator splitting scheme with the grid agree within with those obtained in [4] with the grid and [1], but the two other schemes differ significantly up to .

Table 6: Comparison of the three schemes on the primary vortex at : minimum of the stream function and location.

Reference
Grid

Explicit

0.540
0.560

Operator

0.520
0.580

Internal

0.540
0.560

Explicit

0.530
0.560

Operator

0.530
0.560

Internal

0.530
0.560

Ref. [14]
160

0.5308
0.5652

Ref. [4]

0.53125
0.5625

Ref. [4]

0.53125
0.56543

Ref. [1]

—
0.5316
0.5660

Ref. [15]

0.5250
0.5750

Table 7: Comparison of the three schemes on the primary vortex at : minimum of the stream function and location.

Reference
Grid

Explicit

0.540
0.520

Operator

—
—
—
—

Internal

0.540
0.520

Explicit

0.520
0.540

Operator

0.520
0.550

Internal

0.520
0.540

Ref. [4]

0.53125
0.5625

Ref. [4]

0.53125
0.56543

Ref. [1]

—
0.5160
0.5357

Table 8: Comparison of the three schemes on the bottom right secondary vortex at : maximum of the stream function and location.

Reference
Grid

Explicit

0.9891
0.880
0.120

Operator

0.9802
0.860
0.120

Internal

0.9891
0.880
0.120

Explicit

1.005
0.870
0.110

Operator

1.079
0.860
0.110

Internal

1.006
0.870
0.110

Ref. [14]
160

1.109789
0.8640
0.1118

Ref. [4]

1.1304
0.85937
0.10938

Ref. [4]

1.1120
0.86426
0.11230

Ref. [1]

—
0.8651
0.1118

Ref. [15]

0.9847
0.8500
0.1250

Table 9: Comparison of the three schemes on the bottom right secondary vortex at : maximum of the stream function and location.

Reference
Grid

Explicit

0.90
0.06

Operator

—
—
—
—

Internal

0.90
0.06

Explicit

0.83
0.07

Operator

0.80
0.08

Internal

0.83
0.07

Ref. [4]

2.7718
0.80469
0.070313

Ref. [4]

2.7245
0.80566
0.073242

Ref. [1]

—
0.8077
0.0736

(a)

(b)

(c)

Figure 7: Secondary vortex at the bottom right corner of the cavity at predicted on grid: (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

(a)

(b)

(c)

Figure 8: Secondary vortex at the bottom right corner of the cavity at predicted on grid: (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

Tables 8 and 9 report , and the space location of the bottom right secondary eddy. As can be seen from Table 8, the quantities of agree with those obtained by the other authors. For the bottom right secondary eddy, our results on the grid agree within 5% with those obtained by the other authors and in the case of grid they differ significantly up to 25% from those obtained in [15]. Table 7 shows the values of , and the space location of the bottom right secondary eddy for . For the bottom right secondary eddy, the quantities with the grid agree within 10% with those obtained in [4] with the grid and [1] and differ significantly up to 15% from those obtained [4] with the mesh.

At the high Reynolds number the flow becomes more complicated, and significantly finer grids are needed in the vicinity of the walls where the dynamics of the flow is dominated by viscosity. Coarse grid in general will not resolve the viscous layer near the boundary. For example, as can be seen on the 52 × 52 grid, operator splitting method cannot get correct solution. Moreover, the other two have value of differing significantly up to 67% from those obtained [4] with the mesh.

Figures 9, 10, and 11 show well-known stream function contours for , and on the grid. Whole three algorithms give the similar stream function that cannot be distinguished on the stream line patterns. All of these show secondary vortices at the bottom corners of the cavity as well as at the top left of the cavity for case and . The bottom right tertiary vortices become quite visible for . Figures 12 and 13 present comparisons of the -velocity profiles along a vertical line and the -velocity profiles along a horizontal line passing through the geometric center of the cavity for Reynolds numbers ranging from 100 to 5000. These profiles are in good agreement with that of [5]. While the data of [5] was obtained using that on the grid, our data is obtained using that on the grid.

(a)

(b)

(c)

Figure 9: Streamline contours for : (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

(a)

(b)

(c)

Figure 10: Streamline contours for : (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

(a)

(b)

(c)

Figure 11: Streamline contours for : (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

(a)

(b)

(c)

Figure 12: -velocity along vertical line through the cavity: (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

(a)

(b)

(c)

Figure 13: -velocity along horizontal line through the cavity: (a) explicit scheme, (b) operator splitting, and (c) internal iteration.

5. Conclusions

In this paper, we introduce the finite difference scheme to treat nonlinear convective terms in the stream function formulation. After special renumbering of the grid points, the coupled system is formulated as a single system and solved by a LAPACK algorithm. The numerical model is applied to the flow in lid-driven cavity. This study shows that the internal iteration technique performs robustly and allows one to accurately follow the flow patterns. The results are quantitative in good agreement with [1, 4, 14, 15] in common ranges of the main parameters.

Acknowledgments

This research is supported by the Centre of Excellence in Mathematics and the Commission on Higher Education, Thailand.

References

C. I. Christov and R. S. Marinova, “Implicit vectorial operator splitting for incompressible Navier-Stokes equations in primitive variables,” Computational Technologies, vol. 6, no. 4, pp. 92–119, 2001.

S. Abdallah, “Numerical solutions for the incompressible Navier-Stokes equations in primitive variables using a non-staggered grid, II,” Journal of Computational Physics, vol. 70, no. 1, pp. 193–202, 1987.

C. H. Bruneau and C. Jouron, “An efficient scheme for solving steady incompressible Navier-Stokes equations,” Journal of Computational Physics, vol. 89, no. 2, pp. 389–413, 1990.

C. H. Bruneau and M. Saad, “The 2D lid-driven cavity problem revisited,” Computers and Fluids, vol. 35, no. 3, pp. 326–348, 2006.

U. Ghia, K. N. Ghia, and C. T. Shin, “High-Re solutions for incompressible flow using the Navier-Stokes equations and a multigrid method,” Journal of Computational Physics, vol. 48, no. 3, pp. 387–411, 1982.

S. Smagulov and C. I. Christov, “Iterationless numerical implementation of the boundary conditions in vorticity-stream function formulation of Navier-Stokes equations,” Institute of Theoretical and Applied Mechanics, Russian Academy of Science, Novosibirsk, Russia, 1980

P. N. Vabishchevich, “Implicit finite-difference schemes for the nonstationary Navier-Stokes equations with the stream function and vorticity as variables,” Differential Equations, vol. 20, pp. 820–827, 1984.

M. Napolitano, G. Pascazio, and L. Quartapelle, “A review of vorticity conditions in the numerical solution of the - equations,” Computers & Fluids, vol. 28, no. 2, pp. 139–185, 1999.

M. Li, T. Tang, and B. Fornberg, “A compact fourth-order finite difference scheme for the steady incompressible Navier-Stokes equations,” International Journal for Numerical Methods in Fluids, vol. 20, no. 10, pp. 1137–1151, 1995.

C. I. Christov and A. Ridha, “Splitting scheme for iterative solution of bi-harmonic equation, Application to 2D Navier-Stokes problems,” Advances in Numerical Methods and Applications, pp. 341–352, 1994.

C. I. Christov and A. Ridha, “Splitting scheme for the stream-function formulation of 2D unsteady Navier-Stokes equations,” Comptes Rendus Academie des Sciences, Serie II, vol. 320, no. 9, pp. 441–446, 1995.

G. I. Marchuk, Methods of Numerical Mathematics, Springer, New York, NY, USA, 1975.

C. I. Christov and X.-H. Tang, “An operator splitting scheme for the stream-function formulation of unsteady Navier-Stokes equations,” International Journal for Numerical Methods in Fluids, vol. 53, no. 3, pp. 417–442, 2007.

O. Botella and R. Peyret, “Benchmark spectral results on the lid-driven cavity flow,” Computers and Fluids, vol. 27, no. 4, pp. 421–433, 1998.

W. F. Spotz, “Accuracy and performance of numerical wall boundary conditions for steady, 2D, incompressible streamfunction vorticity,” International Journal for Numerical Methods in Fluids, vol. 28, no. 4, pp. 737–757, 1998.