How to solve Colebrook-white equation?

How to solve Colebrook-white equation? - Сообщения

#1 Опубликовано: 25.06.2012 17:03:07
Danilo Monteiro

Danilo Monteiro

0 сообщений из 14 понравились пользователям.

Группа: 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 Опубликовано: 25.06.2012 17:47:55
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: 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 КиБ) скачан 350 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Опубликовано: 25.06.2012 20:32:22
kilele

kilele

133 сообщений из 397 понравились пользователям.

Группа: 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 Опубликовано: 26.06.2012 04:34:15
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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!"
1 пользователям понравился этот пост
Davide Carpi 26.06.2012 05:11:00
#5 Опубликовано: 26.06.2012 05:08:19
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: 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
1 пользователям понравился этот пост
Radovan Omorjan 28.06.2012 02:27:00
#6 Опубликовано: 26.06.2012 05:18:22
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

You are welcome

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Опубликовано: 28.06.2012 16:14:04
Danilo Monteiro

Danilo Monteiro

0 сообщений из 14 понравились пользователям.

Группа: User

Thank you all, very useful replies
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений