MathLab Code for Navier Stokes Equation
ENME 320 1-D Navier-Stokes problem for ENME 303.
One-dimensional flow equation. Numerically solve the partial differential equation for one dimensional flow between in a gap, also known as the heat equation:
x
p
y
u
t
u
¶
¶
-
¶
¶
=
¶
¶
2
2
m
(1)Use a uniform grid across a channel and the channel that has a width of one unit. The velocity profiles for Couette and Poiseuille (channel flow) between two flat plates at steady-state can be found by solving the system of algebraic equations that result using either an explicit time step or an implicit time step. The general form of the discretized PDEs are given by
[
]
x
p
u
u
u
y
t
u
u
n
j
n
j
n
j
n
j
n
j
¶
¶
-
+
-
D
D
+
=
-
+
+
1
1
2
1
2
m
(2)For an explicit time step, and given by the following for an implicit time step.
[
]
x
p
u
u
u
y
t
u
u
n
j
n
j
n
j
n
j
n
j
¶
¶
-
+
-
D
D
+
=
+
-
+
+
+
+
1
1
1
1
1
2
1
2
m
(3)where (y =
(
)
1
-
-
j
j
y
y
and also the channel width divide (N-1), where N is the number of nodes.Solve the governing PDE numerically as described below. Manipulating equation (3) so that unknown values of velocity at time n+1 are on the left hand side gives the following:
x
p
u
u
y
t
u
y
t
u
y
t
n
j
n
j
n
j
n
j
¶
¶
-
=
ú
û
ù
ê
ë
é
D
D
-
ú
û
ù
ê
ë
é
D
D
+
+
ú
û
ù
ê
ë
é
D
D
-
+
+
+
+
-
1
1
2
1
2
1
1
2
2
1
m
m
m
An algebraic system of equations can be generated for the discretized domain by letting j go from 2 through N, and applying the appropriate boundary conditions. What would you use for your initial velocity profile ?
a) Couette Flow. Let µ=1, and dp/dx=0, and impose a velocity of one at the lower wall and zero at the upper wall, let the channel width be unity. Use 11, and 21 nodes to uniformly discretize the channel width. Experiment with your explicit code: How many time steps does it take to reach the steady state solution as a function of the time step? Try (t=0.01, 0.1, 1, … What happens if the time step is too large? How many time-steps does it take to reach the steady state solution? Can you take a larger time steps with your implicit code? How many time steps does it take to reach the steady-state solution?
b) Channel Flow. (for your consideration) Let µ=1 and apply a pressure gradients dp/dx=-1 to the right hand side of the equation. Impose a velocity of zero at both walls. Discretize the channel width using N=11, and 21 nodes. Use a large time step, (t=105. Using the numerical solution, calculate the mass flux through the channel, and the shear stress on each wall.