📄 moodyfpf.m
字号:
%% DIAGRAMA DE MOODY
% Este m-file genera el diagrama de moody utilizando la ecuacion de
% Colebrook calculada utilzando el metodo del punto fijo.
% Universidad Nacional de Colombia, sede Manizales
% Departamento de Ingenier韆 Qu韒ica
% Programa de pregrado en Ingenier韆 Qu韒ica
% Curso de metodos numericos aplicados a la ingenieria quimica
% Autor: Luis F. Id醨raga Arana 0307026
%% Ajustes del 醨ea del gr醘ico
close all,hold on,axis([600 1e8 0.002 0.025]),pbaspect([35,22,1])
patch([2.1e3 2.6e3 3.2e3 3.2e3 3.45e3 3.45e3 4.2e3 4.2e3 3.45e3 3e3...
2.66e3 2.5e3 2.25e3 2.1e3],[16/2.1e3 16/2.6e3 16/2.6e3 16/2e3...
0.00875 16/1.6e3 0.01225 0.0195 0.017625 0.0125 0.012 0.008125...
0.008 16/2.1e3],[.769531 0.714844 0.703125],'edgecolor','none')
set(gca,'xscale','log','yscale','log','fontsize',10,...
'DefaultTextFontSize',10,'fontname','Times','box','on')
set(gcf,'color','w','name','Diagrama de Moody','numbertitle','off',...
'menubar','none')
xlabel('Numero de Reynolds, \itRe_d')
ylabel('Factor de fricci髇 de Fanning, \itf')
text(2.1e8,0.007,['Rugosidad relativa' ', $\frac{\epsilon}{d}$'],...
'interpreter','latex','rotation',90,'HorizontalAlignment',...
'center','fontname','Times','fontsize',13)
title('DIAGRAMA DE MOODY','FontWeight','b','fontsize',14)
%% Grilla logaritmica
% reng=numeros de reynold para la grilla
% fag:Factores de friccion para la grilla
spaa=logspace(2,8,7);
reng=sort([ 1.5*spaa 2*spaa 2.5*spaa 3*spaa 3.5*spaa 4*spaa 5*spaa...
6*spaa 7*spaa 8*spaa 9*spaa]);
line([reng;reng],[0.002 0.025],'color',[.4219 .8086 .9609])
line([spaa;spaa],[0.002 0.025],'color',[.5742 .582 .5938])
for i=1:length(spaa)-1
for i2=1:9
if (i2*spaa(i)>=600)&&(i2~=7)&&(i2~=9)&&(i2~=1)
text(i2*spaa(i),0.0019,num2str(i2),'horizontalAlignment',...
'center')
end
end
end
fag=[0.002 0.00225 0.0025:0.00125:0.00625 0.0075:0.0025:0.025];
for i=1:length(fag)
text(600,fag(i),num2str(fag(i)),'horizontalalignment','right',...
'fontsize',8)
end
fagn=[0.002:1.25e-4:.002375 0.0025:0.00025:0.00725 0.0075:0.0005:0.0145...
0.015 0.01625 0.0175 .0183333 .01916666666 0.02:0.00125:0.025];
for ino=1:length(fagn)
if ((mean(fagn(ino)~=fag))==1)
col=[.4219 .8086 .9609];
else
col=[.5742 .582 .5938];
end
line([600 1e8],[fagn(ino) fagn(ino)],'color',col)
end
line([600 1e8],[0.0225 0.0225],'color',col)
%% Curvas de rugosidad para regimen laminar y turbulento
% Rl: Flujo laminar
% rc: Zona critica
% Rey: Flujo turbulento
% rug: Rugosidades relativas
% f: factor de fricci髇 Fanning para la zona de transicion y turbulenta
% ini: numeros de reynold para inicio de las curvas de rugosidad
% f0: aproximaci髇 inicial
Rl=[100:2100];
rc=[2100:4e3];
plot(Rl,16./Rl,'LineWidth',1.5,'color',[0 0.6797 0.9336])
plot(rc,16./rc,'--','LineWidth',1.5,'color',[0 0.6797 0.9336])
Rey=2.1*logspace(3,8,300);
ini=[4e3 ones(1,7)*3.5e3 3e3 3.5e3 3e3 1.9e4 1.25e4 6e3 1.6e4 4e4 6e4...
3e3 1.5e6 3.5e6 2e5 ];
rug=[0.05 0.04 0.03 0.02 0.015 0.01 0.008 0.006 0.004 0.002 0.001,...
0.0008 0.0006 0.0004 0.0002 0.0001 0.00005 0.00001 5e-6 1e-6 0 ];
f=zeros(1,length(Rey));
for irr=1:length(rug)
for ire=1:length(Rey)
f(ire)=fanning2(rug(irr),Rey(ire));
end
plot(Rey(Rey>=ini(irr)),f(Rey>=ini(irr)),'LineWidth',1.5,'color',...
[0 0.6797 0.9336]);
if rug(irr)>9e-6
text(1.01e8,fanning2(rug(irr),1e8),num2str(rug(irr)))
end
end
%% Etiquetas del gr醘ico
fm=0.022;
text(1150,fm,{'Flujo','laminar'},'HorizontalAlignment','center',...
'BackgroundColor','w')
text(2.84e3,fm,{'Zona','cr韙ica'},'HorizontalAlignment','center',...
'BackgroundColor','w')
text(6.7e3,fm,{'Zona de','transici髇'},'HorizontalAlignment','center',...
'BackgroundColor','w')
text(2.1e3,fm,'\rightarrow','HorizontalAlignment','right',...
'FontWeight','b','fontsize',12)
text(2.1e3,fm,'\leftarrow','FontWeight','b','fontsize',12)
text(1.3e6,fm,{'Flujo completamente turbulento'},...
'HorizontalAlignment','center','BackgroundColor','w')
text(4e3,fm,'\rightarrow','HorizontalAlignment','right','FontWeight',...
'b','fontsize',12)
text(4e3,fm,'\leftarrow','FontWeight','b','fontsize',12)
text(1e4,fm,'\rightarrow','HorizontalAlignment','right','FontWeight',...
'b','fontsize',12)
text(1e4,fm,'\rightarrow','horizontalalignment','right','FontWeight',...
'b','fontsize',12)
text(1e4,fm,'\leftarrow','FontWeight','b','fontsize',12)
%________________________________________________________________________
% para guardar: saveas(gcf,'moody.bmp')
% esquema de colores tomado de Shaughnessy, Edward J.
% Introduction to fluid mechanics
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -