Cantera 2.6.0

ThermoPhase.h
Go to the documentation of this file.
1/**
2 * @file ThermoPhase.h
3 * Header file for class ThermoPhase, the base class for phases with
4 * thermodynamic properties, and the text for the Module thermoprops
5 * (see \ref thermoprops and class \link Cantera::ThermoPhase ThermoPhase\endlink).
6 */
7
8// This file is part of Cantera. See License.txt in the top-level directory or
9// at https://cantera.org/license.txt for license and copyright information.
10
11#ifndef CT_THERMOPHASE_H
12#define CT_THERMOPHASE_H
13
14#include "Phase.h"
15#include "MultiSpeciesThermo.h"
16#include "cantera/base/Units.h"
17#include "cantera/base/AnyMap.h"
18
19 namespace Cantera
20{
21
22/*!
23 * @name CONSTANTS - Specification of the Molality convention
24 */
25//! @{
26//! Standard state uses the molar convention
27 const int cAC_CONVENTION_MOLAR = 0;
28//! Standard state uses the molality convention
29 const int cAC_CONVENTION_MOLALITY = 1;
30//! @}
31
32/*!
33 * @name CONSTANTS - Specification of the SS convention
34 */
35//! @{
36//! Standard state uses the molar convention
37 const int cSS_CONVENTION_TEMPERATURE = 0;
38//! Standard state uses the molality convention
39 const int cSS_CONVENTION_VPSS = 1;
40//! Standard state thermodynamics is obtained from slave ThermoPhase objects
41 const int cSS_CONVENTION_SLAVE = 2;
42//! @}
43
44//! Differentiate between mole fractions and mass fractions for input mixture composition
45 enum class ThermoBasis
46{
47 mass,
48 molar
49};
50
51//! Base class for a phase with thermodynamic properties.
52/*!
53 * Class ThermoPhase is the base class for the family of classes that represent
54 * phases of matter of any type. It defines a common public interface, and
55 * implements a few methods. Most of the methods, however, are declared virtual
56 * and are meant to be overloaded in derived classes. The standard way used
57 * throughout Cantera to compute properties of phases of matter is through
58 * pointers of type ThermoPhase* that point to objects of subclasses of
59 * ThermoPhase.
60 *
61 * Class ThermoPhase extends class Phase by adding methods to compute
62 * thermodynamic properties in addition to the ones that are used to define the
63 * state of a substance (temperature, density/pressure and composition). The
64 * distinction is that the methods declared in ThermoPhase require knowing the
65 * particular equation of state of the phase of interest, while those of class
66 * Phase do not, since they only involve data values stored within the object.
67 *
68 * Instances of subclasses of ThermoPhase should be created using the factory
69 * class ThermoFactory, not by calling the constructor directly. This allows new
70 * classes to be used with the various Cantera language interfaces.
71 *
72 * To implement a new equation of state, derive a class from ThermoPhase and
73 * overload the virtual methods in ThermoPhase. Methods that are not needed can
74 * be left unimplemented, which will cause an exception to be thrown if it is
75 * called.
76 *
77 * Relationship with the kinetics operator:
78 *
79 * Describe activity coefficients.
80 *
81 * Describe K_a, K_p, and K_c, These are three different equilibrium
82 * constants.
83 *
84 * K_a is the calculation of the equilibrium constant from the standard state
85 * Gibbs free energy values. It is by definition dimensionless.
86 *
87 * K_p is the calculation of the equilibrium constant from the reference state
88 * Gibbs free energy values. It is by definition dimensionless. The pressure
89 * dependence is handled entirely on the RHS of the equilibrium expression.
90 *
91 * K_c is the equilibrium constant calculated from the activity
92 * concentrations. The dimensions depend on the number of products and
93 * reactants.
94 *
95 * The kinetics manager requires the calculation of K_c for the calculation of
96 * the reverse rate constant
97 *
98 * @ingroup thermoprops
99 * @ingroup phases
100 */
101 class ThermoPhase : public Phase
102{
103 public:
104 //! Constructor. Note that ThermoPhase is meant to be used as a base class,
105 //! so this constructor should not be called explicitly.
106 ThermoPhase();
107
108 virtual ~ThermoPhase();
109
110 //! @name Information Methods
111 //! @{
112
113 virtual std::string type() const {
114 return "None";
115 }
116
117 //! Boolean indicating whether phase is ideal
118 virtual bool isIdeal() const {
119 return false;
120 }
121
122 //! String indicating the mechanical phase of the matter in this Phase.
123 /*!
124 * Options for the string are:
125 * * `unspecified`
126 * * `supercritical`
127 * * `gas`
128 * * `liquid`
129 * * `solid`
130 * * `solid-liquid-mix`
131 * * `solid-gas-mix`
132 * * `liquid-gas-mix`
133 * * `solid-liquid-gas-mix`
134 *
135 * `unspecified` is the default and should be used when the Phase does not
136 * distinguish between mechanical phases or does not have enough information to
137 * determine which mechanical phase(s) are present.
138 *
139 * @todo Needs to be implemented for all phase types. Currently only implemented for
140 * PureFluidPhase.
141 */
142 virtual std::string phaseOfMatter() const {
143 return "unspecified";
144 }
145
146 /**
147 * Returns the reference pressure in Pa. This function is a wrapper
148 * that calls the species thermo refPressure function.
149 */
150 virtual doublereal refPressure() const {
151 return m_spthermo.refPressure();
152 }
153
154 //! Minimum temperature for which the thermodynamic data for the species
155 //! or phase are valid.
156 /*!
157 * If no argument is supplied, the value returned will be the lowest
158 * temperature at which the data for \e all species are valid. Otherwise,
159 * the value will be only for species \a k. This function is a wrapper that
160 * calls the species thermo minTemp function.
161 *
162 * @param k index of the species. Default is -1, which will return the max
163 * of the min value over all species.
164 */
165 virtual doublereal minTemp(size_t k = npos) const {
166 return m_spthermo.minTemp(k);
167 }
168
169 //! Report the 298 K Heat of Formation of the standard state of one species
170 //! (J kmol-1)
171 /*!
172 * The 298K Heat of Formation is defined as the enthalpy change to create
173 * the standard state of the species from its constituent elements in their
174 * standard states at 298 K and 1 bar.
175 *
176 * @param k species index
177 * @returns the current value of the Heat of Formation at 298K
178 * and 1 bar
179 */
180 doublereal Hf298SS(const size_t k) const {
181 return m_spthermo.reportOneHf298(k);
182 }
183
184 //! Modify the value of the 298 K Heat of Formation of one species in the
185 //! phase (J kmol-1)
186 /*!
187 * The 298K heat of formation is defined as the enthalpy change to create
188 * the standard state of the species from its constituent elements in their
189 * standard states at 298 K and 1 bar.
190 *
191 * @param k Species k
192 * @param Hf298New Specify the new value of the Heat of Formation at
193 * 298K and 1 bar
194 */
195 virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New) {
196 m_spthermo.modifyOneHf298(k, Hf298New);
197 invalidateCache();
198 }
199
200 //! Restore the original heat of formation of one or more species
201 /*!
202 * Resets changes made by modifyOneHf298SS(). If the species index is not
203 * specified, the heats of formation for all species are restored.
204 */
205 virtual void resetHf298(const size_t k=npos);
206
207 //! Maximum temperature for which the thermodynamic data for the species
208 //! are valid.
209 /*!
210 * If no argument is supplied, the value returned will be the highest
211 * temperature at which the data for \e all species are valid. Otherwise,
212 * the value will be only for species \a k. This function is a wrapper that
213 * calls the species thermo maxTemp function.
214 *
215 * @param k index of the species. Default is -1, which will return the min
216 * of the max value over all species.
217 */
218 virtual doublereal maxTemp(size_t k = npos) const {
219 return m_spthermo.maxTemp(k);
220 }
221
222 //! Returns the chargeNeutralityNecessity boolean
223 /*!
224 * Some phases must have zero net charge in order for their thermodynamics
225 * functions to be valid. If this is so, then the value returned from this
226 * function is true. If this is not the case, then this is false. Now, ideal
227 * gases have this parameter set to false, while solution with molality-
228 * based activity coefficients have this parameter set to true.
229 */
230 bool chargeNeutralityNecessary() const {
231 return m_chargeNeutralityNecessary;
232 }
233
234 //! @}
235 //! @name Molar Thermodynamic Properties of the Solution
236 //! @{
237
238 /// Molar enthalpy. Units: J/kmol.
239 virtual doublereal enthalpy_mole() const {
240 throw NotImplementedError("ThermoPhase::enthalpy_mole");
241 }
242
243 /// Molar internal energy. Units: J/kmol.
244 virtual doublereal intEnergy_mole() const {
245 return enthalpy_mole() - pressure()* molarVolume();
246 }
247
248 /// Molar entropy. Units: J/kmol/K.
249 virtual doublereal entropy_mole() const {
250 throw NotImplementedError("ThermoPhase::entropy_mole");
251 }
252
253 /// Molar Gibbs function. Units: J/kmol.
254 virtual doublereal gibbs_mole() const {
255 return enthalpy_mole() - temperature()*entropy_mole();
256 }
257
258 /// Molar heat capacity at constant pressure. Units: J/kmol/K.
259 virtual doublereal cp_mole() const {
260 throw NotImplementedError("ThermoPhase::cp_mole");
261 }
262
263 /// Molar heat capacity at constant volume. Units: J/kmol/K.
264 virtual doublereal cv_mole() const {
265 throw NotImplementedError("ThermoPhase::cv_mole");
266 }
267
268 //! @}
269 //! @name Mechanical Properties
270 //! @{
271
272 //! Returns the isothermal compressibility. Units: 1/Pa.
273 /*!
274 * The isothermal compressibility is defined as
275 * \f[
276 * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
277 * \f]
278 * or
279 * \f[
280 * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
281 * \f]
282 */
283 virtual doublereal isothermalCompressibility() const {
284 throw NotImplementedError("ThermoPhase::isothermalCompressibility");
285 }
286
287 //! Return the volumetric thermal expansion coefficient. Units: 1/K.
288 /*!
289 * The thermal expansion coefficient is defined as
290 * \f[
291 * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
292 * \f]
293 */
294 virtual doublereal thermalExpansionCoeff() const {
295 throw NotImplementedError("ThermoPhase::thermalExpansionCoeff");
296 }
297
298 /**
299 * @}
300 * @name Electric Potential
301 *
302 * The phase may be at some non-zero electrical potential. These methods
303 * set or get the value of the electric potential.
304 */
305 //! @{
306
307 //! Set the electric potential of this phase (V).
308 /*!
309 * This is used by classes InterfaceKinetics and EdgeKinetics to
310 * compute the rates of charge-transfer reactions, and in computing
311 * the electrochemical potentials of the species.
312 *
313 * Each phase may have its own electric potential.
314 *
315 * @param v Input value of the electric potential in Volts
316 */
317 void setElectricPotential(doublereal v) {
318 m_phi = v;
319 invalidateCache();
320 }
321
322 //! Returns the electric potential of this phase (V).
323 /*!
324 * Units are Volts (which are Joules/coulomb)
325 */
326 doublereal electricPotential() const {
327 return m_phi;
328 }
329
330 /**
331 * @}
332 * @name Activities, Standard States, and Activity Concentrations
333 *
334 * The activity \f$a_k\f$ of a species in solution is related to the
335 * chemical potential by \f[ \mu_k = \mu_k^0(T,P) + \hat R T \log a_k. \f]
336 * The quantity \f$\mu_k^0(T,P)\f$ is the standard chemical potential at
337 * unit activity, which depends on temperature and pressure, but not on
338 * composition. The activity is dimensionless.
339 * @{
340 */
341
342 //! This method returns the convention used in specification of the
343 //! activities, of which there are currently two, molar- and molality-based
344 //! conventions.
345 /*!
346 * Currently, there are two activity conventions:
347 * - Molar-based activities
348 * %Unit activity of species at either a hypothetical pure
349 * solution of the species or at a hypothetical
350 * pure ideal solution at infinite dilution
351 * cAC_CONVENTION_MOLAR 0
352 * - default
353 *
354 * - Molality-based activities
355 * (unit activity of solutes at a hypothetical 1 molal
356 * solution referenced to infinite dilution at all
357 * pressures and temperatures).
358 * cAC_CONVENTION_MOLALITY 1
359 */
360 virtual int activityConvention() const;
361
362 //! This method returns the convention used in specification of the standard
363 //! state, of which there are currently two, temperature based, and variable
364 //! pressure based.
365 /*!
366 * Currently, there are two standard state conventions:
367 * - Temperature-based activities
368 * cSS_CONVENTION_TEMPERATURE 0
369 * - default
370 *
371 * - Variable Pressure and Temperature -based activities
372 * cSS_CONVENTION_VPSS 1
373 *
374 * - Thermodynamics is set via slave ThermoPhase objects with
375 * nothing being carried out at this ThermoPhase object level
376 * cSS_CONVENTION_SLAVE 2
377 */
378 virtual int standardStateConvention() const;
379
380 //! Returns the units of the "standard concentration" for this phase
381 /*!
382 * These are the units of the values returned by the functions
383 * getActivityConcentrations() and standardConcentration(), which can
384 * vary between different ThermoPhase-derived classes, or change within
385 * a single class depending on input options. See the documentation for
386 * standardConcentration() for the derived class for specific details.
387 */
388 virtual Units standardConcentrationUnits() const;
389
390 //! This method returns an array of generalized concentrations
391 /*!
392 * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k / C^0_k, \f$ where
393 * \f$ C^0_k \f$ is a standard concentration defined below and \f$ a_k \f$
394 * are activities used in the thermodynamic functions. These activity (or
395 * generalized) concentrations are used by kinetics manager classes to
396 * compute the forward and reverse rates of elementary reactions. Note that
397 * they may or may not have units of concentration --- they might be partial
398 * pressures, mole fractions, or surface coverages, for example.
399 *
400 * @param c Output array of generalized concentrations. The units depend
401 * upon the implementation of the reaction rate expressions within
402 * the phase.
403 */
404 virtual void getActivityConcentrations(doublereal* c) const {
405 throw NotImplementedError("ThermoPhase::getActivityConcentrations");
406 }
407
408 //! Return the standard concentration for the kth species
409 /*!
410 * The standard concentration \f$ C^0_k \f$ used to normalize the activity
411 * (that is, generalized) concentration. In many cases, this quantity will be
412 * the same for all species in a phase - for example, for an ideal gas \f$
413 * C^0_k = P/\hat R T \f$. For this reason, this method returns a single
414 * value, instead of an array. However, for phases in which the standard
415 * concentration is species-specific (such as surface species of different
416 * sizes), this method may be called with an optional parameter indicating
417 * the species.
418 *
419 * @param k Optional parameter indicating the species. The default
420 * is to assume this refers to species 0.
421 * @return
422 * Returns the standard concentration. The units are by definition
423 * dependent on the ThermoPhase and kinetics manager representation.
424 */
425 virtual doublereal standardConcentration(size_t k=0) const {
426 throw NotImplementedError("ThermoPhase::standardConcentration");
427 }
428
429 //! Natural logarithm of the standard concentration of the kth species.
430 /*!
431 * @param k index of the species (defaults to zero)
432 */
433 virtual doublereal logStandardConc(size_t k=0) const;
434
435 //! Get the array of non-dimensional activities at the current solution
436 //! temperature, pressure, and solution concentration.
437 /*!
438 * Note, for molality based formulations, this returns the molality based
439 * activities.
440 *
441 * We resolve this function at this level by calling on the
442 * activityConcentration function. However, derived classes may want to
443 * override this default implementation.
444 *
445 * @param a Output vector of activities. Length: m_kk.
446 */
447 virtual void getActivities(doublereal* a) const;
448
449 //! Get the array of non-dimensional molar-based activity coefficients at
450 //! the current solution temperature, pressure, and solution concentration.
451 /*!
452 * @param ac Output vector of activity coefficients. Length: m_kk.
453 */
454 virtual void getActivityCoefficients(doublereal* ac) const {
455 if (m_kk == 1) {
456 ac[0] = 1.0;
457 } else {
458 throw NotImplementedError("ThermoPhase::getActivityCoefficients");
459 }
460 }
461
462 //! Get the array of non-dimensional molar-based ln activity coefficients at
463 //! the current solution temperature, pressure, and solution concentration.
464 /*!
465 * @param lnac Output vector of ln activity coefficients. Length: m_kk.
466 */
467 virtual void getLnActivityCoefficients(doublereal* lnac) const;
468
469 //! @}
470 //! @name Partial Molar Properties of the Solution
471 //! @{
472
473 /**
474 * Get the array of non-dimensional species chemical potentials
475 * These are partial molar Gibbs free energies.
476 * \f$ \mu_k / \hat R T \f$.
477 * Units: unitless
478 *
479 * @param mu Output vector of dimensionless chemical potentials.
480 * Length: m_kk.
481 */
482 virtual void getChemPotentials_RT(doublereal* mu) const {
483 throw NotImplementedError("ThermoPhase::getChemPotentials_RT");
484 }
485
486 //! Get the species chemical potentials. Units: J/kmol.
487 /*!
488 * This function returns a vector of chemical potentials of the species in
489 * solution at the current temperature, pressure and mole fraction of the
490 * solution.
491 *
492 * @param mu Output vector of species chemical
493 * potentials. Length: m_kk. Units: J/kmol
494 */
495 virtual void getChemPotentials(doublereal* mu) const {
496 throw NotImplementedError("ThermoPhase::getChemPotentials");
497 }
498
499 //! Get the species electrochemical potentials.
500 /*!
501 * These are partial molar quantities. This method adds a term \f$ F z_k
502 * \phi_p \f$ to each chemical potential. The electrochemical potential of
503 * species k in a phase p, \f$ \zeta_k \f$, is related to the chemical
504 * potential via the following equation,
505 *
506 * \f[
507 * \zeta_{k}(T,P) = \mu_{k}(T,P) + F z_k \phi_p
508 * \f]
509 *
510 * @param mu Output vector of species electrochemical
511 * potentials. Length: m_kk. Units: J/kmol
512 */
513 void getElectrochemPotentials(doublereal* mu) const;
514
515 //! Returns an array of partial molar enthalpies for the species
516 //! in the mixture. Units (J/kmol)
517 /*!
518 * @param hbar Output vector of species partial molar enthalpies.
519 * Length: m_kk. units are J/kmol.
520 */
521 virtual void getPartialMolarEnthalpies(doublereal* hbar) const {
522 throw NotImplementedError("ThermoPhase::getPartialMolarEnthalpies");
523 }
524
525 //! Returns an array of partial molar entropies of the species in the
526 //! solution. Units: J/kmol/K.
527 /*!
528 * @param sbar Output vector of species partial molar entropies.
529 * Length = m_kk. units are J/kmol/K.
530 */
531 virtual void getPartialMolarEntropies(doublereal* sbar) const {
532 throw NotImplementedError("ThermoPhase::getPartialMolarEntropies");
533 }
534
535 //! Return an array of partial molar internal energies for the
536 //! species in the mixture. Units: J/kmol.
537 /*!
538 * @param ubar Output vector of species partial molar internal energies.
539 * Length = m_kk. units are J/kmol.
540 */
541 virtual void getPartialMolarIntEnergies(doublereal* ubar) const {
542 throw NotImplementedError("ThermoPhase::getPartialMolarIntEnergies");
543 }
544
545 //! Return an array of partial molar heat capacities for the
546 //! species in the mixture. Units: J/kmol/K
547 /*!
548 * @param cpbar Output vector of species partial molar heat
549 * capacities at constant pressure.
550 * Length = m_kk. units are J/kmol/K.
551 */
552 virtual void getPartialMolarCp(doublereal* cpbar) const {
553 throw NotImplementedError("ThermoPhase::getPartialMolarCp");
554 }
555
556 //! Return an array of partial molar volumes for the
557 //! species in the mixture. Units: m^3/kmol.
558 /*!
559 * @param vbar Output vector of species partial molar volumes.
560 * Length = m_kk. units are m^3/kmol.
561 */
562 virtual void getPartialMolarVolumes(doublereal* vbar) const {
563 throw NotImplementedError("ThermoPhase::getPartialMolarVolumes");
564 }
565
566 //! @}
567 //! @name Properties of the Standard State of the Species in the Solution
568 //! @{
569
570 //! Get the array of chemical potentials at unit activity for the species at
571 //! their standard states at the current *T* and *P* of the solution.
572 /*!
573 * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
574 * \f$. The values are evaluated at the current temperature and pressure of
575 * the solution
576 *
577 * @param mu Output vector of chemical potentials.
578 * Length: m_kk.
579 */
580 virtual void getStandardChemPotentials(doublereal* mu) const {
581 throw NotImplementedError("ThermoPhase::getStandardChemPotentials");
582 }
583
584 //! Get the nondimensional Enthalpy functions for the species at their
585 //! standard states at the current *T* and *P* of the solution.
586 /*!
587 * @param hrt Output vector of nondimensional standard state enthalpies.
588 * Length: m_kk.
589 */
590 virtual void getEnthalpy_RT(doublereal* hrt) const {
591 throw NotImplementedError("ThermoPhase::getEnthalpy_RT");
592 }
593
594 //! Get the array of nondimensional Entropy functions for the standard state
595 //! species at the current *T* and *P* of the solution.
596 /*!
597 * @param sr Output vector of nondimensional standard state entropies.
598 * Length: m_kk.
599 */
600 virtual void getEntropy_R(doublereal* sr) const {
601 throw NotImplementedError("ThermoPhase::getEntropy_R");
602 }
603
604 //! Get the nondimensional Gibbs functions for the species in their standard
605 //! states at the current *T* and *P* of the solution.
606 /*!
607 * @param grt Output vector of nondimensional standard state Gibbs free
608 * energies. Length: m_kk.
609 */
610 virtual void getGibbs_RT(doublereal* grt) const {
611 throw NotImplementedError("ThermoPhase::getGibbs_RT");
612 }
613
614 //! Get the Gibbs functions for the standard state of the species at the
615 //! current *T* and *P* of the solution
616 /*!
617 * Units are Joules/kmol
618 * @param gpure Output vector of standard state Gibbs free energies.
619 * Length: m_kk.
620 */
621 virtual void getPureGibbs(doublereal* gpure) const {
622 throw NotImplementedError("ThermoPhase::getPureGibbs");
623 }
624
625 //! Returns the vector of nondimensional Internal Energies of the standard
626 //! state species at the current *T* and *P* of the solution
627 /*!
628 * @param urt output vector of nondimensional standard state internal energies
629 * of the species. Length: m_kk.
630 */
631 virtual void getIntEnergy_RT(doublereal* urt) const {
632 throw NotImplementedError("ThermoPhase::getIntEnergy_RT");
633 }
634
635 //! Get the nondimensional Heat Capacities at constant pressure for the
636 //! species standard states at the current *T* and *P* of the
637 //! solution
638 /*!
639 * @param cpr Output vector of nondimensional standard state heat
640 * capacities. Length: m_kk.
641 */
642 virtual void getCp_R(doublereal* cpr) const {
643 throw NotImplementedError("ThermoPhase::getCp_R");
644 }
645
646 //! Get the molar volumes of the species standard states at the current
647 //! *T* and *P* of the solution.
648 /*!
649 * units = m^3 / kmol
650 *
651 * @param vol Output vector containing the standard state volumes.
652 * Length: m_kk.
653 */
654 virtual void getStandardVolumes(doublereal* vol) const {
655 throw NotImplementedError("ThermoPhase::getStandardVolumes");
656 }
657
658 //! @}
659 //! @name Thermodynamic Values for the Species Reference States
660 //! @{
661
662 //! Returns the vector of nondimensional enthalpies of the reference state
663 //! at the current temperature of the solution and the reference pressure
664 //! for the species.
665 /*!
666 * @param hrt Output vector containing the nondimensional reference
667 * state enthalpies. Length: m_kk.
668 */
669 virtual void getEnthalpy_RT_ref(doublereal* hrt) const {
670 throw NotImplementedError("ThermoPhase::getEnthalpy_RT_ref");
671 }
672
673 //! Returns the vector of nondimensional Gibbs Free Energies of the
674 //! reference state at the current temperature of the solution and the
675 //! reference pressure for the species.
676 /*!
677 * @param grt Output vector containing the nondimensional reference state
678 * Gibbs Free energies. Length: m_kk.
679 */
680 virtual void getGibbs_RT_ref(doublereal* grt) const {
681 throw NotImplementedError("ThermoPhase::getGibbs_RT_ref");
682 }
683
684 //! Returns the vector of the Gibbs function of the reference state at the
685 //! current temperature of the solution and the reference pressure for the
686 //! species.
687 /*!
688 * @param g Output vector containing the reference state
689 * Gibbs Free energies. Length: m_kk. Units: J/kmol.
690 */
691 virtual void getGibbs_ref(doublereal* g) const {
692 throw NotImplementedError("ThermoPhase::getGibbs_ref");
693 }
694
695 //! Returns the vector of nondimensional entropies of the reference state at
696 //! the current temperature of the solution and the reference pressure for
697 //! each species.
698 /*!
699 * @param er Output vector containing the nondimensional reference
700 * state entropies. Length: m_kk.
701 */
702 virtual void getEntropy_R_ref(doublereal* er) const {
703 throw NotImplementedError("ThermoPhase::getEntropy_R_ref");
704 }
705
706 //! Returns the vector of nondimensional internal Energies of the reference
707 //! state at the current temperature of the solution and the reference
708 //! pressure for each species.
709 /*!
710 * @param urt Output vector of nondimensional reference state internal
711 * energies of the species. Length: m_kk
712 */
713 virtual void getIntEnergy_RT_ref(doublereal* urt) const {
714 throw NotImplementedError("ThermoPhase::getIntEnergy_RT_ref");
715 }
716
717 //! Returns the vector of nondimensional constant pressure heat capacities
718 //! of the reference state at the current temperature of the solution and
719 //! reference pressure for each species.
720 /*!
721 * @param cprt Output vector of nondimensional reference state
722 * heat capacities at constant pressure for the species.
723 * Length: m_kk
724 */
725 virtual void getCp_R_ref(doublereal* cprt) const {
726 throw NotImplementedError("ThermoPhase::getCp_R_ref");
727 }
728
729 //! Get the molar volumes of the species reference states at the current
730 //! *T* and *P_ref* of the solution.
731 /*!
732 * units = m^3 / kmol
733 *
734 * @param vol Output vector containing the standard state volumes.
735 * Length: m_kk.
736 */
737 virtual void getStandardVolumes_ref(doublereal* vol) const {
738 throw NotImplementedError("ThermoPhase::getStandardVolumes_ref");
739 }
740
741 // The methods below are not virtual, and should not be overloaded.
742
743 //! @}
744 //! @name Specific Properties
745 //! @{
746
747 //! Specific enthalpy. Units: J/kg.
748 doublereal enthalpy_mass() const {
749 return enthalpy_mole()/meanMolecularWeight();
750 }
751
752 //! Specific internal energy. Units: J/kg.
753 doublereal intEnergy_mass() const {
754 return intEnergy_mole()/meanMolecularWeight();
755 }
756
757 //! Specific entropy. Units: J/kg/K.
758 doublereal entropy_mass() const {
759 return entropy_mole()/meanMolecularWeight();
760 }
761
762 //! Specific Gibbs function. Units: J/kg.
763 doublereal gibbs_mass() const {
764 return gibbs_mole()/meanMolecularWeight();
765 }
766
767 //! Specific heat at constant pressure. Units: J/kg/K.
768 doublereal cp_mass() const {
769 return cp_mole()/meanMolecularWeight();
770 }
771
772 //! Specific heat at constant volume. Units: J/kg/K.
773 doublereal cv_mass() const {
774 return cv_mole()/meanMolecularWeight();
775 }
776 //! @}
777
778 //! Return the Gas Constant multiplied by the current temperature
779 /*!
780 * The units are Joules kmol-1
781 */
782 doublereal RT() const {
783 return temperature() * GasConstant;
784 }
785
786 /**
787 * @name Setting the State
788 *
789 * These methods set all or part of the thermodynamic state.
790 * @{
791 */
792
793 //! Set the temperature (K), pressure (Pa), and mole fractions.
794 /*!
795 * Note, the mole fractions are set first before the pressure is set.
796 * Setting the pressure may involve the solution of a nonlinear equation.
797 *
798 * @param t Temperature (K)
799 * @param p Pressure (Pa)
800 * @param x Vector of mole fractions.
801 * Length is equal to m_kk.
802 */
803 virtual void setState_TPX(doublereal t, doublereal p, const doublereal* x);
804
805 //! Set the temperature (K), pressure (Pa), and mole fractions.
806 /*!
807 * Note, the mole fractions are set first before the pressure is set.
808 * Setting the pressure may involve the solution of a nonlinear equation.
809 *
810 * @param t Temperature (K)
811 * @param p Pressure (Pa)
812 * @param x Composition map of mole fractions. Species not in
813 * the composition map are assumed to have zero mole fraction
814 */
815 virtual void setState_TPX(doublereal t, doublereal p, const compositionMap& x);
816
817 //! Set the temperature (K), pressure (Pa), and mole fractions.
818 /*!
819 * Note, the mole fractions are set first before the pressure is set.
820 * Setting the pressure may involve the solution of a nonlinear equation.
821 *
822 * @param t Temperature (K)
823 * @param p Pressure (Pa)
824 * @param x String containing a composition map of the mole fractions.
825 * Species not in the composition map are assumed to have zero
826 * mole fraction
827 */
828 virtual void setState_TPX(doublereal t, doublereal p, const std::string& x);
829
830 //! Set the internally stored temperature (K), pressure (Pa), and mass
831 //! fractions of the phase.
832 /*!
833 * Note, the mass fractions are set first before the pressure is set.
834 * Setting the pressure may involve the solution of a nonlinear equation.
835 *
836 * @param t Temperature (K)
837 * @param p Pressure (Pa)
838 * @param y Vector of mass fractions.
839 * Length is equal to m_kk.
840 */
841 virtual void setState_TPY(doublereal t, doublereal p, const doublereal* y);
842
843 //! Set the internally stored temperature (K), pressure (Pa), and mass
844 //! fractions of the phase
845 /*!
846 * Note, the mass fractions are set first before the pressure is set.
847 * Setting the pressure may involve the solution of a nonlinear equation.
848 *
849 * @param t Temperature (K)
850 * @param p Pressure (Pa)
851 * @param y Composition map of mass fractions. Species not in
852 * the composition map are assumed to have zero mass fraction
853 */
854 virtual void setState_TPY(doublereal t, doublereal p, const compositionMap& y);
855
856 //! Set the internally stored temperature (K), pressure (Pa), and mass
857 //! fractions of the phase
858 /*!
859 * Note, the mass fractions are set first before the pressure is set.
860 * Setting the pressure may involve the solution of a nonlinear equation.
861 *
862 * @param t Temperature (K)
863 * @param p Pressure (Pa)
864 * @param y String containing a composition map of the mass fractions.
865 * Species not in the composition map are assumed to have zero
866 * mass fraction
867 */
868 virtual void setState_TPY(doublereal t, doublereal p, const std::string& y);
869
870 //! Set the temperature (K) and pressure (Pa)
871 /*!
872 * Setting the pressure may involve the solution of a nonlinear equation.
873 *
874 * @param t Temperature (K)
875 * @param p Pressure (Pa)
876 */
877 virtual void setState_TP(doublereal t, doublereal p);
878
879 //! Set the pressure (Pa) and mole fractions.
880 /*!
881 * Note, the mole fractions are set first before the pressure is set.
882 * Setting the pressure may involve the solution of a nonlinear equation.
883 *
884 * @param p Pressure (Pa)
885 * @param x Vector of mole fractions.
886 * Length is equal to m_kk.
887 */
888 virtual void setState_PX(doublereal p, doublereal* x);
889
890 //! Set the internally stored pressure (Pa) and mass fractions.
891 /*!
892 * Note, the temperature is held constant during this operation. Note, the
893 * mass fractions are set first before the pressure is set. Setting the
894 * pressure may involve the solution of a nonlinear equation.
895 *
896 * @param p Pressure (Pa)
897 * @param y Vector of mass fractions.
898 * Length is equal to m_kk.
899 */
900 virtual void setState_PY(doublereal p, doublereal* y);
901
902 //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of
903 //! the phase.
904 /*!
905 * @param h Specific enthalpy (J/kg)
906 * @param p Pressure (Pa)
907 * @param tol Optional parameter setting the tolerance of the calculation.
908 * Important for some applications where numerical Jacobians
909 * are being calculated.
910 */
911 virtual void setState_HP(double h, double p, double tol=1e-9);
912
913 //! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
914 /*!
915 * This function fixes the internal state of the phase so that the specific
916 * internal energy and specific volume have the value of the input
917 * parameters.
918 *
919 * @param u specific internal energy (J/kg)
920 * @param v specific volume (m^3/kg).
921 * @param tol Optional parameter setting the tolerance of the calculation.
922 * Important for some applications where numerical Jacobians
923 * are being calculated.
924 */
925 virtual void setState_UV(double u, double v, double tol=1e-9);
926
927 //! Set the specific entropy (J/kg/K) and pressure (Pa).
928 /*!
929 * This function fixes the internal state of the phase so that the specific
930 * entropy and the pressure have the value of the input parameters.
931 *
932 * @param s specific entropy (J/kg/K)
933 * @param p specific pressure (Pa).
934 * @param tol Optional parameter setting the tolerance of the calculation.
935 * Important for some applications where numerical Jacobians
936 * are being calculated.
937 */
938 virtual void setState_SP(double s, double p, double tol=1e-9);
939
940 //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
941 /*!
942 * This function fixes the internal state of the phase so that the specific
943 * entropy and specific volume have the value of the input parameters.
944 *
945 * @param s specific entropy (J/kg/K)
946 * @param v specific volume (m^3/kg).
947 * @param tol Optional parameter setting the tolerance of the calculation.
948 * Important for some applications where numerical Jacobians
949 * are being calculated.
950 */
951 virtual void setState_SV(double s, double v, double tol=1e-9);
952
953 //! Set the specific entropy (J/kg/K) and temperature (K).
954 /*!
955 * This function fixes the internal state of the phase so that the specific
956 * entropy and temperature have the value of the input parameters.
957 * This base class function will throw an exception if not overridden.
958 *
959 * @param s specific entropy (J/kg/K)
960 * @param t temperature (K)
961 * @param tol Optional parameter setting the tolerance of the calculation.
962 * Important for some applications where numerical Jacobians
963 * are being calculated.
964 */
965 virtual void setState_ST(double s, double t, double tol=1e-9) {
966 throw NotImplementedError("ThermoPhase::setState_ST");
967 }
968
969 //! Set the temperature (K) and specific volume (m^3/kg).
970 /*!
971 * This function fixes the internal state of the phase so that the
972 * temperature and specific volume have the value of the input parameters.
973 * This base class function will throw an exception if not overridden.
974 *
975 * @param t temperature (K)
976 * @param v specific volume (m^3/kg)
977 * @param tol Optional parameter setting the tolerance of the calculation.
978 * Important for some applications where numerical Jacobians
979 * are being calculated.
980 */
981 virtual void setState_TV(double t, double v, double tol=1e-9) {
982 throw NotImplementedError("ThermoPhase::setState_TV");
983 }
984
985 //! Set the pressure (Pa) and specific volume (m^3/kg).
986 /*!
987 * This function fixes the internal state of the phase so that the
988 * pressure and specific volume have the value of the input parameters.
989 * This base class function will throw an exception if not overridden.
990 *
991 * @param p pressure (Pa)
992 * @param v specific volume (m^3/kg)
993 * @param tol Optional parameter setting the tolerance of the calculation.
994 * Important for some applications where numerical Jacobians
995 * are being calculated.
996 */
997 virtual void setState_PV(double p, double v, double tol=1e-9) {
998 throw NotImplementedError("ThermoPhase::setState_PV");
999 }
1000
1001 //! Set the specific internal energy (J/kg) and pressure (Pa).
1002 /*!
1003 * This function fixes the internal state of the phase so that the specific
1004 * internal energy and pressure have the value of the input parameters.
1005 * This base class function will throw an exception if not overridden.
1006 *
1007 * @param u specific internal energy (J/kg)
1008 * @param p pressure (Pa)
1009 * @param tol Optional parameter setting the tolerance of the calculation.
1010 * Important for some applications where numerical Jacobians
1011 * are being calculated.
1012 */
1013 virtual void setState_UP(double u, double p, double tol=1e-9) {
1014 throw NotImplementedError("ThermoPhase::setState_UP");
1015 }
1016
1017 //! Set the specific volume (m^3/kg) and the specific enthalpy (J/kg)
1018 /*!
1019 * This function fixes the internal state of the phase so that the specific
1020 * volume and the specific enthalpy have the value of the input parameters.
1021 * This base class function will throw an exception if not overridden.
1022 *
1023 * @param v specific volume (m^3/kg)
1024 * @param h specific enthalpy (J/kg)
1025 * @param tol Optional parameter setting the tolerance of the calculation.
1026 * Important for some applications where numerical Jacobians
1027 * are being calculated.
1028 */
1029 virtual void setState_VH(double v, double h, double tol=1e-9) {
1030 throw NotImplementedError("ThermoPhase::setState_VH");
1031 }
1032
1033 //! Set the temperature (K) and the specific enthalpy (J/kg)
1034 /*!
1035 * This function fixes the internal state of the phase so that the
1036 * temperature and specific enthalpy have the value of the input parameters.
1037 * This base class function will throw an exception if not overridden.
1038 *
1039 * @param t temperature (K)
1040 * @param h specific enthalpy (J/kg)
1041 * @param tol Optional parameter setting the tolerance of the calculation.
1042 * Important for some applications where numerical Jacobians
1043 * are being calculated.
1044 */
1045 virtual void setState_TH(double t, double h, double tol=1e-9) {
1046 throw NotImplementedError("ThermoPhase::setState_TH");
1047 }
1048
1049 //! Set the specific entropy (J/kg/K) and the specific enthalpy (J/kg)
1050 /*!
1051 * This function fixes the internal state of the phase so that the
1052 * temperature and pressure have the value of the input parameters.
1053 * This base class function will throw an exception if not overridden.
1054 *
1055 * @param s specific entropy (J/kg/K)
1056 * @param h specific enthalpy (J/kg)
1057 * @param tol Optional parameter setting the tolerance of the calculation.
1058 * Important for some applications where numerical Jacobians
1059 * are being calculated.
1060 */
1061 virtual void setState_SH(double s, double h, double tol=1e-9) {
1062 throw NotImplementedError("ThermoPhase::setState_SH");
1063 }
1064
1065 //! Set the density (kg/m**3) and pressure (Pa) at constant composition
1066 /*!
1067 * This method must be reimplemented in derived classes, where it may
1068 * involve the solution of a nonlinear equation. Within %Cantera, the
1069 * independent variable is the density. Therefore, this function solves for
1070 * the temperature that will yield the desired input pressure and density.
1071 * The composition is held constant during this process.
1072 *
1073 * This base class function will print an error, if not overridden.
1074 *
1075 * @param rho Density (kg/m^3)
1076 * @param p Pressure (Pa)
1077 */
1078 virtual void setState_RP(doublereal rho, doublereal p) {
1079 throw NotImplementedError("ThermoPhase::setState_RP");
1080 }
1081
1082 //! Set the density (kg/m**3), pressure (Pa) and mole fractions
1083 /*!
1084 * Note, the mole fractions are set first before the density and pressure
1085 * are set. Setting the pressure may involve the solution of a nonlinear
1086 * equation.
1087 *
1088 * @param rho Density (kg/m^3)
1089 * @param p Pressure (Pa)
1090 * @param x Vector of mole fractions.
1091 * Length is equal to m_kk.
1092 */
1093 virtual void setState_RPX(doublereal rho, doublereal p, const doublereal* x);
1094
1095 //! Set the density (kg/m**3), pressure (Pa) and mole fractions
1096 /*!
1097 * Note, the mole fractions are set first before the density and pressure
1098 * are set. Setting the pressure may involve the solution of a nonlinear
1099 * equation.
1100 *
1101 * @param rho Density (kg/m^3)
1102 * @param p Pressure (Pa)
1103 * @param x Composition map of mole fractions. Species not in
1104 * the composition map are assumed to have zero mole fraction
1105 */
1106 virtual void setState_RPX(doublereal rho, doublereal p, const compositionMap& x);
1107
1108 //! Set the density (kg/m**3), pressure (Pa) and mole fractions
1109 /*!
1110 * Note, the mole fractions are set first before the density and pressure
1111 * are set. Setting the pressure may involve the solution of a nonlinear
1112 * equation.
1113 *
1114 * @param rho Density (kg/m^3)
1115 * @param p Pressure (Pa)
1116 * @param x String containing a composition map of the mole fractions.
1117 * Species not in the composition map are assumed to have zero
1118 * mole fraction
1119 */
1120 virtual void setState_RPX(doublereal rho, doublereal p, const std::string& x);
1121
1122 //! Set the density (kg/m**3), pressure (Pa) and mass fractions
1123 /*!
1124 * Note, the mass fractions are set first before the density and pressure
1125 * are set. Setting the pressure may involve the solution of a nonlinear
1126 * equation.
1127 *
1128 * @param rho Density (kg/m^3)
1129 * @param p Pressure (Pa)
1130 * @param y Vector of mole fractions.
1131 * Length is equal to m_kk.
1132 */
1133 virtual void setState_RPY(doublereal rho, doublereal p, const doublereal* y);
1134
1135 //! Set the density (kg/m**3), pressure (Pa) and mass fractions
1136 /*!
1137 * Note, the mass fractions are set first before the density and pressure
1138 * are set. Setting the pressure may involve the solution of a nonlinear
1139 * equation.
1140 *
1141 * @param rho Density (kg/m^3)
1142 * @param p Pressure (Pa)
1143 * @param y Composition map of mole fractions. Species not in
1144 * the composition map are assumed to have zero mole fraction
1145 */
1146 virtual void setState_RPY(doublereal rho, doublereal p, const compositionMap& y);
1147
1148 //! Set the density (kg/m**3), pressure (Pa) and mass fractions
1149 /*!
1150 * Note, the mass fractions are set first before the density and pressure
1151 * are set. Setting the pressure may involve the solution of a nonlinear
1152 * equation.
1153 *
1154 * @param rho Density (kg/m^3)
1155 * @param p Pressure (Pa)
1156 * @param y String containing a composition map of the mole fractions.
1157 * Species not in the composition map are assumed to have zero
1158 * mole fraction
1159 */
1160 virtual void setState_RPY(doublereal rho, doublereal p, const std::string& y);
1161
1162 //! Set the state using an AnyMap containing any combination of properties
1163 //! supported by the thermodynamic model
1164 /*!
1165 * Accepted keys are:
1166 * * `X` (mole fractions)
1167 * * `Y` (mass fractions)
1168 * * `T` or `temperature`
1169 * * `P` or `pressure` [Pa]
1170 * * `H` or `enthalpy` [J/kg]
1171 * * `U` or `internal-energy` [J/kg]
1172 * * `S` or `entropy` [J/kg/K]
1173 * * `V` or `specific-volume` [m^3/kg]
1174 * * `D` or `density` [kg/m^3]
1175 *
1176 * Composition can be specified as either an AnyMap of species names to
1177 * values or as a composition string. All other values can be given as
1178 * floating point values in Cantera's default units, or as strings with the
1179 * units specified, which will be converted using the Units class.
1180 *
1181 * If no thermodynamic property pair is given, or only one of temperature or
1182 * pressure is given, then 298.15 K and 101325 Pa will be used as necessary
1183 * to fully set the state.
1184 */
1185 virtual void setState(const AnyMap& state);
1186
1187 //! @}
1188 //! @name Set Mixture Composition by Mixture Fraction
1189 //! @{
1190
1191 //! Set the mixture composition according to the
1192 //! mixture fraction = kg fuel / (kg oxidizer + kg fuel)
1193 /*!
1194 * Fuel and oxidizer compositions are given either as
1195 * mole fractions or mass fractions (specified by `basis`)
1196 * and do not need to be normalized. Pressure and temperature are
1197 * kept constant. Elements C, S, H and O are considered for the oxidation.
1198 *
1199 * @param mixFrac mixture fraction (between 0 and 1)
1200 * @param fuelComp composition of the fuel
1201 * @param oxComp composition of the oxidizer
1202 * @param basis either ThermoPhase::molar or ThermoPhase::mass.
1203 * Fuel and oxidizer composition are interpreted
1204 * as mole or mass fractions (default: molar)
1205 */
1206 void setMixtureFraction(double mixFrac, const double* fuelComp, const double* oxComp,
1207 ThermoBasis basis = ThermoBasis::molar);
1208 //! @copydoc ThermoPhase::setMixtureFraction
1209 void setMixtureFraction(double mixFrac, const std::string& fuelComp, const std::string& oxComp,
1210 ThermoBasis basis = ThermoBasis::molar);
1211 //! @copydoc ThermoPhase::setMixtureFraction
1212 void setMixtureFraction(double mixFrac, const compositionMap& fuelComp, const compositionMap& oxComp,
1213 ThermoBasis basis = ThermoBasis::molar);
1214 //! @}
1215 //! @name Compute Mixture Fraction
1216 //! @{
1217
1218 //! Compute the mixture fraction = kg fuel / (kg oxidizer + kg fuel) for
1219 //! the current mixture given fuel and oxidizer compositions.
1220 /*!
1221 * Fuel and oxidizer compositions are given either as
1222 * mole fractions or mass fractions (specified by `basis`)
1223 * and do not need to be normalized.
1224 * The mixture fraction \f$ Z \f$ can be computed from a single element
1225 * \f[ Z_m = \frac{Z_{\mathrm{mass},m}-Z_{\mathrm{mass},m,\mathrm{ox}}}
1226 * {Z_{\mathrm{mass},\mathrm{fuel}}-Z_{\mathrm{mass},m,\mathrm{ox}}} \f] where
1227 * \f$ Z_{\mathrm{mass},m} \f$ is the elemental mass fraction of element m
1228 * in the mixture, and \f$ Z_{\mathrm{mass},m,\mathrm{ox}} \f$ and
1229 * \f$ Z_{\mathrm{mass},m,\mathrm{fuel}} \f$ are the elemental mass fractions
1230 * of the oxidizer and fuel, or from the Bilger mixture fraction,
1231 * which considers the elements C, S, H and O (R. W. Bilger, "Turbulent jet
1232 * diffusion flames," Prog. Energy Combust. Sci., 109-131 (1979))
1233 * \f[ Z_{\mathrm{Bilger}} = \frac{\beta-\beta_{\mathrm{ox}}}
1234 * {\beta_{\mathrm{fuel}}-\beta_{\mathrm{ox}}} \f]
1235 * with \f$ \beta = 2\frac{Z_C}{M_C}+2\frac{Z_S}{M_S}+\frac{1}{2}\frac{Z_H}{M_H}
1236 * -\frac{Z_O}{M_O} \f$
1237 * and \f$ M_m \f$ the atomic weight of element \f$ m \f$.
1238 *
1239 * @param fuelComp composition of the fuel
1240 * @param oxComp composition of the oxidizer
1241 * @param basis either ThermoPhase::mole or ThermoPhase::mass.
1242 * Fuel and oxidizer composition are interpreted
1243 * as mole or mass fractions (default: molar)
1244 * @param element either "Bilger" to compute the mixture fraction
1245 * in terms of the Bilger mixture fraction, or
1246 * an element name, to compute the mixture fraction
1247 * based on a single element (default: "Bilger")
1248 * @returns mixture fraction (kg fuel / kg mixture)
1249 */
1250 double mixtureFraction(const double* fuelComp, const double* oxComp,
1251 ThermoBasis basis = ThermoBasis::molar, const std::string& element = "Bilger") const;
1252 //! @copydoc ThermoPhase::mixtureFraction
1253 double mixtureFraction(const std::string& fuelComp, const std::string& oxComp,
1254 ThermoBasis basis = ThermoBasis::molar, const std::string& element = "Bilger") const;
1255 //! @copydoc ThermoPhase::mixtureFraction
1256 double mixtureFraction(const compositionMap& fuelComp, const compositionMap& oxComp,
1257 ThermoBasis basis = ThermoBasis::molar, const std::string& element = "Bilger") const;
1258 //! @}
1259 //! @name Set Mixture Composition by Equivalence Ratio
1260 //! @{
1261
1262 //! Set the mixture composition according to the equivalence ratio.
1263 /*!
1264 * Fuel and oxidizer compositions are given either as
1265 * mole fractions or mass fractions (specified by `basis`)
1266 * and do not need to be normalized. Pressure and temperature are
1267 * kept constant. Elements C, S, H and O are considered for the oxidation.
1268 *
1269 * @param phi equivalence ratio
1270 * @param fuelComp composition of the fuel
1271 * @param oxComp composition of the oxidizer
1272 * @param basis either ThermoPhase::mole or ThermoPhase::mass.
1273 * Fuel and oxidizer composition are interpreted
1274 * as mole or mass fractions (default: molar)
1275 */
1276 void setEquivalenceRatio(double phi, const double* fuelComp, const double* oxComp, ThermoBasis basis = ThermoBasis::molar);
1277 //! @copydoc ThermoPhase::setEquivalenceRatio
1278 void setEquivalenceRatio(double phi, const std::string& fuelComp, const std::string& oxComp, ThermoBasis basis = ThermoBasis::molar);
1279 //! @copydoc ThermoPhase::setEquivalenceRatio
1280 void setEquivalenceRatio(double phi, const compositionMap& fuelComp, const compositionMap& oxComp, ThermoBasis basis = ThermoBasis::molar);
1281 //! @}
1282
1283 //! @name Compute Equivalence Ratio
1284 //! @{
1285
1286 //! Compute the equivalence ratio for the current mixture
1287 //! given the compositions of fuel and oxidizer
1288 /*!
1289 * The equivalence ratio \f$ \phi \f$ is computed from
1290 * \f[ \phi = \frac{Z}{1-Z}\frac{1-Z_{\mathrm{st}}}{Z_{\mathrm{st}}} \f]
1291 * where \f$ Z \f$ is the Bilger mixture fraction of the mixture
1292 * given the specified fuel and oxidizer compositions
1293 * \f$ Z_{\mathrm{st}} \f$ is the mixture fraction at stoichiometric
1294 * conditions. Fuel and oxidizer compositions are given either as
1295 * mole fractions or mass fractions (specified by `basis`)
1296 * and do not need to be normalized.
1297 * Elements C, S, H and O are considered for the oxidation.
1298 * If fuel and oxidizer composition are unknown or not specified,
1299 * use the version that takes no arguments.
1300 *
1301 * @param fuelComp composition of the fuel
1302 * @param oxComp composition of the oxidizer
1303 * @param basis either ThermoPhase::mole or ThermoPhase::mass.
1304 * Fuel and oxidizer composition are interpreted
1305 * as mole or mass fractions (default: molar)
1306 * @returns equivalence ratio
1307 * @see mixtureFraction for the definition of the Bilger mixture fraction
1308 * @see equivalenceRatio() for the computation of \f$ \phi \f$ without arguments
1309 */
1310 double equivalenceRatio(const double* fuelComp, const double* oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1311 //! @copydoc ThermoPhase::equivalenceRatio
1312 double equivalenceRatio(const std::string& fuelComp, const std::string& oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1313 //! @copydoc ThermoPhase::equivalenceRatio
1314 double equivalenceRatio(const compositionMap& fuelComp, const compositionMap& oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1315 //! @}
1316
1317 //! Compute the equivalence ratio for the current mixture
1318 //! from available oxygen and required oxygen
1319 /*!
1320 * Computes the equivalence ratio \f$ \phi \f$ from
1321 * \f[ \phi = \frac{Z_{\mathrm{mole},C} + Z_{\mathrm{mole},S} + \frac{1}{4}Z_{\mathrm{mole},H}}
1322 * {\frac{1}{2}Z_{\mathrm{mole},O}} \f]
1323 * where \f$ Z_{\mathrm{mole},m} \f$ is the elemental mole fraction
1324 * of element \f$ m \f$. In this special case, the equivalence ratio
1325 * is independent of a fuel or oxidizer composition because it only
1326 * considers the locally available oxygen compared to the required oxygen
1327 * for complete oxidation. It is the same as assuming that the oxidizer
1328 * only contains O (and inert elements) and the fuel contains only
1329 * H, C and S (and inert elements). If either of these conditions is
1330 * not met, use the version of this functions which takes the fuel and
1331 * oxidizer compositions as input
1332 *
1333 * @returns equivalence ratio
1334 * @see equivalenceRatio compute the equivalence ratio from specific
1335 * fuel and oxidizer compositions
1336 */
1337 double equivalenceRatio() const;
1338
1339 //! @name Compute Stoichiometric Air to Fuel Ratio
1340 //! @{
1341
1342 //! Compute the stoichiometric air to fuel ratio (kg oxidizer / kg fuel)
1343 //! given fuel and oxidizer compositions.
1344 /*!
1345 * Fuel and oxidizer compositions are given either as
1346 * mole fractions or mass fractions (specified by `basis`)
1347 * and do not need to be normalized.
1348 * Elements C, S, H and O are considered for the oxidation.
1349 * Note that the stoichiometric air to fuel ratio \f$ \mathit{AFR}_{\mathrm{st}} \f$
1350 * does not depend on the current mixture composition. The current
1351 * air to fuel ratio can be computed from \f$ \mathit{AFR} = \mathit{AFR}_{\mathrm{st}}/\phi \f$
1352 * where \f$ \phi \f$ is the equivalence ratio of the current mixture
1353 *
1354 * @param fuelComp composition of the fuel
1355 * @param oxComp composition of the oxidizer
1356 * @param basis either ThermoPhase::mole or ThermoPhase::mass.
1357 * Fuel and oxidizer composition are interpreted
1358 * as mole or mass fractions (default: molar)
1359 * @returns Stoichiometric Air to Fuel Ratio (kg oxidizer / kg fuel)
1360 */
1361 double stoichAirFuelRatio(const double* fuelComp, const double* oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1362 //! @copydoc ThermoPhase::stoichAirFuelRatio
1363 double stoichAirFuelRatio(const std::string& fuelComp, const std::string& oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1364 //! @copydoc ThermoPhase::stoichAirFuelRatio
1365 double stoichAirFuelRatio(const compositionMap& fuelComp, const compositionMap& oxComp, ThermoBasis basis = ThermoBasis::molar) const;
1366 //! @}
1367
1368 private:
1369
1370 //! Carry out work in HP and UV calculations.
1371 /*!
1372 * @param h Specific enthalpy or internal energy (J/kg)
1373 * @param p Pressure (Pa) or specific volume (m^3/kg)
1374 * @param tol Optional parameter setting the tolerance of the calculation.
1375 * Important for some applications where numerical Jacobians
1376 * are being calculated.
1377 * @param doUV True if solving for UV, false for HP.
1378 */
1379 void setState_HPorUV(doublereal h, doublereal p,
1380 doublereal tol=1e-9, bool doUV = false);
1381
1382 //! Carry out work in SP and SV calculations.
1383 /*!
1384 * @param s Specific entropy (J/kg)
1385 * @param p Pressure (Pa) or specific volume (m^3/kg)
1386 * @param tol Optional parameter setting the tolerance of the calculation.
1387 * Important for some applications where numerical Jacobians
1388 * are being calculated.
1389 * @param doSV True if solving for SV, false for SP.
1390 */
1391 void setState_SPorSV(double s, double p, double tol=1e-9, bool doSV = false);
1392
1393 //! Helper function used by setState_HPorUV and setState_SPorSV.
1394 //! Sets the temperature and (if set_p is true) the pressure.
1395 void setState_conditional_TP(doublereal t, doublereal p, bool set_p);
1396
1397 //! Helper function for computing the amount of oxygen required for complete oxidation.
1398 /*!
1399 * @param y array of (possibly non-normalized) mass fractions (length m_kk)
1400 * @returns amount of required oxygen in kmol O / kg mixture
1401 */
1402 double o2Required(const double* y) const;
1403
1404 //! Helper function for computing the amount of oxygen
1405 //! available in the current mixture.
1406 /*!
1407 * @param y array of (possibly non-normalized) mass fractions (length m_kk)
1408 * @returns amount of O in kmol O / kg mixture
1409 */
1410 double o2Present(const double* y) const;
1411
1412 public:
1413 /**
1414 * @name Chemical Equilibrium
1415 * Chemical equilibrium.
1416 * @{
1417 */
1418
1419 //! Equilibrate a ThermoPhase object
1420 /*!
1421 * Set this phase to chemical equilibrium by calling one of several
1422 * equilibrium solvers. The XY parameter indicates what two thermodynamic
1423 * quantities are to be held constant during the equilibration process.
1424 *
1425 * @param XY String representation of what two properties are being
1426 * held constant
1427 * @param solver Name of the solver to be used to equilibrate the phase.
1428 * If solver = 'element_potential', the ChemEquil element potential
1429 * solver will be used. If solver = 'vcs', the VCS solver will be used.
1430 * If solver = 'gibbs', the MultiPhaseEquil solver will be used. If
1431 * solver = 'auto', the solvers will be tried in order if the initial
1432 * solver(s) fail.
1433 * @param rtol Relative tolerance
1434 * @param max_steps Maximum number of steps to take to find the solution
1435 * @param max_iter For the 'gibbs' and 'vcs' solvers, this is the maximum
1436 * number of outer temperature or pressure iterations to take when T
1437 * and/or P is not held fixed.
1438 * @param estimate_equil For MultiPhaseEquil solver, an integer indicating
1439 * whether the solver should estimate its own initial condition. If 0,
1440 * the initial mole fraction vector in the ThermoPhase object is used
1441 * as the initial condition. If 1, the initial mole fraction vector is
1442 * used if the element abundances are satisfied. If -1, the initial
1443 * mole fraction vector is thrown out, and an estimate is formulated.
1444 * @param log_level loglevel Controls amount of diagnostic output.
1445 * log_level=0 suppresses diagnostics, and increasingly-verbose
1446 * messages are written as loglevel increases.
1447 *
1448 * @ingroup equilfunctions
1449 */
1450 void equilibrate(const std::string& XY, const std::string& solver="auto",
1451 double rtol=1e-9, int max_steps=50000, int max_iter=100,
1452 int estimate_equil=0, int log_level=0);
1453
1454 //!This method is used by the ChemEquil equilibrium solver.
1455 /*!
1456 * It sets the state such that the chemical potentials satisfy
1457 * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
1458 * \left(\frac{\lambda_m} {\hat R T}\right) \f] where
1459 * \f$ \lambda_m \f$ is the element potential of element m. The
1460 * temperature is unchanged. Any phase (ideal or not) that
1461 * implements this method can be equilibrated by ChemEquil.
1462 *
1463 * @param mu_RT Input vector of dimensionless chemical potentials
1464 * The length is equal to nSpecies().
1465 */
1466 virtual void setToEquilState(const doublereal* mu_RT) {
1467 throw NotImplementedError("ThermoPhase::setToEquilState");
1468 }
1469
1470 //! Indicates whether this phase type can be used with class MultiPhase for
1471 //! equilibrium calculations. Returns `false` for special phase types which
1472 //! already represent multi-phase mixtures, namely PureFluidPhase.
1473 virtual bool compatibleWithMultiPhase() const {
1474 return true;
1475 }
1476
1477 //! @}
1478 /// @name Critical State Properties.
1479 /// These methods are only implemented by subclasses that implement
1480 /// liquid-vapor equations of state.
1481 //! @{
1482
1483 /// Critical temperature (K).
1484 virtual doublereal critTemperature() const {
1485 throw NotImplementedError("ThermoPhase::critTemperature");
1486 }
1487
1488 /// Critical pressure (Pa).
1489 virtual doublereal critPressure() const {
1490 throw NotImplementedError("ThermoPhase::critPressure");
1491 }
1492
1493 /// Critical volume (m3/kmol).
1494 virtual doublereal critVolume() const {
1495 throw NotImplementedError("ThermoPhase::critVolume");
1496 }
1497
1498 /// Critical compressibility (unitless).
1499 virtual doublereal critCompressibility() const {
1500 throw NotImplementedError("ThermoPhase::critCompressibility");
1501 }
1502
1503 /// Critical density (kg/m3).
1504 virtual doublereal critDensity() const {
1505 throw NotImplementedError("ThermoPhase::critDensity");
1506 }
1507
1508 //! @}
1509
1510 /** @name Saturation Properties.
1511 *
1512 * These methods are only implemented by subclasses that implement full
1513 * liquid-vapor equations of state.
1514 */
1515 //! @{
1516
1517 //! Return the saturation temperature given the pressure
1518 /*!
1519 * @param p Pressure (Pa)
1520 */
1521 virtual doublereal satTemperature(doublereal p) const {
1522 throw NotImplementedError("ThermoPhase::satTemperature");
1523 }
1524
1525 //! Return the saturation pressure given the temperature
1526 /*!
1527 * @param t Temperature (Kelvin)
1528 */
1529 virtual doublereal satPressure(doublereal t) {
1530 throw NotImplementedError("ThermoPhase::satPressure");
1531 }
1532
1533 //! Return the fraction of vapor at the current conditions
1534 virtual doublereal vaporFraction() const {
1535 throw NotImplementedError("ThermoPhase::vaporFraction");
1536 }
1537
1538 //! Set the state to a saturated system at a particular temperature
1539 /*!
1540 * @param t Temperature (kelvin)
1541 * @param x Fraction of vapor
1542 */
1543 virtual void setState_Tsat(doublereal t, doublereal x) {
1544 throw NotImplementedError("ThermoPhase::setState_Tsat");
1545 }
1546
1547 //! Set the state to a saturated system at a particular pressure
1548 /*!
1549 * @param p Pressure (Pa)
1550 * @param x Fraction of vapor
1551 */
1552 virtual void setState_Psat(doublereal p, doublereal x) {
1553 throw NotImplementedError("ThermoPhase::setState_Psat");
1554 }
1555
1556 //! Set the temperature, pressure, and vapor fraction (quality).
1557 /*!
1558 * An exception is thrown if the thermodynamic state is not consistent.
1559 *
1560 * For temperatures below the critical temperature, if the vapor fraction is
1561 * not 0 or 1, the pressure and temperature must fall on the saturation
1562 * line.
1563 *
1564 * Above the critical temperature, the vapor fraction must be 1 if the
1565 * pressure is less than the critical pressure. Above the critical pressure,
1566 * the vapor fraction is not defined, and its value is ignored.
1567 *
1568 * @param T Temperature (K)
1569 * @param P Pressure (Pa)
1570 * @param Q vapor fraction
1571 */
1572 void setState_TPQ(double T, double P, double Q);
1573
1574 //! @}
1575
1576 //! @name Initialization Methods - For Internal Use (ThermoPhase)
1577 /*!
1578 * The following methods are used in the process of constructing
1579 * the phase and setting its parameters from a specification in an
1580 * input file. They are not normally used in application programs.
1581 * To see how they are used, see importPhase().
1582 */
1583 //! @{
1584
1585 virtual bool addSpecies(shared_ptr<Species> spec);
1586
1587 virtual void modifySpecies(size_t k, shared_ptr<Species> spec);
1588
1589 //! Store a reference pointer to the XML tree containing the species data
1590 //! for this phase.
1591 /*!
1592 * This is used to access data needed to construct transport manager later.
1593 * @internal
1594 *
1595 * @param k Species index
1596 * @param data Pointer to the XML_Node data containing
1597 * information about the species in the phase.
1598 *
1599 * @deprecated The XML input format is deprecated and will be removed in
1600 * Cantera 3.0.
1601 */
1602 void saveSpeciesData(const size_t k, const XML_Node* const data);
1603
1604 //! Return a pointer to the vector of XML nodes containing the species
1605 //! data for this phase.
1606 //!
1607 //! @deprecated The XML input format is deprecated and will be removed in
1608 //! Cantera 3.0.
1609 const std::vector<const XML_Node*> & speciesData() const;
1610
1611 //! Return a changeable reference to the calculation manager for species
1612 //! reference-state thermodynamic properties
1613 /*!
1614 * @param k Species id. The default is -1, meaning return the default
1615 *
1616 * @internal
1617 */
1618 virtual MultiSpeciesThermo& speciesThermo(int k = -1);
1619
1620 virtual const MultiSpeciesThermo& speciesThermo(int k = -1) const;
1621
1622 /**
1623 * @internal
1624 * Initialize a ThermoPhase object using an input file.
1625 *
1626 * Used to implement constructors for derived classes which take a
1627 * file name and phase name as arguments.
1628 *
1629 * @param inputFile Input file containing the description of the phase. If blank,
1630 * no setup will be performed.
1631 * @param id Optional parameter identifying the name of the phase. If
1632 * blank, the first phase definition encountered will be used.
1633 */
1634 void initThermoFile(const std::string& inputFile, const std::string& id);
1635
1636 //!Import and initialize a ThermoPhase object using an XML tree.
1637 /*!
1638 * @internal
1639 *
1640 * Here we read extra information about the XML description of a phase.
1641 * Regular information about elements and species and their reference state
1642 * thermodynamic information have already been read at this point. For
1643 * example, we do not need to call this function for ideal gas equations of
1644 * state. This function is called from importPhase() after the elements and
1645 * the species are initialized with default ideal solution level data.
1646 *
1647 * The default implementation in ThermoPhase calls the virtual function
1648 * initThermo() and then sets the "state" of the phase by looking for an XML
1649 * element named "state", and then interpreting its contents by calling the
1650 * virtual function setStateFromXML().
1651 *
1652 * @param phaseNode This object must be the phase node of a complete XML
1653 * tree description of the phase, including all of the species data. In
1654 * other words while "phase" must point to an XML phase object, it must
1655 * have sibling nodes "speciesData" that describe the species in the
1656 * phase.
1657 * @param id ID of the phase. If nonnull, a check is done to see if
1658 * phaseNode is pointing to the phase with the correct id.
1659 *
1660 * @deprecated The XML input format is deprecated and will be removed in
1661 * Cantera 3.0.
1662 */
1663 virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
1664
1665 //! Initialize the ThermoPhase object after all species have been set up
1666 /*!
1667 * @internal Initialize.
1668 *
1669 * This method is provided to allow subclasses to perform any initialization
1670 * required after all species have been added. For example, it might be used
1671 * to resize internal work arrays that must have an entry for each species.
1672 * The base class implementation does nothing, and subclasses that do not
1673 * require initialization do not need to overload this method. Derived
1674 * classes which do override this function should call their parent class's
1675 * implementation of this function as their last action.
1676 *
1677 * When importing a CTML phase description, this method is called from
1678 * initThermoXML(), which is called from importPhase(), just prior to
1679 * returning from function importPhase().
1680 *
1681 * When importing from an AnyMap phase description (or from a YAML file),
1682 * this method is responsible for setting model parameters from the data
1683 * stored in #m_input.
1684 */
1685 virtual void initThermo();
1686
1687 //! Set the equation of state parameters
1688 /*!
1689 * @internal The number and meaning of these depends on the subclass.
1690 *
1691 * @param n number of parameters
1692 * @param c array of \a n coefficients
1693 * @deprecated To be removed after Cantera 2.6
1694 */
1695 virtual void setParameters(int n, doublereal* const c);
1696
1697 //! Get the equation of state parameters in a vector
1698 /*!
1699 * @internal The number and meaning of these depends on the subclass.
1700 *
1701 * @param n number of parameters
1702 * @param c array of \a n coefficients
1703 * @deprecated To be removed after Cantera 2.6
1704 */
1705 virtual void getParameters(int& n, doublereal* const c) const;
1706
1707 //! Set equation of state parameters from an AnyMap phase description.
1708 //! Phases that need additional parameters from the root node should
1709 //! override this method.
1710 virtual void setParameters(const AnyMap& phaseNode,
1711 const AnyMap& rootNode=AnyMap());
1712
1713 //! Returns the parameters of a ThermoPhase object such that an identical
1714 //! one could be reconstructed using the newPhase(AnyMap&) function.
1715 //! @param withInput If true, include additional input data fields associated
1716 //! with the phase description, such as user-defined fields from a YAML input
1717 //! file, as returned by the input() method.
1718 AnyMap parameters(bool withInput=true) const;
1719
1720 //! Get phase-specific parameters of a Species object such that an
1721 //! identical one could be reconstructed and added to this phase.
1722 /*!
1723 * @param name Name of the species
1724 * @param speciesNode Mapping to be populated with parameters
1725 */
1726 virtual void getSpeciesParameters(const std::string& name,
1727 AnyMap& speciesNode) const {}
1728
1729 //! Access input data associated with the phase description
1730 const AnyMap& input() const;
1731 AnyMap& input();
1732
1733 //! Set equation of state parameter values from XML entries.
1734 /*!
1735 * This method is called by function importPhase() when processing a phase
1736 * definition in an input file. It should be overloaded in subclasses to set
1737 * any parameters that are specific to that particular phase model. Note,
1738 * this method is called before the phase is initialized with elements
1739 * and/or species.
1740 *
1741 * @param eosdata An XML_Node object corresponding to
1742 * the "thermo" entry for this phase in the input file.
1743 *
1744 * @deprecated The XML input format is deprecated and will be removed in
1745 * Cantera 3.0.
1746 */
1747 virtual void setParametersFromXML(const XML_Node& eosdata) {}
1748
1749 //! Set the initial state of the phase to the conditions specified in the
1750 //! state XML element.
1751 /*!
1752 * This method sets the temperature, pressure, and mole fraction vector to a
1753 * set default value.
1754 *
1755 * @param state AN XML_Node object corresponding to the "state" entry for
1756 * this phase in the input file.
1757 *
1758 * @deprecated The XML input format is deprecated and will be removed in
1759 * Cantera 3.0.
1760 */
1761 virtual void setStateFromXML(const XML_Node& state);
1762
1763 virtual void invalidateCache();
1764
1765 //! @}
1766 //! @name Derivatives of Thermodynamic Variables needed for Applications
1767 //! @{
1768
1769 //! Get the change in activity coefficients wrt changes in state (temp, mole
1770 //! fraction, etc) along a line in parameter space or along a line in
1771 //! physical space
1772 /*!
1773 * @param dTds Input of temperature change along the path
1774 * @param dXds Input vector of changes in mole fraction along the
1775 * path. length = m_kk Along the path length it must
1776 * be the case that the mole fractions sum to one.
1777 * @param dlnActCoeffds Output vector of the directional derivatives of the
1778 * log Activity Coefficients along the path. length =
1779 * m_kk units are 1/units(s). if s is a physical
1780 * coordinate then the units are 1/m.
1781 */
1782 virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
1783 doublereal* dlnActCoeffds) const {
1784 throw NotImplementedError("ThermoPhase::getdlnActCoeffds");
1785 }
1786
1787 //! Get the array of ln mole fraction derivatives of the log activity
1788 //! coefficients - diagonal component only
1789 /*!
1790 * For ideal mixtures (unity activity coefficients), this can return zero.
1791 * Implementations should take the derivative of the logarithm of the
1792 * activity coefficient with respect to the logarithm of the mole fraction
1793 * variable that represents the standard state. This quantity is to be used
1794 * in conjunction with derivatives of that mole fraction variable when the
1795 * derivative of the chemical potential is taken.
1796 *
1797 * units = dimensionless
1798 *
1799 * @param dlnActCoeffdlnX_diag Output vector of derivatives of the log
1800 * Activity Coefficients wrt the mole fractions. length = m_kk
1801 */
1802 virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const {
1803 throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnX_diag");
1804 }
1805
1806 //! Get the array of log species mole number derivatives of the log activity
1807 //! coefficients
1808 /*!
1809 * For ideal mixtures (unity activity coefficients), this can return zero.
1810 * Implementations should take the derivative of the logarithm of the
1811 * activity coefficient with respect to the logarithm of the concentration-
1812 * like variable (for example, moles) that represents the standard state. This
1813 * quantity is to be used in conjunction with derivatives of that species
1814 * mole number variable when the derivative of the chemical potential is
1815 * taken.
1816 *
1817 * units = dimensionless
1818 *
1819 * @param dlnActCoeffdlnN_diag Output vector of derivatives of the
1820 * log Activity Coefficients. length = m_kk
1821 */
1822 virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const {
1823 throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnN_diag");
1824 }
1825
1826 //! Get the array of derivatives of the log activity coefficients with
1827 //! respect to the log of the species mole numbers
1828 /*!
1829 * Implementations should take the derivative of the logarithm of the
1830 * activity coefficient with respect to a species log mole number (with all
1831 * other species mole numbers held constant). The default treatment in the
1832 * ThermoPhase object is to set this vector to zero.
1833 *
1834 * units = 1 / kmol
1835 *
1836 * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log
1837 * act_coeff for the *m*-th species with respect to the number of moles of
1838 * the *k*-th species.
1839 *
1840 * \f[
1841 * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
1842 * \f]
1843 *
1844 * @param ld Number of rows in the matrix
1845 * @param dlnActCoeffdlnN Output vector of derivatives of the
1846 * log Activity Coefficients. length = m_kk * m_kk
1847 */
1848 virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
1849
1850 virtual void getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const dlnActCoeffdlnN);
1851
1852 //! @}
1853 //! @name Printing
1854 //! @{
1855
1856 //! returns a summary of the state of the phase as a string
1857 /*!
1858 * @param show_thermo If true, extra information is printed out
1859 * about the thermodynamic state of the system.
1860 * @param threshold Show information about species with mole fractions
1861 * greater than *threshold*.
1862 */
1863 virtual std::string report(bool show_thermo=true,
1864 doublereal threshold=-1e-14) const;
1865
1866 //! returns a summary of the state of the phase to a comma separated file.
1867 /*!
1868 * To customize the data included in the report, derived classes should
1869 * override the getCsvReportData method.
1870 *
1871 * @param csvFile ofstream file to print comma separated data for the phase
1872 */
1873 virtual void reportCSV(std::ofstream& csvFile) const;
1874
1875 //! @}
1876
1877 protected:
1878 //! Store the parameters of a ThermoPhase object such that an identical
1879 //! one could be reconstructed using the newPhase(AnyMap&) function. This
1880 //! does not include user-defined fields available in input().
1881 virtual void getParameters(AnyMap& phaseNode) const;
1882
1883 //! Fills `names` and `data` with the column names and species thermo
1884 //! properties to be included in the output of the reportCSV method.
1885 virtual void getCsvReportData(std::vector<std::string>& names,
1886 std::vector<vector_fp>& data) const;
1887
1888 //! Pointer to the calculation manager for species reference-state
1889 //! thermodynamic properties
1890 /*!
1891 * This class is called when the reference-state thermodynamic properties
1892 * of all the species in the phase needs to be evaluated.
1893 */
1894 MultiSpeciesThermo m_spthermo;
1895
1896 //! Data supplied via setParameters. When first set, this may include
1897 //! parameters used by different phase models when initThermo() is called.
1898 AnyMap m_input;
1899
1900 //! Vector of pointers to the species databases.
1901 /*!
1902 * This is used to access data needed to construct the transport manager and
1903 * other properties later in the initialization process. We create a copy of
1904 * the XML_Node data read in here. Therefore, we own this data.
1905 *
1906 * @deprecated The XML input format is deprecated and will be removed in
1907 * Cantera 3.0.
1908 */
1909 std::vector<const XML_Node*> m_speciesData;
1910
1911 //! Stored value of the electric potential for this phase. Units are Volts.
1912 doublereal m_phi;
1913
1914 //! Boolean indicating whether a charge neutrality condition is a necessity
1915 /*!
1916 * Note, the charge neutrality condition is not a necessity for ideal gas
1917 * phases. There may be a net charge in those phases, because the NASA
1918 * polynomials for ionized species in Ideal gases take this condition into
1919 * account. However, liquid phases usually require charge neutrality in
1920 * order for their derived thermodynamics to be valid.
1921 */
1922 bool m_chargeNeutralityNecessary;
1923
1924 //! Contains the standard state convention
1925 int m_ssConvention;
1926
1927 //! last value of the temperature processed by reference state
1928 mutable doublereal m_tlast;
1929};
1930
1931//! typedef for the ThermoPhase class
1932//! @deprecated To be removed after Cantera 2.6.
1933 typedef ThermoPhase thermo_t;
1934
1935}
1936
1937#endif
AnyMap.h
MultiSpeciesThermo.h
Header for a general species thermodynamic property manager for a phase (see MultiSpeciesThermo).
Phase.h
Header file for class Phase.
Units.h
Header for unit conversion utilities, which are used to translate user input from input files (See In...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:399
Cantera::MultiSpeciesThermo
A species thermodynamic property manager for a phase.
Definition: MultiSpeciesThermo.h:47
Cantera::MultiSpeciesThermo::minTemp
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature.
Definition: MultiSpeciesThermo.cpp:129
Cantera::MultiSpeciesThermo::refPressure
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for species k.
Definition: MultiSpeciesThermo.cpp:151
Cantera::MultiSpeciesThermo::modifyOneHf298
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 ...
Definition: MultiSpeciesThermo.cpp:192
Cantera::MultiSpeciesThermo::reportOneHf298
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)
Definition: MultiSpeciesThermo.cpp:182
Cantera::MultiSpeciesThermo::maxTemp
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature.
Definition: MultiSpeciesThermo.cpp:140
Cantera::NotImplementedError
An error indicating that an unimplemented function has been called.
Definition: ctexceptions.h:187
Cantera::Phase
Class Phase is the base class for phases of matter, managing the species and elements in a phase,...
Definition: Phase.h:103
Cantera::Phase::name
std::string name() const
Return the name of the phase.
Definition: Phase.cpp:70
Cantera::Phase::m_kk
size_t m_kk
Number of species in the phase.
Definition: Phase.h:943
Cantera::Phase::meanMolecularWeight
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:751
Cantera::Phase::temperature
doublereal temperature() const
Temperature (K).
Definition: Phase.h:654
Cantera::Phase::molarVolume
double molarVolume() const
Molar volume (m^3/kmol).
Definition: Phase.cpp:682
Cantera::Phase::pressure
virtual double pressure() const
Return the thermodynamic pressure (Pa).
Definition: Phase.h:672
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
Cantera::ThermoPhase::setStateFromXML
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the phase to the conditions specified in the state XML element.
Definition: ThermoPhase.cpp:1278
Cantera::ThermoPhase::m_ssConvention
int m_ssConvention
Contains the standard state convention.
Definition: ThermoPhase.h:1925
Cantera::ThermoPhase::report
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
Definition: ThermoPhase.cpp:1417
Cantera::ThermoPhase::setState_TPY
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.
Definition: ThermoPhase.cpp:120
Cantera::ThermoPhase::getPartialMolarEntropies
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: ThermoPhase.h:531
Cantera::ThermoPhase::setElectricPotential
void setElectricPotential(doublereal v)
Set the electric potential of this phase (V).
Definition: ThermoPhase.h:317
Cantera::ThermoPhase::setState_PY
virtual void setState_PY(doublereal p, doublereal *y)
Set the internally stored pressure (Pa) and mass fractions.
Definition: ThermoPhase.cpp:193
Cantera::ThermoPhase::setState_HP
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.
Definition: ThermoPhase.cpp:199
Cantera::ThermoPhase::getIntEnergy_RT_ref
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
Definition: ThermoPhase.h:713
Cantera::ThermoPhase::gibbs_mole
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: ThermoPhase.h:254
Cantera::ThermoPhase::setState_UV
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).
Definition: ThermoPhase.cpp:204
Cantera::ThermoPhase::chargeNeutralityNecessary
bool chargeNeutralityNecessary() const
Returns the chargeNeutralityNecessity boolean.
Definition: ThermoPhase.h:230
Cantera::ThermoPhase::addSpecies
virtual bool addSpecies(shared_ptr< Species > spec)
Definition: ThermoPhase.cpp:1140
Cantera::ThermoPhase::equivalenceRatio
double equivalenceRatio() const
Compute the equivalence ratio for the current mixture from available oxygen and required oxygen.
Definition: ThermoPhase.cpp:848
Cantera::ThermoPhase::entropy_mass
doublereal entropy_mass() const
Specific entropy. Units: J/kg/K.
Definition: ThermoPhase.h:758
Cantera::ThermoPhase::setState_TP
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
Definition: ThermoPhase.cpp:138
Cantera::ThermoPhase::getIntEnergy_RT
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition: ThermoPhase.h:631
Cantera::ThermoPhase::critPressure
virtual doublereal critPressure() const
Critical pressure (Pa).
Definition: ThermoPhase.h:1489
Cantera::ThermoPhase::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: ThermoPhase.h:521
Cantera::ThermoPhase::getGibbs_ref
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...
Definition: ThermoPhase.h:691
Cantera::ThermoPhase::RT
doublereal RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:782
Cantera::ThermoPhase::getActivities
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure,...
Definition: ThermoPhase.cpp:77
Cantera::ThermoPhase::isothermalCompressibility
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: ThermoPhase.h:283
Cantera::ThermoPhase::getLnActivityCoefficients
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
Definition: ThermoPhase.cpp:85
Cantera::ThermoPhase::m_tlast
doublereal m_tlast
last value of the temperature processed by reference state
Definition: ThermoPhase.h:1928
Cantera::ThermoPhase::critTemperature
virtual doublereal critTemperature() const
Critical temperature (K).
Definition: ThermoPhase.h:1484
Cantera::ThermoPhase::setState_TV
virtual void setState_TV(double t, double v, double tol=1e-9)
Set the temperature (K) and specific volume (m^3/kg).
Definition: ThermoPhase.h:981
Cantera::ThermoPhase::o2Present
double o2Present(const double *y) const
Helper function for computing the amount of oxygen available in the current mixture.
Definition: ThermoPhase.cpp:731
Cantera::ThermoPhase::setState_Tsat
virtual void setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
Definition: ThermoPhase.h:1543
Cantera::ThermoPhase::getCp_R
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition: ThermoPhase.h:642
Cantera::ThermoPhase::setState_PV
virtual void setState_PV(double p, double v, double tol=1e-9)
Set the pressure (Pa) and specific volume (m^3/kg).
Definition: ThermoPhase.h:997
Cantera::ThermoPhase::satPressure
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
Definition: ThermoPhase.h:1529
Cantera::ThermoPhase::setState
virtual void setState(const AnyMap &state)
Set the state using an AnyMap containing any combination of properties supported by the thermodynamic...
Definition: ThermoPhase.cpp:210
Cantera::ThermoPhase::setState_SPorSV
void setState_SPorSV(double s, double p, double tol=1e-9, bool doSV=false)
Carry out work in SP and SV calculations.
Definition: ThermoPhase.cpp:529
Cantera::ThermoPhase::getEnthalpy_RT
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: ThermoPhase.h:590
Cantera::ThermoPhase::setState_HPorUV
void setState_HPorUV(doublereal h, doublereal p, doublereal tol=1e-9, bool doUV=false)
Carry out work in HP and UV calculations.
Definition: ThermoPhase.cpp:327
Cantera::ThermoPhase::getStandardVolumes
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution.
Definition: ThermoPhase.h:654
Cantera::ThermoPhase::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: ThermoPhase.h:495
Cantera::ThermoPhase::getActivityCoefficients
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
Definition: ThermoPhase.h:454
Cantera::ThermoPhase::initThermoFile
void initThermoFile(const std::string &inputFile, const std::string &id)
Definition: ThermoPhase.cpp:1066
Cantera::ThermoPhase::initThermoXML
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
Definition: ThermoPhase.cpp:1095
Cantera::ThermoPhase::gibbs_mass
doublereal gibbs_mass() const
Specific Gibbs function. Units: J/kg.
Definition: ThermoPhase.h:763
Cantera::ThermoPhase::critVolume
virtual doublereal critVolume() const
Critical volume (m3/kmol).
Definition: ThermoPhase.h:1494
Cantera::ThermoPhase::logStandardConc
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: ThermoPhase.cpp:72
Cantera::ThermoPhase::modifySpecies
virtual void modifySpecies(size_t k, shared_ptr< Species > spec)
Modify the thermodynamic data associated with a species.
Definition: ThermoPhase.cpp:1154
Cantera::ThermoPhase::getCp_R_ref
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition: ThermoPhase.h:725
Cantera::ThermoPhase::getdlnActCoeffdlnN
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 ...
Definition: ThermoPhase.cpp:1353
Cantera::ThermoPhase::setState_ST
virtual void setState_ST(double s, double t, double tol=1e-9)
Set the specific entropy (J/kg/K) and temperature (K).
Definition: ThermoPhase.h:965
Cantera::ThermoPhase::getdlnActCoeffdlnN_diag
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
Definition: ThermoPhase.h:1822
Cantera::ThermoPhase::stoichAirFuelRatio
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...
Definition: ThermoPhase.cpp:766
Cantera::ThermoPhase::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: ThermoPhase.h:249
Cantera::ThermoPhase::parameters
AnyMap parameters(bool withInput=true) const
Returns the parameters of a ThermoPhase object such that an identical one could be reconstructed usin...
Definition: ThermoPhase.cpp:1205
Cantera::ThermoPhase::setState_RPY
virtual void setState_RPY(doublereal rho, doublereal p, const doublereal *y)
Set the density (kg/m**3), pressure (Pa) and mass fractions.
Definition: ThermoPhase.cpp:169
Cantera::ThermoPhase::critDensity
virtual doublereal critDensity() const
Critical density (kg/m3).
Definition: ThermoPhase.h:1504
Cantera::ThermoPhase::m_chargeNeutralityNecessary
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
Definition: ThermoPhase.h:1922
Cantera::ThermoPhase::getEntropy_R
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition: ThermoPhase.h:600
Cantera::ThermoPhase::setState_TPX
virtual void setState_TPX(doublereal t, doublereal p, const doublereal *x)
Set the temperature (K), pressure (Pa), and mole fractions.
Definition: ThermoPhase.cpp:102
Cantera::ThermoPhase::speciesData
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
Definition: ThermoPhase.cpp:1178
Cantera::ThermoPhase::getGibbs_RT_ref
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition: ThermoPhase.h:680
Cantera::ThermoPhase::getPartialMolarVolumes
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: ThermoPhase.h:562
Cantera::ThermoPhase::cp_mass
doublereal cp_mass() const
Specific heat at constant pressure. Units: J/kg/K.
Definition: ThermoPhase.h:768
Cantera::ThermoPhase::getPartialMolarCp
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: ThermoPhase.h:552
Cantera::ThermoPhase::getCsvReportData
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...
Definition: ThermoPhase.cpp:1582
Cantera::ThermoPhase::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: ThermoPhase.h:259
Cantera::ThermoPhase::setState_PX
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
Definition: ThermoPhase.cpp:187
Cantera::ThermoPhase::phaseOfMatter
virtual std::string phaseOfMatter() const
String indicating the mechanical phase of the matter in this Phase.
Definition: ThermoPhase.h:142
Cantera::ThermoPhase::refPressure
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:150
Cantera::ThermoPhase::o2Required
double o2Required(const double *y) const
Helper function for computing the amount of oxygen required for complete oxidation.
Definition: ThermoPhase.cpp:702
Cantera::ThermoPhase::cv_mole
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: ThermoPhase.h:264
Cantera::ThermoPhase::ThermoPhase
ThermoPhase()
Constructor.
Definition: ThermoPhase.cpp:29
Cantera::ThermoPhase::intEnergy_mole
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: ThermoPhase.h:244
Cantera::ThermoPhase::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: ThermoPhase.h:404
Cantera::ThermoPhase::critCompressibility
virtual doublereal critCompressibility() const
Critical compressibility (unitless).
Definition: ThermoPhase.h:1499
Cantera::ThermoPhase::getPartialMolarIntEnergies
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
Definition: ThermoPhase.h:541
Cantera::ThermoPhase::activityConvention
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
Definition: ThermoPhase.cpp:56
Cantera::ThermoPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: ThermoPhase.cpp:1102
Cantera::ThermoPhase::standardConcentration
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: ThermoPhase.h:425
Cantera::ThermoPhase::getdlnActCoeffdlnX_diag
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
Definition: ThermoPhase.h:1802
Cantera::ThermoPhase::saveSpeciesData
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.
Definition: ThermoPhase.cpp:1170
Cantera::ThermoPhase::getChemPotentials_RT
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species chemical potentials These are partial molar Gibbs free energ...
Definition: ThermoPhase.h:482
Cantera::ThermoPhase::speciesThermo
virtual MultiSpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
Definition: ThermoPhase.cpp:1055
Cantera::ThermoPhase::setState_UP
virtual void setState_UP(double u, double p, double tol=1e-9)
Set the specific internal energy (J/kg) and pressure (Pa).
Definition: ThermoPhase.h:1013
Cantera::ThermoPhase::getPureGibbs
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.
Definition: ThermoPhase.h:621
Cantera::ThermoPhase::satTemperature
virtual doublereal satTemperature(doublereal p) const
Return the saturation temperature given the pressure.
Definition: ThermoPhase.h:1521
Cantera::ThermoPhase::setState_SP
virtual void setState_SP(double s, double p, double tol=1e-9)
Set the specific entropy (J/kg/K) and pressure (Pa).
Definition: ThermoPhase.cpp:518
Cantera::ThermoPhase::standardStateConvention
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
Definition: ThermoPhase.cpp:61
Cantera::ThermoPhase::maxTemp
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
Definition: ThermoPhase.h:218
Cantera::ThermoPhase::setState_SH
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)
Definition: ThermoPhase.h:1061
Cantera::ThermoPhase::getElectrochemPotentials
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
Definition: ThermoPhase.cpp:93
Cantera::ThermoPhase::type
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: ThermoPhase.h:113
Cantera::ThermoPhase::cv_mass
doublereal cv_mass() const
Specific heat at constant volume. Units: J/kg/K.
Definition: ThermoPhase.h:773
Cantera::ThermoPhase::setState_RP
virtual void setState_RP(doublereal rho, doublereal p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.
Definition: ThermoPhase.h:1078
Cantera::ThermoPhase::setMixtureFraction
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)
Definition: ThermoPhase.cpp:925
Cantera::ThermoPhase::resetHf298
virtual void resetHf298(const size_t k=npos)
Restore the original heat of formation of one or more species.
Definition: ThermoPhase.cpp:45
Cantera::ThermoPhase::setState_TH
virtual void setState_TH(double t, double h, double tol=1e-9)
Set the temperature (K) and the specific enthalpy (J/kg)
Definition: ThermoPhase.h:1045
Cantera::ThermoPhase::standardConcentrationUnits
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: ThermoPhase.cpp:66
Cantera::ThermoPhase::setState_Psat
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
Definition: ThermoPhase.h:1552
Cantera::ThermoPhase::m_speciesData
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
Definition: ThermoPhase.h:1909
Cantera::ThermoPhase::intEnergy_mass
doublereal intEnergy_mass() const
Specific internal energy. Units: J/kg.
Definition: ThermoPhase.h:753
Cantera::ThermoPhase::setState_RPX
virtual void setState_RPX(doublereal rho, doublereal p, const doublereal *x)
Set the density (kg/m**3), pressure (Pa) and mole fractions.
Definition: ThermoPhase.cpp:151
Cantera::ThermoPhase::isIdeal
virtual bool isIdeal() const
Boolean indicating whether phase is ideal.
Definition: ThermoPhase.h:118
Cantera::ThermoPhase::modifyOneHf298SS
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)
Definition: ThermoPhase.h:195
Cantera::ThermoPhase::getEnthalpy_RT_ref
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition: ThermoPhase.h:669
Cantera::ThermoPhase::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: ThermoPhase.h:239
Cantera::ThermoPhase::thermalExpansionCoeff
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: ThermoPhase.h:294
Cantera::ThermoPhase::m_spthermo
MultiSpeciesThermo m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1894
Cantera::ThermoPhase::getdlnActCoeffds
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,...
Definition: ThermoPhase.h:1782
Cantera::ThermoPhase::m_phi
doublereal m_phi
Stored value of the electric potential for this phase. Units are Volts.
Definition: ThermoPhase.h:1912
Cantera::ThermoPhase::enthalpy_mass
doublereal enthalpy_mass() const
Specific enthalpy. Units: J/kg.
Definition: ThermoPhase.h:748
Cantera::ThermoPhase::getGibbs_RT
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition: ThermoPhase.h:610
Cantera::ThermoPhase::mixtureFraction
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...
Definition: ThermoPhase.cpp:984
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1898
Cantera::ThermoPhase::setParameters
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
Definition: ThermoPhase.cpp:1187
Cantera::ThermoPhase::minTemp
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid.
Definition: ThermoPhase.h:165
Cantera::ThermoPhase::reportCSV
virtual void reportCSV(std::ofstream &csvFile) const
returns a summary of the state of the phase to a comma separated file.
Definition: ThermoPhase.cpp:1550
Cantera::ThermoPhase::getEntropy_R_ref
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition: ThermoPhase.h:702
Cantera::ThermoPhase::setEquivalenceRatio
void setEquivalenceRatio(double phi, const double *fuelComp, const double *oxComp, ThermoBasis basis=ThermoBasis::molar)
Set the mixture composition according to the equivalence ratio.
Definition: ThermoPhase.cpp:797
Cantera::ThermoPhase::setState_TPQ
void setState_TPQ(double T, double P, double Q)
Set the temperature, pressure, and vapor fraction (quality).
Definition: ThermoPhase.cpp:1111
Cantera::ThermoPhase::invalidateCache
virtual void invalidateCache()
Invalidate any cached values which are normally updated only when a change in state is detected.
Definition: ThermoPhase.cpp:1303
Cantera::ThermoPhase::setState_conditional_TP
void setState_conditional_TP(doublereal t, doublereal p, bool set_p)
Helper function used by setState_HPorUV and setState_SPorSV.
Definition: ThermoPhase.cpp:319
Cantera::ThermoPhase::getStandardChemPotentials
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: ThermoPhase.h:580
Cantera::ThermoPhase::setState_VH
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)
Definition: ThermoPhase.h:1029
Cantera::ThermoPhase::setParametersFromXML
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: ThermoPhase.h:1747
Cantera::ThermoPhase::electricPotential
doublereal electricPotential() const
Returns the electric potential of this phase (V).
Definition: ThermoPhase.h:326
Cantera::ThermoPhase::setState_SV
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).
Definition: ThermoPhase.cpp:523
Cantera::ThermoPhase::Hf298SS
doublereal Hf298SS(const size_t k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
Definition: ThermoPhase.h:180
Cantera::ThermoPhase::input
const AnyMap & input() const
Access input data associated with the phase description.
Definition: ThermoPhase.cpp:1268
Cantera::ThermoPhase::getSpeciesParameters
virtual void getSpeciesParameters(const std::string &name, AnyMap &speciesNode) const
Get phase-specific parameters of a Species object such that an identical one could be reconstructed a...
Definition: ThermoPhase.h:1726
Cantera::ThermoPhase::getParameters
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
Definition: ThermoPhase.cpp:1193
Cantera::ThermoPhase::getStandardVolumes_ref
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.
Definition: ThermoPhase.h:737
Cantera::ThermoPhase::vaporFraction
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
Definition: ThermoPhase.h:1534
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::ThermoPhase::compatibleWithMultiPhase
virtual bool compatibleWithMultiPhase() const
Indicates whether this phase type can be used with class MultiPhase for equilibrium calculations.
Definition: ThermoPhase.h:1473
Cantera::ThermoPhase::setToEquilState
virtual void setToEquilState(const doublereal *mu_RT)
This method is used by the ChemEquil equilibrium solver.
Definition: ThermoPhase.h:1466
Cantera::ThermoPhase::equilibrate
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.
Definition: ThermoPhase.cpp:1308
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557
Cantera::npos
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:192
Cantera::cSS_CONVENTION_VPSS
const int cSS_CONVENTION_VPSS
Standard state uses the molality convention.
Definition: ThermoPhase.h:39
Cantera::cAC_CONVENTION_MOLAR
const int cAC_CONVENTION_MOLAR
Definition: ThermoPhase.h:27
Cantera::thermo_t
ThermoPhase thermo_t
typedef for the ThermoPhase class
Definition: ThermoPhase.h:1933
Cantera::GasConstant
const double GasConstant
Universal Gas Constant [J/kmol/K].
Definition: ct_defs.h:113
Cantera::cSS_CONVENTION_TEMPERATURE
const int cSS_CONVENTION_TEMPERATURE
Definition: ThermoPhase.h:37
Cantera::ThermoBasis
ThermoBasis
Differentiate between mole fractions and mass fractions for input mixture composition.
Definition: ThermoPhase.h:46
Cantera::cSS_CONVENTION_SLAVE
const int cSS_CONVENTION_SLAVE
Standard state thermodynamics is obtained from slave ThermoPhase objects.
Definition: ThermoPhase.h:41
Cantera::compositionMap
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:176
Cantera::cAC_CONVENTION_MOLALITY
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.
Definition: ThermoPhase.h:29