100% found this document useful (1 vote)
88 views13 pages

Huang, Haibo - Lu, Xi-Yun - Sukop, Michael C - Multiphase Lattice Boltzmann Methods - Theory and Application-Wiley-Blackwell (2015)

This document describes a project to simulate lid-driven cavity flow using the artificial compressibility method applied to the 2D incompressible Navier-Stokes equations. The methodology involves discretizing the equations using an explicit Forward in Time Central in Space (FTCS) scheme. Team members Fahad Ali and Usama Malik will write a MATLAB code to solve the problem under the guidance of their instructor Dr. M. Sabeel Khan at the Institute of Space Technology in Islamabad.

Uploaded by

Fahad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
88 views13 pages

Huang, Haibo - Lu, Xi-Yun - Sukop, Michael C - Multiphase Lattice Boltzmann Methods - Theory and Application-Wiley-Blackwell (2015)

This document describes a project to simulate lid-driven cavity flow using the artificial compressibility method applied to the 2D incompressible Navier-Stokes equations. The methodology involves discretizing the equations using an explicit Forward in Time Central in Space (FTCS) scheme. Team members Fahad Ali and Usama Malik will write a MATLAB code to solve the problem under the guidance of their instructor Dr. M. Sabeel Khan at the Institute of Space Technology in Islamabad.

Uploaded by

Fahad Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ADVANCE NUMERICAL TECHNIQUES

PROJECT

Solution of Lid-Driven Cavity Problem by Applying


Artificial Compressibility Method on 2-D
Incompressible Navier Stoke’s Equations

Project Members
Fahad Ali (170111004)
Usama Malik (160111005)

Instructor:
Dr. M. Sabeel Khan

INSTITUTE OF SPACE TECHNOLOGY, ISLAMABAD


Navier-Stoke’s Equation
The Navier-Stoke’s equations are basically the momentum equations which can be derived by
applying Newton’s second law of motion to a fluid particle i.e.
=
which can be interpreted as

The basic principle behind NS equations is the conservation of momentum which states that:
“The time rate of change of momentum in a control volume is equal to the sum of forces acting on
the C.V and the rate of change of momentum flux through the control volume surface.”

The x-component and y-component of the Navier-Stoke’s Equation is given as:


1
+ + = − + +

1
+ + = − + +

: This term represents the local acceleration of the fluid particle

+ : This term accounts for the convective acceleration of the fluid particle

: This term represents the pressure gradient in the x-direction

+ : This is the diffusion term which accounts for the dissipation of the fluid particles

= Reynold’s no =

Methodology
The methodology of writing MATLAB code to solve Lid-driven cavity using 2-D
incompressible Navier-Stoke’s equations:
• Use of artificial compressibility method
• Discretization of NS –equations using FTCS (explicit scheme)
• Incorporating these equations into MATLAB code

Artificial Compressibility method


To assure incompressibility, the continuity equation i.e. mass conservation is given as:

+ =0

To solve the Navier-Stoke’s equation along with the incompressibility condition, a pseudo time
derivative term is added in the continuity equation:

+ + =0

This method is known as artificial compressibility. In the above equation

is the pseudo time-derivative term

is the weight term

What is Lid-Driven Cavity?


The lid-driven cavity is a well-known benchmark problem for viscous incompressible fluid flow.
The geometry at stake is shown in figure. We are dealing with a square cavity filled with fluid
consisting of three rigid walls with no-slip conditions and a lid moving with a tangential unit
velocity. At the top boundary, a tangential velocity is applied to drive the fluid flow in the cavity.
The remaining three walls are defined as no-slip conditions; that is, the velocity is 0.

=1

A mesh is obtained to calculate u and v at different nodes respectively.


⇒ . ℎ −
⇒ . ℎ −
= 101
= 101
= ℎ − =1
= ℎ − = 1

Explicit method:
The formulation of a continuum equation in a finite difference equation, which expresses one
unknown in terms of the known values, is known as the explicit method.
Forward-in-time and Central-in-Space (FTCS) scheme:
When forward difference approximation is used for the time derivative and central differencing is
used for space derivatives, the discretization scheme is said to be FTCS which is of order
[∆ , (∆ ) ]. The solution obtained by this scheme is limited by the selection of step-size and the
time steps. A stability analysis has not been done in this report.

Discretization of the Governing Equations using FTCS scheme:


Whenever an equation is discretized, it means that we are converting the partial differential
equations (PDE’s) into finite difference equations (FDE’s). This process is known as
discretization.
The x-component of the Navier-Stoke’s equation is discretized as follows:

1
+ + = − + +

After applying the FTCS scheme at the left hand side of the equation, we get the equations of the
following form:

, − ,


, − ,

2∆
, ,

2∆
, ,

, −2 , + , , −2 , + ,
+ ⇒ +
(∆ ) (∆ )

Combining the L.H.S and R.H.S of the equation, we get the discretized form as:

, − , , − , , ,
+ +
∆ 2∆ 2∆
, − , 1 , −2 , + , , −2 , + ,
= − + +
2∆ (∆ ) (∆ )

Similarly, the discretized y-component of the Navier-Stoke’s Equation as given as:

