Counter Current Heat Exchanger
Counter Current Heat Exchanger
Notice that all the nonzero entries in the matrix are grouped around
the diagonal elements. In fact., we have no more than two elements on
either side of the diagonal for this problem. In order to solve for the
unknown time level temperatures, this matrix must be inverted. Very
efficient algorithms have been developed for the solution of linear alge
braic equations with band type matrices (Von Rosenberg, 1969).
Consider the set of simultaneous equations of the form
Figure 8.10 gives MATLAB m-file Band.m for implementing the band al
gorithm. An alternative formulation of the problem is possible in MAT
LAB. Rather than using the band algorithm directly, we can use the
sparse matrix capability of MATLAB. The matrix to be inverted can be
defined and stored in the sparse or band format (see Chapter 2, section
2.2.3.3). This option is particularly efficient in MATLAB.
Using the sparse matrix formulation, the shell and tube temperatures
for all distance grid points are computed for an unknown time level, t
+ At. This procedure is continued until enough time steps are taken so
that a steady-state condition is reached. A MATLAB program ex83.m
(Figure 8.11) has been developed to solve this problem. The dynamic
response results for this countercurrent heat exchanger are shown in Fig
ure 8.12. It should be noted that some numerical oscillations are present
on the shell side. This is due to not matching the convective flow on this
side but using the nearest neighbor assumption (Eqn. (8.3.6)).
Figure 8.10: m-file Band.
function x = band (a,b,c,d,n,m)
% This file implements the band inversion algorithm
%
W = zeros (n,m) ;
al = zeros (n ,m);
beta = zeros (n,1);
gam = zeros(n,1);
for J = 1:n
for IK = 1:m
K = (m+1) - IK;
sum = 0;
KP1 = K+1;
if ((K+1) -m) <= 0;
for IP = KP1:m
JLP = J-IP;
MPK = IP -K;
if (IP - J) < 0;
sum = sum +al(J,IP) *(JLP,MPK);
else
end
end
else
al(J,K) = a(J,K) -sum;
end
end
% Computation of Beta
%
Sum = 0:
for IP = 1:m
JLP = J - IP;
if JLP> 0
Copyrighted material
Solution of Partial Diferential Equations 365
% Computation of w
for K = 1:m
sum = 0:
IK = K+1;
if (m-IK) >= 0
for IP = IK:m
IMK = IP - K;
JLPMK = J - IMK;
if (J-IMK) > 0
sum = sumtal(J,IMK) * w(JLPMK, IP);
else
end
end
else
w(J,K) = (c(J,K) - sum) /beta(J);
end
end
%Computation of gam
sum = 0:
for IP = 1:m
JLP = J-IP;
if (IP-J) < 0
sum = sumtal(J,IP) * gam(JLP);
else
end
end
gam(J) = (d(J) - sum)/beta(J);
end
Copyrighted material
366 Computational Methods for Process Simulation
end
x(J) = gam(J) Sum;
end
global Pt Ps Vt Vs;
% simulation parameters
Copyrighted matcrial
Solution of Partial Differential Equations 367
x0 = 0.0; x£ = L;
Th10 = [45 0]';
for i = 2:1:N+1,
xf = x0 + delta_x;
[xh1, Th1] = ode45(' Model83', x0, xf, Th10, 1.e-8, 1);
Th1t(i) = Th1(1length(Th1),1);
This(i) = Th1(length (Th1) ,2);
x(i) =xh1 (length(xh1));
Th10 = [Thit (i) This(i)]';
x0 = xf;
end
x(1) = 0;
Thit (1) =45;
This(1) = 0;
plot (x, Thit, -) x, Thls, -. ');
%title('Homogeneous Solution#1);
%pause;
x0 = 0.0; xf L;
Th20 = [O 50];
for i = 2:1:N+1,
xf x0 + delta_x;
[xh2, Th2] = ode45(' Model83, xo, xf, Th20, 1.e-8, 1);
Th2t (i) Th2 (length (Th2),1);
Th2s(i) - Th2(length (Th2) ,2);
x(i) = xh2 (length (xh2) );
Th20 = [Th2t (i) Th2s (i)];
x0 = xf;
end
x(1) = 0;
Th2t (1) = 0;
Th2s(1) = 50;
%plot (x, Th2t, - , x, Th2s, -.');
%title('Homogeneous Solution#2);
%pause;
% solve linear equation set to get the constants that satisfy the real
% boundary conditions .
A = [Th1t (1) Th2t (1);
This (N+1) Th2s (N+1)];
Copyrighted matcrial
Solution of Partial Differential Equations 369
V8 = v7;
r9 =[37 37 37 37 38 38 38 38 39 39 39 40 40 40];
c9 =[36 37 38 39 36 37 38 39 38 39 40 38 39 40]:
v9 =[at bt ct dt as bs cs ds at bt ct as bs cs];
r (r1 r2 r3 r4 r5 r6 r7 r8 r9];
c =[c1 c2 c3 c4 c5 c6 c7 c8 c9]:
v =[v1 v2 v22 v3 v4 v5 vÓ v7 v8 v9];
aa = sparse (r, c,v,40,40);
% define B.C.2:
%
Ttnew = 35;
% define B.C.3:
Tsold = 75;
for n=1:5:iteration+1
plot (x, Tt (n,:));
hold on;
end
Copyrighted matcrial
Solution of Partial Differential Equations 371
F)
(degree
L 55
Temperature
50
Water
Side 46
Tube
40
355 1 2 3 5 7 8 10
Length (ft)
Figure 8.12a: Dynamic Response of Countercurrent Heat
Exchange: Tube Side.
F) 74
(degree
72
Temperature
70
68}
Water
Side66
Shell
g64
60
58
1 2 3 5 6 8 10
Length (t)
Figure 8.12b: Dynamic Response of Countercurrent Heat
Exchange: Shell Side.
Copyrighted matcrial
Solution of Partial Diferential Equations 373
x=0 X=L
At
-/+ 1
i
bc T; -aT, + dË
abc de
abc
T2
abc
T3
abc
abc
ab Ti9 d18
-cT20 + d19 J
Figure 8.16: Matrix for Unsteady-State Heat
Conduetion Simulation.
QAt\
dn =(1-)Tin- a(Tin-1 +Tin+1) (8.5.9)
The matrix of Figure 8.16 is a band matrix and the band algorithm
provides an efficient calculational sequence for solution. File ex85.m,
available on the world wide web, presents a MATLAB solution to the
problem. Figure 8.17 shows the dynamic response curves for this heat
conduction problem.