Computational Fluid Dynamics Practical
Computational Fluid Dynamics Practical
Lab Manual
Department of Mathematics & Computing
Indian Institute of Technology (Indian School of Mines) Dhanbad
1
Primer
This lab manual gives programming problems in C or C++ and provides
instructions to implement them. The problems in this manual are carefully selected
from the accompanying theory course. The lecture plan/syllabus of the theory and
this lab should be available from respective instructors. Basic knowledge of
continuum mechanics is desirable. Students must also know about the simple
partial differential equations (PDEs), classification of PDEs of second order into
elliptic, parabolic and hyperbolic types, and PDEs governing flow and heat transfer
problems.
In order to prepare for conducting lab experiments, please learn C or C++ and git
by completing the corresponding (free) course from https://www.codecademy.com/
You are highly encouraged to take a look at this web-site! Our labs are equipped
with Linux machines. However, you are encouraged and welcome to bring your
laptops to the lab. Please install a CPP Integrated Development Environments
(IDE) and compiler on your laptops before coming to the first lab.
Electronic Lab Report
The lab report in electronic format should be maintained and is due at the end of
the semester. Please create a git directory and create a readme.txt file inside it with
following entries:
1. Name and Admission number of the student:
2. A table of experiments and the corresponding cpp filenames, e.g.,
Date Experiment No. Main filename Commit id
11.08.2020 1HE(a) heatequn.cpp wxyz3275f
3. You should regularly commit your assignment to the git repo.
4. Place all program files inside the same directory.
Grade
L -T-P: 0-0-3
2
LIST OF EXPERIMENTS
3
Sl. No. Name of Experiments
Q1 Write a C or C++ program to solve the equation or ut = uxx
satisfying the conditions by
Crank-Nicolson’s method, which is a semi-implicit method.
Q2 Write a C or C++ program to solve the equation or ut = uxx
satisfying the conditions
by Crank-
Nicolson’s method, which is semi- implicit.
Experiment 4 (Solution of Elliptic PDE by FDM)
Aim To appreciate the importance of second order elliptic partial
differential equations viz. Laplace and Poisson equations and its
solution by finite difference method.
Q1 Write a C or C++ program to solve the Laplace equation =0
oruxx + uyy = 0 or at the interior grid points of a square mesh
with prescribed boundary conditions, using method of relaxation.
Q2 Find the steady state temperature distribution in a square metallic
plate, one side of which is maintained at 100°C and other three sides
maintained at 0°C.
Hint: The problem is that of solving Laplace equation in a rectangle.
Q3 Write a C or C++ program to solve the Poisson equation uxx + uyy = - 4
(x2 + y2) or over the square mesh with sides x =
0, y = 0, x = 3 and y = 3 with u = 0 on the boundary, using the method
of relaxation.
Experiment 5 (Solution of Wave Equation by FDM)
Aim To solve hyperbolic PDEs such as wave equation by finite difference
method.
Q1 Write a C or C++ program to solve the partial differential equation utt
= uxx, for x = 0 (0.2) 1 and t = 0 (0.2) 1, given that u(0, t) = 0, u(1, t) =
0, u (x, 0) = x(1 – x) and ut (x, 0) = 1.
Q2 Write a C or C++ program to solve the equation utt = uxx, up to t = 1
with step size 0.2, given that u(0, t) = 0, u(1, t) = 0, ut (x, 0) = 0 and u
(x, 0) = 10 + x(1 – x), 0 <x<1.
5
Sl. No. Name of Experiments
Aim To be conversant with the SIMPLE algorithm for calculating pressure
andvelocities.
Q1 Consider the steady, one-dimensional flow of a constant-density
fluidthrough a duct with constant cross-sectional area. Use the
staggered grid, where the pressure p is evaluated at the main nodes,
whilst the velocity u is calculated at the backwardstaggered nodes.
Use the SIMPLE algorithm to calculate pressurecorrections at main
nodes and obtain the corrected velocity field atbackward staggered
nodes. Write a C or C++ program to implement it.
Q2 A planar two-dimensional nozzle, wherein the flow is steadyand
frictionless and the density of the fluid is constant.Use the backward-
staggered grid with five pressure nodes and fourvelocity nodes. The
stagnation pressure is given atthe inlet and the static pressure is
specified at the exit. Using the SIMPLEalgorithm, write down the
discretised momentum and pressure correctionequations and solve for
the unknown pressures at the main nodes and velocities at the
staggered nodes. Write a C or C++ program to implement it.
Experiment 10 (QUICK ALGORITHM)
Aim To get acquainted with the Quadratic upwind differencing scheme: the
QUICK scheme.
Q1 A property φ is transported by means of convection and diffusion
throughthe one-dimensional domain as shown below.
u
φ=1 φ=0
x=0 x=L