, − , , − , , ,
+ +
∆ 2∆ 2∆
, − , 1 , −2 , + , , −2 , + ,
= − + +
2∆ (∆ ) (∆ )

The altered continuity equation will also be discretized using the FTCS scheme which can be
described as follows:

+ + =0

, − , − −
= +
∆ 2∆ 2∆
Which can be rearranged as:
− −
, = , + +
2∆ 2∆

The final form of all the discretized equations are given as under:

, , , ,
, = , + − − −
∆ ∆
, , , , , , , ,
+ + ( )
∆ (∆ ) (∆ )

, , , ,
, = , + − ∆
− ∆

, , , , , , , ,

+ (∆ )
+ (∆ )
( )
, = , + + ( )
∆ ∆

Vorticity Discretization
Rotation of fluid particles is related to certain velocity gradients in the flow field. The vorticity (or the
rotation of the fluid element) is given as:

= −

Figure 1 Deformation of a fluid element

The discretized form is given as:

= ( − )
∆ ∆

= 0
=1, = 0

=0 =0
= 0 = 0

/ = 0

= 0 = 0

=0 = 0 = 0
The discretized boundary conditions imposed on the upper, lower, left and right boundaries are
as follows:
, ,
= =0 ⇒

, = ,

, ,
= ∆
=0 ⇒

, = ,

, ,
= = 0 ⇒

, = ,

, ,
= = 0 ⇒

, = ,

In this way, the boundary conditions regarding to pressure which were the Neumann Boundary
conditions are converted into the Dirichlet boundary conditions.
Results:
The results here are given for u-velocity contours, v-velocity contours and vorticity contours
respectively.
U-velocity contours

Figure 2

Figure 3
V-velocity contours

Figure 4

Figure 5
Vorticity contours

Figure 6

Figure 7
Conclusion
It has been concluded from the above figures that as the Reynold’s no increases, the diffusion will
be less. On the other hand, if we decrease the Reynold’s number, the diffusion will also decrease.
This is due to the fact that Re is dependent upon the viscous forces which means that at high Re
no there will be less viscous forces and more diffusion and vice versa.

MATLAB Code
lc
clear all

Lx = 1;
Ly = 1;

nx = 101;
ny = 101;

dx = Lx/(nx);
dy = Ly/(ny);

dt = 0.001;
t=1;
% Boundary Conditions
u(1:nx,1:ny) = 0;
%u(1:nx,1) = 1;
u(1:nx,ny) = 1;
v(1:nx,1:ny) = 0;
p(1:nx,1:ny) = 0.5;

Re = 100;
b=1/0.6;
er=100;

%Calculations are SECOND-ORDER CENTRAL DIFFERENCE in space


%and FORWARD in time.
tic
while (((er >= 1e-6) || (t<=1000)))
u1=u;
v1=v;
p1=p;

for i=2:nx-1
for j=2:ny-1
% Solving dp/dt + beta^2 (du/dx+dv/dy)=0 and b=beta^2
p(i,j)=p1(i,j)-dt*b*(0.5/dx*(u(i+1,j)-u(i-1,j)) ...
+0.5/dy*(v(i,j+1)-v(i,j-1)));
end
end
%Assigning the pressure gradient normal to the walls
%to be equal to zero

p(1,:)=p(2,:);
p(nx,:)=p(nx-1,:);
p(:,1)=p(:,2);
p(:,ny)=p(:,ny-1);

for i=2:nx-1
for j=2:ny-1

%solving for u - forward in time central in space


RHS = 1/Re*(1/dx^2*(u1(i+1,j)-2*u1(i,j)+u1(i-1,j))...
+1/dy^2*(u1(i,j+1)-2*u1(i,j)+u1(i,j-1)))...
-(p(i+1,j)-p(i-1,j))/(2*dx);
LHS = 0.5/dx*(u1(i+1,j)^2-u1(i-1,j)^2)...
+ 0.5/dy*(u1(i,j+1)*v1(i,j+1)-u1(i,j-1)*v1(i,j-1));
u(i,j) = u1(i,j) + dt*RHS - dt*LHS;
end
end

for i=2:nx-1
for j=2:ny-1

%solving for v - forward in time central in space


RHS = 1/Re*(1/dx^2*(v1(i+1,j)-2*v1(i,j)+v1(i-1,j))...
+1/dy^2*(v1(i,j+1)-2*v1(i,j)+v1(i,j-1)))...
-(p(i,j+1)-p(i,j-1))/(2*dy);
LHS = 0.5/dy*(v1(i,j+1)^2-v1(i,j-1)^2)...
+ 0.5/dx*(u1(i+1,j)*v1(i+1,j)-u1(i-1,j)*v1(i-1,j));
v(i,j) = v1(i,j) + dt*RHS - dt*LHS;
end
end

if(t==1)
t=2;
else
er=max(max((abs((p1-p)./p))));
t=t+1;
error=er;
end
%Performing calculations till values converge
end

%Vorticity

for i=1:nx-1
for j=1:ny-1
vor(i,j)=1/dy*(u(i,j+1)-u(i,j))-1/dx*(v(i+1,j)-v(i,j));
end
end
toc
contourf(vor',30)

You might also like