diff --git a/include/AbstractState.h b/include/AbstractState.h index c8d378df..fed09f24 100644 --- a/include/AbstractState.h +++ b/include/AbstractState.h @@ -267,6 +267,10 @@ protected: virtual std::vector calc_mole_fractions_liquid(void){throw NotImplementedError("calc_mole_fractions_liquid is not implemented for this backend");}; virtual std::vector calc_mole_fractions_vapor(void){throw NotImplementedError("calc_mole_fractions_vapor is not implemented for this backend");}; + /// Get the minimum fraction (mole, mass, volume) for incompressible fluid + virtual long double calc_fraction_min(void){throw NotImplementedError("calc_fraction_min is not implemented for this backend");}; + /// Get the maximum fraction (mole, mass, volume) for incompressible fluid + virtual long double calc_fraction_max(void){throw NotImplementedError("calc_fraction_max is not implemented for this backend");}; public: AbstractState(){}; diff --git a/include/DataStructures.h b/include/DataStructures.h index 6d883b3a..61285228 100644 --- a/include/DataStructures.h +++ b/include/DataStructures.h @@ -116,6 +116,10 @@ enum parameters{ idBvirial_dT, idCvirial_dT, iZ, + + // Accessors for incompressibles + ifraction_min, + ifraction_max, // Environmental parameters iGWP20, ///< The 20-year global warming potential diff --git a/src/AbstractState.cpp b/src/AbstractState.cpp index 60714a1f..8cc16efa 100644 --- a/src/AbstractState.cpp +++ b/src/AbstractState.cpp @@ -195,7 +195,10 @@ double AbstractState::trivial_keyed_output(int key) return this->calc_GWP20(); case iGWP500: return this->calc_GWP500(); - + case ifraction_min: + return this->calc_fraction_min(); + case ifraction_max: + return this->calc_fraction_max(); default: throw ValueError(format("This input [%d: \"%s\"] is not valid for trivial_keyed_output",key,get_parameter_information(key,"short").c_str())); } diff --git a/src/Backends/Incompressible/IncompressibleBackend.h b/src/Backends/Incompressible/IncompressibleBackend.h index 2e268e9a..aa16d358 100644 --- a/src/Backends/Incompressible/IncompressibleBackend.h +++ b/src/Backends/Incompressible/IncompressibleBackend.h @@ -119,6 +119,9 @@ public: long double calc_cvmass(void){return fluid->cv(_T, _p, _fractions[0]);}; long double calc_Tmax(void){return fluid->getTmax();}; long double calc_Tmin(void){return fluid->getTmin();}; + + long double calc_fraction_min(void){return fluid->getxmin();}; + long double calc_fraction_max(void){return fluid->getxmax();}; }; } /* namespace CoolProp */ diff --git a/src/DataStructures.cpp b/src/DataStructures.cpp index a3ab1607..6cc37e58 100644 --- a/src/DataStructures.cpp +++ b/src/DataStructures.cpp @@ -65,6 +65,8 @@ parameter_info parameter_info_list[] = { parameter_info(iP_max, "P_max","O","Pa","Maximum pressure limit",true), parameter_info(iP_critical, "p_critical","O","Pa","Pressure at the critical point",true), parameter_info(iP_triple, "p_triple","O","Pa","Pressure at the triple point (pure only)",true), + parameter_info(ifraction_min, "fraction_min","O","-","Fraction (mole, mass, volume) minimum value for incompressible solutions",true), + parameter_info(ifraction_max, "fraction_max","O","-","Fraction (mole, mass, volume) maximum value for incompressible solutions",true), parameter_info(ispeed_sound, "speed_of_sound","O","m/s","Speed of sound",false), parameter_info(iviscosity, "viscosity","O","Pa-s","Viscosity",false),