0% found this document useful (0 votes)
23 views15 pages

Endsem SolutionKey 2021

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views15 pages

Endsem SolutionKey 2021

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

CL 701:Computational Methods in Chemical Engineering

End Semester Examination (60 Marks)


Date: 9.11.2021 Time: 8:50 am to 12:30 pm
Instruction: Closed Book and Closed Notes Examination.

Part1.Q1 Find dimension and basis for the row space and the null space of the following matrix
2 3
1 0 2
6 2 1 4 7
6 7
A =6 7 (1)
4 0 1 0 5
4 0 8

What is the dimension of the row space? (5 marks)


Soln.: Approach 1 (for …nding the row space): Row space is the column space
of AT 2 3
1 2 0 4
6 7
AT = 4 0 1 1 0 5 (2)
2 4 0 8
From examination of columns of AT ; it can be seen that there are only two linearly
independent direction 2 3 2 3
1 0
T 6 7 6 7
R(A ) 4 0 5+ 4 1 5 (3)
2 0
OR 2 3 2 3
1 2
6 7 6 7
R(AT ) 4 0 5+ 4 1 5 (4)
2 4

Approach 2 (for …nding the row space): Using triangularization step of Gaussian
elimination, we have
2 3 2 3
1 2 0 4 1 2 0 4
6 7 6 7
AT = 4 0 1 1 0 5 ! U =4 0 1 1 0 5 (5)
2 4 0 8 0 0 0 0
2 3 2 3
1 0
6 7 6 7
R(AT ) R(U ) 4 0 5+ 4 1 5 (6)
0 0

1
Dimension of Row space = 2
Approach 1 (Finding Null space A): From examination of columns of A, it can
be seen that the …rst and last columns of A are linearly dependent and
2 3 2 3
1 0 2 2 3 0
6 2 1 4 7 2 6 0 7
6 76 7 6 7
6 74 0 5 = 6 7 (7)
4 0 1 0 5 4 0 5
1
4 0 8 0

Thus, null space of A can be expressed as follows


2 3
2
6 7
N (A) 4 0 5
1

Approach 2 (Finding Null space A):


2 3 2 3
1 0 2 2 3 0
6 2 1 4 7 x 6 0 7
6 76 7 6 7
;6 74 y 5 = 6 7
4 0 1 0 5 4 0 5
z
4 0 8 0

The …rst and the last row yield identical equations

x + 2z = 0 and 4x 8z = 0 i.e. x = 2z (8)

The third row yields


y=0 (9)
. Combining these two equations
2 3
2
6 7
N (A) 4 0 5 (10)

Part 1.Q2 It is desired to solve " # " #


a b
Ax = x= (11)
b c
using the Backward Gauss-Seidel method where A is a symmetric positive de…nite
matrix. Show the spectral radius of S 1 T is strictly less than 1 and G-S iterations
will converge. (7 marks)

2
Note: For Backward Gauss-Seidel method

S =(D + U) and T = L (12)

Soln.: " # " #


a b 0 0
S= and T = (13)
0 c b 0

" #" #
1 c b 0 0
S 1T = (14)
ac 0 a b 0
" #
1 b2 0
= (15)
ac ab 0

Eigenvalues of S 1 T " #
2
b =ac 0
det =0 (16)
b=c
( b2 =ac) = 0 (17)
b2
1 = 0 and 2 = (18)
ac
and Since A is a +ve de…nite matrix, we have

a > 0 and ac b2 > 0 (19)

This implies
ac > b2 > 0
and
b2
0< <1 (20)
ac
Thus, spectral radius of S 1 T is

b2
S 1T = <1 (21)
ac
and the backward Gauss-Seidel will converge.

Part 1.Q3 Consider matrix


2 3
0 1 1
6 1 0 1 7
6 7
M =6 7 (22)
4 0 1 1 5
1 1 0

