Go to the documentation of this file.
11 #ifndef CT_THERMOPHASE_H
12 #define CT_THERMOPHASE_H
113 virtual std::string
type()
const {
114 return "ThermoPhase";
138 return "unspecified";
776 doublereal
RT()
const {
797 virtual void setState_TPX(doublereal t, doublereal p,
const doublereal* x);
822 virtual void setState_TPX(doublereal t, doublereal p,
const std::string& x);
835 virtual void setState_TPY(doublereal t, doublereal p,
const doublereal* y);
862 virtual void setState_TPY(doublereal t, doublereal p,
const std::string& y);
871 virtual void setState_TP(doublereal t, doublereal p);
882 virtual void setState_PX(doublereal p, doublereal* x);
894 virtual void setState_PY(doublereal p, doublereal* y);
905 virtual void setState_HP(
double h,
double p,
double tol=1e-9);
919 virtual void setState_UV(
double u,
double v,
double tol=1e-9);
932 virtual void setState_SP(
double s,
double p,
double tol=1e-9);
945 virtual void setState_SV(
double s,
double v,
double tol=1e-9);
1087 virtual void setState_RPX(doublereal rho, doublereal p,
const doublereal* x);
1114 virtual void setState_RPX(doublereal rho, doublereal p,
const std::string& x);
1127 virtual void setState_RPY(doublereal rho, doublereal p,
const doublereal* y);
1154 virtual void setState_RPY(doublereal rho, doublereal p,
const std::string& y);
1201 void setMixtureFraction(
double mixFrac,
const double* fuelComp,
const double* oxComp,
1204 void setMixtureFraction(
double mixFrac,
const std::string& fuelComp,
const std::string& oxComp,
1247 ThermoBasis basis = ThermoBasis::molar,
const std::string& element =
"Bilger")
const;
1249 double mixtureFraction(
const std::string& fuelComp,
const std::string& oxComp,
1250 ThermoBasis basis = ThermoBasis::molar,
const std::string& element =
"Bilger")
const;
1253 ThermoBasis basis = ThermoBasis::molar,
const std::string& element =
"Bilger")
const;
1377 doublereal tol=1e-9,
bool doUV =
false);
1388 void setState_SPorSV(
double s,
double p,
double tol=1e-9,
bool doSV =
false);
1407 double o2Present(
const double* y)
const;
1447 void equilibrate(
const std::string& XY,
const std::string& solver=
"auto",
1448 double rtol=1e-9,
int max_steps=50000,
int max_iter=100,
1449 int estimate_equil=0,
int log_level=0);
1582 virtual bool addSpecies(shared_ptr<Species> spec);
1584 virtual void modifySpecies(
size_t k, shared_ptr<Species> spec);
1606 const std::vector<const XML_Node*> &
speciesData()
const;
1631 const std::string&
id);
1764 doublereal* dlnActCoeffds)
const {
1831 virtual void getdlnActCoeffdlnN_numderiv(
const size_t ld, doublereal*
const dlnActCoeffdlnN);
1844 virtual std::string
report(
bool show_thermo=
true,
1845 doublereal threshold=-1e-14)
const;
1854 virtual void reportCSV(std::ofstream& csvFile)
const;
1862 std::vector<vector_fp>& data)
const;
virtual void setState_SH(double s, double h, double tol=1e-9)
Set the specific entropy (J/kg/K) and the specific enthalpy (J/kg)
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
virtual doublereal satTemperature(doublereal p) const
Return the saturation temperature given the pressure.
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the phase to the conditions specified in the state XML element.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
doublereal cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void setState_PY(doublereal p, doublereal *y)
Set the internally stored pressure (Pa) and mass fractions.
bool chargeNeutralityNecessary() const
Returns the chargeNeutralityNecessity boolean.
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
const int cAC_CONVENTION_MOLAR
Standard state uses the molar convention.
virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New)
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
doublereal intEnergy_mass() const
Specific internal energy. Units: J/kg.
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
An error indicating that an unimplemented function has been called.
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for species k.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
void equilibrate(const std::string &XY, const std::string &solver="auto", double rtol=1e-9, int max_steps=50000, int max_iter=100, int estimate_equil=0, int log_level=0)
Equilibrate a ThermoPhase object.
virtual void setState_TPY(doublereal t, doublereal p, const doublereal *y)
Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species chemical potentials These are partial molar Gibbs free energ...
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
double stoichAirFuelRatio(const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar) const
Compute the stoichiometric air to fuel ratio (kg oxidizer / kg fuel) given fuel and oxidizer composit...
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void setState_UV(double u, double v, double tol=1e-9)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
ThermoPhase thermo_t
typedef for the ThermoPhase class
virtual void modifyOneHf298(const size_t k, const doublereal Hf298New)
Modify the value of the 298 K Heat of Formation of the standard state of one species in the phase (J ...
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
ThermoBasis
Differentiate between mole fractions and mass fractions for input mixture composition.
double equivalenceRatio() const
Compute the equivalence ratio for the current mixture from available oxygen and required oxygen.
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
double mixtureFraction(const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar, const std::string &element="Bilger") const
Compute the mixture fraction = kg fuel / (kg oxidizer + kg fuel) for the current mixture given fuel a...
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual std::string type() const
String indicating the thermodynamic model implemented.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
ThermoPhase()
Constructor.
virtual void setState_SV(double s, double v, double tol=1e-9)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
A species thermodynamic property manager for a phase.
virtual void getStandardVolumes_ref(doublereal *vol) const
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
void setElectricPotential(doublereal v)
Set the electric potential of this phase (V).
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
double o2Required(const double *y) const
Helper function for computing the amount of oxygen required for complete oxidation.
size_t m_kk
Number of species in the phase.
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual bool addSpecies(shared_ptr< Species > spec)
AnyMap m_input
Data supplied via setParameters.
doublereal gibbs_mass() const
Specific Gibbs function. Units: J/kg.
virtual void setState_RPX(doublereal rho, doublereal p, const doublereal *x)
Set the density (kg/m**3), pressure (Pa) and mole fractions.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
double molarVolume() const
Molar volume (m^3/kmol).
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual std::string report(bool show_thermo=true, doublereal threshold=-1e-14) const
returns a summary of the state of the phase as a string
void setEquivalenceRatio(double phi, const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar)
Set the mixture composition according to the equivalence ratio.
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
virtual void setState_TV(double t, double v, double tol=1e-9)
Set the temperature (K) and specific volume (m^3/kg).
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
virtual void setState_TPX(doublereal t, doublereal p, const doublereal *x)
Set the temperature (K), pressure (Pa), and mole fractions.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
virtual bool compatibleWithMultiPhase() const
Indicates whether this phase type can be used with class MultiPhase for equilibrium calculations.
virtual void setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
const AnyMap & input() const
Access input data associated with the phase description.
virtual void reportCSV(std::ofstream &csvFile) const
returns a summary of the state of the phase to a comma separated file.
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
virtual doublereal critDensity() const
Critical density (kg/m3).
virtual void setState_RPY(doublereal rho, doublereal p, const doublereal *y)
Set the density (kg/m**3), pressure (Pa) and mass fractions.
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual MultiSpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
doublereal m_tlast
last value of the temperature processed by reference state
virtual void setState_VH(double v, double h, double tol=1e-9)
Set the specific volume (m^3/kg) and the specific enthalpy (J/kg)
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
void setState_SPorSV(double s, double p, double tol=1e-9, bool doSV=false)
Carry out work in SP and SV calculations.
doublereal Hf298SS(const size_t k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
Base class for a phase with thermodynamic properties.
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.
virtual void setState_HP(double h, double p, double tol=1e-9)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
virtual void invalidateCache()
Invalidate any cached values which are normally updated only when a change in state is detected.
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
virtual double pressure() const
Return the thermodynamic pressure (Pa).
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
doublereal temperature() const
Temperature (K).
void saveSpeciesData(const size_t k, const XML_Node *const data)
Store a reference pointer to the XML tree containing the species data for this phase.
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients wrt changes in state (temp, mole fraction,...
virtual doublereal critPressure() const
Critical pressure (Pa).
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature.
virtual void getCsvReportData(std::vector< std::string > &names, std::vector< vector_fp > &data) const
Fills names and data with the column names and species thermo properties to be included in the output...
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual void modifySpecies(size_t k, shared_ptr< Species > spec)
Modify the thermodynamic data associated with a species.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual std::string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
const int cSS_CONVENTION_VPSS
Standard state uses the molality convention.
Class Phase is the base class for phases of matter, managing the species and elements in a phase,...
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
virtual doublereal critCompressibility() const
Critical compressibility (unitless).
A representation of the units associated with a dimensional quantity.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
void setMixtureFraction(double mixFrac, const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar)
Set the mixture composition according to the mixture fraction = kg fuel / (kg oxidizer + kg fuel)
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
virtual void setState_UP(double u, double p, double tol=1e-9)
Set the specific internal energy (J/kg) and pressure (Pa).
A map of string keys to values whose type can vary at runtime.
doublereal m_phi
Stored value of the electric potential for this phase. Units are Volts.
double o2Present(const double *y) const
Helper function for computing the amount of oxygen available in the current mixture.
const double GasConstant
Universal Gas Constant [J/kmol/K].
void setState_TPQ(double T, double P, double Q)
Set the temperature, pressure, and vapor fraction (quality).
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
virtual void setState_ST(double s, double t, double tol=1e-9)
Set the specific entropy (J/kg/K) and temperature (K).
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
virtual void setState_PV(double p, double v, double tol=1e-9)
Set the pressure (Pa) and specific volume (m^3/kg).
virtual void setState_TH(double t, double h, double tol=1e-9)
Set the temperature (K) and the specific enthalpy (J/kg)
const size_t npos
index returned by functions to indicate "no position"
int m_ssConvention
Contains the standard state convention.
doublereal entropy_mass() const
Specific entropy. Units: J/kg/K.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const int cSS_CONVENTION_SLAVE
Standard state thermodynamics is obtained from slave ThermoPhase objects.
void setState_HPorUV(doublereal h, doublereal p, doublereal tol=1e-9, bool doUV=false)
Carry out work in HP and UV calculations.
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
Namespace for the Cantera kernel.
virtual doublereal critVolume() const
Critical volume (m3/kmol).
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual doublereal critTemperature() const
Critical temperature (K).
void setState_conditional_TP(doublereal t, doublereal p, bool set_p)
Helper function used by setState_HPorUV and setState_SPorSV.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
virtual doublereal reportOneHf298(const size_t k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
virtual void resetHf298(const size_t k=npos)
Restore the original heat of formation of one or more species.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual void setState_RP(doublereal rho, doublereal p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.