Info:
When the f is own both sides of the equation, but one is in a Log, then f can be solved. To solve it easily, let 1/Sqrt(f) be X. Rr is the relative roughness, (which is the actual roughness divided by the inside diameter) and Re is the Reynolds Number. Make A=Rr/3.7 and B=2.51/Re, then X= -2*Log(A+B*X). Use X=3 (or any number you want to test, different starting number will still always solve it). For the first loop use the selected X to solve the right side for a new X. After about 7 loops the X will stop changing to the number of decimals in your calculator. Then f will be 1 divided by X squared. To check, compute both sides with the f, and you will see both sides for the main equation will equal the X. So the f is right to as many decimals as your calculator can figure. This method has been shared with the whole world for 4 years, and everyone has found it to be correct.
To test this method before learning it, you can see the very bottom to completely test my method from the country of Japan! / Harrell
The Colebrook-White equation written in Excel is....
1/sqrt(f) = -2* Log(Rr/3.7+ 2.51/Re*1/sqrt(f))
Where Rr is the relative roughness, (which is the actual roughness divided by the inside diameter) and Re is the Reynolds Number. I can solve this. I will show you how in a simple way. Let's call the "1/sqrt(f)", X at first, then solve for X. ("TRUE" means 14 or 15 digits because Excel will only go that far. If your program can go 100 or 1000 digits, this solution will prove that many digits.)
X = -2* Log(Rr/3.7+ 2.51/Re*X)
When we find the true X, we can solve for f, which is the Darcy Friction Factor.
Example: (in an Excel worksheet)
Enter Rr in cell D1 as 0.015Enter Re in cell D2 as 200,000
Enter an initial value of X in cell D5 as 3 (or you may use a large number to see the initial X still works. Example 1000, but it might take an extra loop)
Enter this equation in the cell D6 for the next X....
=-2*Log(D$1/3.7+2.51/D$2*D5) For Cell D6, you should have 4.78, but reformat to "Number, 15 decimals".
It should then be... 4.776191571199940 if you type the equations and variables right, if you started with 3. (if you started with 1000, it would be 3.559571722914280, which will take one extra loop.)
In Cell E6 type... =D6=D5 . It will say "False", meaning "Not Solved" which means this X is not right yet. Copy cells D6 and E6 and paste into cells from D7 to E25. Cell E12 will say now say "TRUE" for 15 decimals.
You should know this about copying and pasting Excel equations, the variable that says D5 (without the $) increases to the next cell. So that D5 converts to D6, D7, D8, etc. as it is pasted down. So the value of the equation is used as the next X in the next equation.
Into cell D26 write the equation =1/D25^2 and that will be.. 0.043923090770254 , which is the Darcy F friction factor to 15 decimals!!
You can change that initial value of 3 to 1000 and you will see the DarcyF does not change, it may only take one step more to compute X. Also you change the Rr and Re for different solutions. If you are experienced in Excel you should be able move the computations around. Also you can compare this TRUE DarcyF to other approximations and see how close they are.
If you want to test this method for thousands of variables, change
D1 to =RANDBETWEEN(2500,10000000)
D2 to =RANDBETWEEN(4,5000)/100000)
then press or press and hold F9
If you to know the actual roughness and internal diameter, instead of relative roughness then divide the actual roughness by the inside diameter (in same units) to know the "relative" roughness, (Rr).
The Goudar–Sonnad method is good, it averages 14.9 of 15 correct decimal places. The Serghides's approximation averages 14.8 correct decimal places. But Haaland's method only average 2 correct decimals. Other approximations methods average from 3 to 7 correct decimal places.
==============================================================
This is the example....(showing row numbers on far left)...(blue is just notes)
1 Rr= 0.015 D1
2 Re= 200,000 D2
3 False means the right side of the equation is not equal to the left side
4
5 Initial X = 3 put in cell D5
6 4.776191571199940 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D5)
7 4.771472426404240 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D6)
8 4.771484930741390 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D7)
9 4.771484897608350 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D8)
10 4.771484897696150 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D9)
11 4.771484897695920 FALSE =-2*LOG(D$1/3.7+2.51/D$2*D10)
12 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D11)
13 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D12)
14 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D13)
15 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D14)
16 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D15)
17 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D16)
18 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D17)
19 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D18)
20 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D19)
21 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D20)
22 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D21)
23 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D22)
24 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D23)
25 4.771484897695920 TRUE =-2*LOG(D$1/3.7+2.51/D$2*D24)
26 DarcyF 0.043923090770254 =1/D25^2
=======================================================
On an average of random values of Re and Rr, the funnel will take you to an accuracy of 15 decimal places in seven loops for any of the different Colebrook equations. But for some values of Re and Rr it may take 20 loops.
If your computing method could take you to 1000 decimals, the funnel would take you to 1000 decimals for X. and computing Darcyf from f=1/X/X (or 1 / (X)^2) it will take you to another decimal place accuracy.
==========================================================A similar way this works
A very simple prove this works. Try this equation, X=Log(X)+9 Guess a value for X and you should understand this works very cool. For and example, lets guess the X as 20 and solve,.. Log(20)+9= ? about 10.3, then use 10.3 for X and you will get about 10.01, then Log(10.01)+9= about 10.0004, Wow, lets try 10...
Log(10)+9 = 10... Exactly, right! The Log of 10 is 1, and 1+9 =10
So no matter what you first guess, this solution will quickly get the right answer.
If the first guess was 1000. Then Log(1000)+9 = 12. The way the solution works is to get you close very quickly. Using all the decimals in Excel it will take 11 loops.
X=Log(X)+9
Guess 20 then next is... 10.3010299956640, next is...
10.0128806517992, next is... 10.0005590396375, next is...
10.0000242781044, next is... 10.0000010543834, next is...
10.0000000457913, next is... 10.0000000019887, next is...
10.0000000000864, next is... 10.0000000000038, next is...
10.0000000000002, next is... 10.0000000000000
==========================================================
Now, lets return to the (above) Colebrook Equation.
This is a little similar to the Colebrook Equation. The Log function works like what I call a funnel to project each step toward the correct answer by about two more decimal places in each step. An average of seven steps makes the true, absolute value found. Excel can only do 14 or 15 decimal places so Excel holds off more accuracy. To solve this test, write into Excel an initial guess. Enter a 5 or 1000 for a for first step in Excel's cell D5. It will still give the right answer.
How can this work? Test?: solve this... X=10+Log(X)
In a cell D6, enter the equation =10+Log(D5). It should answer 10.6989... Enter into cell E6 this =D6=D5 Copy the cells D6 and E6 down into to about 20 rows. Cell E16 should say TRUE. This the equation has been solved because the left side equals the right side.
The answer to X should be 11.043090636672800 when displayed as 15 decimals.
To understand this, this method works easily when a variable like X is on both sides of an equation, but on one side it is in a Log function. Since the Log makes the section much smaller than the section not with Log. You can test other equations like ....
X=Log(4*X)+5
X=Log(40+X/3)
X=-2*Log(0.04/3.7+2.51/10000*X)
The method of starting with a "guess" of X and computing the right side of the equation will give a new X that is from one to three more correct digits, then
recompute the right in Excel will give 15 digits, but sometimes Excel might round the last digit(s) wrong because it did not go to more than 15 digits. Here are the
answers for those 3 equations. The 3rd is almost like the Colebrook equation.
X=6.40883937854878
X=1.60784032102619
X=3.85777487509132
Another thing to understand is the "FUNNEL". To plot a funnel to see how this works is to make a large and a small initial X and plot steps. Each additional computation takes the value to toward the True computation.
See the funnel plotted here... http://hjgeron.blogspot.com/
==================================================
The "Funnel" works in Colebrook-White, because of the Log function.
Of course it won't work on Log() alone, but it works on other math with a Log. Like something as simple as this... X=10+Log(X). The Log(X) will be a lot smaller than X, and that's what make the "funnel".
Say for example... What's the Log(1000), the Log(100) and the Log(10)? Well, if you don't know, the answers are 3, 2, and 1. The answers are 1 apart, not 10 times apart as 1000. 100, and 10. This is why the graph makes a funnel shape.
So lets look at the test for X=10+Log(X) again.
If you guess the X in the equation as 3, the answer would be 10.47.
If you guess the first X as 1000, you would get 13.
If you guess the first X as 20, you would get 11.30
If you guess the first X as 20, you would get 11.30
Graph this... in step 1, the difference between 3 and 1000 was 997! The second different is 13 - 10.47 = 2.53. So the funnel top was 997 going down to a narrow step 2 as 2.53. If you take one more loop, both will give you 11.04. In an average of many different equations you will find each loop takes you about 2 more decimals of accuracy. If you graph this, you will see the "Funnel" taking to a solution on each loop.
How simple? If you can take a PC calculator, try it this way.
Guess a number for X to use in the equation X=10+Log(X)
Enter the guessed value of X,
1. Press [LOG]
2. Press [Plus] 10 then Equals
3. That gives you the first loop, go back to step 1.
After several times looping you will have 11.0430... and each loop will improve the decimal accuracy by and average of two decimal places. That is how the Log funnel works,
Guess a number for X to use in the equation X=10+Log(X)
Enter the guessed value of X,
1. Press [LOG]
2. Press [Plus] 10 then Equals
3. That gives you the first loop, go back to step 1.
After several times looping you will have 11.0430... and each loop will improve the decimal accuracy by and average of two decimal places. That is how the Log funnel works,
When Mathematicians understand my funnel, they will agree that this is a Math solution to the Colebrook equations. Because of the Log each loop averages about 2 or 3 digits closer. Since Excel will only show 15 digits, the average is about 7 loops.
Sample-------------------------------------------------------------------------------------
Started with 10, see 32 digits done with desktop calculator.
Red shows unchanged digits
10 Started with this as the "guess" that might save one loop.
11 One digit did not change
11.041392685158225040750199971243 Two digits did not change, 2 more were added.
11.043023855760277278908417779052 4 digits did not change, 2 more were added.
11.043088010354671000395276406585 6 digits did not change, 2 more were added.
11.043090533386927914699790684320 6 digits did not change, 0 more was added.
11.043090632610882359484124482596 8 digits did not change, 2 more were added.
11.043090636513088500429056209373 10 digits did not change, 2 more were added.
11.043090636666551570718217687700 11 digits did not change, 1 more was added.
11.043090636672586852578685610125 12 digits did not change, 1 more was added.
11.043090636672824203669514154799 14 digits did not change, 2 more were added.
11.043090636672833538037257025437 15 digits did not change, 1 more was added.
11.043090636672833905132351701379 17 digits did not change, 2 more were added.
11.043090636672833919569195443481 18 digits did not change, 1 more was added.
11.043090636672833920136956931599 18 digits did not change, 0 more was added.
11.043090636672833920159285434501 21 digits did not change, 3 more were added.
11.043090636672833920160163553310 21 digits did not change, 0 more was added.
11.043090636672833920160198087315 24 digits did not change, 3 more were added.
11.043090636672833920160199445443 25 digits did not change, 1 more was added.
11.043090636672833920160199498855 27 digits did not change, 2 more were added.
11.043090636672833920160199500955 26 digits did not change, 1 reduced, 9498 changed to 9500
11.043090636672833920160199501038 28 digits did not change, 2 more were added.
11.043090636672833920160199501041 30 digits did not change, 2 more were added.
11.043090636672833920160199501041 32 digits did not change, 2 more were added.
11.043090636672833920160199501041 32 digits did not change, none was added because it has reached as many digits as program can compute. This averages about 1.5 more extra correct digits per loop
===========================================================
This is a graph of the Simple and True Solution to the Colebrook equation.
This graph shows some first guess for X...0 to 8 at step 1. Each step goes about 2 decimals closer.. 8 was high and 0 was to low, and you can see where they (Red vs Black) crossed at step 2. To get 15 decimals correct, it takes about seven steps.
I just call it a funnel, because of the shape. Each step zooms in much closer, just like the graph from step 1 to 2, To graph step 2 to 3 they vertical side should go from 4.1 to 4.3.
Sample-------------------------------------------------------------------------------------
Started with 10, see 32 digits done with desktop calculator.
Red shows unchanged digits
10 Started with this as the "guess" that might save one loop.
11 One digit did not change
11.041392685158225040750199971243 Two digits did not change, 2 more were added.
11.043023855760277278908417779052 4 digits did not change, 2 more were added.
11.043088010354671000395276406585 6 digits did not change, 2 more were added.
11.043090533386927914699790684320 6 digits did not change, 0 more was added.
11.043090632610882359484124482596 8 digits did not change, 2 more were added.
11.043090636513088500429056209373 10 digits did not change, 2 more were added.
11.043090636666551570718217687700 11 digits did not change, 1 more was added.
11.043090636672586852578685610125 12 digits did not change, 1 more was added.
11.043090636672824203669514154799 14 digits did not change, 2 more were added.
11.043090636672833538037257025437 15 digits did not change, 1 more was added.
11.043090636672833905132351701379 17 digits did not change, 2 more were added.
11.043090636672833919569195443481 18 digits did not change, 1 more was added.
11.043090636672833920136956931599 18 digits did not change, 0 more was added.
11.043090636672833920159285434501 21 digits did not change, 3 more were added.
11.043090636672833920160163553310 21 digits did not change, 0 more was added.
11.043090636672833920160198087315 24 digits did not change, 3 more were added.
11.043090636672833920160199445443 25 digits did not change, 1 more was added.
11.043090636672833920160199498855 27 digits did not change, 2 more were added.
11.043090636672833920160199500955 26 digits did not change, 1 reduced, 9498 changed to 9500
11.043090636672833920160199501038 28 digits did not change, 2 more were added.
11.043090636672833920160199501041 30 digits did not change, 2 more were added.
11.043090636672833920160199501041 32 digits did not change, 2 more were added.
11.043090636672833920160199501041 32 digits did not change, none was added because it has reached as many digits as program can compute. This averages about 1.5 more extra correct digits per loop
Information, if you must have 10 correct digits, you should loop about two more than 10, just because it might be a change bcause of rounding. If your program can compute hundreds or thousands of digits, you will see the results are the same. So if you need 50 correct digits, you should go to 52 just to make sure the 50th is right.
This computation is just like solving each of the Colebrook-White equations.
This is a graph of the Simple and True Solution to the Colebrook equation.
This graph shows some first guess for X...0 to 8 at step 1. Each step goes about 2 decimals closer.. 8 was high and 0 was to low, and you can see where they (Red vs Black) crossed at step 2. To get 15 decimals correct, it takes about seven steps.
I just call it a funnel, because of the shape. Each step zooms in much closer, just like the graph from step 1 to 2, To graph step 2 to 3 they vertical side should go from 4.1 to 4.3.
===========================================================
A few people asked how I figured out how to do this TRUE solution.
When I first began to use approximations, I tested them and found most of them were good enough for actual design. But I wanted to know the TRUE solution to test each approximation. This was before I learned the "Funnel" would take me quickly to the accurate point.
I knew that using Excel that can run fast steps, I could find the TRUE value. Here's a sample of how I could solve for a TRUE solution, but usually it took over a hundred steps, but the time uses was very quick. I fixed the main equation to find X first where X is substituted for "1/sqrt(f)". X is normally somewhere between 2 and 5, so I would start with X=1 and take one step further until the solution of the equation gave me ax X (answer) that was larger that the X used in the equation. Then I would reverse one step and reduce the step size. After 100 steps the TRUE solution would be found where the right side X would compute to the same left side X.
==================================================
Several Colebrook-White equations
Why should the public learn this more accurate solution? Ordinary approximations try to solve the main Colebrook-White solution, as shown in these methods. But as time has pasted many specific types of material and fluids make slight changes in the Colebrook-White equation to more accuracy. My methods can be easily changed by updating the specific equation. Here are six different Colebrook versions. The public approximations only go toward first version listed. Many of the designs we do say the version 4 is the specific equation we should use. But none of the public approximations are very good for it. But I can put that equation into my method and it will get the TRUE solution. All the public approximations fail to be good for those different Colebrook equations.
1/sqrt(f)=-2*Log(Rr/3.7+2.51/Re*1/sqrt(f)) (this is the main one, shown above)
1/sqrt(f)=1.74-2*Log(2*Rr+18.7/Re*1/sqrt(f))
1/sqrt(f)=1.14+2*Log(1/Rr)-2*Log(1+(9.3/(Re*Rr)*1/sqrt(f)))
1/sqrt(f)=1.14-2*Log(Rr+9.35/Re*1/sqrt(f))
1/sqrt(f)=-2*Log(Rr/3.71+2.51/Re*1/sqrt(f))
1/sqrt(f)=-2*Log(Rr/3.72+2.51/Re*1/sqrt(f))
To use these in my method, just first use the RED parts as X, then when X is solved,
compute f is this... f =1/X^2 but I like the "simple" which is f =1/X/X (easier to type).
VBA programming===============
1/sqrt(f)=-2*Log(Rr/3.7+2.51/Re*1/sqrt(f)) mode 2.51
1/sqrt(f)=1.74-2*Log(2*Rr+18.7/Re*1/sqrt(f)) mode 1.74
1/sqrt(f)=1.14+2*Log(1/Rr)-2*Log(1+(9.3/(Re*Rr)*1/sqrt(f))) mode 1.14
1/sqrt(f)=1.14-2*Log(Rr+9.35/Re*1/sqrt(f)) mode 9.35
1/sqrt(f)=-2*Log(Rr/3.71+2.51/Re*1/sqrt(f)) mode 3.71
1/sqrt(f)=-2*Log(Rr/3.72+2.51/Re*1/sqrt(f)) mode 3.72
The symbol x is the left side of the Colebrook Equation, a number that is made by the right side of the equation. the symbol d will be a guess or a re-evaluated value of x. The symbol "A" should be part of the convergence and it is a number that will be multiplied by d on the right side. The symbol "B" should be part of the convergence and it is a number that will be added to "A *d" on the right side.
The symbol "C" should be part of the convergence and it is a number that will be multiplied to the "LOG( B+A*d)" on the right side. The C might be =1/log(10) to convert LN to LOG10, but it might have another part that will be multiplied to the "LOG( B+A*d)" on the right side, like 2 so it would be C=2/Log(10)
Another new part, test for x=d to end the convergence, but if the convergence changes the last decimals back and forth then, use L to count the loops and quit if x<>d.
Note: the variable "a" will be value of a number divided by the Reynolds Number, (for example 2.51/Re) "b" will be Relative Roughness divided by a number (for example Rr/3.7). "c" will be the value to convert Ln() to Log10, and include the multiplier, usually 2, (for example 2*Log(10) ). "d" will be the number moving toward the true value of "x". And the Darcy Factor will be 1/x/x.
The equation like "x = Abs(c * Log(b + a * d))" will be the simplified equation of a Colebrook-White mode. For each different modes, these variables will be changed to match the mode. To solve for x, estimate a value for d, then solve for x, then use the x for the next value of d. Solve for x again and again until x does not change (usually 7 loops for 14 or 15 decimals of accuracy.). Then the Darcy factor will then be 1 / x / x.
New VBA Function updated Oct, 2013,
=================================================================
Option Explicit
Dim L As Integer
Dim mode As String
Function Easy(re As Double, rr As Double, Optional mode, Optional Find As String) As Double
'mode 2.51 1/sqrt(f)=-2*Log(Rr/3.7+2.51/Re*1/sqrt(f))
'mode 1.74 1/sqrt(f)=1.74-2*Log(2*Rr+18.7/Re*1/sqrt(f))
'mode 1.14 1/sqrt(f)=1.14+2*Log(1/Rr)-2*Log(1+(9.3/(Re*Rr)*1/sqrt(f)))
'mode 9.35 1/sqrt(f)=1.14-2*Log(Rr+9.35/Re*1/sqrt(f))
'mode 3.71 1/sqrt(f)=-2*Log(Rr/3.71+2.51/Re*1/sqrt(f))
'mode 3.72 1/sqrt(f)=-2*Log(Rr/3.72+2.51/Re*1/sqrt(f))
Dim A As Double, B As Double, D As Double, X As Double, F As Double, Left As Double, Right As Double
If IsMissing(mode) Then mode = 2.51
If IsMissing(Find) Then Find = ""
If rr > re Then Exit Function
If re < 2000 Then
Easy = 64 / re
Exit Function
End If
L = 0
D = 3
Select Case mode
Case 2.51
A = 2.51 / re
B = rr / 3.7
While X <> D
X = -2 * Log10(B + A * D)
D = -2 * Log10(B + A * X)
L = L + 1: If L > 20 Then X = D 'Excel can't go to more digits, each loop adds about two more correct digits
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = -2 * Log10(rr / 3.7 + 2.51 / re * 1 / Sqr(F))
Case 1.74
A = 18.7 / re
B = 2 * rr
While X <> D
X = 1.74 - 2 * Log10(B + A * D)
D = 1.74 - 2 * Log10(B + A * X)
L = L + 1: If L > 20 Then X = D
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = 1.74 - 2 * Log10(2 * rr + 18.7 / re * 1 / Sqr(F))
Case 1.14:
A = 9.3 / (re * rr)
B = 1.14 + 2 * Log10(1 / rr)
While X <> D
X = B - 2 * Log10(1 + (A * D))
D = B - 2 * Log10(1 + (A * X))
L = L + 1: If L > 20 Then X = D
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = 1.14 + 2 * Log10(1 / rr) - 2 * Log10(1 + (9.3 / (re * rr) * 1 / Sqr(F)))
Case 9.35
A = 9.35 / re
B = rr
While X <> D
X = Abs(1.14 - 2 * Log10(B + A * D))
D = Abs(1.14 - 2 * Log10(B + A * X))
L = L + 1: If L > 20 Then X = D
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = 1.14 - 2 * Log10(rr + 9.35 / re * 1 / Sqr(F))
Case 3.71
A = 2.51 / re
B = rr / 3.71
While X <> D
X = -2 * Log10(B + A * D)
D = -2 * Log10(B + A * X)
L = L + 1: If L > 20 Then X = D
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = -2 * Log10(rr / 3.71 + 2.51 / re * 1 / Sqr(F))
Case 3.72
A = 2.51 / re
B = rr / 3.72
While X <> D
X = -2 * Log10(B + A * D)
D = -2 * Log10(B + A * X)
L = L + 1: If L > 20 Then X = D
Wend
F = 1 / X / X
Easy = F
If Find = "Left" Then Easy = 1 / Sqr(F)
If Find = "Right" Then Easy = -2 * Log10(rr / 3.72 + 2.51 / re * 1 / Sqr(F))
Case Else
Easy = 0
End Select
End Function
Static Function Log10(X)
Log10 = Log(X) / Log(10#)
End Function
'============================
'Public Approximate methods
Function fSerg(Re As Double, Rr As Double, mode) As Double
If mode <> 2.51 Then Exit Function
'Friction Factor calculated by T.K. Serghide's implementation of Steffenson
'RefeRence Chemical Engineering March 5, 1984
Dim a As Single
Dim b As Single
Dim c As Single
Dim x As Double
'Note that in Visual Basic "Log" stands for Natural Log, ie. Ln() x = -0.86858896
x = -0.868588963806504
a = x * Log(Rr / 3.7 + 12 / Re)
b = x * Log(Rr / 3.7 + (2.51 * a / Re))
c = x * Log(Rr / 3.7 + (2.51 * b / Re))
fSerg = (a - ((b - a) ^ 2) / (c - (2 * b) + a)) ^ -2
End Function
Function Serghide(Re As Double, Rr As Double, mode) As Double
If mode <> 2.51 Then Exit Function
Dim a As Double, b As Double, c As Double
a = -2 * Log10(Rr / 3.7 + 12 / Re)
b = -2 * Log10(Rr / 3.7 + 2.51 * a / Re)
c = -2 * Log10(Rr / 3.7 + 2.51 * b / Re)
Serghide = (a - ((b - a) ^ 2) / (c - 2 * b + a)) ^ -2
End Function
Function Swamee(Re As Double, Rr As Double, mode) As Double
'Swamee and Jain approximation to the Colebrook-White equation for Re>4,000(Bhave, 1991)
If mode <> 2.51 Then Exit Function
Dim f, dh, k As Double
On Error GoTo SwameeEr
dh = 1: k = Rr
'Hagen – Poiseuille formula for Re < 2,000 (Bhave, 1991):
If Re < 2000 Then
f = 64 / Re
Swamee = f
Exit Function
End If
Swamee = 1.325 / (Log(Rr / 3.7 + (5.74 / (Re ^ 0.9)))) ^ 2
Exit Function
SwameeEr: Swamee = 9999
End Function
Function Haaland(Re As Double, Rr As Double, mode) As Double
If mode <> 2.51 Then Exit Function
Haaland = 0.308642 / (Log10((Rr / 3.7) ^ 1.11 + 6.9 / Re)) ^ 2
End Function
Function Goudar_Sonnad(Re As Double, Rr As Double, mode) As Double
If mode <> 2.51 Then Exit Function
Dim a As Double, b As Double, d As Double, G As Double, s As Double, Q As Double, Z As Double, Dla As Double, Dcfa As Double, f As Double, x As Double
On Error GoTo quit
a = 2 / Log(10)
b = Rr / 3.7
d = Log(10) * Re / 5.02
s = b * d + Log(d)
Q = s ^ (s / (s + 1))
G = b * d + Log(d / Q)
Z = Log(Q / G)
Dla = Z * (G / (G + 1))
Dcfa = Dla * (1 + (Z / 2) / ((G + 1) ^ 2 + (Z / 3) * (2 * G - 1)))
x = a * (Log(d / Q) + Dcfa)
Goudar_Sonnad = (1 / x) ^ 2
Exit Function
quit: Goudar_Sonnad = 9999
End Function
Function Zigrang(Re As Double, Rr As Double, mode) As Double
'Zigrang_and_Sylvester Solution
If mode <> 2.51 Then Exit Function
Zigrang = 1 / (-2 * Log10(Rr / 3.7 - 5.02 / Re * Log10(Rr / 3.77 - 5.02 / Re * Log10(Rr / 3.77 + 13 / Re)))) ^ 2
End Function
Function Altshul(Re As Double, Rr As Double, mode) As Double
'Altshul-Tsal6
If mode <> 2.51 Then Exit Function
Dim fp, f As Double
fp = 0.11 * (Rr + 68 / Re) ^ 0.25
If fp < 0.018 Then
f = 0.85 * fp + 0.0028
Else
f = fp
End If
Altshul = f
End Function
Function Brkic(Re As Double, Rr As Double, mode) As Double
If mode <> 2.51 Then Exit Function
Dim s As Double, x As Double
s = Log(Re / (1.1816 * Log(1.1 * Re / (Log(1 + 1.1 * Re)))))
x = -2 * Log10((Rr / 3.71) + 2.18 * s / Re)
Brkic = 1 / x ^ 2
End Function
Function DecCorr(x As Double, y As Double) As Integer
'decimals correct, compares upto 15 decimals places
Dim L As Integer
x = Round(x, 15 ): y = Round(y, 15)
For L = 1 To 15
If Round(x, L) = Round(y, L) Then DecCorr = L Else Exit For
Next L
End Function
'==================================================
Static Function Log10(x) 'Vba's Log() is actually Ln(), and this is just to
'convert VBA's "Log" to "Log10"
'Converts VBA Ln( to Log10()
Log10 = Log(x) / Log(10#)
End Function
'==================================================
'
More info: a true solution? Well engineers should understand more about the Colebrook equations. Each of it's "parts" are estimated to be close enough for a design. Even the 3.7 and the 2.51 have been "rounded" to be close enough for most designs. What about values of Rr and Re? If you can compute those to within 1% then it will be good enough for almost all friction factors. With this "true" solution for Excel, this computation will be accepted each part to be true and will give you the Darcy Friction to 15 decimal places which will be more accurate that each of the separate variables used in the equation.
===========================================================
===========================================================
Would you prefer to TEST my Simple, True, Easy Solution?
If you want to check out my method, here's a simple way where you can compute the check to 50 decimals places.
A new Japan web site ...
http://keisan.casio.com/exec/system/1381988562
(older) Go to this web site .... keisan.casio.com
And enter a Reynolds Number as Rn because "Re" is something else at that site. Copy the Computation Lines and enter a Rn and a Rr that you want to use, follow each with a " ; " to end the line.
The Left and Right are the main Colebrook-White equation. Left is 1/sqrt(f) and the Right is -2*log(Rr/3.7+2.51/Rn/sqrt(f)) If this gives the same Left and Right then this is TRUE!
This uses D=3 and the initial 1/sqrt(f) and computes X and D until the are equal.
The is solves f as 1/X/X which is 1/(X^2) When the left and right side are equal, then the Colebrook-White equation has been solved perfectly with a True and Easy solution. The last three lines gives the answers.
Go to keisan.casio.com Note each line ends with a ";" to help the PC computation. With this you can choose 50 digits and you will notice that the left side of the equation is exactly the same as the right side.
This is for the Mode 2.51 ... 1/sqrt(f) = -2* Log(Rr/3.7+ 2.51/Re*1/sqrt(f))
=========================================================
=========================================================
Rn=2525; |
Rr=0.01824; |
A=Rr/3.7; |
B=2.51/Rn; |
D=3; do {X=-2*log(A+B*D); |
D=-2*log(A+B*X);} while (X<>D); |
f=1/X/X; |
Left=1/sqrt(f); |
Right=-2*log(Rr/3.7+2.51/Rn/sqrt(f)); |
f; |
Left; |
Right; |
=========================================================
Today, Oct,3, 2013 I found a tested a special Colebrook solution, called Newton's computation (that you can buy for about $40). I tested and compared many values of the Reynolds Number and relative roughness with my simple, True, and easy solution vs the Newton computation. I learned by testing thousands of random Re and Rr that the Newton is just a good approximation. It's last digit is usually wrong. But about 50% of it's approximations are right. It's crazy, why should users pay for an approximation when the True solution is easy now that you can study this web site!
I did them all with 50 digits. Many times the Newton computations only had 49 digits right. But a few times Newton had all 50 digits right. To tell if a computation is right, you should figure both the...
Left_Side = 1/sqrt(f)
Right_Side = -2*log(Rr/3.7+2.51/Rn/sqrt(f))
to check to see if they are exactly the same.
If you are using Excel, all computation can only have 15 digits correct, and if those 15 digits are used for another computation, then because of wrong rounding of the 15 digit, then maybe only 14 digits or less will be right.
The Newton computation is very complex, but mine is simple.
Rn=2525; (Reynolds Number)
Rr=0.01824; (Relative Roughness, which is roughness divide by the inside diameter)
A=Rr/3.7;
B=2.51/Rn;
D=3 ; (a starting guess of X, but you can use other positive number to begin with)
'start loops
X=-2*log(A+B*D) (both D and X will change until the X is right.)
D=X (if X <> D the change D to the X and continue the loop)...
continue loops until X = D, then (each loop with make 2 or 3 more digits to be right.
f = 1/X/X; (same as 1/sqrt(f) )
Then you can test the f in the Colebrook equation.
Left = 1/sqrt(f)
Right = -2*log(Rr/3.7+2.51/Rn/sqrt(f))
Excel's rounding of 15 digits for f, may cause the 14th and/or 15th digits to be different.
-----------
This type of equation can be computed accuracy. If a number is in a Log() with other numbers, and without numbers other side, it can be solved easily. My training years ago what X=Log(5+X*10). You can guess an X and compute the right side, and use the solution for the next X. Because the Log() makes the compute much smaller, it makes the correct solution quick. In the Colebrook-White equation can have the 1/Sqrt(f) changed to X, and since the right side has a number divided by sqrt(f) it can be changed to *X. So the equation will be X=-2*Log(e/(3.7*Dh)+(2.51/Re)*X). To make the solution easier, compute the e/(3.7*Dh) as A... and compute the 2.51/Re as B. Then the easy solution will be X=-2*Log(A+B*X). Usually in about 5 loops the X will stop changing will about 15 decimals not changing. But some times it may take 10 loops to get 15 decimals. The the f will be the X ... 1/X/X (one divided by the X twice). There are a few approximations that are right to 15 decimals. But if can compute to 50 digits you will see that all the approximation are not right. To check the solution, both the left and right sides will both be the X you computed. See the web site ... keisan.casio.com/exec/system/1381988562 .... that is shearing the whole world with this solution. (There you will see who I am).
----------