Uploaded by Alex

numlesson2

advertisement
marica.pelanti@ensta-paristech.fr
Introduction to CFD
MF206 ENSTA ParisTech
2017-2018
Application Lesson 2
Lid-driven cavity flow problem via
Vorticity-Stream function formulation
Objective: To practice on the different steps of a flow problem computation (definition of flow model,
boundary conditions, grid, discretization method, implementation, analysis of results) by using a simple
Finite Difference scheme for the solution of a classical benchmark test for the incompressible Navier–Stokes
equations.
UL
Lid
H
y
x
L
Figure 1: Lid-driven cavity test configuration.
1
Problem description
The lid-driven cavity test problem is a common test case used for the assessment of numerical methods for
the solution of the incompressible Navier–Stokes equations, see in particular [1, 2]. An analytical solution
for this flow problem is not available, nonetheless there is abundance of numerical results for comparison in
the literature, obtained by a variety of methods. We consider a viscous laminar flow in a two-dimensional
cavity of height H and width L. A square cavity is assumed, H = L. The left, bottom, and right walls of the
cavity are fixed (velocity ~vwall = 0), while the top wall (the lid) moves with constant velocity ~vL = (UL , 0),
see configuration in Figure 1. Initially the flow is at rest (~v (~x, 0) = 0), and it is set in motion impulsively by
the moving lid. The flow density ρ is assumed constant and gravity effects are neglected. Flow properties are
also assumed constant: µ = const. (dynamic viscosity), κ =const. (thermal diffusivity), cp = const. (heat
coefficient). The flow can be then modeled by the 2D incompressible Navier–Stokes equations:
~ · ~v = 0 ,
∇
(1a)
~
∂~v
~ v = − ∇p + ν∇2~v ,
+ ~v · ∇~
∂t
ρ
(1b)
with appropriate initial and boundary conditions in the domain Ω = [0, L] × [0, L]. The unknowns of the
system are the velocity ~v (~x, t), ~v = (vx , vy ), ~x = (x, y), and the pressure p(~x, t). Let us define the Reynolds
1
number
UL L
,
(2)
ν
where ν = µ/ρ is the kinematic viscosity. When the Reynolds number (2) is sufficiently small (Re < 7500)
the flow reaches a steady laminar configuration after a certain time and we will consider such a situation. The
flow field is characterized by a primary vortex and additional weaker counter-rotating secondary vortexes
in correspondence of the cavity corners, depending on the Reynolds number. See an example of numerical
solution taken from [2] for the flow field for Re = 100 in Figure 2.
Re =
Figure 2: Numerical results taken from [2] for the lid-driven cavity test for Re = 100 (uniform grid 129×129).
Left: stream function contours (streamlines); Right: vorticity contours.
2
Tasks
1. Flow model formulation
(a) Non-dimensionalization of the governing equations. We define the non-dimensional variables
~x̃ = ~x ,
L
t̃ =
t
,
L/UL
~ṽ = ~v ,
UL
p̃ =
p
.
ρUL2
(3)
Verify that the incompressible Navier–Stokes equations (1) have the non-dimensional form:
~ · ~v = 0 ,
∇
∂~v
~ v = −∇p
~ + 1 ∇2~v ,
+ ~v · ∇~
∂t
Re
(4a)
(4b)
where we have omitted the tilde symbol ˜ for the non-dimensional variables to simplify the notation.
Write also the appropriate initial and boundary conditions in non-dimensional form.
(b) Vorticity-Stream function formulation. Let’s now rewrite the governing (non-dimensional) flow equations in terms of velocity and pressure (4) in a (non-dimensional) formulation in terms of the vorticity
~ × ~v and the stream function ψ, defined by
ω
~ =∇
vx =
∂ψ
∂y
and vy = −
∂ψ
.
∂x
(5)
~ · ~v = 0 (4a) is identically satisfied. Also recall
Note that with this definition the continuity equation ∇
~
~
that in two dimensions ω
~ = ω k, where k is the unit vector normal to the (x, y) plane and the scalar
value of the vorticity is
∂vx
∂vy
−
.
(6)
ω=
∂x
∂y
2
Show that from (4) we obtain the following equations for the vorticity and the stream function:
2
∂ω
∂ψ ∂ω
∂ψ ∂ω
1
∂ ω ∂2ω
+
,
(7a)
+
+ −
=
∂t
∂y ∂x
∂x ∂y
Re ∂x2
∂y 2
∂2ψ ∂2ψ
+
= −ω .
(7b)
∂x2
∂y 2
Write initial and boundary conditions for (7). The boundary conditions should be conditions of Dirichlet and Neumann type for the the stream function ψ.
(c) Note that the system (7) is composed of a convection-diffusion equation for the vorticity, eq. (7a),
and a Poisson equation for the stream function, eq. (7b). What is the mathematical nature of these
equations?
2. Numerical scheme and simulations
(a) Now write and implement in Matlab a Finite Difference Scheme to solve the flow equations (7) for
the vorticity and stream function over the domain [0, 1] × [0, 1] (square of unit length). Employ a
uniform grid in the x and y directions. Discretize the equation for the vorticity (7a) by the explicit
Forward-Time Centered-Space (FTCS) scheme (first-order accurate in time and second-order accurate
in space). Use second-order finite centered differences with a 5-point stencil for the Laplacian operator
of the stream function equation (7b).
Specifically, use the following algorithm to update the solution from a time level t to the next t + ∆t:
. initial vorticity given
. solve discrete Poisson equation for the stream function (by using S.O.R. method for linear systems)
. find vorticity on the boundary
. update the vorticity in interior points by applying the FTCS scheme to the vorticity equation
. t = t + ∆t (time increment)
For the implementation in Matlab, you can start from the given template numless2 cav templ.m. To
find the vorticity at the grid points on the boundary once you have solved for the stream function ψ,
first write expressions of the vorticity at the wall ωwall in terms of derivatives of ψ by using (7b) and
the boundary conditions for ψ. Then, write a finite difference form of these expressions to obtain the
vorticity at the grid points on the boundary in terms of discrete values of ψ (on the boundary and at
interior points next to the boundary).
(b) Solve the problem for Re = 10 with N = 30 grid points in the x and y directions until a final time
tf = 3 by using a fixed time step ∆t = 0.001. Note that the flow will be stationary for approximately
t > 2. Plot contour lines of the vorticity ω and of the stream function ψ at tf . Compute the velocity
field from the stream function and plot velocity contour lines and the velocity vector field.
(c) Compute now the solution for Re = 100 with N = 50 grid points until a final time tf = 11 by using
a fixed time step ∆t = 0.001. The flow will be stationary for approximately t > 10 for the chosen
value of the Reynolds number. Note that as the Reynolds number is increased the shear layers become
thinner, this requiring more grid points to resolve them. Plot the vorticity ω, the stream function ψ
and the velocity vector field at t = tf . Optional: you can also observe the solution at chosen times
during the transient period towards the stationary configuration.
(d) For a two-dimensional linear convection-diffusion equation for a quantity φ of the form
2
∂φ
∂φ
∂φ
∂ φ ∂2φ
+ ax
+ ay
=ν
+
∂t
∂x
∂y
∂x2
∂y 2
3
(8)
we have the following necessary and sufficient stability conditions for the FTCS algorithm:
2ν
h2
∆t ≤ min
,
,
a2x + a2y 4ν
(9)
where h denotes the mesh width (assuming a uniform grid). Note that the stability condition for the 2D
FTCS scheme is more restrictive than the one for the 1D case (this more severe restriction is a general
feature of schemes when passing from 1D to 2D to 3D). The equation for the vorticity that we solve via
the FTCS method is non-linear, hence the stability conditions above do not hold strictly. Nevertheless
they can be used to estimate the time step ∆t necessary for stability. By using (9), provide an estimate
for the maximum ∆t allowed for stability for the two considered tests (Re = 10 and Re = 100). Based
on (9), what is the expected effect of very high Reynolds numbers on the time step needed for stability?
What is instead the effect of a finer grid, keeping the same Reynolds number?
(e) We make now some qualitative comparison with results in the literature, namely those in Ghia et
al. [2]. Compare your results for the x-component vx of the velocity ~v = (vx , vy ) along the vertical line
at the middle of the cavity to those taken from [2], which you will find in the given Matlab file.
3. Temperature field computation (if lesson time is enough)
For an incompressible flow with constant fluid properties the governing equation for the temperature T (~x, t)
is decoupled from the mass and momentum equations, and the temperature distribution can be computed
after the solution of the problem for (p, ~v ) or for (~
ω , ψ). By observing also that for an incompressible fluid
cv = cp (heat coefficients at constant volume and constant pressure are equal), and neglecting here internal
heat generation due to viscous dissipation (cf. [1]), the temperature equation can be written as
2
∂ T
∂2T
∂T
∂T
∂T
+ vx
+ vy
=α
+
,
(10)
∂t
∂x
∂y
∂x2
∂y 2
where α = ρcκp is the thermal diffusivity (and κ denotes the thermal conductivity coefficient).
By using the non-dimensional variables in (3) and the non-dimensional temperature
T − T0
,
(11)
Tr − T0
where T0 and Tr are two reference temperatures, we obtain the following non-dimensional equation for the
temperature (omitting again the tilde symbol ˜ for non-dimensional variables):
2
∂T
1
∂ T
∂2T
∂T
∂T
+ vx
+ vy
=
+
,
(12)
∂t
∂x
∂y
Re · P r ∂x2
∂y 2
T̃ =
where we have introduced the Prandtl number
ν
µcp
= .
(13)
κ
α
Add in your Matlab code a method to compute the temperature distribution for the test with Re = 100
(Task 2 (c)) by using again the FTCS method. Note that this is easily done at each time step once you
have computed the stream function. Assume that at the fixed walls of the cavity T = 0, while T = 1 along
the moving lid. Initially in the interior of the cavity T = 0. Compute the solution for T for P r = 0.1 and
P r = 5. Comment on the difference of results for different Prandtl number. (Note: P r ≈ 0.7 − 0.8 for air
and other gases, P r ≈ 7 for water at 20o C.)
Pr =
References
[1] O. R. Burggraf. Analytical and numerical studies of the structure of steady separated flows. J. Fluid
Mech., 24:113–151, 1966.
[2] U. Ghia, K. N. Ghia, and C. T. Shin. High-Re solutions for incompressible flow using the Navier–Stokes
equations and a multigrid method. J. Comput. Phys., 48:387–411, 1982.
4
Download