139 double nAtoms(
size_t k,
size_t m)
const {
159 const vector<double>& x,
double t);
167 vector<double>& elMolesGoal,
int loglevel = 0);
218 double oldf, vector<double>& grad, vector<double>& step, vector<double>& x,
219 double& f, vector<double>& elmols,
double xval,
double yval);
225 const vector<double>& elmtotal, vector<double>& resid,
226 double xval,
double yval,
int loglevel = 0);
228 void equilJacobian(
ThermoPhase& s, vector<double>& x,
230 double xval,
double yval,
int loglevel = 0);
232 void adjustEloc(
ThermoPhase& s, vector<double>& elMolesGoal);
247 const double& n_t,
const vector<double>& Xmol_i_calc,
248 vector<double>& eMolesCalc, vector<double>& n_i_calc,
249 double pressureConst);
253 size_t m_skip =
npos;
271 vector<double> m_reswork;
272 vector<double> m_jwork1;
273 vector<double> m_jwork2;
277 double m_temp, m_dens;
284 vector<double> m_startSoln;
286 vector<double> m_grt;
287 vector<double> m_mu_RT;
293 vector<size_t> m_component;
297 bool m_doResPerturb =
false;
299 vector<size_t> m_orderVectorElements;
300 vector<size_t> m_orderVectorSpecies;
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
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.
int setInitialMoles(ThermoPhase &s, vector< double > &elMoleGoal, int loglevel=0)
Estimate the initial mole numbers.
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.
void setToEquilState(ThermoPhase &s, const vector< double > &x, double t)
Set mixture to an equilibrium state consistent with specified element potentials and temperature.
size_t m_eloc
Index of the element id corresponding to the electric charge of each species.
int estimateElementPotentials(ThermoPhase &s, vector< double > &lambda, vector< double > &elMolesGoal, int loglevel=0)
Generate a starting estimate for the element potentials.
int estimateEP_Brinkley(ThermoPhase &s, vector< double > &lambda, vector< double > &elMoles)
Do a calculation of the element potentials using the Brinkley method, p.
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.
int dampStep(ThermoPhase &s, vector< double > &oldx, double oldf, vector< double > &grad, vector< double > &step, vector< double > &x, double &f, vector< double > &elmols, double xval, double yval)
Find an acceptable step size and take it.
double calcEmoles(ThermoPhase &s, vector< double > &x, const double &n_t, const vector< double > &Xmol_i_calc, vector< double > &eMolesCalc, vector< double > &n_i_calc, double pressureConst)
Given a vector of dimensionless element abundances, this routine calculates the moles of the elements...
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.
void equilResidual(ThermoPhase &s, const vector< double > &x, const vector< double > &elmtotal, vector< double > &resid, double xval, double yval, int loglevel=0)
Evaluates the residual vector F, of length m_mm.
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,...
vector< double > m_elementmolefracs
Current value of the element mole fractions.
size_t m_mm
number of elements in the phase
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.
double maxStepSize
Maximum step size.
double relTolerance
Relative tolerance.
int maxIterations
Maximum number of iterations.
int propertyPair
Property pair flag.
bool contin
Continuation flag.
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...
const double OneAtm
One atmosphere [Pa].
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