Skip to content

Commit 8ead1cb

Browse files
author
jorrit
committed
Added rho_smoothing tests and reenabled it in the coolpropsolver
git-svn-id: https://svn.modelica.org/projects/ExternalMediaLibrary/trunk@8046 7ce873d0-865f-4ce7-a662-4bb36ea78beb
1 parent 3185d99 commit 8ead1cb

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

Modelica/ExternalMedia 3.2.1/Test.mo

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,48 @@ package Test "Test models for the different solvers"
10651065
varProps.Xi = X_var;
10661066
end incompressibleCoolPropMixture;
10671067
end Incompressible;
1068+
1069+
model RhoSmoothing
1070+
extends Modelica.Icons.Example;
1071+
package fluid_std
1072+
extends ExternalMedia.Media.CoolPropMedium(
1073+
mediumName = "Pentane",
1074+
substanceNames = {"n-Pentane|rho_smoothing_xend=0.0"},
1075+
inputChoice=ExternalMedia.Common.InputChoice.ph);
1076+
end fluid_std;
1077+
1078+
package fluid_spl
1079+
extends ExternalMedia.Media.CoolPropMedium(
1080+
mediumName = "Pentane",
1081+
substanceNames = {"n-Pentane|rho_smoothing_xend=0.2"},
1082+
inputChoice=ExternalMedia.Common.InputChoice.ph);
1083+
end fluid_spl;
1084+
1085+
fluid_std.ThermodynamicState state_std "Properties of the two-phase fluid";
1086+
fluid_spl.ThermodynamicState state_spl "Properties of the two-phase fluid";
1087+
1088+
Modelica.SIunits.AbsolutePressure p;
1089+
Modelica.SIunits.SpecificEnthalpy h;
1090+
1091+
fluid_std.SaturationProperties sat_std;
1092+
1093+
Modelica.SIunits.SpecificEnthalpy h_start;
1094+
Modelica.SIunits.SpecificEnthalpy h_end;
1095+
Modelica.SIunits.SpecificEnthalpy h_delta;
1096+
1097+
Modelica.SIunits.Time t = 1;
1098+
1099+
equation
1100+
p = 10E5;
1101+
sat_std = fluid_std.setSat_p(p);
1102+
h_start = fluid_std.bubbleEnthalpy(sat_std);
1103+
h_end = h_start;
1104+
//h_end = fluid_std.dewEnthalpy(sat_std);
1105+
h_delta = 1e3;
1106+
h = (h_start - h_delta) + (h_end-h_start+2*h_delta)*time/t;
1107+
state_std = fluid_std.setState_ph(p,h);
1108+
state_spl = fluid_spl.setState_ph(p,h);
1109+
end RhoSmoothing;
10681110
end CoolProp;
10691111

10701112
package WrongMedium "Test cases with wrong medium models"

Projects/Sources/coolpropsolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void CoolPropSolver::postStateChange(ExternalThermodynamicState *const propertie
223223
properties->ddhp = state->drhodh_constp_smoothed(twophase_derivsmoothing_xend); // [1/kPa -- > 1/Pa]
224224
properties->ddph = state->drhodp_consth_smoothed(twophase_derivsmoothing_xend); // [1/(kJ/kg) -- > 1/(J/kg)]
225225
}
226-
else if (state->TwoPhase && state->Q() >= 0 && state->Q() <= rho_smoothing_xend && twophase_derivsmoothing_xend > 0.0)
226+
else if (state->TwoPhase && state->Q() >= 0 && state->Q() <= rho_smoothing_xend && rho_smoothing_xend > 0.0)
227227
{
228228
// Use the smoothed density between a quality of 0 and rho_smoothing_xend
229229
double rho_spline;

0 commit comments

Comments
 (0)