You are on page 1of 4

ME605-CFD

MD/AY2014-2015 1


INDIAN INSTITUTE OF TECHNOLOGY GANDHINAGAR
Discipline of Mechanical Engineering


ME605: COMPUTATIONAL FLUID DYNAMICS

COMPUTATIONAL LABORATORY 1
NUMERICAL SCHEMES FOR PARABOLIC SYSTEMS

Due Date: Any time between 23-31 Aug 2014
Late submissions will attract diminishing returns!

Focus: The focus of this computational laboratory session is on flow problems which are parabolic in nature.
This exercise covers formulation of the flow problems in the framework of finite difference and finite volume
discretization methods and the implementation of efficient and stable solution methods to salvage accurate and
meaningful numerical solutions. You will use these problems to explore basic issues of numerical simulation
such as convergence, error control, stability and so on covered in the associated lectures.
Sample Code
A Matlab code implementing the FTCS (Forward Time Central Space) scheme for the 1D parabolic PDE
discussed in the lectures to model and simulate the one-dimensional heat equation is provided for you to use and
modify accordingly to solve unsteady flow problems dominated by viscous diffusion. You will be required to use
this code to test a Neumann boundary condition which you will develop in CA2..

1. Brief Description of the Flow Problem
The unsteady motion of the fluid due to an impulsive acceleration of an infinite flat plate in a viscous
incompressible fluid can be described by
2
2
u u
t y
v
c c
=
c c
(1)
which exemplifies a parabolic equation where v is the
kinematic viscosity, u is the velocity in the x-direction.
This equation implies that events propagate into the
future, and a monotone convergence to steady state is
expected.
Figure 1: Stokes 1
st
Problem

This is Stokess first problem, a fundamental solution in fluid dynamics, which represents one of the few exact
solutions to the Navier-Stokes equations. It describes the evolution of the velocity field in the vicinity of an
infinite plate which is impulsively set in motion with constant velocity, U, parallel to the x-axis in an infinite
fluid medium, as shown in Fig. 1. Of primary interest are the rate of penetration, ( ) t o of the velocity field into
the fluid and the shear stress at the surface of the plate,
w
t .
Equation (1) is solved subject to the following initial and boundary conditions:
( ) Initial Condition: 0 , 0 0
Boundary Conditions
0 (0, )
( , ) 0
t u y
y u t U
y u y t
= =
= =
=


The exact solution for this problem is
1
2 2
u y y
erf erfc
U t t v v
| | | |
= =
| |
\ . \ .
(2a)
ME605-CFD
MD/AY2014-2015 2

where erf(.) is the error function and erfc(.) is the complimentary error function.

The corresponding shear stress on the wall is
w
w
u U
y t

t
tu
c
= =
c
(2b)

If Eqn(1) is solved numerically, then the boundary condition at infinity must be imposed at a finite distance
from the plate and the applicable initial and boundary conditions will be
( ) Initial Condition: 0 , 0 0
Boundary Conditions
0 (0, )
( , ) 0
t u y
y u t U
y h u h t
= =
= =
= =

The exact analytical solution for this problem for longer times
can be shown to be as follows:
2 2
2
1
sin
1 2
n t
h
n
n y
u y h
e
U h n
t u
t
t


=
| |
|
| |
\ .
=
|
\ .

(3a)
and this corresponds to an impulsively started Couette flow in
which the flow is confined within the space between two
infinitely long plates and the flow is set in motion by moving
the lower plate (y=0) at a constant velocity U relative to the
upper plate (y=h).

Figure 2: Impulsively Started Couette Flow
The corresponding shear stress on the wall can be shown to be
2 2
2
1
1 2
n t
h
w
n
w
u U
e
y h
t u

t


=
| |
c
| = = +
|
c
\ .

(3b)
For very short times, the velocity field has not penetrated far enough into the fluid to reach the upper stationary
wall. Hence for very short times following the impulsive start, the behavior can be represented by the solution to
Stokes first problem and the exact solution for this problem for early times can also be shown to be as follows:
2
2 2 4 4
.....
4
where = and
u
erfc erfc erfc erfc erfc
U
y t
h h

t t t t t
v
t
+ + | |
= + +
|
\ .
=
(3c)
and this corresponds to Couette flow in which the flow is confined within the space between two infinitely long
plates and the flow is set in motion by moving the lower plate (y=0) at a constant velocity U relative to the
upper plate (y=h).

From equation 3(a), in the limit as t Eqn(1) reduces to
2
2
0
u
y
c
=
c
(4a)
the steady state result
1
u y
U h
| |
=
|
\ .
(4b)
which corresponds to steady Couette flow with zero pressure gradient will be reached.



ME605-CFD
MD/AY2014-2015 3
2 Assigned Computational Tasks

(a) Warm Up Exercise: (You are required to complete this task by the end of todays lab session)
The Matlab code FTCS1DP.m simulates the 1-D heat conduction problem used as an example in the
lectures using the explicit FTCS method. Modify the code to use the following 5-point symmetric
scheme for the approximation of the second derivative term in the equation at the interior points i.e.
2
2 1 1 2
2 2
1 1 2 3
max 2
16 30 16
12
11 20 6 4
For 2 use and the equivalent formula for -1
12
i i i i i
i i i i i
T T T T T T
x x
T T T T T
i i i
x
+ +
+ + +
+ + c
~
c A
+ +
= =
A

How does the solution compare with that of the FTCS scheme?