3
Note that the null space of matrix M is given as
2 3
1
6 7
N (M) = 4 1 5 (23)
1

i.e. the columns of M are linearly dependent. It is desired to project vector b


h iT
and b = 1 1 1 1 (24)

on to the column space of M . Use the QR factorization method to compute the projec-
tion vector p that lies in the column space of M and the error vector e = b p which
is orthogonal to the column space of M. (10 marks)
Note: Projection a n 1 vector b 2 Rn on column space of matrix (n m) matrix A,
where n > m and rank of A is m, can be found as, p = Ax;where x is obtained by
solving the following system of linear equation

Rx = QT b (25)

where A = QR;i.e. QR factorization of matrix . Also, the QR Factorization is obtained


by application of the Gram-Schmidt process to columns of matrix A: For example, for
a matrix A with 3 linearly independent columns
h i
A = c(1) c(2) c(3)
2 T 3
h i q(1) c(1) (q(1) )T c(2) (q(1) )T c(3)
6 T T 7
= q(1) q(2) q(3) 4 0 q(2) c(2) q(2) c(3) 5
T
0 0 q(3) c(3)

Soln. : Since columns of M are linearly dependent, we construct matrix A by taking


two linearly independent columns
2 3
0 1
h i 6 1 0 7
6 7
A = c(1) c(2) = 6 7 (26)
4 0 1 5
1 1
2 3 2 3
0 0
6 p 7 6 7
6 1= 2 7 6 0:7071 7
q(1) = c(1) = c(1) =6 7=6 7 (27)
2 4 0 5 4 0 5
p
1= 2 0:7071

4
z(2) = c(2) c(2) ; q(1) q(1) (28)
p
c(2) ; q(1) = 1= 2 (29)
2 3 2 3 2 3
1 0 1
6 7 p 7 6
(2) 6 70 p 6 6 1= 2 7 6 1=2 7
7
z = 6 7 ( 1= 2) 6 7=6 7 (30)
4 51 4 0 5 4 1 5
p
1 1= 2 1=2
2 3 2 p 3 2 3
1 2= 10 0:6325
6 7 6 p 7 6 7
2 6 1=2 7 6 1= 10 7 6 0:3162 7
q(2) = z(2) = z(2) 2 = p 6 7=6 p 7=6 7 (31)
10 4 1 5 4 2= 10 5 4 0:6325 5
p
1=2 1= 10 0:3162
2 p 3 2 3
0 2= 10 0 0:6325
6 1=p2 1=p10 7 6 0:7071 0:3162 7
6 p 7 =6
7 7
Q= 6 6 7 (32)
4 0 2= 10 5 4 0 0:6325 5
p p
1= 2 1= 10 0:7071 0:3162
" p p # " #
2 1= 2 1:4142 0:7071
R= p = (33)
0 5= 10 0 1:5811
2 3
" 1
p p #6 7 " #
1 0 5 0 5 6 1 7 1 0
QT b = p 6 7= p (34)
10 2 1 2 1 4 1 5 10 6
1
" p p #" # " # " #
2 1= 2 x1 1 0 6=10
p =p ) x= (35)
0 5= 10 x2 10 6 6=5

2 3 2 3
0 1 1:2
6 1 0 7 6 0:6 7
6 7 6 7
p = 6 7x =6 7 (36)
4 0 1 5 4 1:2 5
1 1 0:6
2 3
0:2
6 0:4 7
6 7
e= b p= 6 7 (37)
4 0:2 5
0:4

Vector e is orthonormal to the column space of A.

5
Note: It is possible that some students may have applied QR factorization to all
three columns of M without considering the linear dependence of the columns.

z(3) = c(3) c(3) ; q(1) q(1) c(3) ; q(2) q(2)


