From 5accf645d9156d9c413bbd44244a71901ee2c55c Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Mon, 2 Jun 2014 13:21:06 +0200 Subject: [PATCH] IIR HS references set for real this time Signed-off-by: Ian Bell --- dev/fluids/CarbonDioxide.json | 4 ++-- dev/fluids/CycloPropane.json | 4 ++-- dev/fluids/HFE143m.json | 4 ++-- dev/fluids/IsoButane.json | 4 ++-- dev/fluids/Propylene.json | 4 ++-- dev/fluids/Propyne.json | 4 ++-- dev/fluids/R11.json | 4 ++-- dev/fluids/R113.json | 4 ++-- dev/fluids/R114.json | 4 ++-- dev/fluids/R12.json | 4 ++-- dev/fluids/R123.json | 4 ++-- dev/fluids/R1233zd(E).json | 4 ++-- dev/fluids/R1234ze(E).json | 4 ++-- dev/fluids/R124.json | 4 ++-- dev/fluids/R13.json | 4 ++-- dev/fluids/R143a.json | 4 ++-- dev/fluids/R152A.json | 4 ++-- dev/fluids/R161.json | 4 ++-- dev/fluids/R21.json | 4 ++-- dev/fluids/R22.json | 4 ++-- dev/fluids/R227EA.json | 4 ++-- dev/fluids/R365MFC.json | 4 ++-- dev/fluids/R41.json | 4 ++-- dev/fluids/R507A.json | 4 ++-- dev/fluids/RC318.json | 4 ++-- dev/fluids/SES36.json | 4 ++-- dev/fluids/SulfurHexafluoride.json | 4 ++-- dev/fluids/n-Butane.json | 4 ++-- include/CoolProp.h | 4 ++-- src/Backends/Helmholtz/Fluids/FluidLibrary.h | 4 ---- src/CoolProp.cpp | 8 ++------ src/main.cxx | 19 +++++++++++-------- 32 files changed, 71 insertions(+), 76 deletions(-) diff --git a/dev/fluids/CarbonDioxide.json b/dev/fluids/CarbonDioxide.json index 1664ad91..b8c6be3c 100644 --- a/dev/fluids/CarbonDioxide.json +++ b/dev/fluids/CarbonDioxide.json @@ -181,8 +181,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -9.20482556461383, - "a2": 5.33930790626966, + "a1": -14.4979156224319, + "a2": 8.82013935801453, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/CycloPropane.json b/dev/fluids/CycloPropane.json index f8601dd0..59eb28a9 100644 --- a/dev/fluids/CycloPropane.json +++ b/dev/fluids/CycloPropane.json @@ -170,8 +170,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -5.8744265562982, - "a2": 6.20999715674064, + "a1": -10.9358280454636, + "a2": 8.75156673092286, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/HFE143m.json b/dev/fluids/HFE143m.json index 2e22b77d..e0dbe6d5 100644 --- a/dev/fluids/HFE143m.json +++ b/dev/fluids/HFE143m.json @@ -163,8 +163,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": 12.0321093183046, - "a2": -6.36756620155532, + "a1": 7.64964970449937e-05, + "a2": -8.0498560479886e-05, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/IsoButane.json b/dev/fluids/IsoButane.json index fd652ba2..137552b2 100644 --- a/dev/fluids/IsoButane.json +++ b/dev/fluids/IsoButane.json @@ -181,8 +181,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -10.6176788623373, - "a2": 6.88514458886201, + "a1": -17.6081648486994, + "a2": 10.3134499204439, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/Propylene.json b/dev/fluids/Propylene.json index 7687e10a..be9e6370 100644 --- a/dev/fluids/Propylene.json +++ b/dev/fluids/Propylene.json @@ -176,8 +176,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -5.11295044650128, - "a2": 1.75576391667209, + "a1": -10.1739741651451, + "a2": 4.53493517654279, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/Propyne.json b/dev/fluids/Propyne.json index 9a0b6d1b..722a324a 100644 --- a/dev/fluids/Propyne.json +++ b/dev/fluids/Propyne.json @@ -180,8 +180,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -6.18582150073625, - "a2": 6.53176084341793, + "a1": -11.004154248087, + "a2": 8.92674898200796, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R11.json b/dev/fluids/R11.json index b67aa2a1..6b28664d 100644 --- a/dev/fluids/R11.json +++ b/dev/fluids/R11.json @@ -194,8 +194,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -3.46143051269673, - "a2": 5.60542532549845, + "a1": -19.9828934089637, + "a2": 12.619996028432, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R113.json b/dev/fluids/R113.json index b5573ca1..1dd5333d 100644 --- a/dev/fluids/R113.json +++ b/dev/fluids/R113.json @@ -173,8 +173,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -12.4676884656992, - "a2": 8.09676898052432, + "a1": -35.0036997726949, + "a2": 17.3478156256033, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R114.json b/dev/fluids/R114.json index c36c575f..1bbf6822 100644 --- a/dev/fluids/R114.json +++ b/dev/fluids/R114.json @@ -177,8 +177,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -7.71227716096457, - "a2": 7.63006492791018, + "a1": -28.2691959611666, + "a2": 17.4464013989786, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R12.json b/dev/fluids/R12.json index 3e7014ee..d62620b5 100644 --- a/dev/fluids/R12.json +++ b/dev/fluids/R12.json @@ -175,8 +175,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -10.1855125183786, - "a2": 6.51519136530849, + "a1": -24.7279903483588, + "a2": 14.0673715241366, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R123.json b/dev/fluids/R123.json index 6b0f06a1..84e8651f 100644 --- a/dev/fluids/R123.json +++ b/dev/fluids/R123.json @@ -179,8 +179,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -8.28406664756038, - "a2": 8.00843244470562, + "a1": -26.6772954975428, + "a2": 16.0611372782126, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R1233zd(E).json b/dev/fluids/R1233zd(E).json index a44fd484..5b008241 100644 --- a/dev/fluids/R1233zd(E).json +++ b/dev/fluids/R1233zd(E).json @@ -162,8 +162,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -1.15714201814723, - "a2": 5.10465640895579, + "a1": -16.8522083554925, + "a2": 12.2591026026175, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R1234ze(E).json b/dev/fluids/R1234ze(E).json index 640ecede..10ec8044 100644 --- a/dev/fluids/R1234ze(E).json +++ b/dev/fluids/R1234ze(E).json @@ -164,8 +164,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 0.85309349094503, - "a2": 0.385031495925059, + "a1": -12.8629419710783, + "a2": 7.55643976844588, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R124.json b/dev/fluids/R124.json index 99cc6c69..ed1cd1a2 100644 --- a/dev/fluids/R124.json +++ b/dev/fluids/R124.json @@ -171,8 +171,8 @@ "type": "IdealGasHelmholtzPower" }, { - "a1": 16.4141514232817, - "a2": -8.30203002449525, + "a1": -0.000144036507408073, + "a2": 7.30088431548676e-05, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R13.json b/dev/fluids/R13.json index 2b517c6e..271d84be 100644 --- a/dev/fluids/R13.json +++ b/dev/fluids/R13.json @@ -177,8 +177,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -4.70147467359404, - "a2": 5.39527702491361, + "a1": -17.2649115260318, + "a2": 13.7187307950669, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R143a.json b/dev/fluids/R143a.json index 8fc91058..f98ac382 100644 --- a/dev/fluids/R143a.json +++ b/dev/fluids/R143a.json @@ -182,8 +182,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -10.305014971571, - "a2": -1.84499312905667, + "a1": -20.4128125563124, + "a2": 4.0000801727654, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R152A.json b/dev/fluids/R152A.json index 81d5f91a..ce7d402f 100644 --- a/dev/fluids/R152A.json +++ b/dev/fluids/R152A.json @@ -173,8 +173,8 @@ "type": "IdealGasHelmholtzPower" }, { - "a1": 7.93834875128042, - "a2": -4.10681809203532, + "a1": -0.00575158142139323, + "a2": 0.00491802084015653, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R161.json b/dev/fluids/R161.json index 4596fa44..cde53658 100644 --- a/dev/fluids/R161.json +++ b/dev/fluids/R161.json @@ -174,8 +174,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 5.7802649054724, - "a2": -3.08073617461255, + "a1": 4.21805657510139e-05, + "a2": -4.5424171382829e-06, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R21.json b/dev/fluids/R21.json index 88724108..1a45cc4f 100644 --- a/dev/fluids/R21.json +++ b/dev/fluids/R21.json @@ -177,8 +177,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -7.1706255131862, - "a2": 7.15574544804595, + "a1": -19.5492777147267, + "a2": 12.6393155496886, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R22.json b/dev/fluids/R22.json index 53955c9e..f565a853 100644 --- a/dev/fluids/R22.json +++ b/dev/fluids/R22.json @@ -202,8 +202,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 11.5767418685512, - "a2": -6.25428015326267, + "a1": 1.17703822802506, + "a2": -0.622087185111783, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R227EA.json b/dev/fluids/R227EA.json index 5a13a1a6..1a4d4a02 100644 --- a/dev/fluids/R227EA.json +++ b/dev/fluids/R227EA.json @@ -175,8 +175,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 4.62066027816592, - "a2": 0.178496372662916, + "a1": -15.8290880642424, + "a2": 11.087938006383, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R365MFC.json b/dev/fluids/R365MFC.json index be7cd280..3285522c 100644 --- a/dev/fluids/R365MFC.json +++ b/dev/fluids/R365MFC.json @@ -171,8 +171,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 1.46690190075666, - "a2": 2.54580919243753, + "a1": -16.3423492459187, + "a2": 10.2889618649051, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R41.json b/dev/fluids/R41.json index a120d922..7e086068 100644 --- a/dev/fluids/R41.json +++ b/dev/fluids/R41.json @@ -178,8 +178,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 4.09473741595023, - "a2": -2.58374047330277, + "a1": 0.00152259725820867, + "a2": -0.00354958910457479, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/R507A.json b/dev/fluids/R507A.json index 0b1ecf4a..8ab6a7c9 100644 --- a/dev/fluids/R507A.json +++ b/dev/fluids/R507A.json @@ -171,8 +171,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": 11.8898434084695, - "a2": -6.91754471427476, + "a1": -0.000171976752843711, + "a2": -1.94367029874932e-05, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/RC318.json b/dev/fluids/RC318.json index c1f1a6e0..59797af7 100644 --- a/dev/fluids/RC318.json +++ b/dev/fluids/RC318.json @@ -175,8 +175,8 @@ "type": "IdealGasHelmholtzCP0PolyT" }, { - "a1": -8.45917550941048, - "a2": 8.39377061631628, + "a1": -32.5172232538152, + "a2": 20.7826742209953, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/SES36.json b/dev/fluids/SES36.json index 0d242573..fae77d62 100644 --- a/dev/fluids/SES36.json +++ b/dev/fluids/SES36.json @@ -145,8 +145,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -2.33911681574654, - "a2": 0.0442616554096881, + "a1": -24.5714365589605, + "a2": 9.90994603225193, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/SulfurHexafluoride.json b/dev/fluids/SulfurHexafluoride.json index fd1950ff..d8f7788c 100644 --- a/dev/fluids/SulfurHexafluoride.json +++ b/dev/fluids/SulfurHexafluoride.json @@ -176,8 +176,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -9.48116163251935, - "a2": 6.18439894480951, + "a1": -27.047571044927, + "a2": 17.2073865481014, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/dev/fluids/n-Butane.json b/dev/fluids/n-Butane.json index 86daf899..712e6c48 100644 --- a/dev/fluids/n-Butane.json +++ b/dev/fluids/n-Butane.json @@ -178,8 +178,8 @@ "type": "IdealGasHelmholtzPlanckEinstein" }, { - "a1": -10.9833028475357, - "a2": 7.10059070097953, + "a1": -17.9737888338978, + "a2": 10.3892639083242, "reference": "IIR", "type": "IdealGasHelmholtzEnthalpyEntropyOffset" } diff --git a/include/CoolProp.h b/include/CoolProp.h index a8d38140..fd7d3b22 100644 --- a/include/CoolProp.h +++ b/include/CoolProp.h @@ -125,7 +125,7 @@ You might want to start by looking at CoolProp.h \f] where \f$ \Delta s = s-_{spec} \f$ and \f$ \Delta h = h-_{spec} \f$ */ - int set_reference_stateS(std::string FluidName, std::string reference_state); + void set_reference_stateS(std::string FluidName, std::string reference_state); /// Set the reference state based on a thermodynamic state point /// @param FluidName The name of the fluid @@ -133,7 +133,7 @@ You might want to start by looking at CoolProp.h /// @param rho Density at reference state [mol/m^3] /// @param h0 Enthalpy at reference state [J/kg] /// @param s0 Entropy at references state [J/kg/K] - int set_reference_stateD(std::string FluidName, double T, double rho, double h0, double s0); + void set_reference_stateD(std::string FluidName, double T, double rho, double h0, double s0); /* /// Return the phase of the given state point with temperature, pressure as inputs diff --git a/src/Backends/Helmholtz/Fluids/FluidLibrary.h b/src/Backends/Helmholtz/Fluids/FluidLibrary.h index 8aab5592..e367369d 100644 --- a/src/Backends/Helmholtz/Fluids/FluidLibrary.h +++ b/src/Backends/Helmholtz/Fluids/FluidLibrary.h @@ -791,10 +791,6 @@ public: fluid.name = fluid_json["NAME"].GetString(); name_vector.push_back(fluid.name); // CAS number fluid.CAS = fluid_json["CAS"].GetString(); - if (!fluid_json.HasMember("REFPROP_NAME")) - { - std::cout << fluid.name << std::endl; - } // REFPROP alias fluid.REFPROPname = fluid_json["REFPROP_NAME"].GetString(); // Critical state diff --git a/src/CoolProp.cpp b/src/CoolProp.cpp index 3da98c0c..bdf4a6d4 100644 --- a/src/CoolProp.cpp +++ b/src/CoolProp.cpp @@ -639,7 +639,7 @@ double Props1SI(std::string FluidName,std::string Output) // } //} // -int set_reference_stateS(std::string Ref, std::string reference_state) +void set_reference_stateS(std::string Ref, std::string reference_state) { std::tr1::shared_ptr HEOS; HEOS.reset(new CoolProp::HelmholtzEOSMixtureBackend(std::vector(1, Ref))); @@ -654,7 +654,6 @@ int set_reference_stateS(std::string Ref, std::string reference_state) double delta_a1 = deltas/(8.314472/HEOS->molar_mass()); double delta_a2 = -deltah/(8.314472/HEOS->molar_mass()*HEOS->get_reducing().T); HEOS->get_components()[0]->pEOS->alpha0.EnthalpyEntropyOffset.set(delta_a1, delta_a2, "IIR"); - return 0; } else if (!reference_state.compare("ASHRAE")) { @@ -666,7 +665,6 @@ int set_reference_stateS(std::string Ref, std::string reference_state) double delta_a1 = deltas/(8.314472/HEOS->molar_mass()); double delta_a2 = -deltah/(8.314472/HEOS->molar_mass()*HEOS->get_reducing().T); HEOS->get_components()[0]->pEOS->alpha0.EnthalpyEntropyOffset.set(delta_a1, delta_a2, "ASHRAE"); - return 0; } else if (!reference_state.compare("NBP")) { @@ -678,8 +676,6 @@ int set_reference_stateS(std::string Ref, std::string reference_state) double delta_a1 = deltas/(8.314472/HEOS->molar_mass()); double delta_a2 = -deltah/(8.314472/HEOS->molar_mass()*HEOS->get_reducing().T); HEOS->get_components()[0]->pEOS->alpha0.EnthalpyEntropyOffset.set(delta_a1, delta_a2, "NBP"); - - return 0; } else if (!reference_state.compare("DEF")) { @@ -692,7 +688,7 @@ int set_reference_stateS(std::string Ref, std::string reference_state) } else { - return -1; + throw ValueError(format("reference state string is invalid: [%s]",reference_state.c_str())); } } //int set_reference_stateD(std::string Ref, double T, double rho, double h0, double s0) diff --git a/src/main.cxx b/src/main.cxx index 2d6bb6ac..ebe4d34a 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -64,25 +64,27 @@ int main() std::string IIR_refs[] = {"SES36","R143a","CycloPropane","Propylene","R227EA","R365MFC","R161","HFE143m","SulfurHexafluoride","CarbonDioxide","R1234ze(E)","R22","R124","Propyne","R507A","R152A","R123","R11","n-Butane","IsoButane","RC318","R21","R114","R13","R12","R113","R1233zd(E)","R41"}; for (std::size_t i = 0; i < sizeof(NBP_refs)/sizeof(NBP_refs[0]); ++i) { - /*try{*/ + try{ + //set_reference_stateS(NBP_refs[i],"RESET"); HelmholtzEOSMixtureBackend HEOS(std::vector(1,NBP_refs[i])); HEOS.update(PQ_INPUTS, 101325, 0); - double delta_a1 = HEOS.smass()/(8.314472/HEOS.molar_mass()); - double delta_a2 = -HEOS.hmass()/(8.314472/HEOS.molar_mass()*HEOS.get_reducing().T); + double delta_a1 = HEOS.smass()/(HEOS.gas_constant()/HEOS.molar_mass()); + double delta_a2 = -HEOS.hmass()/(HEOS.gas_constant()/HEOS.molar_mass()*HEOS.get_reducing().T); std::cout << format("%s,%s,%16.15g,%16.15g\n",NBP_refs[i].c_str(),"NBP",delta_a1, delta_a2); - /*} + } catch(const std::exception &e) { std::cout << "ERROR FOR " << NBP_refs[i] << std::endl; - }*/ + } } for (std::size_t i = 0; i < sizeof(IIR_refs)/sizeof(IIR_refs[0]); ++i) { try{ + //set_reference_stateS(IIR_refs[i],"RESET"); HelmholtzEOSMixtureBackend HEOS(std::vector(1,IIR_refs[i])); HEOS.update(QT_INPUTS, 0, 273.15); - double delta_a1 = HEOS.smass()/(8.314472/HEOS.molar_mass()); - double delta_a2 = -HEOS.hmass()/(8.314472/HEOS.molar_mass()*HEOS.get_reducing().T); + double delta_a1 = (HEOS.smass()-1000)/(HEOS.gas_constant()/HEOS.molar_mass()); + double delta_a2 = -(HEOS.hmass()-200000)/(HEOS.gas_constant()/HEOS.molar_mass()*HEOS.get_reducing().T); std::cout << format("%s,%s,%16.15g,%16.15g\n",IIR_refs[i].c_str(),"IIR",delta_a1, delta_a2); } catch(const std::exception &e) @@ -90,6 +92,7 @@ int main() std::cout << "ERROR FOR " << IIR_refs[i] << std::endl; } } + double rr = 0; } if (0) { @@ -168,7 +171,7 @@ int main() } if (1) { - double h1 = PropsSI("H","P",101325,"Q",0,"n-Propane"); + double h1 = PropsSI("H","T",273.15,"Q",0,"CO2"); set_reference_stateS("n-Propane","NBP"); double h2 = PropsSI("H","P",101325,"Q",0,"n-Propane");