%ONE_DQ % Chemical and Fuels Engineering 6453, Heat Transfer % University of Utah % Prof. Geoff Silcox % % % % %
1-D fully developed duct-flow heat transfer in a slit of height d. I am using a node-centered grid with n control volumes that are all the same size. The nodes are midway between the boundaries of the CVs. I have used a dimensional formulation. The flux along the top and bottom of slit is uniform and given.
%
28 March 2004
%************************************************************************** close all; clear all; clc; %
Parameters for duct and fluid flow.
dpdz = -1; d = 1; % mu = 1; % wb = 0; % wt = 0; % %
Parameters for heat transfer.
qw = 1; k = 1; tb = 0; %
% % %
Specified flux of energy at top and bottom of duct, W/m^2. Thermal conductivity of fluid, W/(m K). Temperature at bottom of duct, C. This is arbitrary.
Parameters for solution
n = 20; %
% Pressure drop in z-direction , kPa. Height of duct, m. Viscosity of fluid, kg/(m s). Velocity at bottom, m/s. Velocity at top, m/s.
%
Number of control volumes of equal width.
Construct grid.
dely= d / n; % Distance between CV boundaries. % yb are the positions of the n + 1 boundaries. yb = linspace(0,d,n + 1); % y are positions of the n + 2 nodes. y = yb + 0.5 * dely; y = [0 y]; y(n + 2) = d; % % % % % % % % %
Set up tridiagonal matrix for system of equations, Aw = b. Velocity in the z-direction is given by w = A\b. A = is a nxn tridiagonal matrix. This sparse, diagonal matrix is defined using the MATLAB function "spdiags". w = column vector of unknown velocities. b = column vector giving right hand side of equation. am(i) multiplies w(i-1). Define am, a, ap as column vectors. a(i) multiplies w(i). ap(i) multiplies w(i+1).
am = mu / dely .* ones(n,1); am(1) = 0; am(n) = 4 * mu / (3 * dely); ap = am;
ap(1) = 4 * mu / (3 * dely); ap(n) = 0; a = - (am + ap); a(1) = - (4 * mu / dely); a(n) = a(1); b = dpdz * dely .* ones(n,1); % % %
When using "spdiags", we must truncate and extend am and ap. We need to go through these acrobatics because of the way "spdiags" is defined. Note ap, a, and am must be column vectors.
A = spdiags([[am(2:n);0] a [0;ap(1:n-1)]], [-1 0 1], n, n); %
Solve.
w = A\b; %
Calculate hydraulic diameter, dh, mean fluid velocity, wbar, cfRe.
dh = 2 * d; wbar = sum(w) / n; cfRe = -dpdz * dh ^ 2 / (2 * wbar * mu); %
Print to screen.
fprintf('Number of CVs = %3.f\n', n) fprintf('cfRe = %g\n', cfRe) fprintf('wbar, m/s = %g\n', wbar) %
The end of velocity calculation.
Start heat transfer calculation.
% % % % % % % % %
Set up tridiagonal matrix for system of equations, At = b. Temperature is given by t = A\b. A = is a nxn tridiagonal matrix. This sparse, diagonal matrix is defined using the MATLAB function "spdiags". t = column vector of unknown temperatures. b = column vector giving right hand side of equation. am(i) multiplies t(i-1). Define am, a, ap as column vectors. a(i) multiplies t(i). ap(i) multiplies t(i+1).
am = k / dely .* ones(n,1); am(1) = 0; am(n) = 4 * k / (3 * dely); ap = am; ap(1) = 4 * k / (3 * dely); ap(n) = 0; a = - 2 * k / dely .* ones(n,1); a(1) = - 4 * k / dely; a(n) = - 4 * k / dely; b = (2 * qw * dely / (d * wbar)) .* w; b(1) = b(1) - 8 * k * tb / (3 * dely); tt = tb; b(n) = b(n) - 8 * k * tt / (3 * dely); A = spdiags([[am(2:n);0] a [0;ap(1:n-1)]], [-1 0 1], n, n); %
Solve.
t = A\b;
% Calculate dimensionless temperature, theta, mean fluid temperature, tbar, % heat transfer coefficient, and nu. tbar = w' * t * dely / (d * wbar); theta = (t - tb) ./ (tbar - tb); % h = qw / (tb - tbar); nu = h * dh / k; %
dimensionless temperature
As a check, flux must equal qw.
flux = k /(3 * dely) * (8 * tb - 9 * t(1) + t(2)); %
Plot theta versus y
theta = [0; theta; (tt - tb) / (tbar - tb)]; plot(y,theta); title('Dimensionless temperature profile','FontSize',12) xlabel('Distance from bottom, m','FontSize',12) ylabel('Temperature','FontSize',12) %
Print temperatures (dimensionless) to screen.
fprintf('Height, m fprintf('%8.5f
Dim Temperature\n') %g\n',[y; theta'])
fprintf('Number of CVs = %3.f\n', n) fprintf('Nu = %g\n', nu) fprintf('tbar, C = %g\n', tbar) fprintf('flux, W/m^2 = %g\n', flux) %
The End.