(b) Modify the Matlab code FTCS1DP.m to numerically model the impulsively started Couette Flow
problem defined by Eqn (1) and subject to the appropriate initial and boundary conditions. Assume that
the kinematic viscosity of the fluid v is 0.000217 m
2
/s, U=40 m/s and h = 40 mm. Execute the explicit
FTCS method using 0.001 y m A = , 0.002 t s A = and 0.00232 t s A = by marching in time for 540 time
steps. Is h=40 mm an adequate choice? Plot the variation of u as a function of y and t and the wall shear
stress as a function of time and comment on the results for the two choices of the time steps. Repeat the
same for the modification based on the 5-point symmetric scheme for the second derivative at the
interior points as defined in part(a).

(c) Modify the given code to implement the implicit Crank-Nicholson scheme and the fully implicit
Laasonen scheme to obtain the solution using time step 0.002 t A = to march for 540 time steps and
0.01 t A = to march for 108 time steps. Comment on the results predicted by the two methods. Plot the
variation of u as a function of y and t and the wall shear stress as a function of time for both these
methods and comment on your observation.

(d) (i) Since analytical solutions to this problem are available as defined by Eqns (2a-b) and (3a-c), then
the RMS value of the error can be defined as
( )
max
2
1
max
j J
j
RMS
AV CV
J
c
=
=

| |
|
| =
|
|
\ .

where AV is the analytical


value and CV is the computed value. Estimate and monitor the error in u at all the spatial grid points
during the course of the computation using the FTCS, Crank-Nicholson and Laasonen schemes at
selected instants of time and plot the variation of this error with y at the selected instants of time for all
the three methods on the same graph. What can you conclude about the error variation of the three
methods during the early, middle and end stages of the computation? Is this expected and if so why?
What is the impact of increasing the time step of the Laasonen scheme on the errors? If you increase the
time step for Laasonen scheme, can you get the same level of accuracy as FTCS with fewer grid points?

(ii) If an analytical solution is not available you cannot address the issues of accuracy using the method
in part d(i). You need to infer convergence by obtaining solutions on progressively refined grids.
Outline how you would define the RMS value of the error in this case for any selected scheme of your
choice. Estimate the RMS value of the error for the same value of the parameter
( )
2
t
r
y
vA
=
A
by
computing the value of u for a range of y A from coarse to fine at the end of a fixed time. Then plot the
log
10
(RMS value of the error) vs log
10
y A . Repeat for different values of r in the range
1 1
6 2
r s s and
comment on the numerical convergence in this range of r.
(e) In the limit as t , Eqn (1) reduces to Eqn 4(a) for which the analytical solution is defined by Eqn
4(b). Discretize this equation using central difference scheme and obtain the steady state solution using
ME605-CFD
MD/AY2014-2015 4
the direct solver TDMA.m which implements the Tri-Diagonal Matrix Algorithm or the Thomas
Algorithm. Compare the direct solution with the exact solution and the steady state solution reached by
applying the FTCS, Crank-Nicholson and Laasonen schemes on Eqn (1) and comment.

(f) Imagine that the boundary at y=0 slides back and forth in a harmonic oscillation so that the initial and
boundary conditions are now as follows:
( ) Initial Condition: 0 , 0 0
Boundary Conditions
0 (0, ) cos where is the oscillation frequency
( , ) 0
t u y
y u t U t
y h u h t
e e
= =
= =
= =

The exact solution for this problem is:
1 1
2 2
exp cos
2 2
u U y t y
e e
e
u u
( (
| | | |
( (
=
| |
( (
\ . \ .


Compute this problem using FTCS, the 5-point symmetric scheme and the Crank-Nicholson Scheme and
compare the computed results with the exact solution and write your observations covering all issues.
Explain how you define the initial flowfield for this problem. Also which of these computed solutions are
closer to reality and explain the reasons for your choice.


NOTES

Sample Matlab Source Codes for Computational Lab 1
FTCS1DP.m Implements Forward Time Central Space Finite Difference for 1D Parabolic PDE
TDMA.m Tri-Diagonal Matrix Algorithm (Thomas Algorithm)
These codes can be downloaded from the course web-site

Brief Guide on What is Expected in Your Computational Lab Report
- Reports should be brief and to the point. Do not exceed 10 pages of text. More importance should
be given to formulation, results and discussion and general critique.
- Structure of the Report
- Brief Introduction and Problem Statement
- Brief Formulation and Solution Method
- Results and Discussion (should form the crux of the report)
Relevant Graphs and Contours Plots (Be selective , concise and precise here.)
- General Critique/Conclusions/Observations
Physical/Numerical Interpretations
Errors, Accuracy, Convergence Rates etc
- Workable source codes with sufficient documentation supporting the report should be uploaded
in the relevant space which will be intimated in due course. If your codes do not work at all, you
will incur a severe penalty.

I MPORTANT NOTE:
While you are encouraged to discuss this lab among your colleagues, please do the coding, computation and
report writing work independently. Please zip up your brief report and all your codes and results properly
labeled with your name and e-mail it to the space. Please ensure that your Matlab codes and report are labeled
using your name for identification instead of naming it using some unidentifiable tag such as say report etc. The
Matlab codes should have your name inscribed inside the .m file as well as in the name of the file. Suggested
name of your compressed file containing your codes and the report documenting your work:
Your Name_CLAB1.zip or .rar

Please include a readme file annotating the contents of the folder you are zipping up.