Skip to content

Commit

Permalink
Following modifications in the code are performed:
Browse files Browse the repository at this point in the history
1. Fixing typos
2. Adding more detailed documentation
3. Deleting redundant variables
  • Loading branch information
gkogekar committed Aug 7, 2019
1 parent 132af54 commit 9590979
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 94 deletions.
69 changes: 50 additions & 19 deletions include/cantera/thermo/PengRobinsonMFTP.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! @file PengRobinsonMFTP.h

// This file is part of Cantera. See License.txt in the top-level directory or
// at http://www.cantera.org/license.txt for license and copyright information.
// at https://cantera.org/license.txt for license and copyright information.

#ifndef CT_PENGROBINSONMFTP_H
#define CT_PENGROBINSONMFTP_H
Expand Down Expand Up @@ -73,9 +73,33 @@ class PengRobinsonMFTP : public MixtureFugacityTP
* where:
*
* \f[
* \alpha = \left[ 1 + \left(0.37464 + 1.54226\omega - 0.26992\omega^2\right)\left(1-T_r^{0.5}\right)\right]^2
* \alpha = \left[ 1 + \kappa \left(1-T_r^{0.5}\right)\right]^2
* \f]
*
* and
*
* \f[
* \kappa = \left(0.37464 + 1.54226\omega - 0.26992\omega^2\right) for omega <= 0.491
* \kappa = \left(0.379642 + 1.487503\omega - 0.164423\omega^2 + 0.016667\omega^3 \right) for omega > 0.491
* \f]
*
*Coefficients a_mix, b_mix and (a \alpha)_{mix} are caclulated as
*
*\f[
*a_{mix} = \sum_i \sum_j X_i X_j a_{i, j} = \sum_i \sum_j X_i X_j sqrt{a_i a_j}
*\f]
*
*\f[
* b_{mix} = \sum_i X_i b_i
*\f]
*
*\f[
* {a \alpha}_{mix} = \sum_i \sum_j X_i X_j {a \alpha}_{i, j} = \sum_i \sum_j X_i X_j sqrt{a_i a_j} sqrt{\alpha_i \alpha_j}
*\f]
*
*
*/

virtual double pressure() const;

// @}
Expand Down Expand Up @@ -112,8 +136,9 @@ class PengRobinsonMFTP : public MixtureFugacityTP
/*!
* This is defined as the concentration by which the generalized
* concentration is normalized to produce the activity. In many cases, this
* quantity will be the same for all species in a phase. Since the activity
* for an ideal gas mixture is simply the mole fraction, for an ideal gas
* quantity will be the same for all species in a phase.
* The ideal gas mixture is considered as the standard or reference state here.
* Since the activity for an ideal gas mixture is simply the mole fraction, for an ideal gas
* \f$ C^0_k = P/\hat R T \f$.
*
* @param k Optional parameter indicating the species. The default is to
Expand Down Expand Up @@ -143,7 +168,7 @@ class PengRobinsonMFTP : public MixtureFugacityTP
* \f$ \mu_k / \hat R T \f$.
* Units: unitless
*
* We close the loop on this function, here, calling getChemPotentials() and
* We close the loop on this function here calling getChemPotentials() and
* then dividing by RT. No need for child classes to handle.
*
* @param mu Output vector of non-dimensional species chemical potentials
Expand All @@ -158,7 +183,13 @@ class PengRobinsonMFTP : public MixtureFugacityTP
virtual void getPartialMolarCp(double* cpbar) const;
virtual void getPartialMolarVolumes(double* vbar) const;


//! Calculate the temperature dependent interaction parameter alpha needed for P-R EoS
/*
* The temperature dependent parameter in P-R EoS is calculated as
* \alpha = [1 + \kappa(1 - sqrt{T/T_crit}]^2
* kappa is a function calulated based on the accentric factor.
* Units: unitless
*/
virtual void calculateAlpha(const std::string& species, double a, double b, double w);
//@}
/// @name Critical State Properties.
Expand Down Expand Up @@ -190,7 +221,7 @@ class PengRobinsonMFTP : public MixtureFugacityTP
//! Retrieve a and b coefficients by looking up tabulated critical parameters
/*!
* If pureFluidParameters are not provided for any species in the phase,
* consult the critical properties tabulated in /thermo/critProperties.xml.
* consult the critical properties tabulated in /build/data/thermo/critProperties.xml.
* If the species is found there, calculate pure fluid parameters a_k and b_k as:
* \f[ a_k = 0.4278*R**2*T_c^2/P_c \f]
*
Expand Down Expand Up @@ -223,10 +254,10 @@ class PengRobinsonMFTP : public MixtureFugacityTP
/*!
* The "a" parameter for interactions between species *i* and *j* is
* assumed by default to be computed as:
* \f[ a_{ij} = \sqrt(a_{i,0} a_{j,0}) + \sqrt(a_{i,1} a_{j,1}) T \f]
* \f[ a_{ij} = \sqrt(a_{i, 0} a_{j, 0}) + \sqrt(a_{i, 1} a_{j, 1}) T \f]
*
* This function overrides the defaults with the specified parameters:
* \f[ a_{ij} = a_{ij,0} + a_{ij,1} T \f]
* \f[ a_{ij} = a_{ij, 0} + a_{ij, 1} T \f]
*
* @param species_i Name of one species
* @param species_j Name of the other species
Expand Down Expand Up @@ -316,20 +347,20 @@ class PengRobinsonMFTP : public MixtureFugacityTP
protected:
//! Form of the temperature parameterization
/*!
* - 0 = There is no temperature parameterization of a or b
* - 1 = The a_ij parameter is a linear function of the temperature
* 0 = There is no temperature parameterization of a or b
* 1 = The a_ij parameter is a linear function of the temperature
*/
int m_formTempParam;

//! Value of b in the equation of state
/*!
* m_b is a function of the temperature and the mole fraction.
* m_b_current is a function of the temperature and the mole fractions.
*/
double m_b_current;

//! Value of a in the equation of state
//! Value of a and alpha in the equation of state
/*!
* a_b is a function of the temperature and the mole fraction.
* m_aAlpha_current is a function of the temperature and the mole fractions. m_a_current depends only on the mole fractions.
*/
double m_a_current;
double m_aAlpha_current;
Expand Down Expand Up @@ -358,31 +389,31 @@ class PengRobinsonMFTP : public MixtureFugacityTP
// Partial molar volumes of the species
mutable vector_fp m_partialMolarVolumes;

//! The derivative of the pressure wrt the volume
//! The derivative of the pressure with respect to the volume
/*!
* Calculated at the current conditions. temperature and mole number kept
* constant
*/
mutable double dpdV_;

//! The derivative of the pressure wrt the temperature
//! The derivative of the pressure with respect to the temperature
/*!
* Calculated at the current conditions. Total volume and mole number kept
* constant
*/
mutable double dpdT_;

//! Vector of derivatives of pressure wrt mole number
//! Vector of derivatives of pressure with respect to mole number
/*!
* Calculated at the current conditions. Total volume, temperature and
* other mole number kept constant
*/
mutable vector_fp dpdni_;

public:
//! Omega constant for a -> value of a in terms of critical properties
//! Omega constants: a0 (= omega_a) and b0 (= omega_b) values used in Peng-Robinson equation of state
/*!
* this was calculated from a small nonlinear solve
* These values are calculated by solving P-R cubic equation at the critical point.
*/
static const double omega_a;

Expand Down
Loading

0 comments on commit 9590979

Please sign in to comment.