20 static char pprefix[20] =
" --- vcs_inest: ";
23 double*
const ss,
double test)
25 size_t lt, ikl, kspec, iph, irxn;
34 double TMolesMultiphase;
52 plogf(
"%s Mole Numbers returned from linear programming (vcs_inest initial guess):\n",
54 plogf(
"%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix);
55 for (kspec = 0; kspec < nspecies; ++kspec) {
56 plogf(
"%s ", pprefix);
60 plogf(
"%s Element Abundance Agreement returned from linear "
61 "programming (vcs_inest initial guess):",
64 plogf(
"%s Element Goal Actual\n", pprefix);
69 for (kspec = 0; kspec < nspecies; ++kspec) {
72 plogf(
"%s ", pprefix);
88 for (kspec = 0; kspec < nspecies; ++kspec) {
108 (void)
vcs_basopt(
false, aw, sa, sm, ss, test, &conv);
129 TMolesMultiphase = 0.0;
157 for (kspec = 0; kspec < nspecies; ++kspec) {
158 plogf(
"%s", pprefix);
160 if (kspec < m_numComponents)
164 plogf(
"fe* = %15.5g ff = %15.5g dg* = %15.5g\n",
177 for (irxn = 0; irxn < nrxn; ++irxn) {
216 for (kspec = 0; kspec < nspecies; ++kspec) {
218 plogf(
"%sdirection (", pprefix);
225 plogf(
" (ssPhase doesn't exist -> stability not checked)");
245 if (par <= 1.0 && par > 0.0) {
262 for (kspec = m_numComponents; kspec < nspecies; ++kspec) {
282 for (kspec = 0, s = 0.0; kspec < nspecies; ++kspec) {
307 xl = (1.0 - s / (s1 - s)) * 0.5;
323 par = par * 2.0 * xl;
332 plogf(
"%s Final Mole Numbers produced by inest:\n",
334 plogf(
"%s SPECIES MOLE_NUMBER\n", pprefix);
335 for (kspec = 0; kspec < nspecies; ++kspec) {
336 plogf(
"%s ", pprefix);
360 plogf(
"%s Initial guess passed element abundances on input\n", pprefix);
361 plogf(
"%s m_doEstimateEquil = 1 so will use the input mole "
362 "numbers as estimates", pprefix);
370 plogf(
"%s Initial guess failed element abundances on input\n", pprefix);
371 plogf(
"%s m_doEstimateEquil = 1 so will discard input "
372 "mole numbers and find our own estimate", pprefix);
388 std::vector<double> ss(m_numElemConstraints, 0.0);
389 std::vector<double> sa(m_numElemConstraints, 0.0);
396 plogf(
"%sGo find an initial estimate for the equilibrium problem",
421 plogf(
"%sInitial guess failed element abundances\n", pprefix);
422 plogf(
"%sCall vcs_elcorr to attempt fix", pprefix);
428 plogf(
"%sInitial guess still fails element abundance equations\n",
430 plogf(
"%s - Inability to ever satisfy element abundance "
431 "constraints is probable", pprefix);
437 plogf(
"%sInitial guess now satisfies element abundances", pprefix);
440 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
441 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
442 "BUT not NE=%d element abundances", pprefix,
451 plogf(
"%sInitial guess satisfies element abundances", pprefix);
454 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
455 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
456 "BUT not NE=%d element abundances", pprefix,
465 plogf(
"%sTotal Dimensionless Gibbs Free Energy = %15.7E", pprefix,
std::vector< double > m_SSfeSpecies
Standard state chemical potentials for species K at the current temperature and pressure.
void vcs_elab()
Computes the current elemental abundances vector.
size_t m_numRxnTot
Total number of non-component species in the problem.
size_t m_numComponents
Number of components calculated for the problem.
int vcs_inest_TP()
Create an initial estimate of the solution to the thermodynamic equilibrium problem.
Declarations for a simple class that implements an Ansi C wall clock timer (see Cantera::clockWC).
#define VCS_DATA_PTR(vvv)
Points to the data in a std::vector<> object.
std::vector< size_t > m_indexRxnToSpecies
Mapping between the species index for noncomponent species and the full species index.
std::vector< double > m_tPhaseMoles_new
total kmols of species in each phase in the tentative soln vector
int m_debug_print_lvl
Debug printing lvl.
The class provides the wall clock timer in seconds.
std::vector< double > m_feSpecies_old
Free energy vector from the start of the current iteration.
void vcs_inest(double *const aw, double *const sa, double *const sm, double *const ss, double test)
Estimate equilibrium compositions.
int vcs_basopt(const bool doJustComponents, double aw[], double sa[], double sm[], double ss[], double test, bool *const usedZeroedSpecies)
Choose the optimum species basis for the calculations.
void vcs_dfe(const int stateCalc, const int ll, const size_t lbot, const size_t ltop)
Calculate the dimensionless chemical potentials of all species or of certain groups of species...
std::vector< double > m_deltaGRxn_new
Delta G(irxn) for the noncomponent species in the mechanism.
std::vector< double > m_elemAbundancesGoal
Element abundances vector Goals.
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and E...
Header for the object representing each phase within vcs.
#define VCS_SPECIES_TYPE_MOLNUM
Unknown refers to mole number of a single species.
int vcs_elcorr(double aa[], double x[])
int m_doEstimateEquil
Setting for whether to do an initial estimate.
std::vector< double > m_molNumSpecies_new
Tentative value of the mole number vector.
Internal declarations for the VCSnonideal package.
DoubleStarStar m_formulaMatrix
Formula matrix for the problem.
double secondsWC()
Returns the wall clock time in seconds since the last reset.
std::vector< double > m_molNumSpecies_old
Total moles of the species.
size_t m_numSpeciesTot
Total number of species in the problems.
DoubleStarStar m_deltaMolNumPhase
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction...
#define VCS_STATECALC_NEW
State Calculation based on the new or tentative mole numbers.
std::vector< std::string > m_elementName
Vector of strings containing the element names.
std::vector< int > m_elementActive
Specifies whether an element constraint is active.
double T_Time_inest
Time spent in initial estimator.
std::vector< double > m_deltaMolNumSpecies
Reaction Adjustments for each species during the current step.
size_t m_numElemConstraints
Number of element constraints in the problem.
std::vector< vcs_VolPhase * > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
double vcs_Total_Gibbs(double *w, double *fe, double *tPhMoles)
Calculate the total dimensionless Gibbs free energy.
size_t m_numPhases
Number of Phases in the problem.
std::vector< size_t > m_phaseID
Mapping from the species number to the phase number.
std::vector< double > m_feSpecies_new
Dimensionless new free energy for all the species in the mechanism at the new tentatite T...
#define VCS_STATECALC_OLD
State Calculation based on the old or base mole numbers.
std::vector< double > m_tPhaseMoles_old
Total kmols of species in each phase.
#define plogendl()
define this Cantera function to replace cout << endl;
double vcs_tmoles()
Calculates the total number of moles of species in all phases.
DoubleStarStar m_stoichCoeffRxnMatrix
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form...
std::vector< double > TPhInertMoles
Total kmoles of inert to add to each phase.
std::vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
bool vcs_elabcheck(int ibound)
int T_Calls_Inest
Current number of times the initial thermo equilibrium estimator has been called. ...
#define plogf
define this Cantera function to replace printf
#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE
Unknown refers to the voltage level of a phase.
std::vector< double > m_TmpPhase2
Temporary vector of length NPhase.
std::vector< int > m_speciesUnknownType
Specifies the species unknown type.
VCS_COUNTERS * m_VCount
Timing and iteration counters for the vcs object.
std::vector< double > m_TmpPhase
Temporary vector of length NPhase.
int vcs_setMolesLinProg()
Estimate the initial mole numbers by constrained linear programming.
std::vector< double > m_deltaPhaseMoles
Change in the total moles in each phase.
void vcs_deltag(const int l, const bool doDeleted, const int vcsState, const bool alterZeroedPhases=true)
This subroutine calculates reaction free energy changes for all noncomponent formation reactions...
std::vector< std::string > m_speciesName
Species string name for the kth species.