diff --git a/include/CoolProp.h b/include/CoolProp.h index 378d275a..1178bdfe 100644 --- a/include/CoolProp.h +++ b/include/CoolProp.h @@ -81,22 +81,20 @@ You might want to start by looking at CoolProp.h /// @param FluidName The fluid name as a string /// @returns long element from global type enumeration long getFluidType(std::string FluidName); + /// Get a string for a value from a fluid (numerical values can be obtained from Props1 function) - /// @param FluidName The name of the fluid - /// @param ParamName A string, one of "aliases", "CAS", "CAS_number", "ASHRAE34", "REFPROPName","REFPROP_name", "TTSE_mode" + /// @param FluidName The name of the fluid that is part of CoolProp, for instance "n-Propane" + /// @param ParamName A string, one of "aliases", "CAS", "CAS_number", "ASHRAE34", "REFPROPName","REFPROP_name", "TTSE_mode", /// @returns str The string, or an error message if not valid input - std::string get_fluid_param_string(std::string FluidName, std::string ParamName); + std::string get_fluid_param_string(std::string FluidName, std::string ParamName);*/ + /// Returns the BibTeX key from the bibtex library of CoolProp corresponding to the item requested - /// @param FluidName The name of the fluid - /// @param item String, one of "EOS","CP0", "VISCOSITY", "CONDUCTIVITY", "ECS_LENNARD_JONES", "ECS_FITS", "SURFACE_TENSION" + /// @param FluidName The name of the fluid that is part of CoolProp, for instance "n-Propane" + /// @param item The key that is desired, one of "EOS","CP0", "VISCOSITY", "CONDUCTIVITY", "ECS_LENNARD_JONES", "ECS_FITS", "SURFACE_TENSION" /// @returns key the BibTeX key std::string get_BibTeXKey(std::string FluidName, std::string item); - /// Add a REFPROP fluid to the fluid listing in CoolProp - bool add_REFPROP_fluid(std::string FluidName); - /// Get the parameter index for a given parameter - /// @param param The string for an input or output parameter - /// @returns index The parameter index (for use in IProps or elsewhere); -1 if not found - long get_param_index(std::string param); + + /* /// Set the reference state for a pointer to a fluid (not exposed) /// @param pFluid A pointer to a Fluid instance /// @param reference_state The reference state to use, one of "IIR" (h=200 kJ/kg, s=1 kJ/kg/K at 0C sat. liq.) "ASHRAE" (h=0,s=0 @ -40C sat liq), "NBP" (h=0,s=0 @ 1.0 bar sat liq.) @@ -166,12 +164,6 @@ You might want to start by looking at CoolProp.h /// @param FluidName The fluid name double Props(std::string Output,char Name1, double Prop1, char Name2, double Prop2, std::string FluidName);*/ - - - //// **************** DEPRECATION WARNING *********************** - ///// Nearly deprecated function - //void set_phase(std::string Phase_str); - } /* namespace CoolProp */ #endif diff --git a/src/Backends/Helmholtz/Fluids/FluidLibrary.h b/src/Backends/Helmholtz/Fluids/FluidLibrary.h index 52a22a02..88837790 100644 --- a/src/Backends/Helmholtz/Fluids/FluidLibrary.h +++ b/src/Backends/Helmholtz/Fluids/FluidLibrary.h @@ -570,6 +570,9 @@ protected: /// Parse the thermal conductivity data void parse_thermal_conductivity(rapidjson::Value &conductivity, CoolPropFluid & fluid) { + // Load the BibTeX key + fluid.transport.BibTeX_conductivity = cpjson::get_string(conductivity,"BibTeX"); + // Load dilute conductivity term if (conductivity.HasMember("dilute")){ parse_dilute_conductivity(conductivity["dilute"], fluid); diff --git a/src/CoolProp.cpp b/src/CoolProp.cpp index 7efd078a..df706422 100644 --- a/src/CoolProp.cpp +++ b/src/CoolProp.cpp @@ -25,6 +25,7 @@ #include "CoolPropTools.h" #include "Solvers.h" #include "Backends/Helmholtz/Fluids/FluidLibrary.h" +#include "Backends/Helmholtz/HelmholtzEOSBackend.h" namespace CoolProp { @@ -725,25 +726,20 @@ double Props1SI(std::string FluidName,std::string Output) // } //} -//std::string get_BibTeXKey(std::string Ref, std::string item) -//{ -// pFluid=Fluids.get_fluid(Ref); -// if (pFluid!=NULL) -// { -// -// if (!item.compare("EOS")){ return pFluid->BibTeXKeys.EOS; } -// else if (!item.compare("CP0")){ return pFluid->BibTeXKeys.CP0; } -// else if (!item.compare("VISCOSITY")){ return pFluid->BibTeXKeys.VISCOSITY; } -// else if (!item.compare("CONDUCTIVITY")){ return pFluid->BibTeXKeys.CONDUCTIVITY; } -// else if (!item.compare("ECS_LENNARD_JONES")){ return pFluid->BibTeXKeys.ECS_LENNARD_JONES; } -// else if (!item.compare("ECS_FITS")){ return pFluid->BibTeXKeys.ECS_FITS; } -// else if (!item.compare("SURFACE_TENSION")){ return pFluid->BibTeXKeys.SURFACE_TENSION; } -// else{ return "Bad key";} -// } -// else{ -// return std::string(""); -// } -//} +std::string get_BibTeXKey(std::string Ref, std::string key) +{ + std::vector names(1, Ref); + HelmholtzEOSMixtureBackend HEOS(names); + + if (!key.compare("EOS")){ return HEOS.get_components()[0]->pEOS->BibTeX_EOS; } + else if (!key.compare("CP0")){ return HEOS.get_components()[0]->pEOS->BibTeX_CP0; } + else if (!key.compare("VISCOSITY")){ return HEOS.get_components()[0]->transport.BibTeX_viscosity; } + else if (!key.compare("CONDUCTIVITY")){ return HEOS.get_components()[0]->transport.BibTeX_conductivity; } + else if (!key.compare("ECS_LENNARD_JONES")){ throw NotImplementedError(); } + else if (!key.compare("ECS_FITS")){ throw NotImplementedError(); } + else if (!key.compare("SURFACE_TENSION")){ return HEOS.get_components()[0]->ancillaries.surface_tension.BibTeX;} + else{ return "Bad key";} +} std::string get_global_param_string(std::string ParamName) { if (!ParamName.compare("version")){ @@ -754,12 +750,12 @@ std::string get_global_param_string(std::string ParamName) } else if (!ParamName.compare("errstring")){ std::string temp = error_string; - error_string = std::string(""); + error_string = ""; return temp; } else if (!ParamName.compare("warnstring")){ std::string temp = warning_string; - warning_string = std::string(""); + warning_string = ""; return temp; } else if (!ParamName.compare("FluidsList") || !ParamName.compare("fluids_list") || !ParamName.compare("fluidslist")){