Project Assignment of INF5640 Høst 2004 1 Submission and deadline Each student should submit a report typeset using e.g. LATEX. The deadline for submitting the project assignment is Friday, November 26, 2004. 2 Introduction Incompressible fluids can be modelled by the following dimensionless incompressible Navier-Stokes equations: ∂~u 1 + (~u · grad)~u + grad p = ∆~u + ~g ∂t Re div ~u = 0 (1) (2) In Eq. (1), Re is the dimensionless Reynolds number and ~g denotes external body forces. The primary unknowns are the velocity field ~u(~x, t) and the pressure p(~x, t) (which is determined only up to an additive constant). Eq. (1) is the so-called momentum equation and Eq. (2) is the so-called continuity equation. Equations (1)-(2) are subject to initial and boundary conditions. Note that in two space dimensions we have ~u = (u, v) and ! ∂u u ∂u + v ∂x ∂y (~u · grad)~u := . ∂v ∂v u ∂x + v ∂y 3 A simple numerical strategy Introducing 2 1 ∂ u ∂2u ∂(u2 ) ∂(uv) F := u + δt + 2 − − + gx , Re ∂x2 ∂y ∂x ∂y 2 1 ∂ v ∂2v ∂(uv) ∂(v 2 ) G := v + δt + 2 − − + gy , Re ∂x2 ∂y ∂x ∂y 1 and denoting the discrete time levels by a superscript n, we can devise a simple two-dimensional numerical strategy for Eqs. (1)-(2) as ∂p(n+1) , ∂x ∂p(n+1) = G(n) − δt , ∂y u(n+1) = F (n) − δt v (n+1) where p(n+1) can be determined implicitly by using the continuity equation ∂v (n+1) ∂u(n+1) + ∂x ∂y = 0 ⇓ 2 (n+1) ∂ p ∂x2 2 (n+1) + ∂ p ∂y 2 = 1 δt ∂F (n) ∂G(n) + ∂x ∂y . (3) This is a so-called “implicit pressure and explicit velocity” strategy. 4 Assignment Consider a two-dimensional domain Ω = (0, 1) × (0, 1) and a uniform staggered grid, see Figure 1. In order words, p is sought at the cell centers, while u is sought on the midpoint of the vertical cell walls, and v is sought on the midpoint of the horizontal cell walls. The boundary conditions are utop y = 1, v = 0 on ∂Ω. u= 0 on the remaining part of ∂Ω, Task 1 Using finite differences, please write down the detailed time stepping scheme for (n+1) (n) updating u and v at each time level. (That is, ui,j = ui,j + . . .) Remarks 1. When solving the pressure equation (3), the boundary condition is of the ∂p form ∂n = 0. 2. Hint: The convective terms in Eq. (1), i.e., ∂(u2 )/∂x, ∂(uv)/∂x, ∂(uv)/∂y and ∂(v 2 )/∂y, should be treated with upwind discretization. 3. Hint: The boundary condition for v on x = 0 can be discretized as (see Figure 2): va + vi vr := = 0 ⇒ va = −vi , 2 where va is a “ghost” v value that participates in the discretized momentum equation (1). Other boundary conditions can be treated similarly. 2 Figure 1: The spatial staggered grid for finite-difference discretization of the Navier-Stokes equations. Task 2 Implement the simple numerical strategy, i.e., at each time level first solve the pressure equation implicitly and then update the discretized momentum equations explicitly. Any iterative solver can be chosen to solve the discretized pressure equation. Task 3 Develop a parallel version of the above sequential implementation. Task 4 Simulate the following lid-driven cavity case for different values of P : ~u(~x, 0) = ~0, utop = 10, Re = 1000, ~g = ~0. Use e.g. δt = 0.02 and simulate until T = 5. Make some snapshots of the simulation, and study the speed-up results. 3 Figure 2: An example of treating the so-called “no-slip” boundary condition. 4