Skip to content

Commit 62646af

Browse files
committed
More sqrt; have review all.
Remaining are: documentation, or combined with other fractional exponents.
1 parent 1be54b5 commit 62646af

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

Modelica/ComplexMath.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ end Vectors;
488488
input Complex c "Complex number";
489489
output Real result "= abs(c)";
490490
algorithm
491-
result := (c.re^2 + c.im^2)^0.5; //changed from sqrt
491+
result := .sqrt(c.re^2 + c.im^2); // Real, not complex sqrt
492492
annotation(Inline=true, Documentation(info="<html>
493493
<p>This function returns the Real absolute of the Complex input, i.e., its length.</p>
494494
</html>"));

Modelica/Fluid/Dissipation.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4417,9 +4417,9 @@ This record is used as <strong>input record</strong> for the pressure loss funct
44174417
DP := 0.5*IN_var.zeta_TOT*
44184418
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower(
44194419
m_flow,
4420-
(IN_con.dp_smooth/(0.5*IN_var.zeta_TOT*IN_var.rho))^0.5*IN_var.rho
4420+
sqrt(IN_con.dp_smooth/(0.5*IN_var.zeta_TOT*IN_var.rho))*IN_var.rho
44214421
*IN_con.A_cross,
4422-
2)/(IN_var.rho*(IN_con.A_cross)^2);
4422+
2)/(IN_var.rho*sqrt(IN_con.A_cross));
44234423
annotation (Inline=true, smoothOrder(normallyConstant=IN_con) = 2,
44244424
inverse(m_flow=Modelica.Fluid.Dissipation.PressureLoss.General.dp_pressureLossCoefficient_MFLOW(
44254425
IN_con,
@@ -4463,7 +4463,7 @@ Generally this function is numerically best used for the <strong>incompressible
44634463
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower(
44644464
dp,
44654465
IN_con.dp_smooth,
4466-
0.5)/(0.5*IN_var.zeta_TOT*IN_var.rho)^0.5;
4466+
0.5)/sqrt(0.5*IN_var.zeta_TOT*IN_var.rho);
44674467
annotation (Inline=true, smoothOrder(normallyConstant=IN_con) = 2,
44684468
inverse(dp=Modelica.Fluid.Dissipation.PressureLoss.General.dp_pressureLossCoefficient_DP(
44694469
IN_con,
@@ -12865,7 +12865,7 @@ In the picture below the input x is increased from 0 to 1. The range of interpol
1286512865
"Rectangular cross sectional area", enable=geometry ==
1286612866
Modelica.Fluid.Dissipation.Utilities.Types.GeometryOfInternalFlow.Rectangular));
1286712867
//triangular(5)
12868-
SI.Length a_tri=d_cir*(1 + 2^0.5) "Length of base line" annotation (Dialog(
12868+
SI.Length a_tri=d_cir*(1 + sqrt(2)) "Length of base line" annotation (Dialog(
1286912869
group="Rectangular cross sectional area", enable=geometry ==
1287012870
Modelica.Fluid.Dissipation.Utilities.Types.GeometryOfInternalFlow.Rectangular));
1287112871
SI.Length h_tri=0.5*a_tri

Modelica/Media/Water/IF97_Utilities.mo

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ email: hubertus@modelon.se
423423
"IF97 medium function hlowerofp2 called with too low pressure\n" +
424424
"p = " + String(p) + " Pa <= " + String(triple.ptriple) +
425425
" Pa (triple point pressure)");
426-
q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
426+
q1 := 572.54459862746 + 31.3220101646784*sqrt(-13.91883977887 + pi);
427427
q2 := -0.5 + 540./q1;
428428
o[1] := q1*q1;
429429
o[2] := o[1]*o[1];
@@ -514,7 +514,7 @@ email: hubertus@modelon.se
514514
"IF97 medium function slowerofp2 called with too low pressure\n" +
515515
"p = " + String(p) + " Pa <= " + String(triple.ptriple) +
516516
" Pa (triple point pressure)");
517-
q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
517+
q1 := 572.54459862746 + 31.3220101646784*sqrt(-13.91883977887 + pi);
518518
q2 := -0.5 + 540.0/q1;
519519
o[1] := pi*pi;
520520
o[2] := o[1]*pi;
@@ -3143,9 +3143,9 @@ email: hubertus@modelon.se
31433143
o[7] := 14.9151086135300*o[6];
31443144
o[8] := 405113.40542057 + o[5] + o[7];
31453145
p_sat := 16.0e6*o[8]*o[8]*o[8]*o[8]*1/(3.2325550322333e6 -
3146-
12020.8247024700*o[4] + 17.0738469400920*o[6] + (-4.0*(-724213.16703206
3146+
12020.8247024700*o[4] + 17.0738469400920*o[6] + sqrt(-4.0*(-724213.16703206
31473147
+ 1167.05214527670*o[4] + o[6])*o[8] + (-3.2325550322333e6 +
3148-
12020.8247024700*o[4] - 17.0738469400920*o[6])^2.0)^0.5)^4.0;
3148+
12020.8247024700*o[4] - 17.0738469400920*o[6])^2.0))^4.0;
31493149
annotation (derivative=psat_der);
31503150
end psat;
31513151

@@ -4093,7 +4093,7 @@ Ordinary Water Substance<br>
40934093
deltam1 := delta - 1.0;
40944094
tau := tstar/T;
40954095
taum1 := tau - 1.0;
4096-
Psi0 := 1/(n0 + (n1 + (n2 + n3*tau)*tau)*tau)/(tau^0.5);
4096+
Psi0 := 1/(n0 + (n1 + (n2 + n3*tau)*tau)*tau)/(sqrt(tau));
40974097
Psi1 := 0.0;
40984098
tfun := 1.0;
40994099
for i in 1:6 loop

0 commit comments

Comments
 (0)