# Colebrook equation

**URL:** <https://community.wolfram.com/t/colebrook-equation/16550>\
**Category:** Questions\
**Tags:** engineering, equation-solving\
**Created:** [August 9, 2020, 11:03pm UTC](https://community.wolfram.com/t/colebrook-equation/16550 "2020-08-09T23:03:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luiarboleda](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/luiarboleda/32/36674_2.png) [@luiarboleda](https://community.wolfram.com/u/luiarboleda)\
**Post date:** [August 9, 2020, 11:03pm UTC](https://community.wolfram.com/t/colebrook-equation/16550/1 "2020-08-09T23:03:28Z")

</div>

Hello  
I´m programming someting about pumps

I have the flow vector (from the pump chart) (Caudal in spanish)

```
Cau={0.0001,.025,.05,.076,.101,.126,.151}

```

I find the Reynolds number vector :

```
Rei={212.207,53051.6,106103.,161277.,214329.,267380.,320432.}

```

I can find the friction factor, applying individually the colebrook equation to any Reynols number

```
Rei1=Part[Rei,1];
Solve[1/f1^(1/2) ==-2* Log10[(\[Alpha])/3.7+2.51/(Rei1*f1^(1/2))], f1] 
Rei2=Part[Rei,2];
Solve[1/f2^(1/2) ==-2* Log10[(\[Alpha])/3.7+2.51/(Rei2*f2^(1/2))],f2] ..... etc....

```

I obtain in each case:

```
{{f1->0.117072}}
{{f12->0.0206185}} ........etc ......

```

After that I recopilate manually the friction factor values in the vector “f”

```
f={0.117072,0.0206185, .......... etc ....,}

```

The questions are :

- Can I solve the Colebrook equation for the Reynolds number vector ?
- Can I recopilate automatically the values and build the vector “f”.

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [August 10, 2020, 12:59am UTC](https://community.wolfram.com/t/colebrook-equation/16550/2 "2020-08-10T00:59:30Z")

</div>

What is α? Take a look at [Map](http://reference.wolfram.com/language/ref/Map.html).

---

<div class="post-metadata">

**Author:** ![luiarboleda](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/luiarboleda/32/36674_2.png) [@luiarboleda](https://community.wolfram.com/u/luiarboleda)\
**Post date:** [August 10, 2020, 1:27pm UTC](https://community.wolfram.com/t/colebrook-equation/16550/3 "2020-08-10T13:27:39Z")

</div>

Hello

Alpha is related to rugosity

```
Epsilon=.000000046 (*cte*);
Diamtubo=0.3 (*pipe diam.*);
Alpha=[Epsilon]/Diamtubo=1.53*10^-7

```

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [August 10, 2020, 1:55pm UTC](https://community.wolfram.com/t/colebrook-equation/16550/4 "2020-08-10T13:55:59Z")

</div>

Hi Luis,

As I suggested earlier, use `Map`.

```
Rei = {212.207, 53051.6, 106103., 161277., 214329., 267380., 320432.};
α = 1.53*10^-7;

f = Solve[1/f1^(1/2) == -2*Log10[(α)/3.7 + 2.51/(#*f1^(1/2))], f1] & /@ Rei // Flatten
(* {f1 -> 0.117072, f1 -> 0.0206185, f1 -> 0.0177702, f1 -> 0.0163184, 
 f1 -> 0.0154286, f1 -> 0.0147845, f1 -> 0.0142861} *)

```

---

<div class="post-metadata">

**Author:** ![luiarboleda](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/luiarboleda/32/36674_2.png) [@luiarboleda](https://community.wolfram.com/u/luiarboleda)\
**Post date:** [August 12, 2020, 12:28pm UTC](https://community.wolfram.com/t/colebrook-equation/16550/5 "2020-08-12T12:28:44Z")

</div>

Hi Rohit  
I’m writing some basic programs with the purpose of learning the Wolfram language  
I have reduced the list of this program thanks to your help  
So I investigated about Map  
As you know Map applies f to a list of values and obtain :  
f[a],f[b],f[c]  
but I don´t find how to use Map in my program

After obtain :

```
{f->0.117072,f->0.0206185,f->0.0177702,f->0.0163184,f->0.0154286,f->0.0147845,f->0.0142861}

```

I used the command Values to separate f-\>0.117072 to a vector

```
f1=Values[<|1->0.117072,2->0.0206185,3->0.0177702,4->0.0163184,5->0.0154286,6->0.0147845,7->0.0142861 |>] 
obtain :
{0.117072,0.0206185,0.0177702,0.0163184,0.0154286,0.0147845,0.0142861}

```

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [August 12, 2020, 1:21pm UTC](https://community.wolfram.com/t/colebrook-equation/16550/6 "2020-08-12T13:21:49Z")

</div>

Hi Luis,

`f` is a list of `Rule`. To see this

```
FullForm@f
(*
List[Rule[f1,0.11707222431878156],Rule[f1,0.020618532210891344],
Rule[f1,0.01777020476575501],Rule[f1,0.016318426788363215],
Rule[f1,0.015428590744168653],Rule[f1,0.01478451683889462],
Rule[f1,0.014286091322716812]]
*)

```

There are several ways to extract the right hand side of a `Rule`

```
rule = a -> b
Last@rule
(* b *)

rule /. Rule[a_, b_] :> b
(* b *)

```

So, to get the list of RHS values

```
Last /@ f
(* {0.117072, 0.0206185, 0.0177702, 0.0163184, 0.0154286, 0.0147845, 0.0142861} *)

f /. Rule[a_, b_] :> b
(* {0.117072, 0.0206185, 0.0177702, 0.0163184, 0.0154286, 0.0147845, 0.0142861} *)

```

If you are new to WL, I suggest reading [this](https://www.wolfram.com/language/elementary-introduction/2nd-ed/preface.html).

---

<div class="post-metadata">

**Author:** ![luiarboleda](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/luiarboleda/32/36674_2.png) [@luiarboleda](https://community.wolfram.com/u/luiarboleda)\
**Post date:** [August 14, 2020, 5:21am UTC](https://community.wolfram.com/t/colebrook-equation/16550/7 "2020-08-14T05:21:09Z")

</div>

Thank you very much for your help.  
I’ve been reading that on line book.  
I hope improve my Wolfram language.
