Problem 5: Cooling A Pipe by External Flow: 1. Sumary
Problem 5: Cooling A Pipe by External Flow: 1. Sumary
1. Sumary
Initial condition:
Boundary condition:
Data: ; ; ; ; ; ;
a) Analytical solution
The analytical solution is:
b) Numerical solution
The finite different method is applied for solving the PDE.
(Up-wind scheme)
At node 2:
At node n:
1
And
2. Solution
global K1 K2 Tw Tini Tbound A b
% --- declare constant variable
F = 0.001; %[m3/s]
U = 50000; %[W/m2K]
rho = 997; %[kg/m3]
Cp = 4182; %[J/kg]
D = 0.1; %[m]
Tw = 300; %[K]
Tbound = 373; %[K]
Tini = 373; %[K]
% --- Domain
L = 1; %[m]
% --- Computation
tstop = 10; %[s]
a) Analytical solution
% Plot
L = 1; % The length of pipe
x = linspace(0,1,50);
t = linspace(0,tstop,20);
Temp=[];
figure;
subplot(1,2,1)
for i = 1:length(t)
Temp = [Temp; asol(x,t(i))];
plot(x,Temp(i,:))
hold on
end
title('Analytical solution'); xlabel('Length (m)'); ylabel('Temperature K');
2
b) Numerical solution
% --- Construct the matrix A and b
N = 100; % Number of node you want to devide the domain
x = linspace(0,L,N+1);
dx = x(2)-x(1);
% --- solving
[t u] = ode15s(@nsol,[0 tstop],T0);
v = [ones(1,length(t))*Tbound; u'];
subplot(1,2,2)
plot(x,v);
title('Numerical solution');xlabel('Length (m)');ylabel('Temperature K');
3
4