Post Reply 
Civil Engineers with Experience Using the Colebrook Equation?
02-05-2021, 10:02 PM (This post was last modified: 02-05-2021 10:03 PM by MNH.)
Post: #1
Civil Engineers with Experience Using the Colebrook Equation?
Colebrook Equation
[attachment=9074]

I read that an iteration of the Colebrook Equation will test the values of 'f' that will result in the difference between the two sides to be zero or very close to zero. Also, generally three to four iterations are sufficient to converge on a reasonably good value of the friction factor. How was this conclusion reached? I've never worked with iterations before. Will a Do-While loop work well?
Find all posts by this user
Quote this message in a reply
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
02-05-2021, 10:43 PM (This post was last modified: 02-05-2021 10:44 PM by Namir.)
Post: #3
RE: Civil Engineers with Experience Using the Colebrook Equation?
Wikipoedia shows several ways to solve the equation without using iterations. Click here.

Namir
Find all posts by this user
Quote this message in a reply
02-05-2021, 10:56 PM
Post: #4
RE: Civil Engineers with Experience Using the Colebrook Equation?
Also, as the Colebrook–White Equation is iterative in nature, it's a perfect fit for the (numeric) equation solver found in most modern-ish calculators....should you not wish to write a program.

ENTER > =
Find all posts by this user
Quote this message in a reply
02-06-2021, 08:55 PM
Post: #5
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-05-2021 10:43 PM)Namir Wrote:  Wikipoedia shows several ways to solve the equation without using iterations.

I'm aware it can be done without using iterations. I was looking for an iterative approach, which you have shown me. Is that HP Prime code? Thanks for your help!
Find all posts by this user
Quote this message in a reply
02-06-2021, 09:10 PM
Post: #6
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-05-2021 10:56 PM)trojdor Wrote:  Also, as the Colebrook–White Equation is iterative in nature, it's a perfect fit for the (numeric) equation solver found in most modern-ish calculators....should you not wish to write a program.

I'm aware of such a program, however I was looking for the algorithm behind it. Thanks for your help!
Find all posts by this user
Quote this message in a reply
02-06-2021, 10:14 PM (This post was last modified: 02-06-2021 10:16 PM by toml_12953.)
Post: #7
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-05-2021 10:37 PM)Namir Wrote:  
Code:
Input Re, e, Dn,tolerance, guess for f
f = Root(f,tolerance,Re,e,Dh)

Code:
input       function parameter
_____       ______________

guess for f         f
Re                     Re
e                       e
Dn                     ?
tolerance         tolerance

What is Dh? Is that the same as Dn?

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
02-06-2021, 11:58 PM (This post was last modified: 02-06-2021 11:59 PM by C.Ret.)
Post: #8
RE: Civil Engineers with Experience Using the Colebrook Equation?
Hello everyone

What is missing here a good numerical example so that we can check assumptions or simply correctness of our computations.

Yesterday rain has fall all the day along. To avoid overflow in the installations, I had to open the valve and let charged water (sea water with decomposed biologic depots and organic mood) to flow through the canalization line (diam. 120 mm old iron coated with concrete) into the second main emergency retention basin. After 3 hours, I close the valve and notice that nearly 150 m3 of moody water stand now in the reservoir.

From your formulae, I calculate that the friction factor of the canalization is about 0.59
Is this correct ? May I suggest to my company head director to change the canalization and have easier or faster flow rate ?
Find all posts by this user
Quote this message in a reply
02-07-2021, 01:00 AM (This post was last modified: 02-07-2021 01:01 AM by paul0207.)
Post: #9
RE: Civil Engineers with Experience Using the Colebrook Equation?
This open access article lists a number of iterative methods and approximations:
What Can Students Learn While Solving Colebrook’s Flow Friction Equation?
https://www.mdpi.com/2311-5521/4/3/114

Paul
Find all posts by this user
Quote this message in a reply
02-07-2021, 04:17 AM
Post: #10
RE: Civil Engineers with Experience Using the Colebrook Equation?
I am a civil engineer with more than 40 year's consulting experience. My experience is mostly municipal infrastructure, including a lot of modeling and design of water distribution systems.

