11#ifndef CT_THERMOPHASE_H
12#define CT_THERMOPHASE_H
429 return "unspecified";
1097 virtual void setState_TPX(
double t,
double p,
const double* x);
1122 virtual void setState_TPX(
double t,
double p,
const string& x);
1135 virtual void setState_TPY(
double t,
double p,
const double* y);
1162 virtual void setState_TPY(
double t,
double p,
const string& y);
1207 virtual void setState_HP(
double h,
double p,
double tol=1e-9);
1221 virtual void setState_UV(
double u,
double v,
double tol=1e-9);
1234 virtual void setState_SP(
double s,
double p,
double tol=1e-9);
1247 virtual void setState_SV(
double s,
double v,
double tol=1e-9);
1408 virtual void setState_RPX(
double rho,
double p,
const double* x);
1439 virtual void setState_RPX(
double rho,
double p,
const string& x);
1454 virtual void setState_RPY(
double rho,
double p,
const double* y);
1485 virtual void setState_RPY(
double rho,
double p,
const string& y);
1532 const double* oxComp,
ThermoBasis basis=ThermoBasis::molar);
1535 const string& oxComp,
ThermoBasis basis=ThermoBasis::molar);
1576 const string& element=
"Bilger")
const;
1580 const string& element=
"Bilger")
const;
1584 const string& element=
"Bilger")
const;
1607 const string& oxComp,
ThermoBasis basis=ThermoBasis::molar);
1716 void setState_HPorUV(
double h,
double p,
double tol=1e-9,
bool doUV =
false);
1727 void setState_SPorSV(
double s,
double p,
double tol=1e-9,
bool doSV =
false);
1747 double o2Present(
const double* y)
const;
1786 void equilibrate(
const string& XY,
const string& solver=
"auto",
1787 double rtol=1e-9,
int max_steps=50000,
int max_iter=100,
1788 int estimate_equil=0,
int log_level=0);
1918 bool addSpecies(shared_ptr<Species> spec)
override;
1920 void modifySpecies(
size_t k, shared_ptr<Species> spec)
override;
2010 double* dlnActCoeffds)
const {
2080 virtual void getdlnActCoeffdlnN_numderiv(
const size_t ld,
2081 double*
const dlnActCoeffdlnN);
2094 virtual string report(
bool show_thermo=
true,
double threshold=-1e-14)
const;
2104 virtual void reportCSV(std::ofstream& csvFile)
const;
2118 vector<vector<double>>& data)
const;
Header for a general species thermodynamic property manager for a phase (see MultiSpeciesThermo).
Header file for class Phase.
Header for unit conversion utilities, which are used to translate user input from input files (See In...
A map of string keys to values whose type can vary at runtime.
A species thermodynamic property manager for a phase.
virtual double refPressure(size_t k=npos) const
The reference-state pressure for species k.
virtual double minTemp(size_t k=npos) const
Minimum temperature.
virtual double maxTemp(size_t k=npos) const
Maximum temperature.
virtual void modifyOneHf298(const size_t k, const double Hf298New)
Modify the value of the 298 K Heat of Formation of the standard state of one species in the phase (J ...
virtual double reportOneHf298(const size_t k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
An error indicating that an unimplemented function has been called.
Class Phase is the base class for phases of matter, managing the species and elements in a phase,...
size_t m_kk
Number of species in the phase.
double temperature() const
Temperature (K).
double meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
virtual double molarVolume() const
Molar volume (m^3/kmol).
virtual double pressure() const
Return the thermodynamic pressure (Pa).
string name() const
Return the name of the phase.
Base class for a phase with thermodynamic properties.
int m_ssConvention
Contains the standard state convention.
virtual void getPartialMolarEnthalpies(double *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual double critTemperature() const
Critical temperature (K).
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 setState_PX(double p, double *x)
Set the pressure (Pa) and mole fractions.
double electricPotential() const
Returns the electric potential of this phase (V).
virtual void getEntropy_R(double *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
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).
bool chargeNeutralityNecessary() const
Returns the chargeNeutralityNecessity boolean.
virtual double cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
double equivalenceRatio() const
Compute the equivalence ratio for the current mixture from available oxygen and required oxygen.
virtual void setParameters(const AnyMap &phaseNode, const AnyMap &rootNode=AnyMap())
Set equation of state parameters from an AnyMap phase description.
virtual double thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
virtual void getEnthalpy_RT_ref(double *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
virtual double enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getChemPotentials_RT(double *mu) const
Get the array of non-dimensional species chemical potentials These are partial molar Gibbs free energ...
virtual void setState_TP(double t, double p)
Set the temperature (K) and pressure (Pa)
virtual double standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
virtual void getCp_R_ref(double *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
virtual void setState_TV(double t, double v, double tol=1e-9)
Set the temperature (K) and specific volume (m^3/kg).
virtual double logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
double o2Present(const double *y) const
Helper function for computing the amount of oxygen available in the current mixture.
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(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
virtual double minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
virtual void setState_RPY(double rho, double p, const double *y)
Set the density (kg/m**3), pressure (Pa) and mass fractions.
virtual void getdlnActCoeffdlnN_diag(double *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
virtual void setState_TPX(double t, double p, const double *x)
Set the temperature (K), pressure (Pa), and mole fractions.
virtual void getCsvReportData(vector< string > &names, vector< vector< double > > &data) const
Fills names and data with the column names and species thermo properties to be included in the output...
void setState_SPorSV(double s, double p, double tol=1e-9, bool doSV=false)
Carry out work in SP and SV calculations.
double RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void setState_RPX(double rho, double p, const double *x)
Set the density (kg/m**3), pressure (Pa) and mole fractions.
virtual void getPartialMolarCp(double *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
virtual double critPressure() const
Critical pressure (Pa).
virtual void getGibbs_RT_ref(double *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
virtual double soundSpeed() const
Return the speed of sound. Units: m/s.
virtual void setState_TPY(double t, double p, const double *y)
Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
double m_tlast
last value of the temperature processed by reference state
virtual void setState_ST(double s, double t, double tol=1e-9)
Set the specific entropy (J/kg/K) and temperature (K).
void setState_HPorUV(double h, double p, double tol=1e-9, bool doUV=false)
Carry out work in HP and UV calculations.
double gibbs_mass() const
Specific Gibbs function. Units: J/kg.
virtual void getActivityConcentrations(double *c) const
This method returns an array of generalized concentrations.
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...
string type() const override
String indicating the thermodynamic model implemented.
AnyMap parameters(bool withInput=true) const
Returns the parameters of a ThermoPhase object such that an identical one could be reconstructed usin...
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
virtual void getPureGibbs(double *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution.
virtual string report(bool show_thermo=true, double threshold=-1e-14) const
returns a summary of the state of the phase as a string
virtual void getPartialMolarIntEnergies(double *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual void getIntEnergy_RT(double *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual void getCp_R(double *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
virtual double maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
double m_phi
Stored value of the electric potential for this phase. Units are Volts.
virtual double isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
double mixtureFraction(const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar, const string &element="Bilger") const
Compute the mixture fraction = kg fuel / (kg oxidizer + kg fuel) for the current mixture given fuel a...
double o2Required(const double *y) const
Helper function for computing the amount of oxygen required for complete oxidation.
virtual double satTemperature(double p) const
Return the saturation temperature given the pressure.
virtual void getdlnActCoeffds(const double dTds, const double *const dXds, double *dlnActCoeffds) const
Get the change in activity coefficients wrt changes in state (temp, mole fraction,...
void getElectrochemPotentials(double *mu) const
Get the species electrochemical potentials.
virtual void getdlnActCoeffdlnN(const size_t ld, double *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
void setState_RP(double rho, double p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.
virtual void getGibbs_RT(double *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
virtual double critVolume() const
Critical volume (m3/kmol).
virtual void getActivityCoefficients(double *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
virtual string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
virtual void getStandardVolumes(double *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
virtual void setState_Tsat(double t, double x)
Set the state to a saturated system at a particular temperature.
virtual double entropy_mole() const
Molar entropy. Units: J/kmol/K.
void setElectricPotential(double v)
Set the electric potential of this phase (V).
double cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
virtual void setState_PY(double p, double *y)
Set the internally stored pressure (Pa) and mass fractions.
double entropy_mass() const
Specific entropy. Units: J/kg/K.
virtual double critDensity() const
Critical density (kg/m3).
virtual void getGibbs_ref(double *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual MultiSpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
virtual void setState_UP(double u, double p, double tol=1e-9)
Set the specific internal energy (J/kg) and pressure (Pa).
void initThermoFile(const string &inputFile, const string &id)
Initialize a ThermoPhase object using an input file.
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
virtual void modifyOneHf298SS(const size_t k, const double Hf298New)
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
void modifySpecies(size_t k, shared_ptr< Species > spec) override
Modify the thermodynamic data associated with a species.
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 getdlnActCoeffdlnX_diag(double *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
void invalidateCache() override
Invalidate any cached values which are normally updated only when a change in state is detected.
virtual void getActivities(double *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
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 getStandardVolumes_ref(double *vol) const
Get the molar volumes of the species reference states at the current T and P_ref of the solution.
virtual double vaporFraction() const
Return the fraction of vapor at the current conditions.
virtual void resetHf298(const size_t k=npos)
Restore the original heat of formation of one or more species.
virtual void getStandardChemPotentials(double *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
virtual void getEnthalpy_RT(double *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
virtual void getEntropy_R_ref(double *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void getChemPotentials(double *mu) const
Get the species chemical potentials. Units: J/kmol.
double cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
virtual void setState_TH(double t, double h, double tol=1e-9)
Set the temperature (K) and the specific enthalpy (J/kg)
virtual void getLnActivityCoefficients(double *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
double intEnergy_mass() const
Specific internal energy. Units: J/kg.
virtual void getSpeciesParameters(const string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
virtual void getIntEnergy_RT_ref(double *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
double Hf298SS(const size_t k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
ThermoPhase()=default
Constructor.
virtual bool isIdeal() const
Boolean indicating whether phase is ideal.
virtual double cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
virtual double satPressure(double t)
Return the saturation pressure given the temperature.
virtual double refPressure() const
Returns the reference pressure in Pa.
virtual double critCompressibility() const
Critical compressibility (unitless).
bool addSpecies(shared_ptr< Species > spec) override
Add a Species to this Phase.
AnyMap m_input
Data supplied via setParameters.
virtual double intEnergy_mole() const
Molar internal energy. Units: J/kmol.
virtual void reportCSV(std::ofstream &csvFile) const
returns a summary of the state of the phase to a comma separated file.
virtual void setState_DP(double rho, double p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.
void setEquivalenceRatio(double phi, const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar)
Set the mixture composition according to the equivalence ratio.
void setState_TPQ(double T, double P, double Q)
Set the temperature, pressure, and vapor fraction (quality).
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)
virtual void getPartialMolarEntropies(double *sbar) const
Returns an array of partial molar entropies of the species in the solution.
virtual double gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
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).
const AnyMap & input() const
Access input data associated with the phase description.
virtual void setState_Psat(double p, double x)
Set the state to a saturated system at a particular pressure.
void setState_conditional_TP(double t, double p, bool set_p)
Helper function used by setState_HPorUV and setState_SPorSV.
virtual void getPartialMolarVolumes(double *vbar) const
Return an array of partial molar volumes for the species in the mixture.
double enthalpy_mass() const
Specific enthalpy. Units: J/kg.
A representation of the units associated with a dimensional quantity.
void equilibrate(const string &XY, const 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 bool compatibleWithMultiPhase() const
Indicates whether this phase type can be used with class MultiPhase for equilibrium calculations.
virtual void setToEquilState(const double *mu_RT)
This method is used by the ChemEquil equilibrium solver.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
const int cSS_CONVENTION_VPSS
Standard state uses the molality convention.
const int cAC_CONVENTION_MOLAR
Standard state uses the molar convention.
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
ThermoBasis
Differentiate between mole fractions and mass fractions for input mixture composition.
const int cSS_CONVENTION_SLAVE
Standard state thermodynamics is obtained from slave ThermoPhase objects.
map< string, double > Composition
Map from string names to doubles.
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.