Message Boards Message Boards

GROUPS:

Colebrook equation

Posted 2 months ago
572 Views
|
6 Replies
|
1 Total Likes
|

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".

6 Replies
Posted 2 months ago

What is α? Take a look at Map.

Hello

Alpha is related to rugosity

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

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} *)

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}
Posted 2 months ago

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.

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

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract