Tuesday, September 1, 2015

Easy and True solutions of Colebrook-White

This will be easy and true Colebrook-White solution in Excel. 

There are about six different equations for Colebrook-White. The six equations are different for different types of designs.  The first one is the maid type of Colebrook-White, but some folks have asked for different equations.  Her are the six different equations. The mode shows some numbers.

1  mode 2.51...   1/sqrt(f)=-2*Log(Rr/3.7+2.51/(Re*sqrt(f)))
2  mode 1.74...   1/sqrt(f)=1.74-2*Log(2*Rr+18.7/(Re*sqrt(f)))
3  mode 1.14...  1/sqrt(f)=1.14+2*Log(1/Rr)-2*Log(1+(9.3/(Re*Rr*sqrt(f)))
4  mode 9.35...   1/sqrt(f)=1.14-2*Log(Rr+9.35/(Re*sqrt(f)))
5  mode 3.71...   1/sqrt(f)=-2*Log(Rr/3.71+2.51/(Re*sqrt(f)))
6  mode 3.72...   1/sqrt(f)=-2*Log(Rr/3.72+2.51/(Re*sqrt(f)))

Now to compute f  not  the "1/sqrt(f)"  just add  "f=1/(" at the first and ")^2 and the end for all of the six equations.  Example of the main mode, I call  "mode 2.51" the first one. It will be...

f= 1/(-2*Log(Rr/3.7+2.51/(Re*sqrt(f))))^2  (this mode 2.51, but you can use all 6 modes)

In Excel the first Guess f number can be 1 or up to 1000, and the Guess can be changed, but the final f solution will not change.  For this test I am entering the guess in Cell B3  as 100, but 1 might save a loop. But you can change the Guess to see the changes.

The in Cell B1 enter the Rr and Cell B2 enter the Re and in Cell B3 there the Guess f.

And in Cell C4 there   =B4=B3   and it will enter True or False to the B4=B3

But enter the number of Rr and Re and for the f, enter the Cell number that is above, I said that my Guess was in Cell B3.    For this example, I am using  Rr= 0.01954 and the Re = 611,040 and the guess as 100 in cell B3

Her is the Excel picture for the first cells from A1 to C4.
  -----A------|----------B-----------------|-----C------|
1          Rr =           0.01954
2          Re =          611,040
3  Guess f =             100
4           f1 =  0.0482082215337859    FALSE
===============================================
Then below the guess enter of 100 is this, in Cell B4 ...            =1/(-2*LOG($B$1/3.7+2.51/($B$2*SQRT(B3))))^2
And C4 is....       =B4=B3   
(Note: the two $'s will not let the cope's change,  but with out the $, like the B3, it will change the f per cells copied. 

Then copy Cells B4 and C4 down to about 20 or more cells. And in Cells A4 to A23 I enter "f1=" to "f20=", but when the C cells say to TRUE then the f is right, and does not change.

          Rr =           0.01954
         Re =           611,040
 Guess f =            100
           f1=       0.0482082215337859 FALSE
           f2= 0.0482718790546499 FALSE
           f3= 0.0482718361564094 FALSE
           f4= 0.0482718361852896 FALSE
           f5= 0.0482718361852702 FALSE
           f6= 0.0482718361852702 TRUE
           f7= 0.0482718361852702 TRUE
           f8= 0.0482718361852702 TRUE
           f9= 0.0482718361852702 TRUE
         f10= 0.0482718361852702 TRUE
          f11= 0.0482718361852702 TRUE
          f12= 0.0482718361852702 TRUE
         f13= 0.0482718361852702 TRUE
         f14= 0.0482718361852702 TRUE
         f15= 0.0482718361852702 TRUE
         f16= 0.0482718361852702 TRUE
         f17= 0.0482718361852702 TRUE
         f18= 0.0482718361852702 TRUE
         f19= 0.0482718361852702 TRUE
         f20= 0.0482718361852702 TRUE

Now you can change the Rr and Re to compute the mode 2.51
But the cell B4 will change for each modes.

This will be the equations in B4 for different modes...
1 'mode 2.51   =1/(-2*Log($B$1/3.7+2.51/($B$2*sqrt(B3))))^2
2 'mode 1.74   =1/(1.74-2*Log(2*$B$1+18.7/($B$2*sqrt(B3))))^2
3 'mode 1.14 =1/(1.14+2*Log(1/$B$1)-2*Log(1+(9.3/($B$2*$B$1)*1/sqrt(B3))))^2
4 'mode 9.35   =1/(1.14-2*Log($B$1+9.35/($B$2*sqrt(B3))))^2
5 'mode 3.71   =1/(-2*Log($B$1/3.71+2.51/($B$2*sqrt(B3))))^2
6 'mode 3.72   =1/(-2*LOG($B$1/3.72+2.51/($B$2*SQRT(B3))))^2


After you enter B4 cells, then copy the B4 down to the 20 cells.

Then to test it, just compute the 1/sqrt(f) and then compute the right side of this equation using Rr and Re and f  to see if they are te same. 
1  mode 2.51...   1/sqrt(f)=-2*Log(Rr/3.7+2.51/(Re*sqrt(f)))
2  mode 1.74...   1/sqrt(f)=1.74-2*Log(2*Rr+18.7/(Re*sqrt(f)))
3  mode 1.14...  1/sqrt(f)=1.14+2*Log(1/Rr)-2*Log(1+(9.3/(Re*Rr*sqrt(f)))
4  mode 9.35...   1/sqrt(f)=1.14-2*Log(Rr+9.35/(Re*sqrt(f)))
5  mode 3.71...   1/sqrt(f)=-2*Log(Rr/3.71+2.51/(Re*sqrt(f)))
6  mode 3.72...   1/sqrt(f)=-2*Log(Rr/3.72+2.51/(Re*sqrt(f)))





Friday, June 26, 2015

The Easy and True solution to Colebrook-White in Excel

I discovered the Easy and True solution to Colebrook-White equation a long time ago. It is not an approximation, it is true to as many digits as you can compute.  In Excel you can compute 15 digits.

The Easy and True equation can be solved with the Colebrook-White Equation. It is not an "Approximation", it is a true solution.  There are two numbers. Rr and Re to enter in to the Colebrook-White equation. The solution will be the f.  The main Colebrook-White equation is

1/sqrt(f)=-2*Log(Rr/3.7+2.51/(Re*sqrt(f))) 

But the Rr can also be changed to the e/D.
================================================================

Then to computer the Colebrook-White equation in Excel...

To compute the equation, just change the 1/sqrt(f) to an X, and the right section is section 2.51/(Re*sqrt(f)) can be correctly entered as 2.51/Re*1/sqrt(f) then to use the X it will be 2.51/Re+X And the Easy and True solution will be X=-2*Log(Rr/3.7+2.51/Rr+X), Then when it X is solved the f can be solved easy.

So in Excel, just enter a guess number in a cell, (maybe 1 to 10, might be closer) and below the guess number, enter the equation =-2*Log(Rr/3.7+2.51/Rr+X) but for the X just point the Excel to the guess number, and format the equation to 15 digits.  Then copy the equation to below to about 20 cells below, and the X will be changed to the previous cell. And the loops will stop changing to 15 digits. If bottom cells are not the same, just copy the bottom cell to some more loops, but 20 cells in usually more then needed. You can change the top guess number to a closer number like the bottom solution.

Then below the bottom cell enter =1/X/X, where the X's are just pointed to the previous number. This will be the correct solution to f.   You use the f to compute...

      =1/Sqrt(f)     and the          =-2*Log(Rr/3.7+2.51/(Re*Sqrt(f))) 

you will see both computations are to the X.  This is a right computation not an approximation.  If there last digits are off some, it is because Excel could not round the last few digits right.

Then you can compute some of the approximation to find the f, and the best approximation will be the Goudar–Sonnad equation that is mostly the correct approximation. Most of the time it is right to the 15 digits, but the "e/D" is the "Rr" in the made equation.

Now if you want more than 15 digits, you can compute at this web site....      keisan.casio.com/exec/system/1380521258

Folks learned this solution was right and not an approximation in the the year 2013.  The USA does not what to publish my free correct solution, because the it would stop the selling of many approximations.

Here is a easy but true solution in Excel.

In cell A1 enter "Rr=" and in cell B1 enter "0.04" , then in cell B1 rename the cell to "Rr".
In cell A2 enter "Re=" and in cell B2 enter "5000", then in cell B2 rename the cell to "Re".

Then at cell B3 enter the name "Guess first X="  Then in cells C3 enter the guess number of "10".
Then from Cell B4 enter "Loop 1=" Then enter the cells from B5 to B23 an "Loop 2" to Loop 20"
Then in cell C4 enter  "=-2*LOG(Rr/3.7+2.51/Re*C3)" , and format the cell to 15 digits. It will give
the solution of ...   "3.600993682386060". Then copy the cell of C3 down to cell C23. And then you should notice the cells from Loop 11 to Loop 20 are the same numbers are "3.791428222675950".
Then in cell B24 type "f=", then in cell C24 enter the equation "=1/C23/C23" and the f number will be...  "0.069565565980345" Then at the top left of the cell C24, rename the C24 to f.

The in Cell C26 type... "1/sqrt(f)=" and in cell D26 type "=1/sqrt(f)" and it will show the bottom X
The in Cell C27 type... "-2*Log(Rr/3.7+2.51/(Re*sqrt(f)))" and in cell D27 type "-2*Log(Rr/3.7+2.51/(Re*sqrt(f)))" and it will show the bottom X.  Resent each of these to 15 digits.

Then you can change the Rr and Re in cells B1 and B2 and see the f will automatically compute.
When cells D26 and D27 are the same then it is right, but if the last digits are a little different then it was because Excel could not compute more than 15 digits and maybe it round the ends a little different.