moody chart, m-file for finding friction factor using equation

1
M-File for finding Friction factor using equation rough = input('Enter Relative Roughness '); re = input ('Enter Reynolds number '); fst = 0; f = 0.008; while f ~= fst disp (' Assumed value for trial and error ') disp (f) fst = f; int1 = 2 * log10(1 / rough); int2 = (9.3 /(re * rough * sqrt(fst))); int3 = 2 * log10(1 + int2); int4 = 1.14 + int1 - int3; f = (1 / int4)^2; end disp (' Final value of friction factor ') f Programmed by: Danial Sohail Mechanical Engineering Department NED University of Engineering and Technology

Upload: danial-sohail

Post on 21-Jul-2015

34 views

Category:

Engineering


6 download

TRANSCRIPT

Page 1: Moody chart, M-File for finding Friction factor using equation

M-File for finding Friction factor using equation

rough = input('Enter Relative Roughness ');

re = input ('Enter Reynolds number ');

fst = 0;

f = 0.008;

while f ~= fst

disp (' Assumed value for trial and error ')

disp (f)

fst = f;

int1 = 2 * log10(1 / rough);

int2 = (9.3 /(re * rough * sqrt(fst)));

int3 = 2 * log10(1 + int2);

int4 = 1.14 + int1 - int3;

f = (1 / int4)^2;

end

disp (' Final value of friction factor ')

f

Programmed by:

Danial Sohail

Mechanical Engineering Department

NED University of Engineering and Technology