6 #ifndef CT_MULTIPHASE_EQUIL
7 #define CT_MULTIPHASE_EQUIL
46 size_t constituent(
size_t m) {
54 void getStoichVector(
size_t rxn, vector<double>& nu) {
55 nu.resize(m_nsp, 0.0);
59 for (
size_t k = 0; k < m_nsp; k++) {
60 nu[m_order[k]] = m_N(k, rxn);
68 double equilibrate(
int XY,
double err = 1.0e-9,
69 int maxsteps = 1000,
int loglevel=-99);
72 string reactionString(
size_t j) {
75 void setInitialMixMoles(
int loglevel = 0) {
80 size_t componentIndex(
size_t n) {
81 return m_species[m_order[n]];
84 void reportCSV(
const string& reportFile);
86 double phaseMoles(
size_t iph)
const;
127 void unsort(vector<double>& x);
129 void step(
double omega, vector<double>& deltaN,
int loglevel = 0);
134 void updateMixMoles();
142 double moles(
size_t ns)
const {
143 return m_moles[m_order[ns]];
145 double& moles(
size_t ns) {
146 return m_moles[m_order[ns]];
148 int solutionSpecies(
size_t n)
const {
149 return m_dsoln[m_order[n]];
151 bool isStoichPhase(
size_t n)
const {
152 return (m_dsoln[m_order[n]] == 0);
154 double mu(
size_t n)
const {
155 return m_mu[m_species[m_order[n]]];
157 string speciesName(
size_t n)
const {
164 return (m_nsp > m_nel) ? m_nsp - m_nel : 0;
167 size_t m_nel_mix, m_nsp_mix;
170 size_t m_eloc = 1000;
173 double m_press, m_temp;
174 vector<size_t> m_order;
176 vector<double> m_work, m_work2, m_work3;
177 vector<double> m_moles, m_lastmoles, m_dxi;
178 vector<double> m_deltaG_RT, m_mu;
179 vector<bool> m_majorsp;
180 vector<size_t> m_sortindex;
181 vector<int> m_lastsort;
183 vector<int> m_incl_element, m_incl_species;
187 vector<size_t> m_species;
188 vector<size_t> m_element;
189 vector<bool> m_solnrxn;
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Chemica...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Multiphase chemical equilibrium solver.
double computeReactionSteps(vector< double > &dxi)
Compute the change in extent of reaction for each reaction.
double stepComposition(int loglevel=0)
Take one step in composition, given the gradient of G at the starting point, and a vector of reaction...
void finish()
Clean up the composition.
void unsort(vector< double > &x)
Re-arrange a vector of species properties in sorted form (components first) into unsorted,...
size_t nFree() const
Number of degrees of freedom.
MultiPhaseEquil(MultiPhase *mix, bool start=true, int loglevel=0)
Construct a multiphase equilibrium manager for a multiphase mixture.
int setInitialMoles(int loglevel=0)
Estimate the initial mole numbers.
void getComponents(const vector< size_t > &order)
This method finds a set of component species and a complete set of formation reactions for the non-co...
A class for multiphase mixtures.
string speciesName(const size_t kGlob) const
Name of species with global index kGlob.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"