6#ifndef CT_MULTIPHASE_EQUIL
7#define CT_MULTIPHASE_EQUIL
46 size_t constituent(
size_t m) {
54 void getStoichVector(
size_t rxn, span<double> nu) {
55 checkArraySize(
"MultiPhaseEquil::getStoichVector", nu.size(), m_nsp);
56 fill(nu.begin(), nu.end(), 0.0);
60 for (
size_t k = 0; k < m_nsp; k++) {
61 nu[m_order[k]] = m_N(k, rxn);
69 double equilibrate(
int XY,
double err = 1.0e-9,
70 int maxsteps = 1000,
int loglevel=-99);
73 string reactionString(
size_t j) {
76 void setInitialMixMoles(
int loglevel = 0) {
81 size_t componentIndex(
size_t n) {
82 return m_species[m_order[n]];
85 void reportCSV(
const string& reportFile);
87 double phaseMoles(
size_t iph)
const;
128 void unsort(span<double> x);
130 void step(
double omega, span<double> deltaN,
int loglevel = 0);
135 void updateMixMoles();
143 double moles(
size_t ns)
const {
144 return m_moles[m_order[ns]];
146 double& moles(
size_t ns) {
147 return m_moles[m_order[ns]];
149 int solutionSpecies(
size_t n)
const {
150 return m_dsoln[m_order[n]];
152 bool isStoichPhase(
size_t n)
const {
153 return (m_dsoln[m_order[n]] == 0);
155 double mu(
size_t n)
const {
156 return m_mu[m_species[m_order[n]]];
158 string speciesName(
size_t n)
const {
165 return (m_nsp > m_nel) ? m_nsp - m_nel : 0;
168 size_t m_nel_mix, m_nsp_mix;
171 size_t m_eloc = 1000;
174 double m_press, m_temp;
175 vector<size_t> m_order;
177 vector<double> m_work, m_work2, m_work3;
178 vector<double> m_moles, m_lastmoles, m_dxi;
179 vector<double> m_deltaG_RT, m_mu;
180 vector<bool> m_majorsp;
181 vector<size_t> m_sortindex;
182 vector<int> m_lastsort;
184 vector<int> m_incl_element, m_incl_species;
188 vector<size_t> m_species;
189 vector<size_t> m_element;
190 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.
void getComponents(span< const size_t > order)
This method finds a set of component species and a complete set of formation reactions for the non-co...
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 unsort(span< double > x)
Re-arrange a vector of species properties in sorted form (components first) into unsorted,...
void finish()
Clean up the composition.
size_t nFree() const
Number of degrees of freedom.
double computeReactionSteps(span< double > dxi)
Compute the change in extent of reaction for each reaction.
int setInitialMoles(int loglevel=0)
Estimate the initial mole numbers.
A class for multiphase mixtures.
string speciesName(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"
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.