p p
c(3) ; q(1) = 1= 2 and c(3) ; q(2) = 5= 10
2 3 2 3 2 p 3
1 0 2= 10
6 1 7 p 7 p
6 7 p 6 6 1= 2 7 p 6
6 1=p10
7
7
z(3) =6 7 (1= 2) 6 7 (5= 10) 6 7
4 1 5 4 0 5 4 2= 10 5
p p
0 1= 2 1= 10
2 3 2 3 2 3 2 3 2 3
1 0 1 0 0
6 1 7 6 1=2 7 6 7 6 7 6 7
6 7 6 7 6 1=2 7 6 0 7 6 0 7
z(3) = 6 7 6 7 6 7 = 6 7 ) q(3) = 6 7
4 1 5 4 0 5 4 1 5 4 0 5 4 0 5
0 1=2 1=2 0 0
2 p 3
0 2= 10 0 2 p
p p 3
6 p p 7 2 1= 2 1= 2
6 1= 2 1= 10 0 7 6 p p 7
Q= 6 p 7 and R = 4 0 5= 10 5= 10 5
4 0 2= 10 0 5
p p 0 0 0
1= 2 1= 10 0
32
0
1 6 7
QT b = p 4 6 5
10
0
Since the R matrix in this case is not invertible, the following equation does
not have a unique solution
2 p p p 32 3 2 3
2 1= 2 1= 2 x1 0
6 p p 76 7 1 6 7
4 0 5= 10 5= 10 5 4 x2 5 = p 4 6 5
10
0 0 0 x3 0

Only partial credit will be awarded for these calculations (3 marks for Q
matrix and 2 marks for R matrix).

Part 1.Q4 The …rst row of a matrix is scaled so that


" #
2b b
A=
1 1

Show that c1 (A); i.e. condition number of A based on the 1-norm, is a minimum
for b = 2=3. (8 marks)

6
Hint: Examine c1 (A) for the following scenarios: (i) jbj 2=3 and (ii) jbj > 2=3:
Note: Condition number based on in…nite norm is

1
c1 (A) = kAk1 A 1

where in…nite norm corresponds to the maximum over row sums of jaij j
" n #
M ax kAxk1 max X
jjAjj1 = = jaij j (38)
x 6= 0 kxk1 1 i m j=1

Soln.: " #
1 1 1 b
A =
b 1 2b

1 1 1
kAk1 = max f3 jbj ; 2g and A 1
= max + 1; +2
jbj jbj
Scenario jbj 2=3 :

1 1
kAk1 = max f3 jbj ; 2g = 2 and A 1
= +2
jbj

Now, for jbj = 2=3; we have

1
c1 (A) = 2 +2 =7
(2=3)

and for any jbj < 2=3; we have jbj = (2=3) " where 0 < " < 2=3 and

1
c1 (A) = 2 +2 >7
(2=3) "

Alternatively, for for any jbj < 2=3; we have 3 < 2=jbj and

2
c1 (A) = +4 >3+4=7
jbj

Alternatively, for any jbj 2=3;

2
c1 (A) = +4
jbj

i.e. c1 (A) / 1=jbj and the smallest value of c1 (A) is achieved for the largest value jbj
can take over the interval.

7
Scenario jbj > 2=3 :

1 1
kAk1 = max f3 jbj ; 2g = 3 jbj and A 1
= +2
jbj
1
c1 (A) = 3 jbj +2 = 3 + 6 jbj
jbj

For any jbj > 2=3 we have jbj = (2=3) + " where " > 0 and

