Skip to content

Commit e62f3df

Browse files
authored
New code used in revised manuscript
1 parent 26a4f7f commit e62f3df

File tree

5 files changed

+311
-0
lines changed

5 files changed

+311
-0
lines changed

clean_circular_turb_jokhul.m

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
% Heat equation in radial coordinates (circular pipe) to understand Nusselt number in turbulent flow
2+
% Can set up for heated walls or with internal dissipation profile
3+
4+
clear all
5+
close all
6+
7+
Re_list=[1000000];
8+
Nu_list=zeros(size(Re_list));
9+
for Rei=1:length(Re_list)
10+
11+
r0=0.2; % Pipe radius (m)
12+
13+
% Typical 0 deg conditions used in ice sheet subglacial modeling
14+
k=0.558; % Thermal conductivity of water (W/m/K)
15+
cw=4.22e3; %specific heat capacity of water (J/kg/K)
16+
mu=1.787e-3; % Dynamic viscosity of water at 0 degC (Pa s)
17+
18+
rhow=1000; % Density of water (kg/m3)
19+
kappa=k/(rhow*cw); % Thermal diffusivity
20+
nu=mu/rhow; % Kinematic viscosity (m2/s)
21+
22+
Q=1; % Set to 0 to turn off internal heat generation, 1 for internal dissipation
23+
24+
dr=0.00001*r0;
25+
J=ceil(r0/dr+1);
26+
z=0:dr:r0;
27+
28+
% Get velocity profile
29+
y=0:dr:r0;
30+
Re=Re_list(Rei); % Prescribe bulk Reynolds number
31+
vonK=0.4; % Von Karman constant
32+
B=5; % Constant to use in log-law
33+
Cf=fzero(@(Cf) -sqrt(2/Cf)+1/vonK*log(Re*sqrt(Cf)/2/sqrt(2))-1/vonK+B,0.009); % Friction factor (from log-law, A/A eqn 1.5)
34+
u_b=Re*nu/(2*r0); % Bulk mean velocity -- A/A uses 2h, where h is half-width, but Re should depend on hydraulic radius?
35+
tau_w=Cf*rhow*u_b^2/2; % Wall shear stress
36+
u_tau=(tau_w/rhow)^0.5; % Friction velocity (inner velocity scale)
37+
yplus=y.*u_tau./nu; % Non-dimensional y coordinate near wall
38+
39+
uplus(yplus<=20)=yplus(yplus<=20)-1.2533e-4*yplus(yplus<=20).^4+3.9196e-6.*yplus(yplus<=20).^5; % Velocity smooth profile (transition at yplus=20)
40+
uplus(yplus>20)=1/vonK*log(yplus(yplus>20))+B; % Log-layer
41+
u=flip(uplus)'.*(u_tau);
42+
43+
ub=2/r0^2*trapz(u.*z')*dr; % Mean bulk velocity for circular pipe
44+
45+
% Dissipation profile (based on Abe and Antonia, missing interior portion)
46+
% depth-integrated E=<epsilon_bar>+<nu*(du/dz)^2>=(2.54.*log(yplus)+2.41).*u_tau^3;
47+
% eps here epsilon_bar, NOT depth-integrated!
48+
outer=find((r0-abs(z))/r0>0.2);
49+
eps(outer)=(2.45./((r0-abs(z(outer)))./r0)-1.7).*u_tau^3/r0;
50+
inner=find((r0-abs(z))/r0<=0.2);
51+
eps(inner)=(2.54./((r0-abs(z(inner)))./r0)-2.6).*u_tau^3/r0;
52+
% Inner portion of dissipation function (very near wall)
53+
hplus=u_tau*r0/nu;
54+
[ii,jj]=find(abs(y/r0-30/hplus)==(min(abs(y/r0-30/hplus))));
55+
wall=find((r0-abs(z))/r0<30/hplus);
56+
eps(wall)=eps(min(wall)-1);
57+
58+
% % Get eddy diffusivity
59+
tau=tau_w.*z./r0; % Laminar shear stress distribution - linear
60+
nu_T=-(tau(1:end-1)+tau(2:end))./2./(rhow.*diff(u')./dr)-nu; % Eddy viscosity (at half-nodes)
61+
nu_T(nu_T<0)=0;
62+
kappa_T=nu_T; % Eddy diffusivity from Reynolds' analogy (at half-nodes)
63+
64+
dx=r0;
65+
nx=5000/dx; % Number of x steps (iterations)
66+
67+
z_half=(z(1:end-1)+z(2:end))./2; % Half-node radial coordinates
68+
alpha=(kappa+kappa_T').*dx./dr'.^2.*z_half';
69+
70+
% Define vectors (coefficients for interior nodes)
71+
aconst=-alpha./2./z(2:end)';
72+
bconst=(u(2:end-1)+alpha(2:end)./2./z(2:end-1)'+alpha(1:end-1)./2./z(2:end-1)');
73+
cconst=-alpha./2./z(1:end-1)';
74+
75+
% Build a,b,c,r vectors
76+
a=[0;aconst];
77+
b=[0;bconst;0];
78+
c=[cconst;0];
79+
r=zeros(J,1);
80+
81+
% Boundary condition at pipe center (symmetry condition)
82+
% Type II at z=0 (no-flux)
83+
a(1)=0;
84+
b(1)=-1;
85+
c(1)=1;
86+
r(1)=0;
87+
88+
89+
if Q==0 % Type I at wall (heated)
90+
a(J)=0;
91+
b(J)=1;
92+
c(J)=0;
93+
r(J)=1;
94+
end
95+
96+
if Q==1 % Type I at wall (T=0)
97+
a(J)=0;
98+
b(J)=1;
99+
c(J)=0;
100+
r(J)=0;
101+
end
102+
103+
% % Type II at top (no-flux)
104+
% a(J)=-1;
105+
% b(J)=1;
106+
% c(J)=0;
107+
% r(J)=0;
108+
109+
% Initial condition u(x,0)=0
110+
T=2*ones(J,1);
111+
112+
T_CN=[]; % Pre-allocate matrix to store plot values for each t
113+
114+
% Loop through distance along x
115+
for it=1:nx
116+
117+
% Interior nodes
118+
r(2:J-1)=alpha(1:end-1)./2./z(2:end-1)'.*T(1:J-2)+(u(2:J-1)-alpha(1:end-1)./2./z(2:end-1)'-alpha(2:end)./2./z(2:end-1)').*T(2:J-1)+alpha(2:end)./2./z(2:end-1)'.*T(3:J)+...
119+
Q/rhow/cw*dx.*(eps(2:J-1)'.*rhow+mu.*((u(3:J)-u(1:J-2))./dr).^2);
120+
121+
122+
Tnext=thomas(a,b,c,r);
123+
T=Tnext';
124+
% Tbar(it)=trapz(T)*dr/r0;
125+
Tbar(it)=2/(ub*r0^2)*trapz(u.*T.*z')*dr;
126+
127+
% Save to plot for selected downstream distances
128+
if it*dx==1 | it*dx==5 | it*dx==10 | it*dx==20 | it*dx==50 | it*dx==100
129+
T_CN=[T_CN T];
130+
end
131+
132+
% % Brinkman number
133+
Br_lam(it)=mu.*ub.^2./(k.*(T(end)-Tbar(it)));
134+
Phi=2*pi.*((mu*trapz(((u(2:J)-u(1:J-1))'./dr).^2.*(z(2:J)+z(1:J-1))/2))+trapz(eps.*z)*rhow)*dr;
135+
h_coeff=Phi/(2*pi*r0*(Tbar(end)-T(J)));
136+
Br(it)=Phi./(2*h_coeff*(2-T(J)));
137+
138+
139+
end
140+
141+
% Plotting - turn off for timing in problem 3
142+
figure(1)
143+
hold on
144+
plot(T_CN,z./r0,'--','linewidth',1.2)
145+
% axis([0 1 0 1])
146+
legend('x=0.01','x=0.1','x=0.2','x=0.5','x=1','x=2','x=5','x=10','x=20','x=50','x=100','x=200','x=500','x=1000')
147+
xlabel('T')
148+
ylabel('r/r_{0}')
149+
150+
figure(2);hold on;
151+
x=(0:(nx-1)).*dx;
152+
plot(x./r0,log(Tbar-T(end)),'linewidth',2);
153+
xlabel('x/r_0','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
154+
155+
if Q==0 % For wall-heating case
156+
p=polyfit(x,log(T(end)-Tbar),1);
157+
Nu=-p(1)*rhow*cw*u_b*r0^2/k;
158+
elseif Q==1 % For internal dissipation case -- with constant T=0 walls
159+
Phi=2*pi.*((mu*trapz(((u(2:J)-u(1:J-1))'./dr).^2.*(z(2:J)+z(1:J-1))/2))+trapz(eps.*z)*rhow)*dr;
160+
h_coeff=Phi/(2*pi*r0*(Tbar(end)-T(J)));
161+
Nu=h_coeff*2*r0/k;
162+
end
163+
164+
% Comparison with Siegel and Sparrow for internal heat generation (fig. 2)
165+
% -- make sure to set wall b.c. as no-flux for comparison
166+
SS=(T(J)-Tbar(end))./(Q*r0^2/k); % Siegel and Sparrow, fig. 2
167+
168+
% Plot Brinkman number
169+
figure(3);hold on;plot(x./r0,Br)
170+
xlabel('x/r_0','fontsize',14);ylabel('Brinkman number')
171+
172+
% Plot non-dimensional Brinkman
173+
figure(4);hold on;plot(x./r0,log((Tbar-T(J))./(2-T(J))),'linewidth',2)
174+
xlabel('x/r_0','fontsize',14);ylabel('ln((T_b-T_w)/(T_0-T_w))','fontsize',14)
175+
176+
end
177+
178+
179+
180+
181+
182+
183+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
clear all;close all
2+
3+
4+
% Circular pipe flow - wall heating - matches well with D-B correlation
5+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
6+
Nu=[89.2587 165.3526 236.3955 304.3768 370.2091 434.4064 497.2896 559.0866 619.9480 680.0172 1.2511e+03 1.7895e+03 2.3086e+03 2.8093e+03 4.0257e+03 5.1997e+03]; % With finer mesh, from circular_heatedwalls_data
7+
Pr=13.5146;
8+
% figure(1);hold on;plot(Re,Nu,'-o','linewidth',2)
9+
figure(1);semilogx(Re,Nu,'-o','linewidth',2)
10+
11+
% Circular pipe flow with internal dissipation with Abe/Antonia dissipation profile - epsilon*rhow in Phi
12+
% calculation (compare Phi/rhow with E) - WITH NEAR-WALL EPSILON (CONSTANT from y/h<30/hplus)
13+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
14+
Nu=[43.3028 85.510 126.5970 166.9143 206.6587 245.9381 284.8349 323.4069 361.6920 399.7326 763.6548 1.1172e+03 1.4616e+03 1.8287e+03 2.6788e+03 3.5119e+03]; % With finer mesh, from circular_dissipation_data
15+
% figure(1);hold on;plot(Re,Nu,'-o','linewidth',2)
16+
figure(1);hold on;semilogx(Re,Nu,'-o','linewidth',2)
17+
18+
Pr=13.5146;
19+
Re2=10000:10000:1000000;
20+
DB=0.024.*Re2.^0.8.*Pr^0.4;
21+
Re2=10000:10000:1000000;
22+
figure(1);hold on;semilogx(Re2,DB,'--','linewidth',2)
23+
24+
Gni=0.012.*(Re2.^0.87-280).*Pr^0.4;
25+
figure(1);semilogx(Re2,Gni,'--','linewidth',2)
26+
27+
figure(1);set(gca,'FontSize',18)
28+
axis([10000 1000000 0 6000])
29+
xlabel('Re');ylabel('Nu');
30+
legend('Heated Walls','Dissipation','Dittus-Boelter','Gnielinski')

plot_ReNu_combined_2020revisions.m

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
clear all;close all
2+
3+
% Circular pipe flow - wall heating - matches well with D-B correlation
4+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
5+
Nu=[89.2587 165.3526 236.3955 304.3768 370.2091 434.4064 497.2896 559.0866 619.9480 680.0172 1.2511e+03 1.7895e+03 2.3086e+03 2.8093e+03 4.0257e+03 5.1997e+03]; % With finer mesh, from circular_heatedwalls_data
6+
Pr=13.5146;
7+
figure(1);semilogx(Re,Nu,'-o','linewidth',2)
8+
9+
% Circular pipe flow with internal dissipation with Abe/Antonia dissipation profile - epsilon*rhow in Phi
10+
% calculation (compare Phi/rhow with E) - WITH NEAR-WALL EPSILON (CONSTANT from y/h<30/hplus)
11+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
12+
Nu=[43.3028 85.510 126.5970 166.9143 206.6587 245.9381 284.8349 323.4069 361.6920 399.7326 763.6548 1.1172e+03 1.4616e+03 1.8287e+03 2.6788e+03 3.5119e+03]; % With finer mesh, from circular_dissipation_data
13+
figure(1);hold on;semilogx(Re,Nu,'-o','linewidth',2)
14+
15+
% Restart color order
16+
ax = gca;
17+
ax.ColorOrderIndex = 1;
18+
19+
% Channel flow - wall heating
20+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
21+
Nu=[162.4 304.0 436.5 563.6 686.8 807.1 925.0 1041 1155.3 1268.1 2.3430e+03 3.3585e+03 4.3391e+03 5.2859e+03 7.5885e+03 9.8136e+03]; % With finer mesh, from channel_heatedwalls_data
22+
23+
figure(1);hold on;semilogx(Re,Nu,'-.x','linewidth',2)
24+
25+
% Channel flow - with Abe/Antonia dissipation profile - epsilon*rhow in Phi
26+
% calculation (compare Phi/rhow with E) - WITH NEAR-WALL EPSILON (CONSTANT from y/h<30/hplus)
27+
Re=[10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 200000 300000 400000 500000 750000 1000000];
28+
Nu=[91.1845 178.9022 264.1219 347.7000 430.0565 511.4583 592.0762 672.0347 751.4468 830.0000 1.5861e+03 2.3193e+03 3.0395e+03 3.8071e+03 5.5886e+03 7.3389e+03]; % With finer mesh, from AA_dissipationintegral_data
29+
E=[0.0026 0.0173 0.0530 0.1176 0.2186 0.3632 0.5580 0.8099 1.1253 1.5105];
30+
Phi=[4.98 33.29 101.75 224.15 415.74 684.34 1048 1512.7 2097.6 2794.3];
31+
figure(1);semilogx(Re,Nu,'-.x','linewidth',2)
32+
figure(1);set(gca,'FontSize',18)
33+
axis([10000 1000000 0 10000])
34+
xlabel('Re');ylabel('Nu');
35+
legend('Circular conduit - heated walls','Circular conduit - dissipation','Sheet - heated walls','Sheet - dissipation')

plot_fig11a.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
% Plot Figure 11
2+
clear all;close all;
3+
4+
load Re1e5_jokhul_r2.mat
5+
6+
figure(2);hold on;
7+
x=(0:(nx-1)).*dx;
8+
plot(x(1:nx/2),log(Tbar(1:nx/2)-T(end)),'linewidth',2);
9+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
10+
11+
clear all;load Re1e5_heatedwalls_r2.mat
12+
figure(2);hold on;
13+
x=(0:(nx-1)).*dx;
14+
plot(x(1:nx/2),log(Tbar(1:nx/2)-T(end)),'--','linewidth',2);
15+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
16+
17+
clear all;load Re1e5_dissipation_r2.mat
18+
figure(2);hold on;
19+
x=(0:(nx-1)).*dx;
20+
plot(x(1:nx/2),log(Tbar(1:nx/2)-T(end)),'--','linewidth',2);
21+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
22+
23+
figure(2);legend('T_0=2 case','Heated wall case','Dissipation case','fontsize',14)
24+
% title('Re=10^6','fontsize',16)

plot_fig11d_smallr0.m

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
% Plot Figure 11
2+
clear all;close all;
3+
4+
load Re1e4_jokhul_r2.mat
5+
figure(2);hold on;
6+
x=(0:(nx-1)).*dx;
7+
plot(x(1:15000),log(Tbar(1:15000)-T(end)),'linewidth',2);
8+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
9+
10+
clear all
11+
load Re5e4_jokhul_r2.mat
12+
figure(2);hold on;
13+
x=(0:(nx-1)).*dx;
14+
plot(x(1:15000),log(Tbar(1:15000)-T(end)),'linewidth',2);
15+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
16+
17+
clear all
18+
load Re1e5_jokhul_r2.mat
19+
figure(2);hold on;
20+
x=(0:(nx-1)).*dx;
21+
plot(x(1:15000),log(Tbar(1:15000)-T(end)),'linewidth',2);
22+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
23+
24+
clear all
25+
load Re5e5_jokhul_r2.mat
26+
figure(2);hold on;
27+
x=(0:(nx-1)).*dx;
28+
plot(x(1:15000),log(Tbar(1:15000)-T(end)),'linewidth',2);
29+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
30+
31+
clear all
32+
load Re1e6_jokhul_r2.mat
33+
figure(2);hold on;
34+
x=(0:(nx-1)).*dx;
35+
plot(x(1:15000),log(Tbar(1:15000)-T(end)),'linewidth',2);
36+
xlabel('x (m)','fontsize',14);ylabel('ln(T_b-T_w)','fontsize',14)
37+
38+
figure(2);legend('Re=10^4','Re=5x10^4','Re=10^5','Re=5x10^5','Re=10^6','fontsize',14)
39+
% title('Re=10^6','fontsize',16)

0 commit comments

Comments
 (0)