Skip to content

Commit 931de24

Browse files
committed
[Thermo] Add real gas compressibility functions
Add `isothermalCompressibility` and `thermalExpansionCoeff` definitions to the `RedlichKwongMFTP` and `PengRobinson` models
1 parent f807a01 commit 931de24

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

include/cantera/thermo/PengRobinson.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ class PengRobinson : public MixtureFugacityTP
205205

206206
public:
207207

208+
virtual double isothermalCompressibility() const;
209+
virtual double thermalExpansionCoeff() const;
210+
208211
//! Calculate \f$dp/dV\f$ and \f$dp/dT\f$ at the current conditions
209212
/*!
210213
* These are stored internally.
@@ -248,7 +251,7 @@ class PengRobinson : public MixtureFugacityTP
248251
*/
249252
double m_a;
250253

251-
//! Value of \f$\alpha\f$ in the equation of state
254+
//! Value of \f$a \alpha\f$ in the equation of state
252255
/*!
253256
* `m_aAlpha_mix` is a function of the temperature and the mole fractions.
254257
*/

include/cantera/thermo/RedlichKwongMFTP.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ class RedlichKwongMFTP : public MixtureFugacityTP
173173
virtual doublereal densSpinodalGas() const;
174174
virtual doublereal dpdVCalc(doublereal TKelvin, doublereal molarVol, doublereal& presCalc) const;
175175

176+
virtual double isothermalCompressibility() const;
177+
virtual double thermalExpansionCoeff() const;
178+
176179
//! Calculate dpdV and dpdT at the current conditions
177180
/*!
178181
* These are stored internally.

src/thermo/PengRobinson.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,18 @@ double PengRobinson::dpdVCalc(double T, double molarVol, double& presCalc) const
630630
return -GasConstant * T / (vmb * vmb) + 2 * m_aAlpha_mix * vpb / (denom*denom);
631631
}
632632

633+
double PengRobinson::isothermalCompressibility() const
634+
{
635+
calculatePressureDerivatives();
636+
return -1 / (molarVolume() * m_dpdV);
637+
}
638+
639+
double PengRobinson::thermalExpansionCoeff() const
640+
{
641+
calculatePressureDerivatives();
642+
return -m_dpdT / (molarVolume() * m_dpdV);
643+
}
644+
633645
void PengRobinson::calculatePressureDerivatives() const
634646
{
635647
double T = temperature();

src/thermo/RedlichKwongMFTP.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,18 @@ doublereal RedlichKwongMFTP::dpdVCalc(doublereal TKelvin, doublereal molarVol, d
707707
return dpdv;
708708
}
709709

710+
double RedlichKwongMFTP::isothermalCompressibility() const
711+
{
712+
pressureDerivatives();
713+
return -1 / (molarVolume() * dpdV_);
714+
}
715+
716+
double RedlichKwongMFTP::thermalExpansionCoeff() const
717+
{
718+
pressureDerivatives();
719+
return -dpdT_ / (molarVolume() * dpdV_);
720+
}
721+
710722
void RedlichKwongMFTP::pressureDerivatives() const
711723
{
712724
doublereal TKelvin = temperature();

0 commit comments

Comments
 (0)