Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdditionalSqrt #4396

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modelica/ComplexBlocks/ComplexMath/ComplexToPolar.mo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ block ComplexToPolar "Converts complex to polar representation"
parameter Boolean useConjugateInput=false
"If true, input is processed conjugate complex";
equation
len = (u.re^2 + u.im^2)^0.5;
len = sqrt(u.re^2 + u.im^2);
phi = (if useConjugateInput then Modelica.Math.atan2(-u.im, u.re) else
Modelica.Math.atan2(u.im, u.re));

Expand Down
2 changes: 1 addition & 1 deletion Modelica/ComplexMath.mo
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ end Vectors;
input Complex c "Complex number";
output Real result "= abs(c)";
algorithm
result := (c.re^2 + c.im^2)^0.5; //changed from sqrt
result := .sqrt(c.re^2 + c.im^2); // Real, not complex sqrt
annotation(Inline=true, Documentation(info="<html>
<p>This function returns the Real absolute of the Complex input, i.e., its length.</p>
</html>"));
Expand Down
6 changes: 3 additions & 3 deletions Modelica/Fluid/Dissipation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4417,7 +4417,7 @@ This record is used as <strong>input record</strong> for the pressure loss funct
DP := 0.5*IN_var.zeta_TOT*
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower(
m_flow,
(IN_con.dp_smooth/(0.5*IN_var.zeta_TOT*IN_var.rho))^0.5*IN_var.rho
sqrt(IN_con.dp_smooth/(0.5*IN_var.zeta_TOT*IN_var.rho))*IN_var.rho
*IN_con.A_cross,
2)/(IN_var.rho*(IN_con.A_cross)^2);
annotation (Inline=true, smoothOrder(normallyConstant=IN_con) = 2,
Expand Down Expand Up @@ -4463,7 +4463,7 @@ Generally this function is numerically best used for the <strong>incompressible
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower(
dp,
IN_con.dp_smooth,
0.5)/(0.5*IN_var.zeta_TOT*IN_var.rho)^0.5;
0.5)/sqrt(0.5*IN_var.zeta_TOT*IN_var.rho);
annotation (Inline=true, smoothOrder(normallyConstant=IN_con) = 2,
inverse(dp=Modelica.Fluid.Dissipation.PressureLoss.General.dp_pressureLossCoefficient_DP(
IN_con,
Expand Down Expand Up @@ -12865,7 +12865,7 @@ In the picture below the input x is increased from 0 to 1. The range of interpol
"Rectangular cross sectional area", enable=geometry ==
Modelica.Fluid.Dissipation.Utilities.Types.GeometryOfInternalFlow.Rectangular));
//triangular(5)
SI.Length a_tri=d_cir*(1 + 2^0.5) "Length of base line" annotation (Dialog(
SI.Length a_tri=d_cir*(1 + sqrt(2)) "Length of base line" annotation (Dialog(
group="Rectangular cross sectional area", enable=geometry ==
Modelica.Fluid.Dissipation.Utilities.Types.GeometryOfInternalFlow.Rectangular));
SI.Length h_tri=0.5*a_tri
Expand Down
12 changes: 6 additions & 6 deletions Modelica/Media/Water/IF97_Utilities.mo
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ email: [email protected]
"IF97 medium function boundary23ofp called with too low pressure\n"
+ "p = " + String(p) + " Pa <= " + String(triple.ptriple) +
" Pa (triple point pressure)");
t := n[4] + ((pi - n[5])/n[3])^0.5;
t := n[4] + sqrt((pi - n[5])/n[3]);
end boundary23ofp;

function hlowerofp5
Expand Down Expand Up @@ -423,7 +423,7 @@ email: [email protected]
"IF97 medium function hlowerofp2 called with too low pressure\n" +
"p = " + String(p) + " Pa <= " + String(triple.ptriple) +
" Pa (triple point pressure)");
q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
q1 := 572.54459862746 + 31.3220101646784*sqrt(-13.91883977887 + pi);
q2 := -0.5 + 540./q1;
o[1] := q1*q1;
o[2] := o[1]*o[1];
Expand Down Expand Up @@ -514,7 +514,7 @@ email: [email protected]
"IF97 medium function slowerofp2 called with too low pressure\n" +
"p = " + String(p) + " Pa <= " + String(triple.ptriple) +
" Pa (triple point pressure)");
q1 := 572.54459862746 + 31.3220101646784*(-13.91883977887 + pi)^0.5;
q1 := 572.54459862746 + 31.3220101646784*sqrt(-13.91883977887 + pi);
q2 := -0.5 + 540.0/q1;
o[1] := pi*pi;
o[2] := o[1]*pi;
Expand Down Expand Up @@ -3143,9 +3143,9 @@ email: [email protected]
o[7] := 14.9151086135300*o[6];
o[8] := 405113.40542057 + o[5] + o[7];
p_sat := 16.0e6*o[8]*o[8]*o[8]*o[8]*1/(3.2325550322333e6 -
12020.8247024700*o[4] + 17.0738469400920*o[6] + (-4.0*(-724213.16703206
12020.8247024700*o[4] + 17.0738469400920*o[6] + sqrt(-4.0*(-724213.16703206
+ 1167.05214527670*o[4] + o[6])*o[8] + (-3.2325550322333e6 +
12020.8247024700*o[4] - 17.0738469400920*o[6])^2.0)^0.5)^4.0;
12020.8247024700*o[4] - 17.0738469400920*o[6])^2.0))^4.0;
annotation (derivative=psat_der);
end psat;

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