Email: [email protected]
The Navier – Stokes Equation
In physics, the Navier – Stokes equations, named after Claude-Louis Navier and George Gabriel Stokes,
describe the motion of fluid substances. These equations arise from applying Newton's second law to fluid
motion, together with the assumption that the fluid stress is the sum of a diffusing viscous term
(proportional to the gradient of velocity) and a pressure term - hence describing viscous flow.
The general form of Navier – Stokes equation in vector expression is
.
v
v v
p
T
f
t
Here,
T
is the deviatoric stress tensor,
f
is the body force. Replacing
T
with
2
v
, the equation yields
2
.
v
v v
p
v
f
t
Continuity Equation
0
u
u
x
y
Momentum Equation (x - dir)
2 2 2 2
1
u
u
u
p
u
u
u
v
t
x
y
x
x
y
;
= kinematic viscosity
Momentum Equation (y - dir)
2 2 2 2
1
v
v
v
p
v
v
u
v
t
x
y
y
x
y
The Pressure – Poisson equation (Poisson equation for pressure) is a derived equation to relate the pressure
with momentum equation. It has been derived using the continuity equation as constrain for momentum
equation. Adding the partial derivative of x – momentum w.r.t. x and the partial derivative of y –
momentum w.r.t. y and then applying the continuity equation yields the Pressure – Poisson equation. Hence,
Pressure Equation (Pressure – Poisson Equation)
2 2 2 2 2 2
2
p
p
u
v
u
u v
v
x
y
t
x
y
x
y x
y
Derivation of Pressure Equation
Let’s take the partial derivative of x – momentum w.r.t. x
2 2 2 2 2 2
1
u
u u
u
v u
u
p
u
u
u
v
t
x
x x
x
x y
x y
x
x
x
y
2 2 2Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
Now take the partial derivative of y – momentum w.r.t. y
2 2 2 2 2 2 21
v
u v
v
v v
v
p
v
v
u
v
t
y
y x
x y
y y
y
y
y
x
y
2 2Let’s add last two equations. Now, the L.H.S. of the added equation,
2 2 2 2 2 2 2 2
u
u
v
u
u
x
x y
u
u
u v
v u
v
t
x
v
v
v
x y
y
v
x
y
y
x
x y
y
2 2u
u v
v u
v
t
x
y x
x
u
v
u
x
x
u
v
x
y
u
v
v
y
x
y
y
y
y
Using the continuity equation and keeping the continuity part associated with time derivative,
L.H.S
2 22
u
v
u
u v
v
t
x
y
x
y x
y
Now, for the R.H.S
2 2 2 2 2 2 2 2 2 2 2 2
1
p
p
u
u
v
x
y
x
x
y
y
x
y
v
2 2 3 3 3 3 2 2 3 2 2 31
p
p
u
u
v
v
x
y
x
x y
x y
y
3 2 2 2 2 3 3 2 3 3 3 21
p
p
x
y
u
v
x
x
y
y
u
v
x
y
2 2 2 2 2 2 2 21
u
v
u
v
y
p
p
x
x
y
x
y
y
x
Again, using the continuity equation,
R.H.S
2 2 2 21
p
p
x
y
Now, combining both hand sides,
2 2 2 2 2 2
1
2
p
p
u
v
u
u v
v
x
y
t
x
y
x
y x
y
2 2 2 2 2 22
p
p
u
v
u
u v
v
x
y
t
x
y
x
y x
y
This is similar to the Poisson equation
2p
.
f
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
inite Difference Discretization of Navier – Stokes Equation
F
st
Let’s discretize the Navier – Stokes equation taking 1 order forward difference for time discretization, 1
storder backward difference for 1
storder space derivative ( v
), 2
ndorder central difference for 2
ndorder
space derivative (
2v
) and 1
storder central difference for pressure discretization,
Discretized Navier – Stokes equation in x – direction
1 1, , 11
n n n n n n n ij ij n ij i j n ij i j iu
u
u
u
u
u
p
1, 1, 1, 1, , 1 , 1 2 22
2
2
n n n n n n n j i j i j ij i j i j ij i j ij ijp
u
u
u
u
u
u
u
v
t
x
y
x
x
y
iscretized Navier – Stokes equation in y – direction
D
1 1, , 11
n n n n n n n ij ij n ij i j n ij i j iv
v
v
v
v
v
p
1, 1, 1, 1, , 1 , 1 2 22
2
2
n n n n n n n j i j i j ij i j i j ij i j ij ijp
v
u
v
v
v
v
u
v
t
x
y
y
x
y
or discretized pressure equation, let’s take 2
ndorder central difference for pressure and 1
storder central
F
difference in space. Hence, the discretized pressure equation is –
2 1, 1, , 1 , 1 1, 1, 1, 1, , 1 , 1 2 2 , 1 , 1 1, 1, , 1 ,
1
u
in j
2
2
2
2
2
2
2
2
n n n n n i j i j i j i j i j n n n n n n i j ij i j i j ij i j n n n n n i j i j i j i j i j iu
v
v
u
u
t
x
y
x
p
p
p
p
p
p
x
y
u
u
v
v
v
v
y
x
2
12
n jy
y transposing,
B
1 1, , 1 1, 1, 1, 1, 2 , 11
2
2
2
n n n n n n n n n n ij ij ij ij i j ij ij i j i j i j n n n n i j ij i j i jt
t
t
u
u
u
u
u
v
u
u
p
p
x
y
x
t
u
u
u
u
u
x
, 1
2 n n ij i jt
u
y
1 1, , 1 , 1 , 1 1, 1, 2 , 11
2
2
2
n n n n n n n n n n ij ij ij ij i j ij ij i j i j i j n n n n i j ij i j i jt
t
t
v
v
u
v
v
v
v
v
p
p
x
y
y
t
v
v
v
v
v
x
, 1
2 n n ij i jt
v
y
2 2 2 2 1, 1, , 1 , 1 1, 1, , 1 , 1 2 2 2 2 2 2 2 1, 1, 2 22
2
2
2
2
2
n n n n n n n n i j i j i j i j i j i j i j i j n ij n n i j i jp
p
y
p
p
x
x
y
u
u
v
v
p
x
y
x
y
x
y
t
u
u
x
y
x
x
y
2 , 1 , 1 1, 1, , 1 , 12
2
2
2
n n n n n n i j i j i j i j i j i ju
u
v
v
v
v
y
x
y
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
(0, 0) y (2 ux,2 = 1 x , 2) vx,2 = 0 u0,y = 0 v0,y 0 ux,0 = 0 = vx,0 = 0 u2,y = 0 v2,y 0 = px,2 = 0 0 p y 0 p x 0 p x (2, 0) (0, 2)
ATLAB Code for Solution – Explicit Scheme
M
Case 1: Cavity Flow
Let’s consider a square domain for the cavity flow problem with arm length of 2 units. For all the walls,
itial Condition
except the top wall, no slip condition has been considered. The top wall has been considered as free stream.
In
:
; for all (x,y)
oundary Condition
0;
v
0;
p
0
u
B
:
Wall
,
Bottom
:
u
x,0 ,
0
v
x,0
0
00
yp
y
Left Wall
:
u
0,y ,
0
v
0,y ,
0
00
xp
x
Right Wall
:
u
0,2 ,
0
v
0,2
0
,
20
xp
x
Top Wall
,
ase 1: MATLAB Code for Cavity Flow
:
u
x,2 ,
1
v
x,2
0
p
x,2
0
C
%%%%%%%%%%%%%%%%%%%%%% Start of the code %%%%%%%%%%%%%%%%%%%%%%
all
= 21; % number of nodes in x-direction
... -direction c cl clear close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Initial Condition % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% nx
ny = 21; % number of nodes in y-direction
nt = 10; % number of time steps
ime steps
nit = 10; % number of artificial t
% ... for pressure vis = 0.1; % Viscosity rho = 1.0; % Density x Lx = 2; % Length in Ly = 2; % Length in y-direction
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
dx = Lx/(nx-1); % grid spacing in x-direction
omponent
ction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(:,:,1) = u(:,:);
:nt+1 % loop over time
for calculating the ...
j,i) = rho*(((((u(j,i+1)-u(j,i-1))/(2*dx))+... 1)... r -1 (j,i+1)+p(j,i-1))*(dy^2)... +dy^2))... p(:,2); p(:,nx) = p(:,nx-1);
dy = Ly/(ny-1); % grid spacing in y-direction
dt = 0.01; % time step size
x = 0:dx:Lx; % node x-ordinates
y = 0:dy:Ly; % node y-ordinates
u = zeros(ny,nx); % nodal velocity x-c
v = zeros(ny,nx); % nodal velocity y-component
p = zeros(ny,nx); % nodal pressure
ocity x-dire
un = zeros(ny,nx); % time marched vel
vn = zeros(ny,nx); % time marched velocity x-direction
pn = zeros(ny,nx); % temporary pressure for calculation
= zeros(ny,nx); % nodal source term value from pressure
b % % % Boundary Condition % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ,x] = meshgrid(y,x); [y u(ny,:) = 1; %% %%% % % % Calculation % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% uT vT(:,:,1) = v(:,:); pT(:,:,1) = p(:,:); for it = 1
for i = 2:nx-1 % this i,j loop is
for j = 2:ny-1 % ... body force from pressure equation
b( ((v(j+1,i)-v(j-1,i))/(2*dy)))*(1/dt))+((u(j,i+ - u(j,i-1))/(2*dx)).^2+(2*((u(j,i+1)... 2*dx)))... -u(j,i-1))/(2*dy))*((v(j+1,i)-v(j-1,i))/( +((v(j+1,i)-v(j-1,i))/(2*dy)).^2); end end iit = 1:nit+1 fo pn = p; :nx-1 for i = 2 for j = 2:ny p(j,i) = ((p +(p(j+1,i)+p(j-1,i))*(dx^2))/(2*(dx^2 +(b(j,i)*dx^2*dy^2)/(2*(dx^2+dy^2)); end end ) = p(:,1 p(1,:) = p(2,:); p(ny,:) = p(ny-1,:); end
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
= u; vn = v; % assigning velocity values to nth-time values
r i = 2:nx-1 % this i,j loop is for calculating velocity
.. 2)); j,i) = vn(j,i)-un(j,i)*(vn(j,i)-vn(j,i-1))*(dt/dx)... *... 2)); %%%%%%%%%%%%%%%%% Surface Plotting %%%%%%%%%%%%%%%%%%%%%% gure(1) )
Plot: Velocity Component, u');
t, u'); gure(2) ) rt(u.^2+v.^2)') y Field, U'); t, v'); gure(4) ) Plot: Pressure, P'); y,u',10) ity Component, u'); un
% to calculate (n+1)th-time values
fo for j = 2:ny-1 u(j,i) = un(j,i)-un(j,i)*(un(j,i)-un(j,i-1))*(dt/dx)... -vn(j,i)*(un(j,i)-un(j-1,i))*(dt/dy)... -(1/rho)*(p(j,i+1)-p(j,i-1))*(dt/(2*dx)). +(vis/rho)*((un(j,i+1)-(2*un(j,i))+un(j,i-1))*... (dt/dx^2)+(un(j+1,i)-(2*un(j,i))+un(j-1,i))*(dt/dy^ v( -vn(j,i)*(vn(j,i)-vn(j-1,i))*(dt/dy)... -(1/rho)*(p(j+1,i)-p(j-1,i))*(dt/(2*dy))... +(vis/rho)*((vn(j,i+1)-(2*vn(j,i))+vn(j,i-1)) (dt/dx^2)+(vn(j+1,i)-(2*vn(j,i))+vn(j-1,i))*(dt/dy^ end end %%% %% fi surf(x,y,u' title('Surface xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Velocity componen
fi
surf(x,y,v'
title('Surface Plot: Velocity Component, v'); xlabel('x - ordinate');
ylabel('y - ordinate');
zlabel('Velocity component, v');
figure(3) surf(x,y,sq
title('Surface Plot: Velocit
xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Velocity componen
fi surf(x,y,p' title('Surface xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Pressure, p'); %%%%%%%%%%%%%%%%%%%%%% Contour Plotting %%%%%%%%%%%%%%%%%%%%%% figure(5) contourf(x,
title('Contour: Veloc
xlabel('x - ordinate'); ylabel('y - ordinate');
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
gure(6) y,v',10) ity Component, v'); gure(7) y,sqrt(u.^2+v.^2)') y,p',10) ure, P'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:,1) = 0; u(:,nx) = 0; u(1,:) = 0; u(ny,:) = 1;
%%%%%%%%%%%%%%%%%%%%%%% End of the code %%%%%%%%%%%%%%%%%%%%%%%
fi
contourf(x,
title('Contour: Veloc
xlabel('x - ordinate'); ylabel('y - ordinate');
fi
contourf(x,
title('Surface Plot: Velocity Field, U'); xlabel('x - ordinate');
ylabel('y - ordinate');
zlabel('Velocity component, v');
figure(8) contourf(x,
title('Contour: Press
xlabel('x - ordinate'); ylabel('y - ordinate'); u( v(:,1) = 0; v(:,nx) = 0; v(1,:) = 0; v(ny,:) = 0; end
Fig.3
: Surface plot for velocity y – component
Fig.4
: Contour plot for velocity y – component
Fig.5
: Surface plot for velocity field, U
Fig.6
: Contour plot for velocity field, U
Fig.7
: Surface plot for pressure, p
Fig.8
: Contour plot for pressure, p
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
ase 2: Channel Flow
C
Let’s consider a square domain for the channel flow problem with arm length of 2 units. For the top and
itial Condition
bottom wall, no slip condition has been considered. The side walls have been considered as periodic.
In
:
; for all (x,y)
oundary Condition
0;
v
0;
p
0
u
B
:
Wall
,
Bottom
:
u
x,0 ,
0
v
x,0
0
00
yp
y
Left Wall
:
u
0,y ,
0
v
0,y ,
0
00
xp
x
Right Wall
:
u
0,2 ,
0
v
0,2
0
,
20
xp
x
Top Wall
:
u
x,2 ,
0
v
x,2
0
,
20
yp
y
ase 2: Channel Flow
C
%%%%%%%%%%%%%%%%%%%%%% Start of the code %%%%%%%%%%%%%%%%%%%%%%
all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % .... -direction tion x (2, 2) (0, 0) y ux,2 = 0 c cl clear close all % %
% Initial & Boundary Condition
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
= 21; % number of nodes in x-direction
nx
ny = 21; % number of nodes in y-direction
nt = 10; % number of time steps
ime steps .
nit = 10; % number of artificial t
% ... for pressure vis = 0.1; % Viscosity rho = 1.0; % Density x Lx = 2; % Length in Ly = 2; % Length in y-direction
x = Lx/(nx-1); % grid spacing in x-direc
d
dy = Ly/(ny-1); % grid spacing in y-direction
vx,2 = 0 u0,y = 0 v0,y 0 ux,0 = 0 = vx,0 = 0 u2,y = 0 v2,y 0 = 0 p y 0 p x 0 p x (2, 0) (0, 2) 0 p y
Periodic
Periodic
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
= 0:dx:Lx; % node x-ordinates
= zeros(ny,nx); % nodal body force term from pressure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
= 1:nt+1 % loop over time
for calculating the ...
1)...
:nx-(j,i+1)+p(j,i-1))*(dy^2)...
+dy^2))...
= u; vn = v;
r i = 2:nx-1 % this i,j loop is for calculating velocity
..
dt = 0.01; % time step size
x
y = 0:dy:Ly; % node y-ordinates
u = zeros(ny,nx); % nodal velocity x-component
v = zeros(ny,nx); % nodal velocity y-component
p = zeros(ny,nx); % nodal pressure
un = zeros(ny,nx); % time marched velocity x-direction
vn = zeros(ny,nx); % time marched velocity x-direction
pn = zeros(ny,nx); % temporary pressure for calculation
b
f = ones(ny,nx); % nodal source term
[y,x] = meshgrid(y,x); % % % Calculation % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for it
for i = 2:nx-1 % this i,j loop is
for j = 2:ny-1 % ... body force from pressure equation
b(j,i) = rho*(((((u(j,i+1)-u(j,i-1))/(2*dx))+... ((v(j+1,i)-v(j-1,i))/(2*dy)))*(1/dt))+((u(j,i+ - u(j,i-1))/(2*dx)).^2+(2*((u(j,i+1)... -u(j,i-1))/(2*dy))*((v(j+1,i)-v(j-1,i))/(2*dx)))... +((v(j+1,i)-v(j-1,i))/(2*dy)).^2); end end
for iit = 1:nit+1 pn = p; 1 for i = 2 for j = 2:ny-1 p(j,i) = ((p +(p(j+1,i)+p(j-1,i))*(dx^2))/(2*(dx^2 +(b(j,i)*dx^2*dy^2)/(2*(dx^2+dy^2)); end end p(:,1) = p(:,2); p(:,nx) = p(:,nx-1); p(1,:) = p(2,:); p(ny,:) = p(ny-1,:); end un fo for j = 2:ny-1 u(j,i) = un(j,i)-un(j,i)*(un(j,i)-un(j,i-1))*(dt/dx)... -vn(j,i)*(un(j,i)-un(j-1,i))*(dt/dy)... -(1/rho)*(p(j,i+1)-p(j,i-1))*(dt/(2*dx)). +(vis/rho)*((un(j,i+1)-(2*un(j,i))+un(j,i-1))*... (dt/dx^2)+(un(j+1,i)-(2*un(j,i))+un(j-1,i))... *(dt/dy^2))+(f(j,i)*dt);
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
j,i) = vn(j,i)-un(j,i)*(vn(j,i)-vn(j,i-1))*(dt/dx)... *... 2)); % %%%%%%%%%%%%%%%%% Surface Plotting %%%%%%%%%%%%%%%%%%%%%% figure(1) )
Plot: Velocity Component, u');
t, u');
)
Plot: Velocity Component, v');
t, v'); gure(3) rt(u.^2+v.^2)') y Field, U'); t, v'); gure(4) ) Plot: Pressure, P'); Contour Plotting %%%%%%%%%%%%%%%%%%%%%% y,u',10) ity Component, u'); gure(6) y,v',10) ity Component, v'); gure(7) y,sqrt(u.^2+v.^2)') eld, U'); v( -vn(j,i)*(vn(j,i)-vn(j-1,i))*(dt/dy)... .. -(1/rho)*(p(j+1,i)-p(j-1,i))*(dt/(2*dy)). +(vis/rho)*((vn(j,i+1)-(2*vn(j,i))+vn(j,i-1)) (dt/dx^2)+(vn(j+1,i)-(2*vn(j,i))+vn(j-1,i))*(dt/dy^ end end %% %% surf(x,y,u' title('Surface xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Velocity componen
gure(2) fi surf(x,y,v' title('Surface xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Velocity componen
fi
surf(x,y,sq
title('Surface Plot: Velocit
xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Velocity componen
fi surf(x,y,p' title('Surface xlabel('x - ordinate'); ylabel('y - ordinate'); zlabel('Pressure, p'); %%%%%%%%%%%%%%%%%%%% %% figure(5) contourf(x,
title('Contour: Veloc
xlabel('x - ordinate'); ylabel('y - ordinate');
fi
contourf(x,
title('Contour: Veloc
xlabel('x - ordinate'); ylabel('y - ordinate');
fi
contourf(x,
title('Surface Plot: Velocity Fi
xlabel('x - ordinate'); ylabel('y - ordinate');
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)
t, v');
gure(8)
y,p',10)
:,1) = 0; u(:,nx) = 0; u(1,:) = 0; u(ny,:) = 0; zlabel('Velocity componen
fi
contourf(x,
title('Contour: Pressure, P'); xlabel('x - ordinate'); ylabel('y - ordinate'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% u( v(:,1) = 0; v(:,nx) = 0; v(1,:) = 0; v(ny,:) = 0; end
%%%%%%%%%%%%%%%%%%%%%%% End of the code %%%%%%%%%%%%%%%%%%%%%%%
Fig.1
: Surface plot for velocity x – component
Fig.2
: Contour plot for velocity x – component
Email: [email protected] Source: Computational Fluid Dynamics, ME 702 (Online Material) - Dr. Lorena A Barba, Professor, Department of Mechanical Engineering, Boston University Acknowledgement: Boston University – for sharing the course content at BU You Tube Channel (http://www.youtube.com/user/bu)