@@ -15,54 +15,58 @@ model Pipe "Model of a pipe"
1515 Dialog(group = "Geometry" ));
1616 parameter SI.Height p_eps = data.p_eps "Pipe roughness height" annotation (
1717 Dialog(group = "Geometry" ));
18- //parameter Real K_c = 0.1 "Loss coefficient for contraction"
19- // annotation (Dialog(group = "Geometry"));
18+
2019 // Steady state:
2120 parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization" ));
2221 parameter SI.VolumeFlowRate Vdot_0=data.Vdot_0 "Initial flow rate of the pipe" annotation (Dialog(group="Initialization" ));
2322
2423
2524 SI.Velocity v "Average Water velocity" ;
2625 SI.Force F_f "Friction force" ;
27- // SI.Force F_taper "Tape friction force";
28- SI.Momentum M "Water momentum" ;
26+ //SI.Momentum M "Water momentum";
2927 SI.Pressure p_i "Inlet pressure" ;
3028 SI.Pressure p_o "Outlet pressure" ;
3129 SI.Pressure dp= p_o- p_i "Pressure difference across the pipe" ;
3230 SI.VolumeFlowRate Vdot(start = Vdot_0) "Volume flow rate" ;
3331 protected
34- SI.Velocity v_o;
35- parameter Real delta= (D_i- D_o)/ D_i "Contraction factor" ;
36- // parameter Real ddd=;
3732 parameter SI.Diameter D_ = sqrt ((4 / C.pi)* A_) "Average diameter" ;
3833 parameter SI.Mass m = data.rho * A_ * L "Mass of water" ;
3934 parameter SI.Area A_i = D_i ^ 2 * C.pi / 4 "Inlet cross-sectional area" ;
4035 parameter SI.Area A_o = D_o ^ 2 * C.pi / 4 "Outlet cross-sectional area" ;
4136 parameter SI.Area A_ = 0.5 * (A_i + A_o) "Average cross-sectional area" ;
42-
37+ parameter Real delta= (D_i- D_o)/ D_i "Contraction factor" ;
38+ parameter Real cf= ((0.5 * delta+ 1 )/ (delta^ 2 + 2 * delta+ 1 )) "Conical pipe function" ;
4339 parameter Real cos_theta = H / L "Slope ratio" ;
40+ parameter Real phi = Modelica.Units.Conversions.to_deg(Modelica.Math.atan ((abs (D_i- D_o)/ (2 * L)))) "Cone half angle" ;
4441
4542
4643
4744
4845initial equation
46+
4947 if SteadyState then
50- der (M) = 0 ;
48+ // der(M)= 0;
49+ der (mdot) = 0 ;
5150 end if ;
52- assert ((D_i- D_o)/ L > 0.1 , "Change in pipe diameter too large" ,AssertionLevel.warning);
51+ algorithm
52+ Modelica.Utilities.Streams.print("\n D> delta..........= " + String (delta)+ "\n " );
53+ Modelica.Utilities.Streams.print("\n D> Cone function..= " + String (cf)+ "\n " );
54+ assert ( phi > 1.0 , "Change in pipe diameter is too large. (angle= " + String (phi)+ " )" ,AssertionLevel.warning);
5355equation
56+
5457 Vdot = mdot / data.rho "Volumetric flow rate through the pipe" ;
5558 v = Vdot / A_ "Average water velocity" ;
56- v_o = Vdot / A_o "Outlet water velocity" ;
57- M = data.rho * L * Vdot "Momentum of water" ;
58-
59- F_f = Functions.DarcyFriction.Friction(v, D_, L, data.rho, data.mu, p_eps)* ((0.5 * delta+ 1 )/ (delta^ 2 + 2 * delta+ 1 )) "Friction force" ;
59+ // v_o = Vdot / A_o "Outlet water velocity";
60+ //M = data.rho * L * Vdot "Momentum of water";
6061
62+ F_f = Functions.DarcyFriction.Friction(v, D_, L, data.rho, data.mu, p_eps)* cf "Friction force" ;
63+ /*
6164 der(M) = data.rho * Vdot^2 * (1/A_i - 1/A_o)
6265 + p_i * A_i - p_o * A_o
6366 - F_f
6467 + m * data.g * cos_theta "Momentum balance including friction loss";
65-
68+ */
69+ L * der (mdot)= (p_i+ data.rho * data.g * H)* A_i- p_o* A_o - F_f;
6670 p_i = i.p "Inlet pressure" ;
6771 p_o = o.p "Outlet pressure" ;
6872
0 commit comments