0
$\begingroup$

I have a fluid mechanics problem, but when I try to solve an equation to get the flow rate Q (m^3/s) it throws an error that I can't track

ClearAll["Global`*"]
g = Quantity[9.81, "Meters"/"Seconds"^2];
rho = Quantity[1000, "Kilograms"/"Meters"^3];
mu = Quantity[1.31*10^3, "Newtons"*"Seconds"/"Meters"^2];
L1 = Quantity[50, "Meters"];
L2 = Quantity[30, "Meters"];
D1 = Quantity[7.5, "Centimeters"];
D2 = Quantity[15, "Centimeters"];
kcodo = 0.3;
kvalvula = 0.15;
k45 = 0.04;
k = Quantity[0.26, "Millimeters"];
z = Quantity[7.5, "Meters"]
f[Kd_, Re_] := Power[-1.8 Log10[Power[Kd/3.7, 1.1] + 6.9/Re], -2]
Reynolds[Diameter_, Q_] := (rho*4 Q)/(mu*Pi*Diameter)
FindRoot[(16 Q^2)/(
   g*Pi^2) ((L1*f[k/D1, Reynolds[D1, Q]])/D1^5 + (
     L2*f[k/D2, Reynolds[0.15, Q]])/D2^5) == z, {Q, 
  Quantity[1, "Meters"^3/"Seconds"]}]
Reynolds[0.15, %[[1, 2]]]

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ I think your dimensions are wrong. Maybe you want Reynolds[Quantity[0.15, "Centimeters"], Q] instead of Reynolds[0.15, Q]? $\endgroup$
    – Michael E2
    Dec 15, 2021 at 4:54
  • $\begingroup$ You're right! thanks. $\endgroup$ Dec 15, 2021 at 5:07

1 Answer 1

0
$\begingroup$

Use Plot to get an initial estimate for FindRoot

Plot[(16 Q^2)/(g*Pi^2) ((L1*f[k/D1, Reynolds[D1, Q]])/
      D1^5 + (L2*f[k/D2, Reynolds[Quantity[0.15, "Centimeters"], Q]])/D2^5) - 
  z,
 {Q, Quantity[10^-6, "Meters"^3/"Seconds"], 
  Quantity[0.005, "Meters"^3/"Seconds"]},
 Evaluated -> False,
 PlotRange -> {-10, 1}]

enter image description here

sol = FindRoot[(16 Q^2)/(g*Pi^2) ((L1*f[k/D1, Reynolds[D1, Q]])/
       D1^5 + (L2*f[k/D2, Reynolds[Quantity[0.15, "Centimeters"], Q]])/D2^5) ==
    z, {Q, Quantity[0.004, "Meters"^3/"Seconds"]}]

(* {Q -> Quantity[0.00441093, ("Meters")^3/("Seconds")]} *)

Reynolds[Quantity[0.15, "Centimeters"], Q] /. sol

(* 2.8581 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.