Skip to content

Commit

Permalink
critical phase failure
Browse files Browse the repository at this point in the history
  • Loading branch information
DANA-Laboratory committed Dec 14, 2016
1 parent 79ce9b9 commit ab50cf8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/CoolProp.jl
Expand Up @@ -9,7 +9,7 @@ message_buffer = Array(UInt8, buffer_length)

const inputs_to_get_global_param_string = ["version", "gitrevision", "errstring", "warnstring", "FluidsList", "incompressible_list_pure", "incompressible_list_solution", "mixture_binary_pairs_list", "parameter_list", "predefined_mixtures", "HOME", "cubic_fluids_schema"];

include("HighLevel.jl");
include("CoolPropHighLevel.jl");

# ---------------------------------
# Getter and setter for debug level
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions test/runtests.jl
Expand Up @@ -11,7 +11,7 @@ const coolproptrivialparameters = ["ACENTRIC", "DIPOLE_MOMENT", "FH", "FRACTION_
"TMIN", "TTRIPLE", "T_FREEZE", "T_REDUCING"];
const trivalwithnumval = ["FH","GWP100","PMIN","TMIN","P_REDUCING","PCRIT","GWP20","GAS_CONSTANT","PMAX","RHOCRIT","TCRIT","T_REDUCING","ACENTRIC","GWP500","RHOMOLAR_REDUCING","TMAX","TTRIPLE","PH","M","PTRIPLE","RHOMOLAR_CRITICAL","ODP","HH"];
const fails_any_props_trivals = ["DIPOLE_MOMENT","FRACTION_MAX","FRACTION_MIN","RHOMASS_REDUCING","T_FREEZE"];
const fails_critical_point = [["DiethylEther"]; ["trans-2-Butene", "SulfurDioxide", "SES36", "R507A", "R410A", "R41", "R407C", "R404A", "R245fa", "R236FA", "R227EA", "R134a", "R116", "R11", "Oxygen", "Neon", "n-Undecane", "n-Propane", "n-Pentane", "n-Nonane", "MM", "MDM", "Air", "CycloPropane", "D5", "DimethylCarbonate", "Fluorine", "Helium", "IsoButane", "Isohexane", "MD4M"]];
const fails_critical_point = ["DiethylEther","R134a","R116","SulfurDioxide","n-Pentane","R11","CycloPropane","MDM","n-Nonane","Oxygen","DimethylCarbonate","R41","R227EA","R245fa","trans-2-Butene","n-Propane","MM","Air","R236FA","Neon","SES36","Fluorine","n-Undecane","Isohexane","MD4M","IsoButane","D5"];
const fails_tcrit_eq_treducing = ["R134a","R116","n-Pentane","R11","n-Nonane","MDM","Oxygen","R41","MM","Neon","Fluorine","n-Undecane","Isohexane","Helium","IsoButane","D5"];
#high
info("********* High Level Api *********");
Expand All @@ -26,11 +26,11 @@ end
#PropsSI
@test (CoolProp.PropsSI("T","P",101325.0,"Q",0.0,"Water")-373.1242958476879)<1e-5
#get_fluid_param_string PhaseSI PropsSI
include("AllFluids.jl");
include("testFluids.jl");
#get_parameter_information_string PropsSI
include("AllParameters.jl");
include("AllConstants.jl");
include("Low.jl");
include("testParameters.jl");
include("testConstants.jl");
include("testLow.jl");


#set_reference_stateS
Expand Down
File renamed without changes.
27 changes: 16 additions & 11 deletions test/AllFluids.jl → test/testFluids.jl
Expand Up @@ -3,6 +3,7 @@ counter = 0;
maxdiffreduvscriti = 0.0;
maxfluid = "";
uneq = Set();
critphasefail = Set();
logf = open("fluids.table", "w");
println(logf, "ID |Name |Alias |CAS |Pure |Formula |BibTeX ");
println(logf, ":--|:----|:-----|:---|:----|:-------|:------");
Expand All @@ -19,17 +20,19 @@ for fluid in coolpropfluids
print(logf, "\n");
tcrit = PropsSI("TCRIT", fluid);
pcrit = PropsSI("PCRIT", fluid);
!(fluid in fails_critical_point) && begin
#DiethylEther
println(fluid);
@test PhaseSI("P", pcrit, "T", tcrit, fluid)=="critical_point";
@test PhaseSI("P", pcrit+100, "T", tcrit+10, fluid)=="supercritical";
@test PhaseSI("P", pcrit+100, "T", tcrit-10, fluid)=="supercritical_liquid";
@test PhaseSI("P", pcrit-100, "T", tcrit+10, fluid)=="supercritical_gas";
psat = PropsSI("P","T",tcrit-10,"Q",1, fluid);
@test PhaseSI("P", psat+100, "T", tcrit-10, fluid)=="liquid";
@test PhaseSI("P", psat-100, "T", tcrit-10, fluid)=="gas";
try
(PhaseSI("P", pcrit, "T", tcrit, fluid) != "critical_point") && push!(critphasefail, fluid);
catch err
push!(critphasefail, fluid);
end
@test PhaseSI("P", pcrit+50000, "T", tcrit+3, fluid)=="supercritical";
@test PhaseSI("P", pcrit+50000, "T", tcrit-3, fluid)=="supercritical_liquid";
@test PhaseSI("P", pcrit-50000, "T", tcrit+3, fluid)=="supercritical_gas";
psat = PropsSI("P","T",tcrit-3,"Q",1, fluid);
t3 = PropsSI("Ttriple", fluid);
p3 = PropsSI("ptriple", fluid);
@test PhaseSI("P", p3, "T", (t3+tcrit)/2, fluid)=="gas";
@test PhaseSI("P", (pcrit+p3)/2, "T", (t3+tcrit)/2, fluid)=="liquid";
(pure == "true") && (tcrit != PropsSI("T_REDUCING", fluid)) && push!(uneq, fluid);
diffreduvscriti = abs(PropsSI("TCRIT", fluid) - PropsSI("T_REDUCING", fluid));
if (diffreduvscriti > maxdiffreduvscriti)
Expand All @@ -40,4 +43,6 @@ end
close(logf);
println("max diff between reducing vs critical point temp: $maxdiffreduvscriti for $maxfluid");
@test uneq == Set(fails_tcrit_eq_treducing);
println("fails_tcrit_eq_treducing $uneq");
println("different reducing vs critical point: $uneq");
@test issubset(critphasefail, Set(fails_critical_point));
println("fails to get phase for critical point: $critphasefail");
File renamed without changes.
File renamed without changes.

0 comments on commit ab50cf8

Please sign in to comment.