Skip to content

Commit

Permalink
[Thermo] Add real gas compressibility functions
Browse files Browse the repository at this point in the history
Add `isothermalCompressibility` and `thermalExpansionCoeff` definitions to the `RedlichKwongMFTP` and `PengRobinson` models
  • Loading branch information
corykinney committed Apr 27, 2023
1 parent f807a01 commit 37409c0
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
18 changes: 17 additions & 1 deletion include/cantera/thermo/PengRobinson.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,22 @@ class PengRobinson : public MixtureFugacityTP

public:

//! Returns the isothermal compressibility (\f$\beta_T\f$). Units: 1/Pa.
/*!
* \f[
* \beta_T = -\frac{1}{v} \left(\frac{\partial v}{\partial p}\right)_T
* \f]
*/
virtual double isothermalCompressibility() const;

//! Return the volumetric thermal expansion coefficient (\f$\alpha_V\f$). Units: 1/K.
/*!
* \f[
* \alpha_V = \frac{1}{v} \left(\frac{\partial v}{\partial T}\right)_p
* \f]
*/
virtual double thermalExpansionCoeff() const;

//! Calculate \f$dp/dV\f$ and \f$dp/dT\f$ at the current conditions
/*!
* These are stored internally.
Expand Down Expand Up @@ -248,7 +264,7 @@ class PengRobinson : public MixtureFugacityTP
*/
double m_a;

//! Value of \f$\alpha\f$ in the equation of state
//! Value of \f$a \alpha\f$ in the equation of state
/*!
* `m_aAlpha_mix` is a function of the temperature and the mole fractions.
*/
Expand Down
16 changes: 16 additions & 0 deletions include/cantera/thermo/RedlichKwongMFTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,22 @@ class RedlichKwongMFTP : public MixtureFugacityTP
virtual doublereal densSpinodalGas() const;
virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const;

//! Returns the isothermal compressibility (\f$\beta_T\f$). Units: 1/Pa.
/*!
* \f[
* \beta_T = -\frac{1}{v} \left(\frac{\partial v}{\partial p}\right)_T
* \f]
*/
virtual double isothermalCompressibility() const;

//! Return the volumetric thermal expansion coefficient (\f$\alpha_V\f$). Units: 1/K.
/*!
* \f[
* \alpha_V = \frac{1}{v} \left(\frac{\partial v}{\partial T}\right)_p
* \f]
*/
virtual double thermalExpansionCoeff() const;

//! Calculate dpdV and dpdT at the current conditions
/*!
* These are stored internally.
Expand Down
12 changes: 12 additions & 0 deletions src/thermo/PengRobinson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,18 @@ double PengRobinson::dpdVCalc(double T, double molarVol, double& presCalc) const
return -GasConstant * T / (vmb * vmb) + 2 * m_aAlpha_mix * vpb / (denom*denom);
}

double PengRobinson::isothermalCompressibility() const
{
calculatePressureDerivatives();
return -1 / (molarVolume() * m_dpdV);
}

double PengRobinson::thermalExpansionCoeff() const
{
calculatePressureDerivatives();
return -m_dpdT / (molarVolume() * m_dpdV);
}

void PengRobinson::calculatePressureDerivatives() const
{
double T = temperature();
Expand Down
12 changes: 12 additions & 0 deletions src/thermo/RedlichKwongMFTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,18 @@ doublereal RedlichKwongMFTP::dpdVCalc(doublereal TKelvin, doublereal molarVol, d
return dpdv;
}

double RedlichKwongMFTP::isothermalCompressibility() const
{
pressureDerivatives();
return -1 / (molarVolume() * dpdV_);
}

double RedlichKwongMFTP::thermalExpansionCoeff() const
{
pressureDerivatives();
return -dpdT_ / (molarVolume() * dpdV_);
}

void RedlichKwongMFTP::pressureDerivatives() const
{
doublereal TKelvin = temperature();
Expand Down

0 comments on commit 37409c0

Please sign in to comment.