Add functions to set property pairs specified in Sub.cpp

Add functions to set the unimplemented property pairs specified
in the Substance::Set function of Sub.cpp
This commit is contained in:
Bryan W. Weber 2016-01-22 16:43:09 -05:00
parent 31316b7079
commit 63cfed1503
3 changed files with 161 additions and 0 deletions

View file

@ -126,6 +126,13 @@ public:
virtual void setState_UV(double u, double v, double tol = 1.e-8);
virtual void setState_SV(double s, double v, double tol = 1.e-8);
virtual void setState_SP(double s, double p, double tol = 1.e-8);
virtual void setState_ST(double s, double t, double tol = 1.e-8);
virtual void setState_TV(double t, double v, double tol = 1.e-8);
virtual void setState_PV(double p, double v, double tol = 1.e-8);
virtual void setState_UP(double u, double p, double tol = 1.e-8);
virtual void setState_VH(double v, double h, double tol = 1.e-8);
virtual void setState_TH(double t, double h, double tol = 1.e-8);
virtual void setState_SH(double s, double h, double tol = 1.e-8);
//@}
//! @name Critical State Properties

View file

@ -974,6 +974,118 @@ public:
*/
virtual void setState_SV(doublereal s, doublereal v, doublereal tol = 1.e-4);
//! Set the specific entropy (J/kg/K) and temperature (K).
/*!
* This function fixes the internal state of the phase so that the specific
* entropy and temperature have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param s specific entropy (J/kg/K)
* @param t temperature (K)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_ST(double s, double t, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_ST");
}
//! Set the temperature (K) and specific volume (m^3/kg).
/*!
* This function fixes the internal state of the phase so that the
* temperature and specific volume have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param t temperature (K)
* @param v specific volume (m^3/kg)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_TV(double t, double v, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_TV");
}
//! Set the pressure (Pa) and specific volume (m^3/kg).
/*!
* This function fixes the internal state of the phase so that the
* pressure and specific volume have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param p pressure (Pa)
* @param v specific volume (m^3/kg)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_PV(double p, double v, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_PV");
}
//! Set the specific internal energy (J/kg) and pressure (Pa).
/*!
* This function fixes the internal state of the phase so that the specific
* internal energy and pressure have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param u specific internal energy (J/kg)
* @param p pressure (Pa)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_UP(double u, double p, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_UP");
}
//! Set the specific volume (m^3/kg) and the specific enthalpy (J/kg)
/*!
* This function fixes the internal state of the phase so that the specific
* volume and the specific enthalpy have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param v specific volume (m^3/kg)
* @param h specific enthalpy (J/kg)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_VH(double v, double h, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_VH");
}
//! Set the temperature (K) and the specific enthalpy (J/kg)
/*!
* This function fixes the internal state of the phase so that the
* temperature and specific enthalpy have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param t temperature (K)
* @param h specific enthalpy (J/kg)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_TH(double t, double h, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_TH");
}
//! Set the specific entropy (J/kg/K) and the specific enthalpy (J/kg)
/*!
* This function fixes the internal state of the phase so that the
* temperature and pressure have the value of the input parameters.
* This base class function will print an error if not overwritten.
*
* @param s specific entropy (J/kg/K)
* @param h specific enthalpy (J/kg)
* @param tol Optional parameter setting the tolerance of the calculation.
* Defaults to 1.0E-4. Important for some applications where
* numerical Jacobians are being calculated.
*/
virtual void setState_SH(double s, double h, double tol = 1.e-4) {
throw NotImplementedError("ThermoPhase::setState_SH");
}
//! Set the density (kg/m**3) and pressure (Pa) at constant composition
/*!
* This method must be reimplemented in derived classes, where it may

View file

@ -308,6 +308,48 @@ void PureFluidPhase::setState_SP(double s, double p, double tol)
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_ST(double s, double t, double tol)
{
Set(tpx::PropertyPair::ST, s, t);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_TV(double t, double v, double tol)
{
Set(tpx::PropertyPair::TV, t, v);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_PV(double p, double v, double tol)
{
Set(tpx::PropertyPair::PV, p, v);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_UP(double u, double p, double tol)
{
Set(tpx::PropertyPair::UP, u, p);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_VH(double v, double h, double tol)
{
Set(tpx::PropertyPair::VH, v, h);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_TH(double t, double h, double tol)
{
Set(tpx::PropertyPair::TH, t, h);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
void PureFluidPhase::setState_SH(double s, double h, double tol)
{
Set(tpx::PropertyPair::SH, s, h);
setState_TR(m_sub->Temp(), 1.0/m_sub->v());
}
doublereal PureFluidPhase::satPressure(doublereal t)
{
Set(tpx::PropertyPair::TV, t, m_sub->v());