I don't use Darcy-Weisbach and Colebrook-White all that often, sticking mostly with Hazen-Williams and Manning's. When I do use Colebrook-White, I sometimes iterate (HP-41CX, HP-42S, DM-42, Excel, and Mathcad), but I mostly use an the explicit approximation equation. About two dozen explicit approximation equations have been published--some excellent, some good, some fair, and some poor--and I have my favorites. I have had a long-time interest in the explicit approximations since running across the Blasius Equation in college.

Back in 2014, I published on the PTC Mathcad forums a very thorough analysis of the explicit approximation equations I had found. Here is a link to that post: https://community.ptc.com/t5/PTC-Mathcad...m-p/450068 . The attached .zip file includes .pdf files for those who don't have Mathcad. The two worksheets (one for smooth pipe approximations and one for everything else) also solve Colebrook-White using Mathcad's solver and it's that solution that forms the basis for comparing the explicit approximations.

While the Mathcad solution won't necessarily be useful for programming a calculator, you may find the rest of the analysis useful for practical hydraulic calculations.
Find all posts by this user
Quote this message in a reply
02-07-2021, 01:05 PM
Post: #11
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-07-2021 04:17 AM)Fred Lusk Wrote:  While the Mathcad solution won't necessarily be useful for programming a calculator, you may find the rest of the analysis useful for practical hydraulic calculations.

Programming a calculator is secondary to my interest in using an iterative approach in problem solving. It's my understanding that the goal of an iterative approach is to make each side of an equation more equal to or equal to zero. In general, how many iterations are necessary to satisfy this requirement? I assume this requirement depends on what you're trying to approximate and on personal experience of what is "close enough." I want to extend this line of thinking to my line of work, surveying, in order to solve "what if" problems such as curve fitting. Thanks for responding!
Find all posts by this user
Quote this message in a reply
02-07-2021, 02:29 PM
Post: #12
RE: Civil Engineers with Experience Using the Colebrook Equation?
My "ABC-method" from my university years (yes, I was VERY proud for my 12 steps fixed point iterative method Big Grin ) - check the attached picture.

I made a quick English printout with an example to show how fast the iteration is. There is no any accuracy checking and the program makes one step only, because these calculators had only few dozens of memory.

Typically the first three-four iteration is good enough.

You must to know this formula is used for pipe flows where the cross section fullfilled with fluid. Rule of thumb: for water f=0.025 is a good approximation and f=0.02 ... 0.03 range is typically OK, your 0.59 is too high. You made a mistake during calculation or used non-consistent units, maybe Reynolds-number calculated with wrong viscosity (kinematic vs. dynamic), etc...

Csaba
(a fluid flow mechanical engineer)

   
Find all posts by this user
Quote this message in a reply
02-07-2021, 02:54 PM (This post was last modified: 02-07-2021 03:09 PM by C.Ret.)
Post: #13
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-07-2021 02:29 PM)Csaba Tizedes Wrote:  My "ABC-method" from my university years (yes, I was VERY proud for my 12 steps fixed point iterative method Big Grin ) - check the attached picture.

Efficient ABC-method ! Thanks for the numerical example you provide.
My own full personal HP-28'Solver-method is 100% in agreement with your numeric result.

I must admit that entering the formulae in the HP-28S solver equation need more than 12 keystrokes. But this is the cost to pay for a more readable display and a full equation solver environment.
Estimating f is no more complicated than entering all the parameter by pressing corresponding labels and then a final pression on [shift]( f ) soft menu key to get the numeric result in a flash !

C.Ret
(Biochemist)
Find all posts by this user
Quote this message in a reply
02-07-2021, 04:56 PM (This post was last modified: 02-10-2021 02:19 PM by Albert Chan.)
Post: #14
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-07-2021 02:29 PM)Csaba Tizedes Wrote:  My "ABC-method" from my university years (yes, I was VERY proud for my 12 steps fixed point iterative method Big Grin )

This can be made more efficient by letting x = -A/2 = -0.5/√f

A := log10(1/(B+C*A)^2)       → (-A/2) = log10(B - (2C)*(-A/2))

x = log10(b - c*x)
f = 0.25/x^2

Redoing the same example:

lua> eps, D, Re = 0.2, 105, 178500
lua> b = eps/(3.7*D)
lua> c = 5.02/Re

