Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Molar Mixture Properties #1837

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions include/cantera/base/Solution.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ class Solution : public std::enable_shared_from_this<Solution>
return m_adjacent.size();
}

//! Get the name of an adjacent phase by index
string adjacentName(size_t i) const {
return m_adjacent.at(i)->name();
}

AnyMap parameters(bool withInput=false) const;

//! Access input data associated with header definition
Expand Down
29 changes: 0 additions & 29 deletions include/cantera/thermo/DebyeHuckel.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,32 +431,6 @@ class DebyeHuckel : public MolalityVPSSTP
return "Debye-Huckel";
}

//! @}
//! @name Molar Thermodynamic Properties of the Solution
//! @{

double enthalpy_mole() const override;

//! Molar entropy. Units: J/kmol/K.
/**
* For an ideal, constant partial molar volume solution mixture with
* pure species phases which exhibit zero volume expansivity:
* @f[
* \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T)
* - \hat R \sum_k X_k \ln(X_k)
* @f]
* The reference-state pure-species entropies
* @f$ \hat s^0_k(T,p_{ref}) @f$ are computed by the
* species thermodynamic
* property manager. The pure species entropies are independent of
* temperature since the volume expansivities are equal to zero.
* @see MultiSpeciesThermo
*/
double entropy_mole() const override;

double gibbs_mole() const override;
double cp_mole() const override;

//! @}
//! @name Mechanical Equation of State Properties
//!
Expand Down Expand Up @@ -911,9 +885,6 @@ class DebyeHuckel : public MolalityVPSSTP
//! Pointer to the water property calculator
unique_ptr<WaterProps> m_waterProps;

//! vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

/**
* Stoichiometric species charge -> This is for calculations
* of the ionic strength which ignore ion-ion pairing into
Expand Down
28 changes: 0 additions & 28 deletions include/cantera/thermo/HMWSoln.h
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ class HMWSoln : public MolalityVPSSTP
//! @name Molar Thermodynamic Properties of the Solution
//! @{

double enthalpy_mole() const override;

/**
* Excess molar enthalpy of the solution from
* the mixing process. Units: J/ kmol.
Expand All @@ -823,29 +821,6 @@ class HMWSoln : public MolalityVPSSTP
*/
virtual double relative_molal_enthalpy() const;

//! Molar entropy. Units: J/kmol/K.
/**
* Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant
* partial molar volume solution mixture with pure species phases which
* exhibit zero volume expansivity:
* @f[
* \hat s(T, P, X_k) = \sum_k X_k \hat s^0_k(T)
* - \hat R \sum_k X_k \ln(X_k)
* @f]
* The reference-state pure-species entropies @f$ \hat s^0_k(T,p_{ref}) @f$
* are computed by the species thermodynamic property manager. The pure
* species entropies are independent of temperature since the volume
* expansivities are equal to zero.
* @see MultiSpeciesThermo
*
* (HKM -> Bump up to Parent object)
*/
double entropy_mole() const override;

double gibbs_mole() const override;

double cp_mole() const override;

double cv_mole() const override;

//! @}
Expand Down Expand Up @@ -1422,9 +1397,6 @@ class HMWSoln : public MolalityVPSSTP
//! Pointer to the water property calculator
unique_ptr<WaterProps> m_waterProps;

//! vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

