139 double nAtoms(
size_t k,
size_t m)
const {
166 span<double> elMolesGoal,
int loglevel = 0);
217 span<double> step, span<double> x,
double& f, span<double> elmols,
218 double xval,
double yval);
224 span<const double> elmtotal, span<double> resid,
225 double xval,
double yval,
int loglevel = 0);
229 double xval,
double yval,
int loglevel = 0);
231 void adjustEloc(
ThermoPhase& s, span<double> elMolesGoal);
246 span<const double> Xmol_i_calc, span<double> eMolesCalc,
247 span<double> n_i_calc,
double pressureConst);
251 size_t m_skip =
npos;
269 vector<double> m_reswork;
270 vector<double> m_jwork1;
271 vector<double> m_jwork2;
275 double m_temp, m_dens;
282 vector<double> m_startSoln;
284 vector<double> m_grt;
285 vector<double> m_mu_RT;
291 vector<size_t> m_component;
295 bool m_doResPerturb =
false;
297 vector<size_t> m_orderVectorElements;
298 vector<size_t> m_orderVectorSpecies;
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
int dampStep(ThermoPhase &s, span< double > oldx, double oldf, span< double > grad, span< double > step, span< double > x, double &f, span< double > elmols, double xval, double yval)
Find an acceptable step size and take it.
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,...
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.
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