How to solve Colebrook-white equation?

How to solve Colebrook-white equation? - Mensajes

#1 Publicado: 25/6/2012 17:03:07
Danilo Monteiro

Danilo Monteiro

0 me gusta en 14 mensajes.

Grupo: User

Hello,

I'd like to solve the equation of Colebrook-White using Smath to find Darcy–Weisbach friction factor (f)

The equation is:

Colebrook-white Equation from Wikipedia

I tried to use solve and roots commands (Smath 0.95.4559), with no sucess.
Is it already possible to find the answer through Smath?

#2 Publicado: 25/6/2012 17:47:55
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

Hi

try using solve(4) instead of solve(2) or changing the "Roots (range)" value in "from 0 to 1" in "Tools" > "Options" > "Calculation"

in the attachment there is an example


regards,

w3b5urf3r
colebrook_uncommented.sm (13,3 KiB) descargado 1771 vez(es).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Publicado: 25/6/2012 20:32:22
kilele

kilele

134 me gusta en 397 mensajes.

Grupo: User

isn't that an implicit equation ? so numerical iteration may be needed, look at this discussion about several methods to solve the equation of Colebrook-White

http://trickofmind.com/?p=1189

Also this post might be of help

http://en.smath.info/forum/yaf_postsm5611_How-to-write-a-recursive-function.aspx#post5611
#4 Publicado: 26/6/2012 4:34:15
Radovan Omorjan

Radovan Omorjan

325 me gusta y 1 no me gusta en 2.052 mensajes.

Grupo: Moderator

Hello,
Wrote

Hi

try using solve(4) instead of solve(2) or changing the "Roots (range)" value in "from 0 to 1" in "Tools" > "Options" > "Calculation"

in the attachment there is an example


regards,

w3b5urf3r


It should be noted here that the solve() gives you two solutions. Actually, there are no two solution and I do not know why solve() returned these two. On the other hand, we have to take into account that solve() depends on "Tools" > "Options" > "Calculation" >"Decimal places". If you use, for instance, 4 decimal places these are the solutions

[MATH=eng]el(f.Colebrook,1)=0.011542553663605[/MATH]

[MATH=eng]el(f.Colebrook,2)=0.01216608597662[/MATH]

15 decimal places

[MATH=eng]el(f.Colebrook,1)=0.012166073459707[/MATH]

[MATH=eng]el(f.Colebrook,2)=0.012166080958897[/MATH]

Solve() will return only one solution if your left boundary is not zero, but some small number greater than zero. Have in mind that in the equation you have [MATH=eng]1/sqrt(f)[/MATH].
(I changed displayed decimals with context menu for each result regardless of numbers of decimals chosen from the manu option)

On the other hand, roots() will give you a single solution which does not depend on decimal places chosen from the menu
[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.01)=0.012166080958897[/MATH]

But if you are far from the solution with your guess value, roots() will fail as could be expected when nonlinear equations are involved

[MATH=eng]roots(1/sqrt(f#)-(-2)*log({ε/D}/3.7+2.51/{Re*sqrt(f#)},10),f#,0.03)[/MATH]

That is the "beauty" of strugling with nonlinear equations

Representing 15 decimal places for this equation has no to much sence, I just put them here to point out the problematic results from solve().

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
A 1 usuarios les gustó este mensaje
Davide Carpi 26/6/2012 5:11:00
#5 Publicado: 26/6/2012 5:08:19
Davide Carpi

Davide Carpi

1.443 me gusta en 2.936 mensajes.

Grupo: Moderator

Wrote


Solve() will return only one solution if your left boundary is not zero, but some small number greater than zero. Have in mind that in the equation you have [MATH=eng]1/sqrt(f)[/MATH].



Thank you omorr, I was wondering what generate the 2nd solution

file updated with lower bound little but greater than zero (and Moody Diagram)...


regards,

w3b5urf3r
colebrook.PNG
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
A 1 usuarios les gustó este mensaje
Radovan Omorjan 28/6/2012 2:27:00
#6 Publicado: 26/6/2012 5:18:22
Radovan Omorjan

Radovan Omorjan

325 me gusta y 1 no me gusta en 2.052 mensajes.

Grupo: Moderator

You are welcome

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Publicado: 28/6/2012 16:14:04
Danilo Monteiro

Danilo Monteiro

0 me gusta en 14 mensajes.

Grupo: User

Thank you all, very useful replies
  • Nuevos mensajes
  • Sin mensajes nuevos