Solution to Two-Dimensional Incompressible Navier-Stokes Equations with SIMPLE, SIMPLER and Vorticity-Stream Function Approaches
Total Page:16
File Type:pdf, Size:1020Kb
Solution to two-dimensional Incompressible Navier-Stokes Equations with SIMPLE, SIMPLER and Vorticity-Stream Function Approaches. Driven-Lid Cavity Problem: Solution and Visualization. by Maciej Matyka Computational Physics Section of Theoretical Physics University of Wrocław in Poland Department of Physics and Astronomy Exchange Student at University of Link¨oping in Sweden [email protected] http://panoramix.ift.uni.wroc.pl/∼maq 30 czerwca 2004 roku Streszczenie In that report solution to incompressible Navier - Stokes equations in non - dimensional form will be presented. Standard fundamental methods: SIMPLE, SIMPLER (SIMPLE Revised) and Vorticity-Stream function approach are compared and results of them are analyzed for standard CFD test case - Drived Cavity flow. Different aspect ratios of cavity and different Reynolds numbers are studied. 1 Introduction will be solved on rectangular, staggered grid. Then, solu- tion on non-staggered grid with vorticity-stream function The main problem is to solve two-dimensional Navier- form of NS equations will be shown. Stokes equations. I will consider two different mathemati- cal formulations of that problem: ¯ u,v,p primitive variables formulation 2 Math background ¯ ζ, ψ vorticity-stream function approach We will consider two-dimensional Navier-Stokes equations I will provide full solution with both of these methods. in non-dimensional form1: First we will consider three standard, primitive component formulations, where fundamental Navier-Stokes equation 1We consider flow without external forces i.e. without gravity. −→ Guess: Solve (3),(4) for: ∂ u −→ −→ 1 2−→ = −( u ∇) u − ∇ϕ + ∇ u (1) n n n n+1 n+1 ∂t Re (P*) ,(U*) ,(V*) (U*) ,(V*) D = ∇−→u = 0 (2) Where equation (2) is a continuity equation which has Solve (6) for: to be true for the final result. (P’) 3 Primitive variables formulation Calculate Visualization First we will examine SIMPLE algorithm which is ba- (U'),(V') - Appendix A sed on primitive variables formulation of NS equations. When we say ”primitive variables” we mean u,v,p where u = (u, v) is a velocity vector, and p is pressure. We can rewrite equation (1) in differential form for both velocity Un+1 =(U*)n+(U’) Pn+1 =(P*) n+(P’) components: Vn+1 =(V*) n+(V’) ∂u ∂u2 ∂uv ∂p 1 ∂2u ∂2v = − − − + ( + ) (3) Rysunek 1: SIMPLE Flow Diagram ∂t ∂x ∂y ∂x Re ∂x2 ∂y2 ∂v ∂v2 ∂uv ∂p 1 ∂2u ∂2v 3.2 Numerical Methods in SIMPLE = − − − + ( + ) (4) ∂t ∂y ∂x ∂y Re ∂x2 ∂y2 3.2.1 Staggered Grid We rewrite continuity equation in the following form: For discretization of differential equations I am using stag- ∂u ∂v + = 0 (5) gered grid. In the figure (2) staggered grid for rectangular ∂x ∂y area is sketched. Primitive variables are placed in different These equations are to be solved with SIMPLE method. places. In points i, j on a grid pressure P values, in points i +0.5,j u x-velocity components and in points i, j +0.5 v y-velocity components are placed. That simple model of 3.1 SIMPLE algorithm staggered grid gives us possibility to use simple discreti- zation with second order accuracy which will be discussed SIMPLE algorithm is one of the fundamental algorithm to later. solve incompressible NS equations. SIMPLE means: Semi Implicit Method for Pressure Linked Equations. p u Algorithm used in my calculations is presented in the 0,0 0.5,0 figure (1). First we have to guess initial values of the pres- v0,0.5 v sure field2 (P ∗)n and set initial value of velocity field - i,j-0.5 (U ∗)n, (V ∗)n. Then equation (3) and (4) is solved to ob- u pi,j u tain values of (U ∗)n+1, (V ∗)n+1. Next we have to solve i-0.5,j i+0.5,j pressure-correction equation: vi,j+0.5 1 ∇2p′ = (∇ · V ) (6) ∆t Next - a simple relation to obtain corrected values of pressure and velocity fields is applied (see appendix A for details about velocity correction calculaion). At the end of time step we check if solution coverged. Rysunek 2: Staggered grid: filled circles P , outline circles U x-velocity, cross V y-velocity component. 2Subscripts denote computational step, where ”n+1” means cur- rent step. 2 Differential Discretization Type (v2)n − (v2)n (vu˙)n − (vu˙ )n ∂u un+1−un i,j+1.5 i,j−0.5 i+1,j+0.5 i−1,j+0.5 forward, O(h) b1 = − − ∂t ∆t 2 · ∆y 2 · ∆x (12) 2 n n n ∂ u ui+1,j −2∗ui,j +ui−1,j 2 u − 2 · u + u 2 2 central, O(h ) i+1.5,j i+0.5,j i−0.5,j ∂x (∆x) (a )= (13) 3 (∆x)2 n n n ui+0.5,j+1 − 2 · ui+0.5,j + ui+0.5,j−1 2 2 2 ∂u ui+1,j −ui−1,j 2 (a4)= 2 (14) ∂x (2·∆x) central, O(h ) (∆y) vn − 2 · vn + vn (b )= i,j+1.5 i,j+0.5 i,j−0.5 (15) 3 (∆y)2 ∂p pi+1,j −pi,j forward, O(h) ∂x (∆x) vn − 2 · vn + vn (b )= i+1,j+0.5 i,j+0.5 i−1,j+0.5 (16) 4 (∆x)2 ∂p pi,j+1 −pi,j forward, O(h) Now we have defined almost everything. Dotted velo- ∂y (∆y) cities should be also defined. I use simple expressions for it: Tabela 1: Discretizations used in SIMPLE algorithm u˙ =0.5 · (ui−0.5,j + ui−0.5,j+1) (17) 3.2.2 Discretization Schemes u˙ =0.5 · (ui+0.5,j + ui+0.5,j+1) (18) Let us now examine some numerical methods used in pre- sented solution. For algorithm presented in the figure (1) v˙ =0.5 · (v + v ) (19) we have only three equations which have to be discretized i,j+0.5 i+1,j+0.5 on a grid. First we have momentum equations (3) and (4). Discrete schemes used in discretization of momentum v˙ =0.5 · (vi,j−0.5 + vi+1,j−0.5) (20) equations are presented in a table (1). Using presented discrete form of derivatives I obtain numerical scheme for 3.2.3 Poisson Equation momentum equations exactly in the form presented in [1]. Equations (3) , (4) discretized on staggered grid can be For equation I use simple iterative procedure. In the figure written3 as follows4: (3) points used for calculation of pressure at each (i, j) grid points are marked. n+1 n −1 ui . ,j = ui+0.5,j + ∆t · (A − (∆x) (pi+1,j − pi,j )) (7) +0 5 Pi,j-1 n+1 n −1 vi,j+0.5 = vi,j+0.5 + ∆t · (B − (∆y) (pi,j+1 − pi,j )) (8) where A and B are defined as: Pi-1,j Pi,j Pi+1,j −1 A = −a1 + (Re) · (a3 + a4) (9) P −1 i,j+1 B = −b1 + (Re) · (b3 + b4) (10) and respectively we define: Rysunek 3: Points on a grid used in iterative procedure for Poisson equation solving. (u2)n − (u2)n (uv˙)n − (uv˙)n a = − i+1.5,j i−0.5,j − i+0.5,j+1 i+0.5,j−1 1 2 · ∆x 2 · ∆y I use simple 4 points scheme for Laplace operator. Di- (11) rectly from [1] expression for one iterative step of poisson equation solver can be written as follows: 3Please note than cited [1] reference contains some print mistakes there. 4 Generally I show there only an idea how to write discretized equ- ′ −1 ′ ′ ′ ′ ations, they should be rewritten with ”*” and ”’” chars for concrete pi,j = −a (b · (pi+1,j + pi−1,j )+ c · (pi,j+1 + pi,j−1)+ d) steps of the algorithm (21) 3 where 4 Vorticity-Stream Function ap- 1 1 proach a = 2∆t 2 + 2 (22) ∆x ∆y Vorticity-Stream Function approach to two-dimensional ∆t problem of solving Navier-Stokes equations is rather easy. b = − (23) ∆x2 A different form of equations can be scary at the beginning but, mathematically, we have only two variables which ha- ∆t ve to be obtained during computations: stream vorticity c = − 2 (24) ∆y vector ζ and stream function Ψ. 1 1 First let us provide some definition which will simplify d = [u − u ]+ [v − v ] (25) ∆x i+0.5,j i−0.5,j ∆y i,j+0.5 i,j−0.5 NS equation. The main goal of that is to remove explici- tly Pressure from N-S equations. We can do it with the That iterative procedure is rather simple - we use equ- procedure as follows. ation (21) for all interior points on a grid. After that one First let us define vorticity for 2D case: step of iterative procedure is done. Then we check if so- lution coverges. We can do it simply to check maximum ∂v ∂u ζ = |ζ| = |∇ × V | = − (26) change of pressure on a grid. If it is bigger than ǫ we conti- ∂x ∂y nue iterative process. Solution should finish when pressure field is exactly coverged ǫ = 0, but in practice I use diffe- And stream function definition is: rent value of ǫ for different physical properties of simulated ∂Ψ models - it will be discussed later. = u (27) ∂y ∂Ψ 3.3 SIMPLE Revised algorithm = −v (28) ∂x We can combine these definitions with equations (3) and Solve Momentum Guess (4). It will eliminate pressure from these momentum equ- eq. (without P) (U^) n, (V^) n (U^) n+1, (V^) n+1 ations.