8 #ifndef CT_MULTIPHASE_H
9 #define CT_MULTIPHASE_H
150 doublereal
nAtoms(
const size_t kGlob,
const size_t mGlob)
const;
175 std::string
phaseName(
const size_t iph)
const;
184 int phaseIndex(
const std::string& pName)
const;
262 doublereal
charge()
const;
331 bool standard =
false)
const;
350 doublereal
equilibrate(
int XY, doublereal err = 1.0e-9,
351 int maxsteps = 1000,
int maxiter = 200,
int loglevel = -99);
382 void equilibrate(
const std::string& XY,
const std::string& solver=
"auto",
383 double rtol=1e-9,
int max_steps=50000,
int max_iter=100,
384 int estimate_equil=0,
int log_level=0);
397 void setState_TP(
const doublereal T,
const doublereal Pres);
406 void setState_TPMoles(
const doublereal T,
const doublereal Pres,
const doublereal* Moles);
418 doublereal
volume()
const;
439 doublereal
gibbs()
const;
443 doublereal
cp()
const;
504 void getMoles(doublereal* molNum)
const;
536 bool tempOK(
size_t p)
const;
586 int maxiter,
int loglevel);
715 for (ip = 0; ip < x.
nPhases(); ip++) {
717 s <<
"*************** " << x.
phase(ip).
name() <<
" *****************" << std::endl;
719 s <<
"*************** Phase " << ip <<
" *****************" << std::endl;
721 s <<
"Moles: " << x.
phaseMoles(ip) << std::endl;
761 MultiPhase* mphase, std::vector<size_t>& orderVectorSpecies,
762 std::vector<size_t>& orderVectorElements,
807 std::vector<size_t>& orderVectorSpecies,
808 std::vector<size_t>& orderVectorElements);
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
std::vector< size_t > m_spphase
Mapping between the global species number and the phase ID.
doublereal m_temp
Current value of the temperature (kelvin)
size_t BasisOptimize(int *usedZeroedSpecies, bool doFormRxn, MultiPhase *mphase, std::vector< size_t > &orderVectorSpecies, std::vector< size_t > &orderVectorElements, vector_fp &formRxnMatrix)
Choose the optimum basis of species for the equilibrium calculations.
int BasisOptimize_print_lvl
External int that is used to turn on debug printing for the BasisOptimze program. ...
bool tempOK(size_t p) const
Return true if the phase p has valid thermo data for the current temperature.
bool m_init
True if the init() routine has been called, and the MultiPhase frozen.
void setPhaseMoles(const size_t n, const doublereal moles)
Set the number of moles of phase with index n.
doublereal speciesMoles(size_t kGlob) const
Returns the moles of global species k. units = kmol.
void checkElementIndex(size_t m) const
Check that the specified element index is in range.
std::map< std::string, size_t > m_enamemap
Returns the global element index, given the element string name.
std::string speciesName(const size_t kGlob) const
Name of species with global index kGlob.
void checkSpeciesArraySize(size_t kk) const
Check that an array size is at least nSpecies().
vector_int m_atomicNumber
Atomic number of each element.
doublereal phaseMoles(const size_t n) const
Return the number of moles in phase n.
doublereal temperature() const
Temperature [K].
void addPhase(ThermoPhase *p, doublereal moles)
Add a phase to the mixture.
doublereal phaseCharge(size_t p) const
Charge (Coulombs) of phase with index p.
doublereal equilibrate(int XY, doublereal err=1.0e-9, int maxsteps=1000, int maxiter=200, int loglevel=-99)
Set the mixture to a state of chemical equilibrium.
int phaseIndex(const std::string &pName) const
Returns the index, given the phase name.
std::string name() const
Return the name of the phase.
void getChemPotentials(doublereal *mu) const
Returns a vector of Chemical potentials.
void checkPhaseArraySize(size_t mm) const
Check that an array size is at least nPhases() Throws an exception if mm is less than nPhases()...
vector_fp m_moles
Vector of the number of moles in each phase.
Base class for a phase with thermodynamic properties.
void getMoleFractions(doublereal *const x) const
Returns the global Species mole fractions.
size_t speciesPhaseIndex(const size_t kGlob) const
Returns the phase index of the Kth "global" species.
std::vector< int > vector_int
Vector of ints.
std::vector< std::string > m_enames
String names of the global elements.
doublereal gibbs() const
The Gibbs function of the mixture [J].
void addSpeciesMoles(const int indexS, const doublereal addedMoles)
Adds moles of a certain species to the mixture.
vector_fp m_moleFractions
Locally stored vector of mole fractions of all species comprising the MultiPhase object.
void uploadMoleFractionsFromPhases()
Update the locally-stored composition within this object to match the current compositions of the pha...
A class for multiphase mixtures.
void checkPhaseIndex(size_t m) const
Check that the specified phase index is in range Throws an exception if m is greater than nPhases() ...
doublereal charge() const
Total charge summed over all phases (Coulombs).
std::vector< bool > m_temp_OK
Vector of bools indicating whether temperatures are ok for phases.
void setState_TPMoles(const doublereal T, const doublereal Pres, const doublereal *Moles)
Set the state of the underlying ThermoPhase objects in one call.
void checkSpeciesIndex(size_t k) const
Check that the specified species index is in range.
std::string elementName(size_t m) const
Returns the name of the global element m.
size_t m_eloc
Global ID of the element corresponding to the electronic charge.
void getValidChemPotentials(doublereal not_mu, doublereal *mu, bool standard=false) const
Returns a vector of Valid chemical potentials.
doublereal entropy() const
The entropy of the mixture [J/K].
void addPhases(std::vector< ThermoPhase * > &phases, const vector_fp &phaseMoles)
Add a vector of phases to the mixture.
DenseMatrix m_atoms
Global Stoichiometric Coefficient array.
std::vector< size_t > m_spstart
Vector of ints containing of first species index in the global list of species for each phase...
void setPhaseMoleFractions(const size_t n, const doublereal *const x)
Set the Mole fractions of the nth phase.
size_t m_nsp
Number of distinct species in all of the phases.
void calcElemAbundances() const
Calculate the element abundance vector.
size_t m_nel
Number of distinct elements in all of the phases.
void setTemperature(const doublereal T)
Set the temperature [K].
void checkElementArraySize(size_t mm) const
Check that an array size is at least nElements().
double equilibrate_MultiPhaseEquil(int XY, doublereal err, int maxsteps, int maxiter, int loglevel)
Set the mixture to a state of chemical equilibrium using the MultiPhaseEquil solver.
size_t elementIndex(const std::string &name) const
Returns the index of the element with name name.
virtual ~MultiPhase()
Destructor.
doublereal IntEnergy() const
The internal energy of the mixture [J].
size_t m_np
Number of phases in the MultiPhase object.
vector_fp m_elemAbundances
Vector of element abundances.
std::vector< ThermoPhase * > m_phase
Vector of the ThermoPhase pointers.
void getMoles(doublereal *molNum) const
Get the mole numbers of all species in the multiphase object.
void setMolesByName(const compositionMap &xMap)
Set the number of moles of species in the mixture.
doublereal nAtoms(const size_t kGlob, const size_t mGlob) const
Returns the Number of atoms of global element mGlob in global species kGlob.
void setPressure(doublereal P)
Set the pressure [Pa].
doublereal moleFraction(const size_t kGlob) const
Returns the mole fraction of global species k.
void updatePhases() const
Set the states of the phase objects to the locally-stored state within this MultiPhase object...
void setState_TP(const doublereal T, const doublereal Pres)
Set the state of the underlying ThermoPhase objects in one call.
doublereal enthalpy() const
The enthalpy of the mixture [J].
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
doublereal maxTemp() const
Maximum temperature for which all solution phases have valid thermo data.
doublereal cp() const
Heat capacity at constant pressure [J/K].
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
std::string phaseName(const size_t iph) const
Returns the name of the n'th phase.
virtual std::string report(bool show_thermo=true, doublereal threshold=-1e-14) const
returns a summary of the state of the phase as a string
doublereal elementMoles(size_t m) const
Total moles of global element m, summed over all phases.
void init()
Process phases and build atomic composition array.
std::vector< std::string > m_snames
Vector of species names in the problem.
bool solutionSpecies(size_t kGlob) const
Return true is species kGlob is a species in a multicomponent solution phase.
thermo_t & phase(size_t n)
Return a reference to phase n.
doublereal minTemp() const
Minimum temperature for which all solution phases have valid thermo data.
doublereal m_press
Current value of the pressure (Pa)
doublereal pressure() const
Pressure [Pa].
void getElemAbundances(doublereal *elemAbundances) const
Retrieves a vector of element abundances.
size_t nSpecies() const
Number of species, summed over all phases.
size_t speciesIndex(size_t k, size_t p) const
Return the global index of the species belonging to phase number p with local index k within the phas...
doublereal m_Tmax
Minimum temperature for which thermo parameterizations are valid.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
size_t ElemRearrange(size_t nComponents, const vector_fp &elementAbundances, MultiPhase *mphase, std::vector< size_t > &orderVectorSpecies, std::vector< size_t > &orderVectorElements)
Handles the potential rearrangement of the constraint equations represented by the Formula Matrix...
doublereal m_Tmin
Minimum temperature for which thermo parameterizations are valid.
void setMoles(const doublereal *n)
Sets all of the global species mole numbers.
doublereal volume() const
The total mixture volume [m^3].
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
size_t nElements() const
Number of elements.
size_t nPhases() const
Number of phases.