You are on page 1of 1

ME 5107: Numerical methods in Thermal Engineering Jul–Nov 2023

Assignment 5
Submission date: 13th October 2023

Hand calculations
1. (20 points) Consider a non-uniform grid with the left and right-hand side grid sizes of point xi are hl and
hr respectively and the grid size ratio is a constant (hr /hl = r). Denoting the function values at the grid
points xi , (xi − hl ), (xi + hr ) as u(xi ), u(xi − hl ) and u(xi + hr ) respectively. Derive second-order accurate
central-difference formulae for the first derivative at the grid point xi . Express your answer in terms of
u(xi ), u(xi − hl ), u(xi + hr ), r and hl (20 points).

2. (10 points) Derive a fourth-order accurate forward-difference formula for evaluating the second derivative
on a uniform grid of size ∆x (10 points).
3. (10 points) A general Padé type boundary scheme for the first derivative is given by,
′ ′ 1
f0 + αf1 = (af0 + bf1 + cf2 + d f3 ) .
h
Show that requiring this scheme to be at least third-order accurate would constrain the coefficients to
11 + 2α 6−α 2α − 3 2−α
a=− ,b = ,c = ,d = . Which value of α would you choose and why?
6 2 2 6

Programming
1. (40 points) Consider the following equation that arises in the solution of transient heat conduction in a
plane wall

u(x) = Bi − x tan(x)

where Bi is the Biot number in the present case taken to be 7 and x = [−1, 1]. Write a program to compute
the first derivative using first, second and fourth-order accurate forward-difference formulae. Using grid
sizes of ∆x = 0.1, 0.01, 0.001 plot the ∞-norm of the truncation-error versus the grid sizes for all the three
schemes on a log-log plot. Provide the values of the slopes of these lines and compare them with the
theoretical prediction.
2. (20 points) Non-uniform mesh:
Consider the function f (x) = 1 − x8 and a grid defined as follows in x-space (non-uniform grid) and
ξ-space (uniform grid) with N = 32:

j = 0, 1, 2, . . . , N (1)
ξj = πj/N (2)
xj = cos(ξj ) (3)

(i) Compute and plot the first derivative of f at all xj , except j = 0 (left boundary) and j = N (right
boundary) points, with
′ fj+1 − fj−1
(a) The central difference formula fj =
xj+1 − xj−1
(b) The coordinate transformation method using grid in ξ-space. Use second order central difference
df
formula to obtain .

(ii) Compare results in (a) and (b) with the exact derivative at those xj locations.

You might also like