AndersE
Chemical
- Sep 19, 2007
- 18
Hi everyone
Just wanted to share a little tip for direct solving of implicit equations (like the Colebrook-White equation) in Excel without having to use Solver, goalseek, VB or macros.
Implicit equations will of course still have to be iterated in order to be solved, but this can easily be automated.
The trick is to allow Excel to iterate circular references.
Go to "Tools" -> "Options" -> "Calculation" tab and check the box "Iteration".
You might also want to change the maximum number iterations (the default is usually 10, I use 100). Note that if the "Iteration" box is not checked Excel will give an error message regarding circular references with this method.
Here is a simple examle for solving the equation x = ln(x + 2):
Let cell A1 be the left side of the above equation (in other words "x"). Enter the formula "=A2" into cell A1.
In cell A2, enter the right side of the equation: "=LN(A1 + 2)"
Excel will automatically iterate the above equation and arrive at a result where the values in cell A1 and A2 become the same.
(All equations are entered into excel without the "s)
The Colebrook-White equation, 1/sqrt(f) = -2*log(e/D/3.7 + 2.51/Re*1/sqrt(f)), is solved in the same way as the above example:
Enter the Reynolds number into cell A1
Enter the relative roughness e/D into cell A2
In cell A3, enter "=A4"
In cell A4, enter "=-2*LOG(A2/3.7 + 2.51/A1*A3)"
In cell A5, enter "=1/A3^2" for calculating the final result
I have not yet been able to solve the equation directly for the friction factor without going through the third step in cell A5.
The equations I have tried solves instantly with this method on my computer, much faster than goal seek or solver.
Hope you'll find this tip useful!
Just wanted to share a little tip for direct solving of implicit equations (like the Colebrook-White equation) in Excel without having to use Solver, goalseek, VB or macros.
Implicit equations will of course still have to be iterated in order to be solved, but this can easily be automated.
The trick is to allow Excel to iterate circular references.
Go to "Tools" -> "Options" -> "Calculation" tab and check the box "Iteration".
You might also want to change the maximum number iterations (the default is usually 10, I use 100). Note that if the "Iteration" box is not checked Excel will give an error message regarding circular references with this method.
Here is a simple examle for solving the equation x = ln(x + 2):
Let cell A1 be the left side of the above equation (in other words "x"). Enter the formula "=A2" into cell A1.
In cell A2, enter the right side of the equation: "=LN(A1 + 2)"
Excel will automatically iterate the above equation and arrive at a result where the values in cell A1 and A2 become the same.
(All equations are entered into excel without the "s)
The Colebrook-White equation, 1/sqrt(f) = -2*log(e/D/3.7 + 2.51/Re*1/sqrt(f)), is solved in the same way as the above example:
Enter the Reynolds number into cell A1
Enter the relative roughness e/D into cell A2
In cell A3, enter "=A4"
In cell A4, enter "=-2*LOG(A2/3.7 + 2.51/A1*A3)"
In cell A5, enter "=1/A3^2" for calculating the final result
I have not yet been able to solve the equation directly for the friction factor without going through the third step in cell A5.
The equations I have tried solves instantly with this method on my computer, much faster than goal seek or solver.
Hope you'll find this tip useful!