27 ThermoPhase::ThermoPhase() :
30 m_hasElementPotentials(false),
31 m_chargeNeutralityNecessary(false),
37 ThermoPhase::~ThermoPhase()
49 m_hasElementPotentials(false),
50 m_chargeNeutralityNecessary(false),
54 " Cantera 2.3 for all classes derived from ThermoPhase.");
61 warn_deprecated(
"ThermoPhase assignment operator",
"To be removed after" 62 " Cantera 2.3 for all classes derived from ThermoPhase.");
75 Phase::operator=(right);
83 for (
size_t k = 0; k <
m_kk; k++) {
99 "To be removed after Cantera 2.3.");
107 for (
size_t k = 0; k <
nSpecies(); k++) {
132 for (
size_t k = 0; k <
nSpecies(); k++) {
140 for (
size_t k = 0; k <
m_kk; k++) {
141 lnac[k] = std::log(lnac[k]);
149 for (
size_t k = 0; k <
m_kk; k++) {
263 double rtol,
bool doUV)
273 "Input specific volume is too small or negative. v = {}", v);
279 "Input pressure is too small or negative. p = {}", p);
292 }
else if (Tnew < Tmin) {
306 bool ignoreBounds =
false;
309 bool unstablePhase =
false;
312 double Tunstable = -1.0;
313 bool unstablePhaseNew =
false;
316 for (
int n = 0; n < 500; n++) {
321 unstablePhase =
true;
325 dt =
clip((Htarget - Hold)/cpd, -100.0, 100.0);
332 if ((dt > 0.0 && unstablePhase) || (dt <= 0.0 && !unstablePhase)) {
333 if (Hbot < Htarget && Tnew < (0.75 * Tbot + 0.25 * Told)) {
334 dt = 0.75 * (Tbot - Told);
337 }
else if (Htop > Htarget && Tnew > (0.75 * Ttop + 0.25 * Told)) {
338 dt = 0.75 * (Ttop - Told);
343 if (Tnew > Tmax && !ignoreBounds) {
346 if (Hmax >= Htarget) {
347 if (Htop < Htarget) {
356 if (Tnew < Tmin && !ignoreBounds) {
359 if (Hmin <= Htarget) {
360 if (Hbot > Htarget) {
373 for (
int its = 0; its < 10; its++) {
375 if (Tnew < Told / 3.0) {
377 dt = -2.0 * Told / 3.0;
388 unstablePhaseNew =
true;
391 unstablePhaseNew =
false;
394 if (unstablePhase ==
false && unstablePhaseNew ==
true) {
399 if (Hnew == Htarget) {
401 }
else if (Hnew > Htarget && (Htop < Htarget || Hnew < Htop)) {
404 }
else if (Hnew < Htarget && (Hbot > Htarget || Hnew > Hbot)) {
409 double Herr = Htarget - Hnew;
410 double acpd = std::max(fabs(cpd), 1.0E-5);
411 double denom = std::max(fabs(Htarget), acpd * Tnew);
412 double HConvErr = fabs((Herr)/denom);
413 if (HConvErr < rtol || fabs(dt/Tnew) < rtol) {
421 string ErrString =
"No convergence in 500 iterations\n";
423 ErrString += fmt::format(
424 "\tTarget Internal Energy = {}\n" 425 "\tCurrent Specific Volume = {}\n" 426 "\tStarting Temperature = {}\n" 427 "\tCurrent Temperature = {}\n" 428 "\tCurrent Internal Energy = {}\n" 429 "\tCurrent Delta T = {}\n",
430 Htarget, v, Tinit, Tnew, Hnew, dt);
432 ErrString += fmt::format(
433 "\tTarget Enthalpy = {}\n" 434 "\tCurrent Pressure = {}\n" 435 "\tStarting Temperature = {}\n" 436 "\tCurrent Temperature = {}\n" 437 "\tCurrent Enthalpy = {}\n" 438 "\tCurrent Delta T = {}\n",
439 Htarget, p, Tinit, Tnew, Hnew, dt);
442 ErrString += fmt::format(
443 "\t - The phase became unstable (Cp < 0) T_unstable_last = {}\n",
464 double rtol,
bool doSV)
472 "Input specific volume is too small or negative. v = {}", v);
478 "Input pressure is too small or negative. p = {}", p);
491 }
else if (Tnew < Tmin) {
505 bool ignoreBounds =
false;
508 bool unstablePhase =
false;
509 double Tunstable = -1.0;
510 bool unstablePhaseNew =
false;
513 for (
int n = 0; n < 500; n++) {
518 unstablePhase =
true;
522 dt =
clip((Starget - Sold)*Told/cpd, -100.0, 100.0);
526 if ((dt > 0.0 && unstablePhase) || (dt <= 0.0 && !unstablePhase)) {
527 if (Sbot < Starget && Tnew < Tbot) {
528 dt = 0.75 * (Tbot - Told);
531 }
else if (Stop > Starget && Tnew > Ttop) {
532 dt = 0.75 * (Ttop - Told);
537 if (Tnew > Tmax && !ignoreBounds) {
540 if (Smax >= Starget) {
541 if (Stop < Starget) {
549 }
else if (Tnew < Tmin && !ignoreBounds) {
552 if (Smin <= Starget) {
553 if (Sbot > Starget) {
566 for (
int its = 0; its < 10; its++) {
572 unstablePhaseNew =
true;
575 unstablePhaseNew =
false;
578 if (unstablePhase ==
false && unstablePhaseNew ==
true) {
583 if (Snew == Starget) {
585 }
else if (Snew > Starget && (Stop < Starget || Snew < Stop)) {
588 }
else if (Snew < Starget && (Sbot > Starget || Snew > Sbot)) {
593 double Serr = Starget - Snew;
594 double acpd = std::max(fabs(cpd), 1.0E-5);
595 double denom = std::max(fabs(Starget), acpd * Tnew);
596 double SConvErr = fabs((Serr * Tnew)/denom);
597 if (SConvErr < rtol || fabs(dt/Tnew) < rtol) {
605 string ErrString =
"No convergence in 500 iterations\n";
607 ErrString += fmt::format(
608 "\tTarget Entropy = {}\n" 609 "\tCurrent Specific Volume = {}\n" 610 "\tStarting Temperature = {}\n" 611 "\tCurrent Temperature = {}\n" 612 "\tCurrent Entropy = {}\n" 613 "\tCurrent Delta T = {}\n",
614 Starget, v, Tinit, Tnew, Snew, dt);
616 ErrString += fmt::format(
617 "\tTarget Entropy = {}\n" 618 "\tCurrent Pressure = {}\n" 619 "\tStarting Temperature = {}\n" 620 "\tCurrent Temperature = {}\n" 621 "\tCurrent Entropy = {}\n" 622 "\tCurrent Delta T = {}\n",
623 Starget, p, Tinit, Tnew, Snew, dt);
626 ErrString += fmt::format(
"\t - The phase became unstable (Cp < 0) T_unstable_last = {}\n",
639 "Unused. To be removed after Cantera 2.3.");
650 "species reference state thermo manager was not set");
656 const std::string&
id)
662 "ERROR: Can not find phase named {} in file" 663 " named {}",
id, inputFile);
680 "To be removed after Cantera 2.3.");
688 if (fabs(sum) > 1.0E-11) {
689 throw CanteraError(
"ThermoPhase::setReferenceComposition",
690 "input mole fractions don't sum to 1.0");
697 "To be removed after Cantera 2.3.");
706 "Missing species thermo data");
712 "Unused. To be removed after Cantera 2.3.");
719 "Species {} has no thermo data", spec->name);
723 spec->thermo->validate(spec->name);
734 "Species {} has no thermo data", spec->name);
739 "New species '{}' does not match existing species '{}' at index {}",
742 spec->thermo->validate(spec->name);
758 "m_speciesData is the wrong size");
774 if (state.
hasChild(
"temperature")) {
775 double t =
getFloat(state,
"temperature",
"temperature");
779 double p =
getFloat(state,
"pressure",
"pressure");
783 double rho =
getFloat(state,
"density",
"density");
794 double rtol,
int max_steps,
int max_iter,
795 int estimate_equil,
int log_level)
797 if (solver ==
"auto" || solver ==
"element_potential") {
800 debuglog(
"Trying ChemEquil solver\n", log_level);
805 bool use_element_potentials = (estimate_equil == 0);
806 int ret = E.
equilibrate(*
this, XY.c_str(), use_element_potentials, log_level-1);
809 "ChemEquil solver failed. Return code: {}", ret);
812 debuglog(
"ChemEquil solver succeeded\n", log_level);
814 }
catch (std::exception& err) {
815 debuglog(
"ChemEquil solver failed.\n", log_level);
818 if (solver ==
"auto") {
825 if (solver ==
"auto" || solver ==
"vcs" || solver ==
"gibbs") {
829 M.
equilibrate(XY, solver, rtol, max_steps, max_iter,
830 estimate_equil, log_level);
834 if (solver !=
"auto") {
836 "Invalid solver specified: '{}'", solver);
843 if (lambda.size() < mm) {
844 throw CanteraError(
"setElementPotentials",
"lambda too small");
863 for (
size_t m = 0; m <
m_kk; m++) {
864 for (
size_t k = 0; k <
m_kk; k++) {
865 dlnActCoeffdlnN[ld * k + m] = 0.0;
871 void ThermoPhase::getdlnActCoeffdlnN_numderiv(
const size_t ld, doublereal*
const dlnActCoeffdlnN)
873 double deltaMoles_j = 0.0;
885 double v_totalMoles = 1.0;
886 double TMoles_base = v_totalMoles;
889 for (
size_t j = 0; j <
m_kk; j++) {
895 double moles_j_base = v_totalMoles * Xmol_Base[j];
896 deltaMoles_j = 1.0E-7 * moles_j_base + v_totalMoles * 1.0E-13 + 1.0E-150;
900 v_totalMoles = TMoles_base + deltaMoles_j;
901 for (
size_t k = 0; k <
m_kk; k++) {
902 Xmol[k] = Xmol_Base[k] * TMoles_base / v_totalMoles;
904 Xmol[j] = (moles_j_base + deltaMoles_j) / v_totalMoles;
912 double*
const lnActCoeffCol = dlnActCoeffdlnN + ld * j;
913 for (
size_t k = 0; k <
m_kk; k++) {
914 lnActCoeffCol[k] = (2*moles_j_base + deltaMoles_j) *(ActCoeff[k] - ActCoeff_Base[k]) /
915 ((ActCoeff[k] + ActCoeff_Base[k]) * deltaMoles_j);
918 v_totalMoles = TMoles_base;
930 b.write(
"\n {}:\n",
name());
933 b.write(
" temperature {:12.6g} K\n",
temperature());
934 b.write(
" pressure {:12.6g} Pa\n",
pressure());
935 b.write(
" density {:12.6g} kg/m^3\n",
density());
940 b.write(
" potential {:12.6g} V\n", phi);
944 b.write(
" 1 kg 1 kmol\n");
945 b.write(
" ----------- ------------\n");
946 b.write(
" enthalpy {:12.5g} {:12.4g} J\n",
948 b.write(
" internal energy {:12.5g} {:12.4g} J\n",
950 b.write(
" entropy {:12.5g} {:12.4g} J/K\n",
952 b.write(
" Gibbs function {:12.5g} {:12.4g} J\n",
954 b.write(
" heat capacity c_p {:12.5g} {:12.4g} J/K\n",
957 b.write(
" heat capacity c_v {:12.5g} {:12.4g} J/K\n",
960 b.write(
" heat capacity c_v <not implemented> \n");
971 doublereal xMinor = 0.0;
972 doublereal yMinor = 0.0;
976 " Y Chem. Pot. / RT\n");
977 b.write(
" ------------- " 978 "------------ ------------\n");
979 for (
size_t k = 0; k <
m_kk; k++) {
980 if (abs(x[k]) >= threshold) {
982 b.write(
"{:>18s} {:12.6g} {:12.6g} {:12.6g}\n",
985 b.write(
"{:>18s} {:12.6g} {:12.6g}\n",
996 b.write(
" ------------- ------------\n");
997 for (
size_t k = 0; k <
m_kk; k++) {
998 if (abs(x[k]) >= threshold) {
999 b.write(
"{:>18s} {:12.6g} {:12.6g}\n",
1009 b.write(
" [{:+5d} minor] {:12.6g} {:12.6g}\n",
1010 nMinor, xMinor, yMinor);
1013 return b.str() + err.
what();
1022 csvFile.precision(8);
1025 std::vector<std::string> pNames;
1026 std::vector<vector_fp> data;
1029 csvFile << setw(tabS) <<
"Species,";
1030 for (
size_t i = 0; i < pNames.size(); i++) {
1031 csvFile << setw(tabM) << pNames[i] <<
",";
1034 for (
size_t k = 0; k <
nSpecies(); k++) {
1037 for (
size_t i = 0; i < pNames.size(); i++) {
1038 csvFile << setw(tabM) << data[i][k] <<
",";
1042 for (
size_t i = 0; i < pNames.size(); i++) {
1043 csvFile << setw(tabM) << 0 <<
",";
1051 std::vector<vector_fp>& data)
const 1056 names.push_back(
"X");
1059 names.push_back(
"Y");
1062 names.push_back(
"Chem. Pot (J/kmol)");
1065 names.push_back(
"Activity");
1068 names.push_back(
"Act. Coeff.");
1071 names.push_back(
"Part. Mol Enthalpy (J/kmol)");
1074 names.push_back(
"Part. Mol. Entropy (J/K/kmol)");
1077 names.push_back(
"Part. Mol. Energy (J/kmol)");
1080 names.push_back(
"Part. Mol. Cp (J/K/kmol");
1083 names.push_back(
"Part. Mol. Cv (J/K/kmol)");
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
ThermoPhase()
Constructor.
EquilOpt options
Options controlling how the calculation is carried out.
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).
size_t nElements() const
Number of elements.
virtual bool addSpecies(shared_ptr< Species > spec)
void restoreState(const vector_fp &state)
Restore a state saved on a previous call to saveState.
virtual void setState_RPX(doublereal rho, doublereal p, const doublereal *x)
Set the density (kg/m**3), pressure (Pa) and mole fractions.
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 void modifySpecies(size_t k, shared_ptr< Species > spec)
Modify the thermodynamic data associated with a species.
XML_Node * findXMLPhase(XML_Node *root, const std::string &idtarget)
Search an XML_Node tree for a named phase XML_Node.
void getMassFractions(doublereal *const y) const
Get the species mass fractions.
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.
vector_fp xMol_Ref
Reference Mole Fraction Composition.
bool ready(size_t nSpecies)
Check if data for all species (0 through nSpecies-1) has been installed.
doublereal temperature() const
Temperature (K).
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
An error indicating that an unimplemented function has been called.
virtual void resetHf298(const size_t k)
Restore the original heat of formation of one or more species.
virtual void setState_TPX(doublereal t, doublereal p, const doublereal *x)
Set the temperature (K), pressure (Pa), and mole fractions.
virtual void modifySpecies(size_t index, shared_ptr< SpeciesThermoInterpType > spec)
Modify the species thermodynamic property parameterization for a species.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
void saveState(vector_fp &state) const
Save the current internal state of the phase.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const size_t npos
index returned by functions to indicate "no position"
ThermoPhase & operator=(const ThermoPhase &right)
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
const int cAC_CONVENTION_MOLAR
Standard state uses the molar convention.
bool getElementPotentials(doublereal *lambda) const
Returns the element potentials stored in the ThermoPhase object.
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
void addPhase(ThermoPhase *p, doublereal moles)
Add a phase to the mixture.
const char * what() const
Get a description of the error.
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
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.
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
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.
size_t nSpecies() const
Returns the number of species in the phase.
virtual doublereal density() const
Density (kg/m^3).
vector_fp m_lambdaRRT
Vector of element potentials. Length equal to number of elements.
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
void setState_HPorUV(doublereal h, doublereal p, doublereal tol=1e-9, bool doUV=false)
Carry out work in HP and UV calculations.
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 doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes 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.
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 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 doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Equilfu...
virtual void setState_PY(doublereal p, doublereal *y)
Set the internally stored pressure (Pa) and mass fractions.
void setState_SPorSV(double s, double p, double tol=1e-9, bool doSV=false)
Carry out work in SP and SV calculations.
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
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 invalidateCache()
Invalidate any cached values which are normally updated only when a change in state is detected...
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.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
A class for multiphase mixtures.
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
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 setSpeciesThermo(MultiSpeciesThermo *spthermo)
Install a species thermodynamic property manager.
doublereal m_phi
Stored value of the electric potential for this phase. Units are Volts.
std::string speciesName(size_t k) const
Name of the species with index k.
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...
doublereal electricPotential() const
Returns the electric potential of this phase (V).
void setMoleFractionsByName(const compositionMap &xMap)
Set the species mole fractions by name.
int m_ssConvention
Contains the standard state convention.
doublereal entropy_mass() const
Specific entropy. Units: J/kg/K.
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
void setMassFractionsByName(const compositionMap &yMap)
Set the species mass fractions by name.
virtual void modifySpecies(size_t k, shared_ptr< Species > spec)
Modify the thermodynamic data associated with a species.
Base class for exceptions thrown by Cantera classes.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
virtual void invalidateCache()
Invalidate any cached values which are normally updated only when a change in state is detected...
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
virtual void setMoleFractions(const doublereal *const x)
Set the mole fractions to the specified values.
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
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 resetHf298(const size_t k=npos)
Restore the original heat of formation of one or more species.
virtual void setState_RP(doublereal rho, doublereal p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.
virtual bool addSpecies(shared_ptr< Species > spec)
Add a Species to this Phase.
void getMoleFractions(doublereal *const x) const
Get the species mole fraction vector.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
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...
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
void debuglog(const std::string &msg, int loglevel)
Write a message to the log only if loglevel > 0.
MultiSpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
doublereal cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
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
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
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.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
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 gibbs_mass() const
Specific Gibbs function. Units: J/kg.
void init()
Process phases and build atomic composition array.
std::string name() const
Return the name of the phase.
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Contains declarations for string manipulation functions within Cantera.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
virtual void getReferenceComposition(doublereal *const x) const
Gets the reference composition.
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.
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 ...
A species thermodynamic property manager for a phase.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
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 void install_STIT(size_t index, shared_ptr< SpeciesThermoInterpType > stit)
Install a new species thermodynamic property parameterization for one species.
Namespace for the Cantera kernel.
doublereal intEnergy_mass() const
Specific internal energy. Units: J/kg.
bool m_hasElementPotentials
Boolean indicating whether there is a valid set of saved element potentials for this phase...
virtual void setState_RPY(doublereal rho, doublereal p, const doublereal *y)
Set the density (kg/m**3), pressure (Pa) and mass fractions.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
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).
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
virtual void installSlavePhases(XML_Node *phaseNode)
Add in species from Slave phases.