MultiPhase.h Source File#
MultiPhase.h
Go to the documentation of this file.
Headers for the DenseMatrix object, which deals with dense rectangular matrices and description of th...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Definition DenseMatrix.h:55
void checkPhaseIndex(size_t m) const
Check that the specified phase index is in range Throws an exception if m is greater than nPhases()
Definition MultiPhase.cpp:160
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...
Definition MultiPhase.h:226
bool solutionSpecies(size_t kGlob) const
Return true is species kGlob is a species in a multicomponent solution phase.
Definition MultiPhase.cpp:260
double nAtoms(const size_t kGlob, const size_t mGlob) const
Returns the Number of atoms of global element mGlob in global species kGlob.
Definition MultiPhase.cpp:751
void setMolesByName(const Composition &xMap)
Set the number of moles of species in the mixture.
Definition MultiPhase.cpp:342
void setMoles(const double *n)
Sets all of the global species mole numbers.
Definition MultiPhase.cpp:374
void checkSpeciesIndex(size_t k) const
Check that the specified species index is in range.
Definition MultiPhase.cpp:732
double speciesMoles(size_t kGlob) const
Returns the moles of global species k. units = kmol.
Definition MultiPhase.cpp:174
void getValidChemPotentials(double not_mu, double *mu, bool standard=false) const
Returns a vector of Valid chemical potentials.
Definition MultiPhase.cpp:241
vector< size_t > m_spstart
Vector of ints containing of first species index in the global list of species for each phase.
Definition MultiPhase.h:598
vector< size_t > m_spphase
Mapping between the global species number and the phase ID.
Definition MultiPhase.h:590
void getMoles(double *molNum) const
Get the mole numbers of all species in the multiphase object.
Definition MultiPhase.cpp:359
double minTemp() const
Minimum temperature for which all solution phases have valid thermo data.
Definition MultiPhase.h:246
vector< double > m_moleFractions
Locally stored vector of mole fractions of all species comprising the MultiPhase object.
Definition MultiPhase.h:583
double equilibrate_MultiPhaseEquil(int XY, double err, int maxsteps, int maxiter, int loglevel)
Set the mixture to a state of chemical equilibrium using the MultiPhaseEquil solver.
Definition MultiPhase.cpp:470
void checkPhaseArraySize(size_t mm) const
Check that an array size is at least nPhases() Throws an exception if mm is less than nPhases().
Definition MultiPhase.cpp:167
vector< bool > m_temp_OK
Vector of bools indicating whether temperatures are ok for phases.
Definition MultiPhase.h:641
double phaseCharge(size_t p) const
Charge (Coulombs) of phase with index p.
Definition MultiPhase.cpp:220
int phaseIndex(const string &pName) const
Returns the index, given the phase name.
Definition MultiPhase.cpp:766
size_t m_eloc
Global ID of the element corresponding to the electronic charge.
Definition MultiPhase.h:634
void getChemPotentials(double *mu) const
Returns a vector of Chemical potentials.
Definition MultiPhase.cpp:231
double moleFraction(const size_t kGlob) const
Returns the mole fraction of global species k.
Definition MultiPhase.cpp:791
bool tempOK(size_t p) const
Return true if the phase p has valid thermo data for the current temperature.
Definition MultiPhase.cpp:796
void addPhases(vector< ThermoPhase * > &phases, const vector< double > &phaseMoles)
Add a vector of phases to the mixture.
Definition MultiPhase.cpp:30
map< string, size_t > m_enamemap
Returns the global element index, given the element string name.
Definition MultiPhase.h:615
void addSpeciesMoles(const int indexS, const double addedMoles)
Adds moles of a certain species to the mixture.
Definition MultiPhase.cpp:404
size_t elementIndex(const string &name) const
Returns the index of the element with name name.
Definition MultiPhase.cpp:722
void checkElementArraySize(size_t mm) const
Check that an array size is at least nElements().
Definition MultiPhase.cpp:710
size_t speciesPhaseIndex(const size_t kGlob) const
Returns the phase index of the Kth "global" species.
Definition MultiPhase.cpp:786
void setState_TPMoles(const double T, const double Pres, const double *Moles)
Set the state of the underlying ThermoPhase objects in one call.
Definition MultiPhase.cpp:423
string speciesName(const size_t kGlob) const
Name of species with global index kGlob.
Definition MultiPhase.cpp:746
double phaseMoles(const size_t n) const
Return the number of moles in phase n.
Definition MultiPhase.cpp:776
void getMoleFractions(double *const x) const
Returns the global Species mole fractions.
Definition MultiPhase.cpp:756
void setPhaseMoleFractions(const size_t n, const double *const x)
Set the Mole fractions of the nth phase.
Definition MultiPhase.cpp:329
void uploadMoleFractionsFromPhases()
Update the locally-stored composition within this object to match the current compositions of the pha...
Definition MultiPhase.cpp:801
bool m_init
True if the init() routine has been called, and the MultiPhase frozen.
Definition MultiPhase.h:630
double m_Tmin
Minimum temperature for which thermo parameterizations are valid.
Definition MultiPhase.h:645
void updatePhases() const
Set the states of the phase objects to the locally-stored state within this MultiPhase object.
Definition MultiPhase.cpp:812
void getElemAbundances(double *elemAbundances) const
Retrieves a vector of element abundances.
Definition MultiPhase.cpp:430
void checkSpeciesArraySize(size_t kk) const
Check that an array size is at least nSpecies().
Definition MultiPhase.cpp:739
string phaseName(const size_t iph) const
Returns the name of the n'th phase.
Definition MultiPhase.cpp:761
void setState_TP(const double T, const double Pres)
Set the state of the underlying ThermoPhase objects in one call.
Definition MultiPhase.cpp:413
void checkElementIndex(size_t m) const
Check that the specified element index is in range.
Definition MultiPhase.cpp:703
double maxTemp() const
Maximum temperature for which all solution phases have valid thermo data.
Definition MultiPhase.h:253
string elementName(size_t m) const
Returns the name of the global element m.
Definition MultiPhase.cpp:717
void setPhaseMoles(const size_t n, const double moles)
Set the number of moles of phase with index n.
Definition MultiPhase.cpp:781
double elementMoles(size_t m) const
Total moles of global element m, summed over all phases.
Definition MultiPhase.cpp:180
double m_Tmax
Minimum temperature for which thermo parameterizations are valid.
Definition MultiPhase.h:649
Base class for a phase with thermodynamic properties.
Definition ThermoPhase.h:390
void equilibrate(const string &XY, const string &solver="auto", double rtol=1e-9, int max_steps=50000, int max_iter=100, int estimate_equil=0, int log_level=0)
Equilibrate a MultiPhase object.
Definition MultiPhase.cpp:630
void ElemRearrange(size_t nComponents, const vector< double > &elementAbundances, MultiPhase *mphase, vector< size_t > &orderVectorSpecies, vector< size_t > &orderVectorElements)
Handles the potential rearrangement of the constraint equations represented by the Formula Matrix.
Definition BasisOptimize.cpp:292
size_t BasisOptimize(int *usedZeroedSpecies, bool doFormRxn, MultiPhase *mphase, vector< size_t > &orderVectorSpecies, vector< size_t > &orderVectorElements, vector< double > &formRxnMatrix)
Choose the optimum basis of species for the equilibrium calculations.
Definition BasisOptimize.cpp:18
int BasisOptimize_print_lvl
External int that is used to turn on debug printing for the BasisOptimize program.
Definition BasisOptimize.cpp:15
std::ostream & operator<<(std::ostream &s, const Array2D &m)
Output the current contents of the Array2D object.
Definition Array.cpp:100
Generated by