lua> x0 = -3 -- guess
lua> x1 = log10(b-c*x0) --> x1 = -3.2224497491569166
lua> x2 = log10(b-c*x1) --> x2 = -3.2179387367766976
lua> x3 = log10(b-c*x2) --> x3 = -3.218029750749086
lua> 0.25 / x3^2 --> f3
0.02414125808712503

Fixed point iterations might converge very slowly, or not at all.
We can improve convergence by putting a weight on it.

lua> r = (x2-x3)/(x1-x2) -- rate of spiral ≈ -0.02
lua> w = 1/(1-r)             -- weight ≈ 0.98
lua> x = x3
lua> x = x + (log10(b-c*x) - x)*w --> x4 = -3.2180279505869267
lua> x = x + (log10(b-c*x) - x)*w --> x5 = -3.2180279505905083 (converged)
lua> 0.25 / x^2 --> f
0.02414128509627824

Update: we can also visualize w = 1/slope of 2 points, (x1, x2-x1), (x2, x3-x2)
Since log10(b-c*x) is locally very flat, (log10(b-c*x) - x)' ≈ -1/w = r-1
Weighted iterations thus similar to Newton's method, but with constant slope.

see https://www.hpmuseum.org/forum/thread-12...#pid125977
Find all posts by this user
Quote this message in a reply
02-07-2021, 05:17 PM
Post: #15
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-07-2021 04:56 PM)Albert Chan Wrote:  This can be made more efficient (...) Fixed point iterations might converge very slowly, or not at all.

There is always a better solution and improved methods, but as an engineer I can decide it is converges or not (because I have experience which values right and which aren't) and 12 steps are really efficient. After three steps it converges for three significant figures which is good enough for a pressure drop calculation.

But, OK, new methods are always welcome. Smile

In the evolution's tree the engineers and scientist sits on different branch and that is so right Big Grin otherwise nothing would ever be built Wink

Csaba
Find all posts by this user
Quote this message in a reply
02-08-2021, 05:56 PM
Post: #16
RE: Civil Engineers with Experience Using the Colebrook Equation?
Here is another way, by shifting iterations to W(exp(x)).
Argument inside W might be huge, we combine W(exp(x)) ≡ Wexp(x)

w*e^w = e^x       → w + ln(w) = x

If x → +∞, (x-ln(x)) + ln(x-ln(x)) ≈ x-ln(x)+ln(x) = x
If x → −∞, (e^x) + ln(e^x) ≈ 0 + x = x

We use these 2 asymptotic solutions for guess of W(e^z).
Code:
function Wexp(x)
    local w = x<0.3442 and exp(x) or x-log(x)
    repeat
        local f = w + log(w) - x
        local fp = 1 + 1/w
        local h = -f/(fp + f/(2*fp*w*w))
        w = w + h       -- Halley's correction
    until w + h*h == w
    return w            -- W(e^x)
end

Colebrook Equation:

x = log10(b-c*x) = ln(b-c*x)/ln(10),       where b = eps/(3.7*D), c = 5.02/Re, x = -0.5/√f

Let X = x*ln(10), C = c/ln(10), B = b/C, we have:

X = ln(C*(B-X))
B-X = B - (ln(C) + ln(B-X)) = W(e^(B-ln(C)))

Redo previous example:

lua> eps, D, Re = 0.2, 105, 178500
lua> C = 5.02/(log(10)*Re)   --> C = 1.2213771984057835e-005
lua> B = eps/(3.7*D*C)       --> B = 42.14918335404198
lua> X = B - Wexp(B-log(C))  --> X = -7.4097831878678875
lua> f = (0.5*log(10)/X)^2   --> f = 0.024141285096278223
Find all posts by this user
Quote this message in a reply
02-14-2021, 05:11 PM (This post was last modified: 02-14-2021 05:13 PM by armandine2.)
Post: #17
RE: Civil Engineers with Experience Using the Colebrook Equation?
(02-05-2021 10:02 PM)MNH Wrote:  Colebrook Equation

I note, going to my Massey (1989) Mechanics of Fluids 6th Ed [see pages 278, 199-200], that f and lamda are related: lambda = 4f.

And Massey's Colebrook formula is different: -4 for the -2 and numerator 1.26 for the 2.51.
Find all posts by this user
Quote this message in a reply
Post Reply 




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