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 / 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 decimals because Excel will only go that far.)
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:
Enter Rr in cell D1 as 0.015
Enter Re in cell D2 as 200,000
Enter an initial value of X in cell D5 as 3
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
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 D12 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 D3
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
How can this work? Test?: solve this... X=10+Log(X)
It's 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 for a for first step in Excel's cell D5.
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 anwser to X should be 11.043090636672800 when diplayed as 15 decimals.
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 plot 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 hand held 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
3. Press Equals
4. 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
3. Press Equals
4. 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.
===========================================================
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
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 convergency and it is a number that will be multiplied by d on the right side.
The symbol "B" should be part of the convergency and it is a number that will be added to "A *d" on the right side.
The symbol "C" should be part of the convergency 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 convergency, but if the convergency 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 towaed 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.
Option Explicit
Dim L As Integer
Dim mode As String
Function DarcyF(Re As Double, Rr As Double, mode) As Double
'Function by Harrell Geron
Dim a As Double, b As Double, c As Double, d As Double, x As Double
If Rr > Re Then GoTo HaltF
If Re < 2000 Then
DarcyF = 64 / Re
Exit Function
End If
d = 3 ' initial guess for X
c = 2 / Log(10)
On Error GoTo HaltF
Select Case mode
Case 2.51: a = 2.51 / Re: b = Rr / 3.7
For L = 1 To 20
x = Abs(c * Log(b + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case 9.35: a = 9.35 / Re: b = Rr
For L = 1 To 20
x = Abs(1.14 - c * Log(b + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case 3.71: a = 2.51 / Re: b = Rr / 3.71
For L = 1 To 20
x = Abs(c * Log(b + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case 1.14: a = 9.3 / (Re * Rr): b = 1.14 + c * Log(1 / Rr)
For L = 1 To 20
x = Abs(b - c * Log(1 + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case 1.74: a = 18.7 / Re: b = 2 * Rr
For L = 1 To 20
x = Abs(1.74 - c * Log(b + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case 3.72: a = 2.51 / Re: b = Rr / 3.72
For L = 1 To 20
x = Abs(c * Log(b + a * d))
If x = d Then Exit For
If L > 10 And Abs(x - d) < 1E-16 Then Exit For
d = x
Next L
Case Else: DarcyF = 9999: Exit Function
End Select
DarcyF = 1 / x / x
Exit Function
HaltF: DarcyF = 9999
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 calulated 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
'==================================================
'An old version of mine in a VBA module without knowing the "Funnel".
Function OldTest(Re, Rr, mode) As Double
Dim a As Double, b As Double, c As Double, d As Double, x1 As Double, x2 As Double, Point As Double, step As Double
If mode <> 2.51 Then Exit Function
'1/sqrt(f)=-2*Log10(Rr/3.7+2.51/Re*1/sqrt(f))
'X=-2*Log10(Rr/3.7+2.51/Re*X)
'X = Abs(2 * Log10(b + a * X))
a = 2.51 / Re
b = Rr / 3.7
Point = 1 ' The point that will be tested for X
step = Point / 2 ' The step size will be shortened as needed.
L = 0
again:
L = L + 1
If L > 200 Then OldTest = 1 / x2 / x2: Exit Function
x1 = Point
x2 = Abs(2 * Log10(b + a * x1))
Debug.Print L, Point
If Round(x1, 15) = Round(x2, 15) Then
OldTest = 1 / x2 / x2
Exit Function
End If
If x2 > x1 Then
Point = Point + step
Else
Point = Point - step
step = step / 10
End If
GoTo again
End Function
'An implicit method?
'This is a great method, but it is complex, and gives the same answers as my DarcyF 'function. The math 'person who showed me this is great. I changed the variable names 'to match much like my version, but 'there's a large numbers of variables. It has been 'edited to solve each of the different Colebrook equations I 'call "modes". It does a quick 'solution with about 3 to 4 loops.
Function test2(Re As Double, Rr As Double, mode) As Double
Dim a As Double, b As Double, c As Double, d As Double, e As Double, x As Double
Dim F0 As Double, F1 As Double, F2 As Double, F3 As Double, F4 As Double
e = 0: x = 3: c = 2 / Log(10): L = 0
If mode = 2.51 Then b = Rr / 3.7: a = 2.51 / Re
If mode = 1.74 Then b = 2 * Rr: a = 18.7 / Re: e = 1.74
If mode = 1.14 Then b = Rr: a = 9.3 / Re: e = 1.14
If mode = 9.35 Then b = Rr: a = 9.35 / Re: e = 1.14
If mode = 3.71 Then b = Rr / 3.71: a = 2.51 / Re
If mode = 3.72 Then b = Rr / 3.72: a = 2.51 / Re
Do: L = L + 1
d = x
F0 = a / (b + a * d)
F1 = c * Log(b + a * d) + d - e
F2 = c * F0 + 1
F3 = -c * F0 * F0
F4 = -2 * F3 * F0
x = d - 3 * F1 * (2 * F2 * F2 - F1 * F3) / (6 * F2 * F2 * F2 - 6 * F1 * F2 * F3 + F3 * F4)
If L > 5 Then Exit Do
Loop Until x = d
Debug.Print x, d
test2 = 1 / x / x
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.