Assignment6
Assignment6
Assignment 6
General Instructions
Solutions due by 8th April for Group A
Hand calculations
0
1. (20 points) Consider the Euler explicit method applied to a differential equation y = f (y, t) with initial condition
y(t = 0) = y0 . In the lecture, to perform stability analysis, we linearized the differential equation to get:
0 0
y = λy + c1 + c2 t. Further, neglecting the inhomogenous terms, we obtained the model problem y = λy, where
λ = λR + iλI with λR ≤ 0. We will now study the effects of inhomogeous terms in the linearized equation on
stability analysis.
c1 c2 c1 c2 c2 t
(a) Verify that y(t) = y0 + + 2 eλt − − 2− is an exact solution to the differential equation
λ λ λ λ λ
(b) Apply Euler explicit method to derive a difference equation of the form: yn+1 = αyn + βn + γ. What are
α, β, and γ?
(c) Use transformation zn = yn+1 − yn to derive the following difference equation: zn+1 = αzn + β.
(d) Solve the above difference equation and obtain an expression for zk in terms of y0 , α, β, γ for some k.
(e) Express the numerical solution ynnum in terms of y0 using the result from part (d)
(f) Show that the stability of the error, en = ynnum − ynanaly depends only on λ.
2. (10 points) Calculate the truncation error and examine the consistency and stability of Dufort-Frankel’s method
for the solution of one-dimensional transient heat conduction equation given by
3. (10 points) Calculate the truncation error and examine the consistency and stability of the following discretiza-
tions for the solution of first-order wave equation give by
∂u ∂u
+c = 0, c>0 (2)
∂t ∂x
(a) Euler explicit method
un+1 − uni un − uni−1
i
+ c i+1 =0 (3)
∆t 2∆x
(b) Lax method
un+1 − 12 (uni+1 + uni−1 ) un − uni−1
i
+ c i+1 =0 (4)
∆t 2∆x
Programming
1. (60 points) The heat equation with a source term is
∂T ∂2T
= α 2 + S(x), 0 ≤ x ≤ L (5)
∂t ∂x
The initial and boundary conditions are T (x, 0) = 0, T (0, t) = 0 and T (L, t) = Tsteady (L). Taking α = 1, L = 15
and S(x) = −(x2 − 4x + 2)e−x . The exact steady solution is
Solve the equation to steady state on a uniform grid with a grid spacing of ∆x = 1, 0.1 and employing a time
step of ∆t = 0.005. For each of the following methods (i) plot the variation of error in 1−norm with respect to
∆x on a log-log plot for a ∆t = 0.005 (ii) plot the exact and the numerical solutions for ∆x = 1 and ∆t = 0.005.
Comment on the maximum time step you can use in each of the following methods and show that by employing
a larger ∆t you can take fewer iterations to arrive at the steady solution in case of implicit methods. (a) Explicit
Euler time-advacement with second-order central difference scheme for spatial derivate (b) Implicit Euler time-
advancement with second-order central difference scheme for spatial derivate (c) Crank-Nicolson method.
2. (60 points) Consider the following initial value problem
dy
= −λ (y − e−t ) − e−t , λ>0
dt
with the intial condition y(t = 0) = y0 . Solve this initial value problem for λ = 10 and y0 = 10 using
explicit Euler, implicit Euler, trapezoidal, second-order Runge-Kutta, fourth-order Runge-Kutta and Runge-
Kutta-Fehlberg method. Use time step sizes h = 0.1, 0.05, 0.025, 0.0125, 0.00625 and integrate from t = 0 to 0.8.
The exact analytical solution to this equation is
(a) For each method, plot the solutions obtained along with the exact solution from t = 0 to t = 0.8.
(b) Evaluate the error between the numerical and the exact solution at t = 0.8 as follows. If the order of the
method is p, then the ratio of the error corresponding to a step size of h and h/2 should be 2p . Tabulate this ratio
for successive pairs of h and deduce the asymptotic value of p for each method. Use double precision arithmetic
throghout. The formulation of the methods is given as follows,
Trapezoidal Method
h
yi+1 = yi + [f (xi , yi ) + f (xi+1 , yi+1 )]
2
Second-Order Runge-Kutta Method
yi+1 = yi + hk2
where
k1 = f (xi , yi )
h h
k2 = f xi + , yi + k1
2 2
k1 = f (xi , yi )
h h
k2 = f xi + , yi + k1
2 2
h h
k3 = f xi + , yi + k2
2 2
k4 = f (xi + h, yi + hk3 )
Runge-Kutta-Fehlberg Method
16 6656 28561 9 2
yi+1 = yi + k1 + k3 + k4 − k5 + k6
135 12825 56430 50 55
ME 5107: Numerical Methods in Thermal Engineering Jan–May 2025
where
k1 = hf (xi , yi )
h k1
k2 = hf xi + , yi +
4 4
3h 3k1 9k2
k3 = hf xi + , yi + +
8 32 32
12h 1932k1 7200k2 7296k3
k4 = hf xi + , yi + − +
13 2197 2197 2197
439k1 3680k3 845k4
k5 = hf xi + h, yi + − 8k2 + −
216 513 4104
h 8k1 3544k3 1859k4 11k5
k6 = hf xi + , yi − + 2k2 − + − .
2 27 2565 4104 40