8 #ifndef CT_CHEM_EQUIL_H 9 #define CT_CHEM_EQUIL_H 107 bool useThermoPhaseElementPotentials =
false,
int loglevel = 0);
129 bool useThermoPhaseElementPotentials =
false,
int loglevel = 0);
130 const vector_fp& elementPotentials()
const {
150 doublereal
nAtoms(
size_t k,
size_t m)
const {
178 vector_fp& elMolesGoal,
int loglevel = 0);
230 double& f,
vector_fp& elmols,
double xval,
double yval);
237 double xval,
double yval,
int loglevel = 0);
241 double xval,
double yval,
int loglevel = 0);
255 const double& n_t,
const vector_fp& Xmol_i_calc,
257 double pressureConst);
267 std::function<double(ThermoPhase&)> m_p1, m_p2;
288 doublereal m_temp, m_dens;
304 std::vector<size_t> m_component;
310 std::vector<size_t> m_orderVectorElements;
311 std::vector<size_t> m_orderVectorSpecies;
314 extern int ChemEquil_print_lvl;
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
EquilOpt options
Options controlling how the calculation is carried out.
vector_fp m_muSS_RT
Dimensionless values of the Gibbs free energy for the standard state of each species, at the temperature and pressure of the solution (the star standard state).
thermo_t * m_phase
Pointer to the ThermoPhase object used to initialize this object.
doublereal relTolerance
Relative tolerance.
int setInitialMoles(thermo_t &s, vector_fp &elMoleGoal, int loglevel=0)
Estimate the initial mole numbers.
doublereal nAtoms(size_t k, size_t m) const
number of atoms of element m in species k.
size_t m_kk
number of species in the phase
doublereal maxStepSize
Maximum step size.
doublereal m_elementTotalSum
Current value of the sum of the element abundances given the current element potentials.
int equilibrate(thermo_t &s, const char *XY, bool useThermoPhaseElementPotentials=false, int loglevel=0)
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
int propertyPair
Property pair flag.
void initialize(thermo_t &s)
size_t m_nComponents
This is equal to the rank of the stoichiometric coefficient matrix when it is computed.
vector_fp m_elementmolefracs
Current value of the element mole fractions.
void equilResidual(thermo_t &s, const vector_fp &x, const vector_fp &elmtotal, vector_fp &resid, double xval, double yval, int loglevel=0)
Evaluates the residual vector F, of length m_mm.
void update(const thermo_t &s)
Update internally stored state information.
int iterations
Iteration counter.
Base class for a phase with thermodynamic properties.
void setToEquilState(thermo_t &s, const vector_fp &x, doublereal t)
Chemical equilibrium options.
size_t m_eloc
Index of the element id corresponding to the electric charge of each species.
vector_fp m_comp
Storage of the element compositions. natom(k,m) = m_comp[k*m_mm+ m];.
doublereal absElemTol
Abs Tol in element number.
double m_elemFracCutoff
element fractional cutoff, below which the element will be zeroed.
int estimateEP_Brinkley(thermo_t &s, vector_fp &lambda, vector_fp &elMoles)
bool contin
Continuation flag.
int estimateElementPotentials(thermo_t &s, vector_fp &lambda, vector_fp &elMolesGoal, int loglevel=0)
Generate a starting estimate for the element potentials.
size_t m_mm
number of elements in the phase
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
vector_fp m_lambda
Current value of the dimensional element potentials. length = m_mm.
vector_fp m_molefractions
Current value of the mole fractions in the single phase. length = m_kk.
double calcEmoles(thermo_t &s, vector_fp &x, const double &n_t, const vector_fp &Xmol_i_calc, vector_fp &eMolesCalc, vector_fp &n_i_calc, double pressureConst)
Given a vector of dimensionless element abundances, this routine calculates the moles of the elements...
int maxIterations
Maximum number of iterations.
int _equilflag(const char *xy)
map property strings to integers
Namespace for the Cantera kernel.
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
int dampStep(thermo_t &s, vector_fp &oldx, double oldf, vector_fp &grad, vector_fp &step, vector_fp &x, double &f, vector_fp &elmols, double xval, double yval)
Find an acceptable step size and take it.