131 double nAtoms(
size_t k,
size_t m)
const {
158 span<double> elMolesGoal,
int loglevel = 0);
208 void dampStep(span<double> oldx, span<double> step, span<double> x);
214 span<const double> elmtotal, span<double> resid,
215 double xval,
double yval,
int loglevel = 0);
219 double xval,
double yval,
int loglevel = 0);
221 void adjustEloc(
ThermoPhase& s, span<double> elMolesGoal);
236 span<const double> Xmol_i_calc, span<double> eMolesCalc,
237 span<double> n_i_calc,
double pressureConst);
241 size_t m_skip =
npos;
259 vector<double> m_jwork1;
260 vector<double> m_jwork2;
269 vector<double> m_mu_RT;
275 vector<size_t> m_component;
280 vector<size_t> m_orderVectorElements;
281 vector<size_t> m_orderVectorSpecies;
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
int setInitialMoles(ThermoPhase &s, span< double > elMoleGoal, int loglevel=0)
Estimate the initial mole numbers.
void equilResidual(ThermoPhase &s, span< const double > x, span< const double > elmtotal, span< double > resid, double xval, double yval, int loglevel=0)
Evaluates the residual vector F, of length m_mm.
int equilibrate(ThermoPhase &s, const char *XY, int loglevel=0)
Equilibrate a phase, holding the elemental composition fixed at the initial value found within the Th...
size_t m_kk
number of species in the phase
int m_loglevel
Verbosity of printed output.
size_t m_nComponents
This is equal to the rank of the stoichiometric coefficient matrix when it is computed.
ThermoPhase * m_phase
Pointer to the ThermoPhase object used to initialize this object.
double m_elementTotalSum
Current value of the sum of the element abundances given the current element potentials.
void update(const ThermoPhase &s)
Update internally stored state information.
int estimateElementPotentials(ThermoPhase &s, span< double > lambda, span< double > elMolesGoal, int loglevel=0)
Generate a starting estimate for the element potentials.
size_t m_eloc
Index of the element id corresponding to the electric charge of each species.
double calcEmoles(ThermoPhase &s, span< double > x, const double &n_t, span< const double > Xmol_i_calc, span< double > eMolesCalc, span< double > n_i_calc, double pressureConst)
Given a vector of dimensionless element abundances, this routine calculates the moles of the elements...
void initialize(ThermoPhase &s)
Prepare for equilibrium calculations.
EquilOpt options
Options controlling how the calculation is carried out.
vector< double > m_molefractions
Current value of the mole fractions in the single phase. length = m_kk.
vector< double > m_comp
Storage of the element compositions. natom(k,m) = m_comp[k*m_mm+ m];.
double nAtoms(size_t k, size_t m) const
number of atoms of element m in species k.
double m_elemFracCutoff
element fractional cutoff, below which the element will be zeroed.
vector< double > m_muSS_RT
Dimensionless values of the Gibbs free energy for the standard state of each species,...
void dampStep(span< double > oldx, span< double > step, span< double > x)
Find an acceptable step size and take it.
vector< double > m_elementmolefracs
Current value of the element mole fractions.
size_t m_mm
number of elements in the phase
void setToEquilState(ThermoPhase &s, span< const double > x, double t)
Set mixture to an equilibrium state consistent with specified element potentials and temperature.
int estimateEP_Brinkley(ThermoPhase &s, span< double > lambda, span< double > elMoles)
Do a calculation of the element potentials using the Brinkley method, p.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
Chemical equilibrium options.
double absElemTol
Abs Tol in element number.
int iterations
Iteration counter.
bool enforceTemperatureLimits
Enforce temperature validity limits during equilibrium solver iterations.
double relTolerance
Relative tolerance.
int maxIterations
Maximum number of iterations.
Base class for a phase with thermodynamic properties.
This file contains definitions of constants, types and terms that are used in internal routines and a...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
int _equilflag(const char *xy)
map property strings to integers