c1 (A) = 3 + 6 jbj = 3 + 6 ((2=3) + ") = 7 + 6" > 7

Alternatively, for for any jbj 2=3

c1 (A) = 3 + 6 jbj

and c1 (A) / jbj: Thus, the smallest value of c1 (A) is achieved for the smallest value
of jbj in the interval.
Thus, the condition number of A based on the 1-norm, is a minimum for b = 2=3:
Common conceptual errors for which marks have been deducted:

(a) Forgot to use the mod operator while computing norm, i.e. the norms
were incorrectly computed as follows

1 1 1
kAk1 = max f3 b; 2g and A 1
= max + 1; + 2
b b

(b) Wrong use of the mod operator

1 1 1
A 1
= max 1 ; +2
b b

(c) Trying to di¤erentiate c1 (A) w.r.t. b : Due to mod operator, c1 (A) is


not di¤erentiable w.r.t. b.
(d) Trying to "prove" using sample calculations for 3 or 4 speci…c values of
b or jbj: Such sample calculations cannot be basis for drawing conclusion
about all possible values of b.

Part 2.Q1 Consider the problem of Langmuir Hinselwood reaction occurring in a catalyst sphere
and modelled as ODE-BVP:
1 d du 2 u(E + u)
z2 = (0 < z < 1) (39)
z 2 dz dz (1 + Ku)2

8
du
B. C. at z = 0 : =0 (40)
dz z=0
B. C. at z = 1 : u(1) = 1 (41)

It is desired to use method of single shooting to solve the ODE-BVP. By suitably in-
troducing new state vector x, express them in standard form

dx=dz = f (x(z))

Further, Assuming that the resulting set of ODEs are solved using explicit Euler method
with step size of 0.1, develop an iteration scheme using the secant method for estimation
of the missing initial condition at z = 0. (State all the steps in the iteration scheme
including the FOR loop for explicit Euler integration). (7 marks)
Soln.:
d2 u 2 du 2 u(E + u)
+ = (0 < z < 1) (42)
dz 2 z dz (1 + Ku)2
Now, de…ning new state variables
du
x1 = u and x2 = (43)
dz
we can transform the above ODE as
" # 2 3
x2
d x1
= 4 2 x1 (E + x1 ) 5 f (x) (44)
dz x2 x2 + 2
z (1 + Kx1 )2
z = 0 : x2 (0) = 0 (45)
z = 1 : x1 (1) = 1 (46)

The single shooting method solves this problem by converting it into a sequence of
ODE-IVP problems as follows:
Step 1: Guess x1 (0) = " #
x(0) = (47)
0

Step 2: Integrate the two ODEs simultaneously using explicit Euler from z = 0 to z
= 1. Since z = 0:1; we
FOR k = 0 To 9
x(k + 1) = x(k) + 0:1 f (x(k))
END FOR

9
Step 3: Examine whether the given boundary condition, g( ) = x1 (z = 1) 1 =
x1 (10) 1 = 0; is satis…ed, i.e., stop iterations if jx1 (1) 1j < "; else go to Step 1.
De…ning
g( ) = x1 (1) 1 (48)
the value of can be changed from iteration to iteration by the secant method as
follows
(k) (k 1)
(k+1) (k) (k)
= g[ ] (k) ] (k 1) ]
(49)
g[ g[
Part 2.Q2 Consider a CSTR where a feed with unknown pH is ‡owing into the reactor. The
system dynamics is modelled using the following set of DAEs:
dX
= A BX 2 (50)
dt
Y 3 + CY 2 + ( X + )Y + D = 0

where X represents the concentration of the cation of the base in the CSTR, Y repre-
sents the hydrogen ion concentration and (A,B,C,D, ; ) represent model parameters.
It is desired to use the implicit Euler method to integrate this set of DAEs over in-
terval [tn ; tn + h] starting from initial condition ( X(n); Y (n)). Here, h represents the
integration interval. Derive two nonlinear algebraic equations that need to be solved
simultaneously to obtain ( X(n + 1); Y (n + 1)) using the implicit Euler method. Sub-
sequently, formulate a Gauss-Seidel based successive substitution type derivative free
iteration scheme for solving the resulting set of coupled nonlinear equations starting
from initial guess X (0) (n + 1); Y (0) (n + 1) (7 marks)
Soln.: Using implicit Euler, we have

X(n + 1) = X(n) + hf [X(n + 1)] = X(n) + h A BX(n + 1)2 (51)

This gives one nonlinear equation

f1 [X(n + 1); Y (n + 1)] = X(n + 1) X(n) h A BX(n + 1)2 = 0 (52)

The second nonlinear equation arises from the algebraic equation at (n + 1)

f2 [X(n + 1); Y (n + 1)] = Y (n + 1)3 + CY (n + 1)2 + ( X(n + 1) + )Y (n + 1) + D = 0


(53)
which are two equations in unknowns X(n + 1); Y (n + 1). Here X(n) is a known
quantity.

10
One way to formulate G-S like iteration scheme is as follows:

X (k+1) (n + 1) = X(n) + h A BX (k) (n + 1)2 (54)


3 2
Y (k) (n + 1) + C Y (k) (n + 1) +D
Y (k+1) (n + 1) = (55)
( X (k+1) (n + 1) + )
where k is iteration index. Termination condition
" #
X (k+1) (n + 1) X (k) (n + 1)
Y (k+1) (n + 1) Y (k) (n + 1)
" # <" (56)
X (k+1) (n + 1)
Y (k+1) (n + 1)

Part 2.Q3 Consider the following PDE representing the unsteady state one dimensional heat trans-
fer across an in…nite slab with no heat generation and with thermal conductivity being
linear function of temperature
2
@u @2u @u
= (1 + au) 2 + a (0 z 1) (57)
@t @z @z

Initial Condition at t = 0 : u(z; 0) = 1 z (58)


Boundary Condition at z = 0 : u(0; t) = 1 (59)
Boundary Condition at z = 1 : u(1; t) = 0 (60)

where, a is a dimensionless constant related to the thermal conductivity and u repre-


sents the dimensionless temperature. Initially discretize the PDE in the spacial coordi-
nate, z, using the method of orthogonal collocations with one internal collocation point
(at 0:5) and …nd the nonlinear ODE-IVP that needs to be solved in time. Further, it
is desired to solve the resulting ODE-IVP using the method of orthogonal collocations
with one internal collocation point (at 0.5) lying between [nh; (n + 1)h]. At t = nh;the
initial values, u2 (n) is known and we want to obtain u2 (n + 1) at t = (n + 1)h, where
h represents the integration interval, Transform the ODEs in terms of an independent
variable,
t (nh)
=
h
such that
=0 t = (nh); = 1 t = (n + 1)h and dt = hd
De…ning variables
u2j = u2 ( i ) for i = 1; 2; 3

11
state the set of appropriate nonlinear algebraic equations that need to be solved simul-
taneously for …nding u2 (n + 1) i.e. u2 ( = 1). (8 marks)
Note: The S and T matrices for one internal collocation point at z2 = 0:5 are as
follows 2 3 2 3
3 4 1 4 8 4
6 7 6 7
S=4 1 0 1 5 ; T=4 4 8 4 5
1 4 3 4 8 4

Soln.: Discretizing the PDE in space we have

From B.C. 1: u1 (t) = 1 (61)

At z = 0.5, using second rows of S and T matrices


du2
= (1 + au2 ) (4u1 8u2 + 4u3 ) + a ( u1 + u3 )2 (62)
dt
From B.C. 2: u3 (t) = 0 (63)
Thus, combining, we have
du2
= (1 + au2 ) (4 8u2 ) + a (64)
dt

Initial condition
u2 (0) = 0:5

Now, discretizing in time, we …rst transform the ODE as


du2
= h [(1 + au2 ) (4 8u2 ) + a] (65)
d

The initial condition u2 (n) for the ODE-IVP is known. This gives one equation

u21 = u2 (n) (66)

At = 0:5; the ODE constraint becomes

u21 + u23 = h [(1 + au22 ) (4 8u22 ) + a] (67)

At = 1; the ODE constraint becomes

u21 4u22 + 3u23 = h [(1 + au23 ) (4 8u23 ) + a] (68)

12
Eliminating u21 from the last two equations, we get 2 equations in two unknowns

u23 = h [(1 + au22 ) (4 8u22 ) + a] + u2 (n) (69)

4u22 + 3u23 = h [(1 + au23 ) (4 8u23 ) + a] u2 (n) (70)


Solving the above two nonlinear algebraic equations simultaneously, we can compute

u2 (n + 1) = u2 ( = 1) = u23 (71)

Part 2.Q4 Consider an ODE-IVP of the form


dx
= f (x(t))
dt
with initial condition over x(0) interval 0 t tf . A numerical solver constructs a
solution of the ODE-IVP by solving the following sequence of ODE-IVPs de…ed over
intervals nh t (n + 1)h

x(n + 1) = x(n) + ck1 + dk2

k1 = B f (x(n))
k2 = B f (x(n) + bk1 )
where n = 0; 1; :::and
1
B = h (I ahJn )
@f
Jn =
@x x=x(n)

A student intends to use the solver following solving an ODE-IVP of the form
dx
= f (x(t)) = Ax(t)
dt
where A is an n n matrix. Assume that (a) matrix A is diagonalizable, i.e. D D 1
where is a diagonal matrix with eigenvalues of A appearing on the main diagonal,
(b) columns of D are eigenvectors of A and D is invertible, and (c) the eigenvalues
of A are strictly in the left half plane. Find conditions on the integration step size
’h’ (in terms of eigenvalues of matrix A) that must be satis…ed so that the norm of
the approximation error decays to zero and approximate solution approaches the true
solution. Note that the true solution evolves as follows

x (n + 1) = D exp(h )D 1 x (n)

13
(8 marks).
Soln.:
@f
f (t) = Ax(t) ) Jn = =A (72)
@x x=x(n)

1
k1 = Bf (n) = BAx(n) = h (I ahA) Ax(n)

k2 = Bf (x(n) + bk1 ) (73)


= BA [x(n) + bBAx(n)] (74)
= BA+b(BA)2 x(n) (75)
h 2
i
= h (I ahA) 1 A+bh2 (I ahA) 1
A x(n) (76)

x(n + 1) = x(n) + ck1 + dk2


= x(n) + cBAx(n) + d BA+b(BA)2 x(n) (77)
2
= I + (c + d)BA+db(BA) x(n) (78)
h 2
i
= I + (c + d)h (I ahA) 1 A+dbh2 (I ahA) 1
A x(n) (79)

Now, since A =D D 1 ;
1 1 1 1 1
(I ahA) A= DD ahD D D D = D [I ah ] D (80)
1 2 2 2 1
(I ahA) A = D [I ah ] D (81)
h 2
i
1 2 1
x(n + 1) = I + (c + d)h (I ahA) A+dbh (I ahA) A x(n) (82)
1 2
= D I + (c + d)h [I ah ] +dbh2 [I ah ] 2
D 1 x(n) (83)

The true solution evolves as

x (n + 1) = D exp(h )D 1 x (n) (84)

The dynamics of the approximation error, e(n) = x(n) x (n); is governed by the
following matrix di¤erence equation
" # " #
e(n + 1) e(n)
= (85)
x (n + 1) x (n)
" #
M [exp(At) M]
= (86)
0 exp(At)

14
h 2
i
1 1
M = I + (c + d)h (I ahA) A+dbh2 (I ahA) A (87)
In order that ke(n)k ! 0 as n ! 1; then following condition should hold

j i j < 1 for i = 1; 2; :::; n (88)

where i is
2
h i i
i = 1 + (c + d) + dbh2 (89)
1 ah i 1 ah i

Thus, the convergence conditions for approximation errors can be stated as follows
2
h i i
1 + (c + d) + dbh2 < 1 for i = 1; 2; :::; n (90)
1 ah i 1 ah i

Common errors for which marks have been deducted

(a) Unable to use


Jn = A

(b) Confusion about order of multiplications of matrices and vectors

15

You might also like