/**
* Array of 2D data used in the Pitzer/HMW formulation. Beta0_ij[i][j] is
* the value of the Beta0 coefficient for the ij salt. It will be nonzero
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/IdealGasPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class IdealGasPhase: public ThermoPhase
* enthalpies @f$ \hat h^0_k(T) @f$ are computed by the species
* thermodynamic property manager.
*
* \see MultiSpeciesThermo
* @see MultiSpeciesThermo
*/
double enthalpy_mole() const override {
return RT() * mean_X(enthalpy_RT_ref());
Expand Down
60 changes: 0 additions & 60 deletions include/cantera/thermo/IdealMolalSoln.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,6 @@ class IdealMolalSoln : public MolalityVPSSTP
//! @name Molar Thermodynamic Properties of the Solution
//! @{

//! Molar enthalpy of the solution. Units: J/kmol.
/*!
* Returns the amount of enthalpy per mole of solution. For an ideal molal
* solution,
* @f[
* \bar{h}(T, P, X_k) = \sum_k X_k \bar{h}_k(T)
* @f]
* The formula is written in terms of the partial molar enthalpies.
* @f$ \bar{h}_k(T, p, m_k) @f$.
* See the partial molar enthalpy function, getPartialMolarEnthalpies(),
* for details.
*
* Units: J/kmol
*/
double enthalpy_mole() const override;

//! Molar internal energy of the solution: Units: J/kmol.
/*!
* Returns the amount of internal energy per mole of solution. For an ideal
Expand All @@ -117,44 +101,6 @@ class IdealMolalSoln : public MolalityVPSSTP
*/
double intEnergy_mole() const override;

//! Molar entropy of the solution. Units: J/kmol/K.
/*!
* Returns the amount of entropy per mole of solution. For an ideal molal
* solution,
* @f[
* \bar{s}(T, P, X_k) = \sum_k X_k \bar{s}_k(T)
* @f]
* The formula is written in terms of the partial molar entropies.
* @f$ \bar{s}_k(T, p, m_k) @f$.
* See the partial molar entropies function, getPartialMolarEntropies(),
* for details.
*
* Units: J/kmol/K.
*/
double entropy_mole() const override;

//! Molar Gibbs function for the solution: Units J/kmol.
/*!
* Returns the Gibbs free energy of the solution per mole of the solution.
*
* @f[
* \bar{g}(T, P, X_k) = \sum_k X_k \mu_k(T)
* @f]
*
* Units: J/kmol
*/
double gibbs_mole() const override;

//! Molar heat capacity of the solution at constant pressure. Units: J/kmol/K.
/*!
* @f[
* \bar{c}_p(T, P, X_k) = \sum_k X_k \bar{c}_{p,k}(T)
* @f]
*
* Units: J/kmol/K
*/
double cp_mole() const override;

//! @}
//! @name Mechanical Equation of State Properties
//!
Expand All @@ -165,9 +111,6 @@ class IdealMolalSoln : public MolalityVPSSTP
//! cause an exception to be thrown.
//! @{

protected:
void calcDensity() override;

public:
//! The isothermal compressibility. Units: 1/Pa.
/*!
Expand Down Expand Up @@ -404,9 +347,6 @@ class IdealMolalSoln : public MolalityVPSSTP
int IMS_typeCutoff_ = 0;

private:
//! vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

//! Logarithm of the molal activity coefficients
/*!
* Normally these are all one. However, stability schemes will change that
Expand Down
14 changes: 0 additions & 14 deletions include/cantera/thermo/IdealSolidSolnPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,6 @@ class IdealSolidSolnPhase : public ThermoPhase
//! @name Molar Thermodynamic Properties of the Solution
//! @{

/**
* Molar enthalpy of the solution. Units: J/kmol. For an ideal, constant
* partial molar volume solution mixture with pure species phases which
* exhibit zero volume expansivity and zero isothermal compressibility:
* @f[
* \hat h(T,P) = \sum_k X_k \hat h^0_k(T) + (P - P_{ref}) (\sum_k X_k \hat V^0_k)
* @f]
* The reference-state pure-species enthalpies at the reference pressure Pref
* @f$ \hat h^0_k(T) @f$, are computed by the species thermodynamic
* property manager. They are polynomial functions of temperature.
* @see MultiSpeciesThermo
*/
double enthalpy_mole() const override;

/**
* Molar entropy of the solution. Units: J/kmol/K. For an ideal, constant
* partial molar volume solution mixture with pure species phases which
Expand Down
8 changes: 7 additions & 1 deletion include/cantera/thermo/LatticePhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class LatticePhase : public ThermoPhase
* computed first by the species reference state thermodynamic property
* manager and then a small pressure dependent term is added in.
*
* \see MultiSpeciesThermo
* @see MultiSpeciesThermo
*/
double enthalpy_mole() const override;

Expand All @@ -240,6 +240,12 @@ class LatticePhase : public ThermoPhase
*/
double entropy_mole() const override;

//! Molar Gibbs function of the solution. Units: J/kmol
/*!
* Uses thermodynamic property relations.
*/
double gibbs_mole() const override;

//! Molar heat capacity at constant pressure of the solution.
//! Units: J/kmol/K.
/*!
Expand Down
3 changes: 0 additions & 3 deletions include/cantera/thermo/MargulesVPSSTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ class MargulesVPSSTP : public GibbsExcessVPSSTP
//! @name Molar Thermodynamic Properties
//! @{

double enthalpy_mole() const override;
double entropy_mole() const override;
double cp_mole() const override;
double cv_mole() const override;

//! @}
Expand Down
2 changes: 0 additions & 2 deletions include/cantera/thermo/MixtureFugacityTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ class MixtureFugacityTP : public ThermoPhase
*/
virtual void _updateReferenceStateThermo() const;

//! Temporary storage - length = m_kk.
mutable vector<double> m_tmpV;
public:

//! @name Thermodynamic Values for the Species Reference States
Expand Down
3 changes: 3 additions & 0 deletions include/cantera/thermo/Phase.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,9 @@ class Phase
//! Flag determining whether case sensitive species names are enforced
bool m_caseSensitiveSpecies = false;

//! Vector of size m_kk, used as a temporary holding area.
mutable vector<double> m_tmpV;

private:
//! Find lowercase species name in m_speciesIndices when case sensitive
//! species names are not enforced and a user specifies a non-canonical
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/PlasmaPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class PlasmaPhase: public IdealGasPhase
* enthalpies @f$ \hat h^0_k(T) @f$ are computed by the species
* thermodynamic property manager.
*
* \see MultiSpeciesThermo
* @see MultiSpeciesThermo
*/
double enthalpy_mole() const override;

Expand Down
3 changes: 0 additions & 3 deletions include/cantera/thermo/RedlichKisterVPSSTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
//! @name Molar Thermodynamic Properties
//! @{

double enthalpy_mole() const override;
double entropy_mole() const override;
double cp_mole() const override;
double cv_mole() const override;

//! @}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/SurfPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SurfPhase : public ThermoPhase
* Enthalpies @f$ \hat h^0_k(T) @f$ are computed by the species
* thermodynamic property manager.
*
* \see MultiSpeciesThermo
* @see MultiSpeciesThermo
*/
double enthalpy_mole() const override;

Expand Down
Loading
Loading