Overload setState_RP for IdealGasPhase

Use the ideal gas law to compute the temperature corresponding to the
given density and pressure.
This commit is contained in:
Bryan W. Weber 2015-06-13 19:43:56 -04:00 committed by Ray Speth
parent 5d215b7e86
commit 8e58a45edb

View file

@ -508,6 +508,28 @@ public:
setDensity(p * meanMolecularWeight() / (GasConstant * temperature()));
}
//! Set the density and pressure at constant composition.
/*!
* Units: kg/m^3, Pa
* This method is implemented by setting the density to the input
* value and setting the temperature to
* \f[
* T = \frac{P \overline W}{\hat R \rho}.
* \f]
*
* @param rho Density (kg/m^3)
* @param p Pressure (Pa)
*/
virtual void setState_RP(doublereal rho, doublereal p)
{
if (p <= 0) {
throw CanteraError("IdealGasPhase::setState_RP",
"pressure must be positive");
}
setDensity(rho);
setTemperature(p * meanMolecularWeight() / (GasConstant * rho));
}
//! Returns the isothermal compressibility. Units: 1/Pa.
/**
* The isothermal compressibility is defined as