28 ThermoPhase::ThermoPhase() :
31 m_hasElementPotentials(false),
32 m_chargeNeutralityNecessary(false),
50 m_hasElementPotentials(false),
51 m_chargeNeutralityNecessary(false),
80 (void)Phase::operator=(right);
92 for (
size_t k = 0; k <
m_kk; k++) {
128 for (
size_t k = 0; k <
nSpecies(); k++) {
136 for (
size_t k = 0; k <
m_kk; k++) {
137 lnac[k] = std::log(lnac[k]);
215 doublereal dTtol,
bool doUV)
225 "Input specific volume is too small or negative. v = " +
fp2str(v));
231 "Input pressure is too small or negative. p = " +
fp2str(p));
244 }
else if (Tnew < Tmin) {
258 bool ignoreBounds =
false;
262 bool unstablePhase =
false;
265 double Tunstable = -1.0;
266 bool unstablePhaseNew =
false;
269 for (
int n = 0; n < 500; n++) {
274 unstablePhase =
true;
278 dt =
clip((Htarget - Hold)/cpd, -100.0, 100.0);
286 if ((dt > 0.0 && unstablePhase) || (dt <= 0.0 && !unstablePhase)) {
287 if (Hbot < Htarget && Tnew < (0.75 * Tbot + 0.25 * Told)) {
288 dt = 0.75 * (Tbot - Told);
291 }
else if (Htop > Htarget && Tnew > (0.75 * Ttop + 0.25 * Told)) {
292 dt = 0.75 * (Ttop - Told);
297 if (Tnew > Tmax && !ignoreBounds) {
300 if (Hmax >= Htarget) {
301 if (Htop < Htarget) {
310 if (Tnew < Tmin && !ignoreBounds) {
313 if (Hmin <= Htarget) {
314 if (Hbot > Htarget) {
327 for (
int its = 0; its < 10; its++) {
329 if (Tnew < Told / 3.0) {
331 dt = -2.0 * Told / 3.0;
342 unstablePhaseNew =
true;
345 unstablePhaseNew =
false;
348 if (unstablePhase ==
false && unstablePhaseNew ==
true) {
353 if (Hnew == Htarget) {
355 }
else if (Hnew > Htarget && (Htop < Htarget || Hnew < Htop)) {
358 }
else if (Hnew < Htarget && (Hbot > Htarget || Hnew > Hbot)) {
363 double Herr = Htarget - Hnew;
364 double acpd = std::max(fabs(cpd), 1.0E-5);
365 double denom = std::max(fabs(Htarget), acpd * dTtol);
366 double HConvErr = fabs((Herr)/denom);
367 if (HConvErr < 0.00001 *dTtol || fabs(dt) < dTtol) {
376 string ErrString =
"No convergence in 500 iterations\n";
378 ErrString +=
"\tTarget Internal Energy = " +
fp2str(Htarget) +
"\n";
379 ErrString +=
"\tCurrent Specific Volume = " +
fp2str(v) +
"\n";
380 ErrString +=
"\tStarting Temperature = " +
fp2str(Tinit) +
"\n";
381 ErrString +=
"\tCurrent Temperature = " +
fp2str(Tnew) +
"\n";
382 ErrString +=
"\tCurrent Internal Energy = " +
fp2str(Hnew) +
"\n";
383 ErrString +=
"\tCurrent Delta T = " +
fp2str(dt) +
"\n";
385 ErrString +=
"\tTarget Enthalpy = " +
fp2str(Htarget) +
"\n";
386 ErrString +=
"\tCurrent Pressure = " +
fp2str(p) +
"\n";
387 ErrString +=
"\tStarting Temperature = " +
fp2str(Tinit) +
"\n";
388 ErrString +=
"\tCurrent Temperature = " +
fp2str(Tnew) +
"\n";
389 ErrString +=
"\tCurrent Enthalpy = " +
fp2str(Hnew) +
"\n";
390 ErrString +=
"\tCurrent Delta T = " +
fp2str(dt) +
"\n";
393 ErrString +=
"\t - The phase became unstable (Cp < 0) T_unstable_last = "
394 +
fp2str(Tunstable) +
"\n";
416 doublereal dTtol,
bool doSV)
424 "Input specific volume is too small or negative. v = " +
fp2str(v));
430 "Input pressure is too small or negative. p = " +
fp2str(p));
443 }
else if (Tnew < Tmin) {
458 bool ignoreBounds =
false;
462 bool unstablePhase =
false;
463 double Tunstable = -1.0;
464 bool unstablePhaseNew =
false;
467 for (
int n = 0; n < 500; n++) {
472 unstablePhase =
true;
476 dt =
clip((Starget - Sold)*Told/cpd, -100.0, 100.0);
480 if ((dt > 0.0 && unstablePhase) || (dt <= 0.0 && !unstablePhase)) {
481 if (Sbot < Starget && Tnew < Tbot) {
482 dt = 0.75 * (Tbot - Told);
485 }
else if (Stop > Starget && Tnew > Ttop) {
486 dt = 0.75 * (Ttop - Told);
491 if (Tnew > Tmax && !ignoreBounds) {
494 if (Smax >= Starget) {
495 if (Stop < Starget) {
503 }
else if (Tnew < Tmin && !ignoreBounds) {
506 if (Smin <= Starget) {
507 if (Sbot > Starget) {
520 for (
int its = 0; its < 10; its++) {
526 unstablePhaseNew =
true;
529 unstablePhaseNew =
false;
532 if (unstablePhase ==
false && unstablePhaseNew ==
true) {
537 if (Snew == Starget) {
539 }
else if (Snew > Starget && (Stop < Starget || Snew < Stop)) {
542 }
else if (Snew < Starget && (Sbot > Starget || Snew > Sbot)) {
547 double Serr = Starget - Snew;
548 double acpd = std::max(fabs(cpd), 1.0E-5);
549 double denom = std::max(fabs(Starget), acpd * dTtol);
550 double SConvErr = fabs((Serr * Tnew)/denom);
551 if (SConvErr < 0.00001 *dTtol || fabs(dt) < dTtol) {
560 string ErrString =
"No convergence in 500 iterations\n";
562 ErrString +=
"\tTarget Entropy = " +
fp2str(Starget) +
"\n";
563 ErrString +=
"\tCurrent Specific Volume = " +
fp2str(v) +
"\n";
564 ErrString +=
"\tStarting Temperature = " +
fp2str(Tinit) +
"\n";
565 ErrString +=
"\tCurrent Temperature = " +
fp2str(Tnew) +
"\n";
566 ErrString +=
"\tCurrent Entropy = " +
fp2str(Snew) +
"\n";
567 ErrString +=
"\tCurrent Delta T = " +
fp2str(dt) +
"\n";
569 ErrString +=
"\tTarget Entropy = " +
fp2str(Starget) +
"\n";
570 ErrString +=
"\tCurrent Pressure = " +
fp2str(p) +
"\n";
571 ErrString +=
"\tStarting Temperature = " +
fp2str(Tinit) +
"\n";
572 ErrString +=
"\tCurrent Temperature = " +
fp2str(Tnew) +
"\n";
573 ErrString +=
"\tCurrent Entropy = " +
fp2str(Snew) +
"\n";
574 ErrString +=
"\tCurrent Delta T = " +
fp2str(dt) +
"\n";
577 ErrString +=
"\t - The phase became unstable (Cp < 0) T_unstable_last = "
578 +
fp2str(Tunstable) +
"\n";
590 "To be removed after Cantera 2.2.");
591 for (
int i = 0; i < sizeUA; i++) {
596 uA[1] = -int(
nDim());
615 if (!dynamic_cast<GeneralSpeciesThermo*>(spthermo)) {
617 "Use of SpeciesThermo classes other than "
618 "GeneralSpeciesThermo is deprecated.");
632 "species reference state thermo manager was not set");
638 const std::string&
id)
644 "ERROR: Can not find phase named " +
645 id +
" in file named " + inputFile);
667 if (fabs(sum) > 1.0E-11) {
668 throw CanteraError(
"ThermoPhase::setReferenceComposition",
669 "input mole fractions don't sum to 1.0");
683 "Number of species is equal to zero");
688 "Missing species thermo data");
700 spec->thermo->validate(spec->name);
718 "m_speciesData is the wrong size");
734 if (state.
hasChild(
"temperature")) {
735 double t =
getFloat(state,
"temperature",
"temperature");
739 double p =
getFloat(state,
"pressure",
"pressure");
743 double rho =
getFloat(state,
"density",
"density");
749 double rtol,
int max_steps,
int max_iter,
750 int estimate_equil,
int log_level)
753 if (solver ==
"auto" || solver ==
"element_potential") {
756 writelog(
"Trying ChemEquil solver\n", log_level);
761 bool use_element_potentials = (estimate_equil == 0);
762 int ret = E.
equilibrate(*
this, XY.c_str(), use_element_potentials, log_level-1);
765 "ChemEquil solver failed. Return code: " +
int2str(ret));
768 writelog(
"ChemEquil solver succeeded\n", log_level);
770 }
catch (std::exception& err) {
771 writelog(
"ChemEquil solver failed.\n", log_level);
774 if (solver ==
"auto") {
781 if (solver ==
"auto" || solver ==
"vcs" || solver ==
"gibbs") {
785 M.
equilibrate(XY, solver, rtol, max_steps, max_iter,
786 estimate_equil, log_level);
790 if (solver !=
"auto") {
792 "Invalid solver specified: '" + solver +
"'");
799 if (lambda.size() < mm) {
800 throw CanteraError(
"setElementPotentials",
"lambda too small");
819 for (
size_t m = 0; m <
m_kk; m++) {
820 for (
size_t k = 0; k <
m_kk; k++) {
821 dlnActCoeffdlnN[ld * k + m] = 0.0;
827 void ThermoPhase::getdlnActCoeffdlnN_numderiv(
const size_t ld, doublereal*
const dlnActCoeffdlnN)
829 double deltaMoles_j = 0.0;
835 std::vector<double> ActCoeff_Base(
m_kk);
837 std::vector<double> Xmol_Base(
m_kk);
841 std::vector<double> ActCoeff(
m_kk);
842 std::vector<double> Xmol(
m_kk);
843 double v_totalMoles = 1.0;
844 double TMoles_base = v_totalMoles;
849 for (
size_t j = 0; j <
m_kk; j++) {
857 double moles_j_base = v_totalMoles * Xmol_Base[j];
858 deltaMoles_j = 1.0E-7 * moles_j_base + v_totalMoles * 1.0E-13 + 1.0E-150;
863 v_totalMoles = TMoles_base + deltaMoles_j;
864 for (
size_t k = 0; k <
m_kk; k++) {
865 Xmol[k] = Xmol_Base[k] * TMoles_base / v_totalMoles;
867 Xmol[j] = (moles_j_base + deltaMoles_j) / v_totalMoles;
879 double*
const lnActCoeffCol = dlnActCoeffdlnN + ld * j;
880 for (
size_t k = 0; k <
m_kk; k++) {
881 lnActCoeffCol[k] = (2*moles_j_base + deltaMoles_j) *(ActCoeff[k] - ActCoeff_Base[k]) /
882 ((ActCoeff[k] + ActCoeff_Base[k]) * deltaMoles_j);
887 v_totalMoles = TMoles_base;
905 sprintf(p,
" \n %s:\n",
name().c_str());
908 sprintf(p,
" \n temperature %12.6g K\n",
temperature());
910 sprintf(p,
" pressure %12.6g Pa\n",
pressure());
912 sprintf(p,
" density %12.6g kg/m^3\n",
density());
919 sprintf(p,
" potential %12.6g V\n", phi);
925 sprintf(p,
" 1 kg 1 kmol\n");
927 sprintf(p,
" ----------- ------------\n");
929 sprintf(p,
" enthalpy %12.5g %12.4g J\n",
932 sprintf(p,
" internal energy %12.5g %12.4g J\n",
935 sprintf(p,
" entropy %12.5g %12.4g J/K\n",
938 sprintf(p,
" Gibbs function %12.5g %12.4g J\n",
941 sprintf(p,
" heat capacity c_p %12.5g %12.4g J/K\n",
945 sprintf(p,
" heat capacity c_v %12.5g %12.4g J/K\n",
950 sprintf(p,
" heat capacity c_v <not implemented> \n");
964 doublereal xMinor = 0.0;
965 doublereal yMinor = 0.0;
968 " Y Chem. Pot. / RT \n");
970 sprintf(p,
" ------------- "
971 "------------ ------------\n");
973 for (
size_t k = 0; k <
m_kk; k++) {
974 if (x[k] >= threshold) {
976 sprintf(p,
"%18s %12.6g %12.6g %12.6g\n",
979 sprintf(p,
"%18s %12.6g %12.6g \n",
993 sprintf(p,
" -------------"
996 for (
size_t k = 0; k <
m_kk; k++) {
997 if (x[k] >= threshold) {
998 sprintf(p,
"%18s %12.6g %12.6g\n",
1009 sprintf(p,
" [%+5i minor] %12.6g %12.6g\n",
1010 nMinor, xMinor, yMinor);
1024 csvFile.precision(8);
1029 std::vector<std::string> pNames;
1030 std::vector<vector_fp> data;
1033 csvFile << setw(tabS) <<
"Species,";
1034 for (
size_t i = 0; i < pNames.size(); i++) {
1035 csvFile << setw(tabM) << pNames[i] <<
",";
1038 for (
size_t k = 0; k <
nSpecies(); k++) {
1041 for (
size_t i = 0; i < pNames.size(); i++) {
1042 csvFile << setw(tabM) << data[i][k] <<
",";
1046 for (
size_t i = 0; i < pNames.size(); i++) {
1047 csvFile << setw(tabM) << 0 <<
",";
1055 std::vector<vector_fp>& data)
const
1060 names.push_back(
"X");
1063 names.push_back(
"Y");
1066 names.push_back(
"Chem. Pot (J/kmol)");
1069 names.push_back(
"Activity");
1072 names.push_back(
"Act. Coeff.");
1075 names.push_back(
"Part. Mol Enthalpy (J/kmol)");
1078 names.push_back(
"Part. Mol. Entropy (J/K/kmol)");
1081 names.push_back(
"Part. Mol. Energy (J/kmol)");
1084 names.push_back(
"Part. Mol. Cp (J/K/kmol");
1087 names.push_back(
"Part. Mol. Cv (J/K/kmol)");
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
virtual void setState_HP(doublereal h, doublereal p, doublereal tol=1.e-4)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
ThermoPhase()
Constructor.
EquilOpt options
Options controlling how the calculation is carried out.
virtual doublereal density() const
Density (kg/m^3).
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
doublereal electricPotential() const
Returns the electric potential of this phase (V).
XML_Node * get_XML_File(const std::string &file, int debug)
Return a pointer to the XML tree for a Cantera input file.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
std::string getChildValue(const XML_Node &parent, const std::string &nameString)
This function reads a child node with the name, nameString, and returns its XML value as the return s...
doublereal relTolerance
Relative tolerance.
size_t nElements() const
Number of elements.
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
virtual void setState_TPX(doublereal t, doublereal p, const doublereal *x)
Set the temperature (K), pressure (Pa), and mole fractions.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
const int cAC_CONVENTION_MOLAR
Standard state uses the molar convention.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
void setState_HPorUV(doublereal h, doublereal p, doublereal tol=1.e-4, bool doUV=false)
Carry out work in HP and UV calculations.
virtual void reportCSV(std::ofstream &csvFile) const
returns a summary of the state of the phase to a comma separated file.
void addPhase(ThermoPhase *p, doublereal moles)
Add a phase to the mixture.
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
virtual void install_STIT(size_t index, shared_ptr< SpeciesThermoInterpType > stit)=0
Install a new species thermodynamic property parameterization for one species.
int equilibrate(thermo_t &s, const char *XY, bool useThermoPhaseElementPotentials=false, int loglevel=0)
Class XML_Node is a tree-based representation of the contents of an XML file.
void setState_conditional_TP(doublereal t, doublereal p, bool set_p)
Helper function used by setState_HPorUV and setState_SPorSV.
T clip(const T &value, const T &lower, const T &upper)
Clip value such that lower <= value <= upper.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
vector_fp m_lambdaRRT
Vector of element potentials.
doublereal equilibrate(int XY, doublereal err=1.0e-9, int maxsteps=1000, int maxiter=200, int loglevel=-99)
Set the mixture to a state of chemical equilibrium.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
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.
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.
doublereal m_tlast
last value of the temperature processed by reference state
std::string name() const
Return the name of the phase.
Pure Virtual base class for the species thermo manager classes.
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Equilib...
virtual void setState_PY(doublereal p, doublereal *y)
Set the internally stored pressure (Pa) and mass fractions.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
bool ready(size_t nSpecies)
Check if data for all species (0 through nSpecies-1) has been installed.
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
doublereal intEnergy_mass() const
Specific internal energy.
Base class for a phase with thermodynamic properties.
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
virtual void setReferenceComposition(const doublereal *const x)
Sets the reference composition.
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the phase to the conditions specified in the state XML element.
bool importPhase(XML_Node &phase, ThermoPhase *th, SpeciesThermoFactory *spfactory)
Import a phase information into an empty ThermoPhase object.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
A class for multiphase mixtures.
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
A species thermodynamic property manager for a phase.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
doublereal gibbs_mass() const
Specific Gibbs function.
doublereal entropy_mass() const
Specific entropy.
doublereal m_phi
Stored value of the electric potential for this phase.
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
bool getElementPotentials(doublereal *lambda) const
Returns the element potentials stored in the ThermoPhase object.
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
doublereal cp_mass() const
Specific heat at constant pressure.
virtual void setState_SP(doublereal s, doublereal p, doublereal tol=1.e-4)
Set the specific entropy (J/kg/K) and pressure (Pa).
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 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...
void setMoleFractionsByName(const compositionMap &xMap)
Set the species mole fractions by name.
int m_ssConvention
Contains the standard state convention.
void setMassFractionsByName(const compositionMap &yMap)
Set the species mass fractions by name.
virtual void getReferenceComposition(doublereal *const x) const
Gets the reference composition.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Base class for exceptions thrown by Cantera classes.
doublereal cv_mass() const
Specific heat at constant volume.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values There is no restriction on the sum of the mole fractio...
virtual void setState_UV(doublereal u, doublereal v, doublereal tol=1.e-4)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual void installSlavePhases(Cantera::XML_Node *phaseNode)
Add in species from Slave phases.
virtual void setState_SV(doublereal s, doublereal v, doublereal tol=1.e-4)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
doublereal temperature() const
Temperature (K).
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
Headers for a completely general species thermodynamic property manager for a phase (see Managers for...
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
const doublereal SmallNumber
smallest number to compare to zero.
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
void setState_SPorSV(doublereal s, doublereal p, doublereal tol=1.e-4, bool doSV=false)
Carry out work in SP and SV calculations.
Templates for operations on vector-like objects.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
virtual void setTemperature(const doublereal temp)
Set the internally stored temperature of the phase (K).
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
doublereal enthalpy_mass() const
Specific enthalpy.
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
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
void init()
Process phases and build atomic composition array.
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
Contains declarations for string manipulation functions within Cantera.
std::vector< doublereal > xMol_Ref
Reference Mole Fraction Composition.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
#define DATA_PTR(vec)
Creates a pointer to the start of the raw data for a vector.
void saveState(vector_fp &state) const
Save the current internal state of the phase Write to vector 'state' the current internal state...
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void setMassFractions(const doublereal *const y)
Set the mass fractions to the specified values and normalize them.
void setElementPotentials(const vector_fp &lambda)
Stores the element potentials in the ThermoPhase object.
int maxIterations
Maximum number of iterations.
virtual SpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
void writelog(const std::string &msg)
Write a message to the screen.
size_t m_kk
Number of species in the phase.
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 void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
void setSpeciesThermo(SpeciesThermo *spthermo)
Install a species thermodynamic property manager.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
virtual ~ThermoPhase()
Destructor. Deletes the species thermo manager.
bool m_hasElementPotentials
Boolean indicating whether there is a valid set of saved element potentials for this phase...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
std::string speciesName(size_t k) const
Name of the species with index k.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
void save()
Function to put this error onto Cantera's error stack.