Post Reply 
Civil Engineers with Experience Using the Colebrook Equation?
02-05-2021, 10:37 PM (This post was last modified: 02-05-2021 10:38 PM by Namir.)
Post: #2
RE: Civil Engineers with Experience Using the Colebrook Equation?
Code:
function fx(f,Re,e,Dh)
  s = sqrt(f)
  return 1/s + 2*log10(e/3.7/Dh+2.51/Re/s)

function Root(f,tolerance,Re,e,Dh)
  diff = 2* toler
  while abs(diff)>tolerance
    h = 0.01 * (1 + abs(f))
    f0 = fx(f,Re,e,Dh)
    diff = h * f0 / (fx(f+h,Re,e,Dh) - f0)
    f = f - diff
  end while
  return f
 
## Main program here 
Input Re, e, Dn,tolerance, guess for f
f = Root(f,tolerance,Re,e,Dh)
display f
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Civil Engineers with Experience Using the Colebrook Equation? - Namir - 02-05-2021 10:37 PM



User(s) browsing this thread: 1 Guest(s)