From 32fa56108dbfc2208b1e12840cfda5cd6fae0f86 Mon Sep 17 00:00:00 2001 From: Ian Bell Date: Mon, 8 Dec 2014 18:22:01 -0500 Subject: [PATCH] Implemented rhomass_critical function in AbstractState. Closes https://github.com/CoolProp/CoolProp/issues/303 Signed-off-by: Ian Bell --- include/AbstractState.h | 24 +++++++++++++++++++----- src/AbstractState.cpp | 6 ++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/include/AbstractState.h b/include/AbstractState.h index 9164bc34..a635af6c 100644 --- a/include/AbstractState.h +++ b/include/AbstractState.h @@ -347,12 +347,19 @@ protected: For mixtures, it is the exact critical point pressure calculated by the methods of Michelsen( \todo fill in reference) */ double p_critical(void); - /// Return the critical molar density in mol/m^3 - /** - For pure fluids, this is the critical point molar density - For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference) - */ + /// + /** \brief Return the critical molar density in mol/m^3 + * + * For pure fluids, this is the critical point molar density + * For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference) + */ double rhomolar_critical(void); + /** \brief Return the critical molar density in kg/m^3 + * + * For pure fluids, this is the critical point molar density + * For mixtures, it is the exact critical point molar density calculated by the methods of Michelsen( \todo fill in reference) + */ + double rhomass_critical(void); /// Return the triple point pressure double p_triple(void); @@ -494,6 +501,13 @@ protected: * Matthis Thorade, Ali Saadat, "Partial derivatives of thermodynamic state properties for dynamic simulation", * Environmental Earth Sciences, December 2013, Volume 70, Issue 8, pp 3497-3503 * + * Like with \ref first_saturation_deriv, we can express the derivative as + * \f[ \left(\frac{\partial y}{\partial T}\right)_{\sigma} = \left(\frac{\partial y}{\partial T}\right)+\left(\frac{\partial y}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f] + * + * where \f$ y \f$ is already a saturation derivative. So you might end up with something like + * + * \f[ \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)_{\sigma} = \left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial T}\right)+\left(\frac{\partial \left(\frac{\partial T}{\partial p}\right)_{\sigma}}{\partial p}\right)\left(\frac{\partial p}{\partial T}\right)_{\sigma} \f] + * * @param Of1 The parameter that the derivative is taken of * @param Wrt1 The parameter that the derivative is taken with respect to * */ diff --git a/src/AbstractState.cpp b/src/AbstractState.cpp index 01b4ae24..40876ddb 100644 --- a/src/AbstractState.cpp +++ b/src/AbstractState.cpp @@ -188,7 +188,7 @@ double AbstractState::trivial_keyed_output(int key) case irhomolar_critical: return this->rhomolar_critical(); case irhomass_critical: - return this->rhomolar_critical()*molar_mass(); + return this->rhomass_critical(); case iODP: return this->calc_ODP(); case iGWP100: @@ -322,7 +322,9 @@ double AbstractState::p_triple(void){ double AbstractState::rhomolar_critical(void){ return calc_rhomolar_critical(); } - +double AbstractState::rhomass_critical(void){ + return calc_rhomolar_critical()*molar_mass(); +} double AbstractState::hmolar(void){ if (!_hmolar) _hmolar = calc_hmolar(); return _hmolar;