Professional Documents
Culture Documents
Project5 Report Venu
Project5 Report Venu
Prepared by
Venu Agarwal
Submitted to
I. Introduction:
The objective of this project is to develop a computer program for two-dimensional unsteady
recirculating flows with constant properties (density and viscosity) in a square cavity with top
wall sliding at a given velocity. Two dimensional Navier Stokes equation are solved using first
order time and second-order space discretization. An explicit time discretization scheme for
both convection and diffusion terms is used. Three cases are considered corresponding to
Reynolds number: 50, 100 and 200, using a square grid of size 1 unit with 40*40 grid intervals
(42 x 42 finite difference points).
()
X- Momentum equation:
2 2
+(
+
)=
+ ( 2+ 2)
()
Y momentum equation:
2 2
+(
+
)=
+ ( 2+ 2)
()
III. Geometry:
A. Continuity equation
(+1, 1, ) (,+1 ,1 )
+
=0
2
2
B. X momentum equation
The various terms in X momentum equation are discretized as follows:
Unsteady term
+1
,
)
(,
=
+1
,
)
(,
=
Advection terms
(+1,
)
1,
(,+1
)
,1
(+1,
)
1,
(,+1
)
,1
Diffusion term
2
2
2,
+1,
(+1,
)
2,
+,1
(,+1
)
2
2
2,
+1,
(+1,
)
2,
+,1
(,+1
)
Pressure Term
+1
+1
(+1,
1,
)
=
,
2
+1
+1
(,+1
,1
)
=
,
2
V.
A.
(uB)left=0 &
(1,
+2,
)/2 = (uB)left
B.
(v1,
+v2,
)/2 = (vB)left
(uB)right=0 &
(+1,
+,
)/2 = (uB)right
C.
(uB)top=1.0
(,+1
+,
)/2 = (uB)top
D.
(vB)left=0
(vB)right=0
(v+1,
+v,
)/2 = (vB)right
&
(vB)top=0
(v,+1
+v,
)/2 = (vB)top
(uB)bottom=0
&
(vB)bottom=0
(,1
+,2
)/2 = (uB)bottom (v,1
+v,2
)/2 = (vB)bottom
p(1,j) = p(2,j)
p(nx+1,j) = p(nx,j)
p(i,ny+1) = p(i,ny)
Cun
Cvn
Dnu
Dnv
=
=
u u
x
u v
x
2
2
2 v
2
v u
y
v v
+
+
2
2
2 v
2
n
un
i1,j )
n (ui+1,j
ui,j
2x
n
vn
i1,j )
n (vi+1,j
ui,j
2x
=
=
n
un
i,j1 )
n (ui,j+1
vi,j
2y
n
vn
i,j1 )
n (vi,j+1
vi,j
2y
2,
+1,
(+1,
)
(v
+1, 2v, +v1, )
2,
+,1
(,+1
)
(v
,+1 2v, +v,1 )
)=
,
,
Cun + un
Cvn + vn
(v
v
) =
,
,
Intermediate velocities are then calculated at half grid points by taking average of
neighbouring velocities
+1/2, =
(, + +1, )/2
v,1/2 =
+1
+1
(,
1,
)
,+1/2 v
,1/2 )
(v
+1
+1
(,
,+1
)
+1
+1
(,
,1
)
+1
+1
(,
+1,
)
=0
From the above Pressure Poisson equation, we get a penta diagonal system of equations,
which are solved using SOR technique.
Finally, after computing intermediate velocities at the grid points and pressure fields at
n+1, velocities at n+1 time step can be computed by plugging into the equation.
+1
,
+1
+1
1,
+1,
= , (
)
+1
v,
+1
+1
,1
,+1
= v, (
)
VIII.
Results:
Case I:
Re=50
Case II:
Re=100
Fig 1.
Fig 2.
Comparison of the above obtained results were done with the already published results for
lid-driven cavity through the above two figures.
Fig 1 shows the variation of u component of the velocity along the vertical centreline, and the
variation of v component of the velocity along the horizontal centreline, for Re=200. The trend
agrees to a large extent with the results obtained by the present study. The u max is reached
at around 0.4 unit above the bottom plate and v component velocity attains a maximum of
about 0.3 m/s and becomes zero at the centre along with flow reversal taking place about the
centre. The same trend was observed for both the u and v component velocity in the present
study for Re=200.
In the Fig 2. , variation of u and v component of velocity along the centreline is seen with
respect to different Reynolds number from studies of different researchers. The general
trend seen is, that by increasing the Reynolds number, the position of umax approaches the
bottom wall, with the magnitude of umax increasing with Reynolds number.
The trend observed for v component of velocity from Fig 2, also agrees with the results
obtained. The vmax increases with Reynolds number but at the centre of the cavity v remains
zero irrespective of the Reynolds number.
Hence quantitatively we can say that results obtained in the present study agrees significantly
with the already published results by researchers.
IX. References
1. Lid Driven Sqaure Cavity Flow: Numerical Solution with 1024*1024 Grid by Carlos
Henrique Marchi, Robert Suero, Luciano Kiyoshi Araki
2. CFD simulations for Lid Driven Cavity Flow at Moderate Reynolds Number by Reyad
Omari
X. Appendix
Implicit double precision(a-h,o-z)
Parameter (nx=40)
Parameter (ny=40)
DIMENSION u(nx+2,ny+2),v(nx+2,ny+2),p(nx+2,ny+2)
DIMENSION ae(nx+2,ny+2),aw(nx+2,ny+2),an(nx+2,ny+2),as(nx+2,ny+2)
DIMENSION a(nx+2,ny+2),uh(nx+2,ny+2),vh(nx+2,ny+2),s(nx+2,ny+2)
c
c
open(unit=9,file='centreline_u_200_2.0.txt')
open(unit=10,file='v.txt')
open(unit=11,file='p.txt')
xl=1.0
yl=1.0
Re=200.0
ntmax=2000
niter=200
rho=1.2
omega=1.4
utop=1.0
dx=xl/nx
dy=yl/ny
dxsq=dx**2
dysq=dy**2
c
c
c
c
c
c
conux,conuy,convx,convy=0.0d0
diffux,diffuy,diffvx,diffvy,temp=0.0d0
temp=0.0d0
ae(i,j)=1.0/dxsq
an(i,j)=1.0/dysq
as(i,j)=1.0/dysq
a(i,j)=2.0/dxsq+2.0/dysq
if (i.eq.2)then
aw(i,j)=0.0
a(i,j)=1.0/dxsq+2.0/dysq
endif
if (i.eq.nx+1)then
ae(i,j)=0.0
a(i,j)=1.0/dxsq+2.0/dysq
endif
if (j.eq.2)then
as(i,j)=0.0
a(i,j)=2.0/dxsq+1.0/dysq
endif
if (j.eq.ny+1)then
an(i,j)=0.0
a(i,j)=2.0/dxsq+1.0/dysq
endif
enddo
enddo
c-------------------------------------------------------------Time iteration begins
do itime=1,ntmax
sumu=0.0d0
sumv=0.0d0
c-------Updating the intermediate velcoites
do i=2,nx+1
do j=2,ny+1
conux=rho*u(i,j)*(u(i+1,j)-u(i-1,j))/(2.0*dx)
conuy=rho*v(i,j)*(u(i,j+1)-u(i,j-1))/(2.0*dy)
convx=rho*u(i,j)*(v(i+1,j)-v(i-1,j))/(2.0*dx)
convy=rho*v(i,j)*(v(i,j+1)-v(i,j-1))/(2.0*dy)
diffux=vis*(u(i+1,j)-2.0*u(i,j)+u(i-1,j))/dxsq
diffuy=vis*(u(i,j+1)-2.0*u(i,j)+u(i,j-1))/dysq
diffvx=vis*(v(i+1,j)-2.0*v(i,j)+v(i-1,j))/dxsq
diffvy=vis*(v(i,j+1)-2.0*v(i,j)+v(i,j-1))/dysq
uh(i,j)=u(i,j)+dt/rho*(-conux-conuy+diffux+diffuy)
vh(i,j)=v(i,j)+dt/rho*(-convx-convy+diffvx+diffvy)
enddo
enddo
p(i,j)=omega*temp+(1-omega)*p(i,j)
print *, temp
enddo
enddo
enddo
do i=2,nx+1
do j=2,ny+1
u(i,j)=uh(i,j)+(dt/rho)*(p(i-1,j)-p(i+1,j))/(2.0*dx)
v(i,j)=vh(i,j)+(dt/rho)*(p(i,j-1)-p(i,j+1))/(2.0*dy)
enddo
enddo
v(1,j)=-v(2,j)
u(nx+2,j)=-u(nx+1,j)
v(nx+2,j)=-v(nx+1,j)
enddo
c------------------------------------Error computation
do i=2,nx+1
do j=2,ny+1
sumu=sumu+(u(i,j)-uh(i,j))**(2.0d0)
sumv=sumv+(v(i,j)-vh(i,j))**(2.0d0)
enddo
enddo
erroru=(sumu**0.5)/(nx*ny)
errorv=(sumv**0.5)/(nx*ny)
time=time+dt
print *,time,itime,erroru,errorv
enddo
c---------------------------------------------------------Time iteration ends
stop
END