Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
isantosruiz authored Oct 3, 2020
1 parent bdb9df9 commit 18f1d83
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions moody.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ function moody(my_epsilon,my_Re,epsilon_list)
% MOODY
% MOODY(my_epsilon)
% MOODY(my_epsilon,my_Re)
% MOODY(my_epsilon,Re_list)
% MOODY(my_epsilon,my_Re,epsilon_list)
% MOODY(my_epsilon,Re_list,epsilon_list)
%
% Author:
% Ildeberto de los Santos Ruiz
% [email protected]
%
% References:
% [1] Moody, L. F. (1944), "Friction factors for pipe flow",
% Transactions of the ASME, 66 (8): 671–684
% Transactions of the ASME, 66(8): 671–684

clf
Re = logspace(2,8,1000);
Expand All @@ -37,10 +39,12 @@ function moody(my_epsilon,my_Re,epsilon_list)
min_f = 0.005;
max_f = 0.2;
if nargin > 1
my_f = friction(my_Re,my_epsilon);
plot([min_Re,my_Re],[my_f,my_f],'LineStyle','--','Color',[1,0.5,0])
plot([my_Re,my_Re],[min_f,my_f],'LineStyle','--','Color',[1,0.5,0])
plot(my_Re,my_f,'Marker','.','MarkerSize',18,'Color','red')
for i = 1:numel(my_Re)
my_f = friction(my_Re(i),my_epsilon);
plot([min_Re,my_Re(i)],[my_f,my_f],'LineStyle','--','Color',[1,0.5,0])
plot([my_Re(i),my_Re(i)],[min_f,my_f],'LineStyle','--','Color',[1,0.5,0])
plot(my_Re(i),my_f,'Marker','.','MarkerSize',12,'Color','red')
end
end
grid on
xlabel('Reynolds number, $\mathrm{Re}$','Interpreter','LaTeX','FontSize',10)
Expand All @@ -54,9 +58,9 @@ function moody(my_epsilon,my_Re,epsilon_list)
'LineStyle','--','EdgeColor',[0,0,0],'FaceColor',[0.75,0.75,0.75,0.5])
text(3000,0.011,'Critical zone','Interpreter','LaTeX',...
'Rotation',90,'VerticalAlignment','middle','HorizontalAlignment','center','FontSize',10)
text(4000,0.011,'~Turbulent flow','Interpreter','LaTeX',...
text(4000,0.011,'~Turbulent f{}low','Interpreter','LaTeX',...
'VerticalAlignment','middle','HorizontalAlignment','left','FontSize',10)
text(2000,0.011,'Laminar flow~','Interpreter','LaTeX',...
text(2000,0.011,'Laminar f{}low~','Interpreter','LaTeX',...
'VerticalAlignment','middle','HorizontalAlignment','right','FontSize',10)
yyaxis right
h = gca;
Expand Down

0 comments on commit 18f1d83

Please sign in to comment.