diff --git a/include/AbstractState.h b/include/AbstractState.h index aedc6a79..ef021b4c 100644 --- a/include/AbstractState.h +++ b/include/AbstractState.h @@ -659,8 +659,15 @@ public: double fugacity(std::size_t i); /// Return the chemical potential of the i-th component of the mixture double chemical_potential(std::size_t i); - /// Return the fundamental derivative of gas dynamics - //double fundamental_derivative_of_gas_dynamics(void){return this->second_partial_deriv(iP, iDmolar, iSmolar, iDmolar, iSmolar)/pow(speed_sound(), 2)/2/pow(this->rhomolar(),3);}; + /** \brief Return the fundamental derivative of gas dynamics \f$ \Gamma \f$ + * + * see also Colonna et al, FPE, 2010 + * + * \f[ \Gamma = 1+\frac{\rho}{c}\left(\frac{partial c}{\partial \rho}\right)_{s} = 1+\frac{\rho}{2c^2}\left(\frac{partial^2 p}{\partial \rho^2}\right)_{s} = 1+\frac{v^3}{2c^2}\left(\frac{partial^2 p}{\partial v^2}\right)_{s}\f] + * + * Note: densities are mass-based densities, not mole-based densities + */ + double fundamental_derivative_of_gas_dynamics(void); /// Return the phase identification parameter (PIP) of G. Venkatarathnam and L.R. Oellrich, "Identification of the phase of a fluid using partial derivatives of pressure, volume, and temperature without reference to saturation properties: Applications in phase equilibria calculations" double PIP(){ return calc_PIP(); }; diff --git a/src/AbstractState.cpp b/src/AbstractState.cpp index 3b1ba6e4..51f48462 100644 --- a/src/AbstractState.cpp +++ b/src/AbstractState.cpp @@ -408,6 +408,8 @@ double AbstractState::keyed_output(parameters key) return compressibility_factor(); case iPIP: return PIP(); + case ifundamental_derivative_of_gas_dynamics: + return fundamental_derivative_of_gas_dynamics(); default: throw ValueError(format("This input [%d: \"%s\"] is not valid for keyed_output",key,get_parameter_information(key,"short").c_str())); } @@ -548,6 +550,12 @@ double AbstractState::Cvirial(void){ return calc_Cvirial(); } double AbstractState::dBvirial_dT(void){ return calc_dBvirial_dT(); } double AbstractState::dCvirial_dT(void){ return calc_dCvirial_dT(); } double AbstractState::compressibility_factor(void){ return calc_compressibility_factor(); } + +double AbstractState::fundamental_derivative_of_gas_dynamics() +{ + // See Colonna, FPE, 2010, Eq. 1 + return 1 + this->second_partial_deriv(iP, iDmass, iSmolar, iDmass, iSmolar)*this->rhomass()/(2*powInt(speed_sound(), 2)); +}; // Get the derivatives of the parameters in the partial derivative with respect to T and rho void get_dT_drho(AbstractState &AS, parameters index, CoolPropDbl &dT, CoolPropDbl &drho) diff --git a/wrappers/Python/CoolProp/AbstractState.pxd b/wrappers/Python/CoolProp/AbstractState.pxd index 6cfe2c6d..b0b46652 100644 --- a/wrappers/Python/CoolProp/AbstractState.pxd +++ b/wrappers/Python/CoolProp/AbstractState.pxd @@ -125,6 +125,7 @@ cdef class AbstractState: cpdef double Bvirial(self) except * cpdef double Cvirial(self) except * cpdef double PIP(self) except * + cpdef double fundamental_derivative_of_gas_dynamics(self) except * cpdef double isothermal_compressibility(self) except * cpdef double isobaric_expansion_coefficient(self) except * cpdef double fugacity(self, size_t) except * diff --git a/wrappers/Python/CoolProp/AbstractState.pyx b/wrappers/Python/CoolProp/AbstractState.pyx index a784c11f..163e42c2 100644 --- a/wrappers/Python/CoolProp/AbstractState.pyx +++ b/wrappers/Python/CoolProp/AbstractState.pyx @@ -302,6 +302,9 @@ cdef class AbstractState: cpdef double Cvirial(self) except *: """ Get the C virial coefficient - wrapper of c++ function :cpapi:`CoolProp::AbstractState::Cvirial(void)` """ return self.thisptr.Cvirial() + cpdef double fundamental_derivative_of_gas_dynamics(self) except *: + """ Get the fundamental derivative of gas dynamics - wrapper of c++ function :cpapi:`CoolProp::AbstractState::fundamental_derivative_of_gas_dynamics(void)` """ + return self.thisptr.fundamental_derivative_of_gas_dynamics() cpdef double PIP(self) except *: """ Get the phase identification parameter - wrapper of c++ function :cpapi:`CoolProp::AbstractState::PIP(void)` """ return self.thisptr.PIP() diff --git a/wrappers/Python/CoolProp/cAbstractState.pxd b/wrappers/Python/CoolProp/cAbstractState.pxd index 52e27fcb..dbc0d9d8 100644 --- a/wrappers/Python/CoolProp/cAbstractState.pxd +++ b/wrappers/Python/CoolProp/cAbstractState.pxd @@ -132,6 +132,7 @@ cdef extern from "AbstractState.h" namespace "CoolProp": double Bvirial() except +ValueError double Cvirial() except +ValueError double PIP() except +ValueError + double fundamental_derivative_of_gas_dynamics() except +ValueError double isothermal_compressibility() except +ValueError double isobaric_expansion_coefficient() except +ValueError double fugacity(size_t) except +ValueError