24void printProgress(
const vector<string>& spName,
const vector<double>& soln,
25 const vector<double>& ff)
28 plogf(
" --- Summary of current progress:\n");
29 plogf(
" --- Name Moles - SSGibbs \n");
30 plogf(
" -------------------------------------------------------------------------------------\n");
31 for (
size_t k = 0; k < soln.size(); k++) {
32 plogf(
" --- %20s %12.4g - %12.4g\n", spName[k], soln[k], ff[k]);
33 sum += soln[k] * ff[k];
35 plogf(
" --- Total sum to be minimized = %g\n", sum);
43 m_nsp(mphase->nSpecies()),
44 m_numSpeciesRdc(mphase->nSpecies()),
45 m_numPhases(mphase->nPhases()),
46 m_temperature(mphase->temperature()),
47 m_pressurePA(mphase->pressure()),
50 string ser =
"VCS_SOLVE: ERROR:\n\t";
52 plogf(
"%s Number of species is nonpositive\n", ser);
54 " Number of species is nonpositive\n");
57 plogf(
"%s Number of phases is nonpositive\n", ser);
59 " Number of phases is nonpositive\n");
130 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
135 if (tPhase->
nDim() != 3) {
137 "Surface/edge phase not handled yet.");
141 make_unique<vcs_VolPhase>(
this, tPhase, iphase));
146 size_t nSpPhase = tPhase->
nSpecies();
147 for (
size_t k = 0; k < nSpPhase; k++) {
191 for (
size_t j = 0; j <
m_nelem; j++) {
192 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
201 writeline(
'=', 80,
true,
true);
202 writeline(
'=', 16,
false);
203 plogf(
" Cantera_to_vprob: START OF PROBLEM STATEMENT ");
206 plogf(
" Phase IDs of species\n");
207 plogf(
" species phaseID phaseName ");
208 plogf(
" Initial_Estimated_kMols\n");
209 for (
size_t i = 0; i <
m_nsp; i++) {
223 writeline(
'-', 80,
true,
true);
224 plogf(
" Information about phases\n");
225 plogf(
" PhaseName PhaseNum SingSpec EqnState NumSpec "
228 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
236 writeline(
'=', 80,
true,
true);
237 writeline(
'=', 16,
false);
238 plogf(
" Cantera_to_vprob: END OF PROBLEM STATEMENT ");
246 for (
size_t i = 0; i <
m_nsp; i++) {
251 for (
size_t i = 0; i <
m_nelem; i++) {
258 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
262 "Species to Phase Mapping, PhaseID, has a bad value\n"
263 "\tm_phaseID[{}] = {}\n"
264 "Allowed values: 0 to {}", kspec, iph,
m_numPhases - 1);
272 if (numPhSp[iph] != Vphase->
nSpecies()) {
274 "Number of species in phase {}, {}, doesn't match ({} != {}) [vphase = {}]",
279 for (
size_t i = 0; i <
m_nelem; i++) {
284 "Charge neutrality condition {} is signicantly "
285 "nonzero, {}. Giving up",
289 plogf(
"Charge neutrality condition %s not zero, %g. Setting it zero\n",
299 for (
size_t i = 0; i <
m_nsp; i++) {
316 for (
size_t k = 1; k < Vphase->
nSpecies(); k++) {
326VCS_SOLVE::~VCS_SOLVE()
335 "called for a phase that exists!");
341 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
344 "VCS_SOLVE::vcs_popPhasePossible",
345 "we shouldn't be here {}: {} > 0.0", kspec,
349 bool iPopPossible =
true;
359 double negChangeComp = - stoicC;
360 if (negChangeComp > 0.0) {
364 iPopPossible =
false;
379 for (
size_t jrxn = 0; jrxn <
m_numRxnRdc; jrxn++) {
380 bool foundJrxn =
false;
422 size_t iphasePop =
npos;
423 double FephaseMax = -1.0E30;
424 double Fephase = -1.0E30;
428 plogf(
" --- vcs_popPhaseID() called\n");
429 plogf(
" --- Phase Status F_e MoleNum\n");
430 plogf(
" --------------------------------------------------------------------------\n");
434 int existence = Vphase->
exists();
438 plogf(
" --- %18s %5d NA %11.3e\n",
455 "Index out of bounds due to logic error.");
458 Fephase = exp(-deltaGRxn) - 1.0;
460 note =
"(ready to be birthed)";
461 if (Fephase > FephaseMax) {
463 FephaseMax = Fephase;
464 note =
"(chosen to be birthed)";
468 note =
"(not stable)";
470 "VCS_SOLVE::vcs_popPhaseID",
"shouldn't be here");
474 plogf(
" --- %18s %5d %10.3g %10.3g %s\n",
482 if (Fephase > FephaseMax) {
484 FephaseMax = Fephase;
487 FephaseMax = std::max(FephaseMax, Fephase);
490 plogf(
" --- %18s %5d %11.3g %11.3g\n",
495 plogf(
" --- %18s %5d blocked %11.3g\n",
504 plogf(
" ---------------------------------------------------------------------\n");
515 "called for a phase whose species is a component");
518 vector<size_t> creationGlobalRxnNumbers(Vphase->
nSpecies(),
npos);
526 "called for a phase that exists!");
528 plogf(
" --- vcs_popPhaseRxnStepSizes() called to pop phase %s %d into existence\n",
574 vector<double> fracDelta(Vphase->
nSpecies());
575 vector<double> X_est(Vphase->
nSpecies());
577 copy(storedDelta.begin(), storedDelta.end(), fracDelta.begin());
579 double sumFrac = 0.0;
580 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
581 sumFrac += fracDelta[k];
583 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
584 X_est[k] = fracDelta[k] / sumFrac;
587 double deltaMolNumPhase = tPhaseMoles;
592 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
594 double delmol = deltaMolNumPhase * X_est[k];
598 throw CanteraError(
"VCS_SOLVE::vcs_popPhaseRxnStepSizes",
599 "Index out of bounds due to logic error.");
604 molNumSpecies_tmp[j] += stoicC * delmol;
610 double ratioComp = 0.0;
613 if (molNumSpecies_tmp[j] < 0.0) {
617 damp = std::min(damp, delta0 / deltaJ * 0.9);
622 if ((jph != iphasePop) && (!
m_SSPhase[j])) {
623 double fdeltaJ = fabs(deltaJ);
636 if (ratioComp > 1.0E-30 && ratioComp < 0.001) {
637 damp = 0.001 / ratioComp;
639 if (damp <= 1.0E-6) {
643 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
659 size_t iphDel =
npos;
663 for (
int j = 0; j < 82; j++) {
667 plogf(
" --- Subroutine vcs_RxnStepSizes called - Details:\n");
669 for (
int j = 0; j < 82; j++) {
673 plogf(
" --- Species KMoles Rxn_Adjustment DeltaG\n");
683 for (
size_t irxn = 0; irxn <
m_numRxnRdc; ++irxn) {
711 if (Vphase->
exists() > 0 && trphmoles > 0.0) {
727 plogf(
" %12.4E %12.4E %12.4E\n",
739 plogf(
" %12.4E %12.4E %12.4E\n",
831 if ((k == kspec) && (
m_SSPhase[kspec] != 1)) {
841 plogf(
" %12.4E %12.4E %12.4E\n",
849 for (
size_t j = 0; j <
m_nsp; j++) {
865 plogf(
" %12.4E %12.4E %12.4E\n",
868 plogf(
" --- vcs_RxnStepSizes Special section to set up to delete %s\n",
872 forceComponentCalc = 1;
885 plogf(
" %12.4E %12.4E %12.4E\n",
902 const size_t nsp = Vphase->
nSpecies();
903 int minNumberIterations = 3;
905 minNumberIterations = 1;
909 bool doSuccessiveSubstitution =
true;
910 double funcPhaseStability;
911 vector<double> X_est(nsp, 0.0);
912 vector<double> delFrac(nsp, 0.0);
913 vector<double> E_phi(nsp, 0.0);
914 vector<double> fracDelta_old(nsp, 0.0);
915 vector<double> fracDelta_raw(nsp, 0.0);
916 vector<size_t> creationGlobalRxnNumbers(nsp,
npos);
925 vector<double> fracDelta_new(nsp, 0.0);
927 copy(storedDelta.begin(), storedDelta.end(), fracDelta_new.begin());
929 vector<size_t> componentList;
930 for (
size_t k = 0; k < nsp; k++) {
933 componentList.push_back(k);
937 double normUpdate = 0.1 *
vcs_l2norm(fracDelta_new);
938 double damp = 1.0E-2;
940 if (doSuccessiveSubstitution) {
943 plogf(
" --- vcs_phaseStabilityTest() called\n");
944 plogf(
" --- Its X_old[%2d] FracDel_old[%2d] deltaF[%2d] FracDel_new[%2d]"
945 " normUpdate damp FuncPhaseStability\n", KP, KP, KP, KP);
946 plogf(
" --------------------------------------------------------------"
947 "--------------------------------------------------------\n");
949 plogf(
" --- vcs_phaseStabilityTest() called for phase %d\n", iph);
952 for (
size_t k = 0; k < nsp; k++) {
953 if (fracDelta_new[k] < 1.0E-13) {
954 fracDelta_new[k] =1.0E-13;
957 bool converged =
false;
958 double dirProd = 0.0;
959 for (
int its = 0; its < 200 && (!converged); its++) {
960 double dampOld = damp;
961 double normUpdateOld = normUpdate;
962 fracDelta_old = fracDelta_new;
963 double dirProdOld = dirProd;
967 for (
size_t i = 0; i < componentList.size(); i++) {
968 size_t kc = componentList[i];
970 fracDelta_old[kc] = 0.0;
971 for (
size_t k = 0; k < nsp; k++) {
981 double sumFrac = 0.0;
982 for (
size_t k = 0; k < nsp; k++) {
983 sumFrac += fracDelta_old[k];
987 if (sumFrac <= 0.0) {
990 double sum_Xcomp = 0.0;
991 for (
size_t k = 0; k < nsp; k++) {
992 X_est[k] = fracDelta_old[k] / sumFrac;
994 sum_Xcomp += X_est[k];
1007 for (
size_t i = 0; i < componentList.size(); i++) {
1008 size_t kc = componentList[i];
1015 for (
size_t i = 0; i < componentList.size(); i++) {
1017 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
1034 funcPhaseStability = sum_Xcomp - 1.0;
1035 for (
size_t k = 0; k < nsp; k++) {
1042 funcPhaseStability += E_phi[k];
1049 for (
size_t k = 0; k < nsp; k++) {
1051 double b = E_phi[k] / sum * (1.0 - sum_Xcomp);
1053 fracDelta_raw[k] = b;
1059 for (
size_t i = 0; i < componentList.size(); i++) {
1060 size_t kc = componentList[i];
1062 fracDelta_raw[kc] = 0.0;
1063 for (
size_t k = 0; k < nsp; k++) {
1073 for (
size_t k = 0; k < nsp; k++) {
1074 delFrac[k] = fracDelta_raw[k] - fracDelta_old[k];
1079 for (
size_t k = 0; k < nsp; k++) {
1080 dirProd += fracDelta_old[k] * delFrac[k];
1082 bool crossedSign =
false;
1083 if (dirProd * dirProdOld < 0.0) {
1088 if (dampOld < 0.25) {
1089 damp = 2.0 * dampOld;
1092 if (normUpdate *1.5 > normUpdateOld) {
1093 damp = 0.5 * dampOld;
1094 }
else if (normUpdate *2.0 > normUpdateOld) {
1095 damp = 0.8 * dampOld;
1098 if (normUpdate > normUpdateOld * 2.0) {
1099 damp = 0.6 * dampOld;
1100 }
else if (normUpdate > normUpdateOld * 1.2) {
1101 damp = 0.9 * dampOld;
1105 for (
size_t k = 0; k < nsp; k++) {
1106 if (fabs(damp * delFrac[k]) > 0.3*fabs(fracDelta_old[k])) {
1107 damp = std::max(0.3*fabs(fracDelta_old[k]) / fabs(delFrac[k]),
1108 1.0E-8/fabs(delFrac[k]));
1110 if (delFrac[k] < 0.0 && 2.0 * damp * (-delFrac[k]) > fracDelta_old[k]) {
1111 damp = fracDelta_old[k] / (2.0 * -delFrac[k]);
1113 if (delFrac[k] > 0.0 && 2.0 * damp * delFrac[k] > fracDelta_old[k]) {
1114 damp = fracDelta_old[k] / (2.0 * delFrac[k]);
1117 damp = std::max(damp, 0.000001);
1118 for (
size_t k = 0; k < nsp; k++) {
1119 fracDelta_new[k] = fracDelta_old[k] + damp * delFrac[k];
1123 plogf(
" --- %3d %12g %12g %12g %12g %12g %12g %12g\n", its, X_est[KP], fracDelta_old[KP],
1124 delFrac[KP], fracDelta_new[KP], normUpdate, damp, funcPhaseStability);
1127 if (normUpdate < 1.0E-5 * damp) {
1129 if (its < minNumberIterations) {
1144 throw CanteraError(
"VCS_SOLVE::vcs_phaseStabilityTest",
"not done yet");
1147 plogf(
" ------------------------------------------------------------"
1148 "-------------------------------------------------------------\n");
1150 if (funcPhaseStability > 0.0) {
1151 plogf(
" --- phase %d with func = %g is to be born\n", iph, funcPhaseStability);
1153 plogf(
" --- phase %d with func = %g stays dead\n", iph, funcPhaseStability);
1156 return funcPhaseStability;
1166 for (
size_t k = 0; k <
m_nsp; k++) {
1190 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1192 for (
size_t e = 0; e <
m_nelem; e++) {
1195 m_spSize[kspec] = (sz > 0.0) ? sz : 1.0;
1212 double test = -1.0e-10;
1213 bool modifiedSoln =
false;
1216 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1221 if (fabs(sum) < 1.0E-6) {
1222 modifiedSoln =
true;
1225 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1255 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1274 for (
size_t e = 0; e < m_mix->
nElements(); e++) {
1277 if (sum < 1.0E-20) {
1278 throw CanteraError(
"VCS_SOLVE::vcs_prep",
"The problem is not well posed"
1279 " because the total number of element moles is zero.");
1293 plogf(
" --- Subroutine elem_rearrange() called to ");
1294 plogf(
"check stoich. coefficient matrix\n");
1295 plogf(
" --- and to rearrange the element ordering once\n");
1301 double test = -1.0E10;
1304 for (
size_t i = 0; i <
m_nelem; ++i) {
1307 if (test == aw[i]) {
1316 while (jr < ncomponents) {
1325 for (
size_t ielem = jr; ielem <
m_nelem; ielem++) {
1333 "Shouldn't be here. Algorithm misfired.");
1350 for (
size_t j = 0; j < ncomponents; ++j) {
1357 for (
size_t j = 0; j < jl; ++j) {
1359 for (
size_t i = 0; i < ncomponents; ++i) {
1360 ss[j] += sm[i + jr*ncomponents] * sm[i + j*ncomponents];
1367 for (
size_t j = 0; j < jl; ++j) {
1368 for (
size_t i = 0; i < ncomponents; ++i) {
1369 sm[i + jr*ncomponents] -= ss[j] * sm[i + j*ncomponents];
1377 for (
size_t ml = 0; ml < ncomponents; ++ml) {
1378 sa[jr] += pow(sm[ml + jr*ncomponents], 2);
1381 if (sa[jr] > 1.0e-6) {
1388 plogf(
" --- %-2.2s(%9.2g) replaces %-2.2s(%9.2g) as element %3d\n",
1393 std::swap(aw[jr], aw[k]);
1407 "vcs_switch_elem_pos",
1408 "inappropriate args: {} {}", ipos, jpos);
1428 for (
size_t j = 0; j <
m_nsp; ++j) {
1436 double diag = hessianDiag_Ideal;
1438 if (hessianDiag_Ideal <= 0.0) {
1440 "We shouldn't be here");
1442 if (hessActCoef >= 0.0) {
1443 diag += hessActCoef;
1444 }
else if (fabs(hessActCoef) < 0.6666 * hessianDiag_Ideal) {
1445 diag += hessActCoef;
1447 diag -= 0.6666 * hessianDiag_Ideal;
1486 if (!Vphase->m_singleSpecies && !Vphase->isIdealSoln()) {
1500 vector<pair<double, size_t>> x_order;
1501 for (
size_t i = 0; i <
m_nsp; i++) {
1514 plogf(
"\t\t VCS_TP REPORT\n");
1518 plogf(
" ERROR: CONVERGENCE CRITERION NOT SATISFIED.\n");
1519 }
else if (iconv == 1) {
1520 plogf(
" RANGE SPACE ERROR: Equilibrium Found but not all Element Abundances are Satisfied\n");
1525 double totalVolume = 0.0;
1526 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
1531 totalVolume += Volp;
1536 plogf(
"\t\ttotal Volume = %15.5g m**3\n", totalVolume);
1541 plogf(
" Species Equilibrium kmoles ");
1542 plogf(
"Mole Fraction ChemPot/RT SpecUnkType\n");
1546 writeline(
' ', 13,
false);
1553 size_t j = x_order[i].second;
1555 writeline(
' ', 13,
false);
1565 throw CanteraError(
"VCS_SOLVE::vcs_report",
"we have a problem");
1570 plogf(
"\n SPECIES WITH LESS THAN 1.0E-32 KMOLES:\n\n");
1574 plogf(
" %14.7E %14.7E %12.4E",
1592 plogf(
" |ComponentID|");
1597 plogf(
" | Components|");
1602 plogf(
" NonComponent | Moles |");
1606 plogf(
" | DG/RT Rxn |\n");
1608 for (
size_t irxn = 0; irxn <
m_numRxnTot; irxn++) {
1610 plogf(
" %3d ", kspec);
1623 vector<double> gaTPhase(
m_nelem, 0.0);
1624 double totalMoles = 0.0;
1625 double gibbsPhase = 0.0;
1626 double gibbsTotal = 0.0;
1629 writeline(
'-',
m_nelem*10 + 58);
1630 plogf(
" | ElementID |");
1631 for (
size_t j = 0; j <
m_nelem; j++) {
1635 plogf(
" | Element |");
1636 for (
size_t j = 0; j <
m_nelem; j++) {
1640 plogf(
" PhaseName |KMolTarget |");
1641 for (
size_t j = 0; j <
m_nelem; j++) {
1644 plogf(
" | Gibbs Total |\n");
1645 writeline(
'-',
m_nelem*10 + 58);
1646 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
1647 plogf(
" %3d ", iphase);
1654 throw CanteraError(
"VCS_SOLVE::vcs_report",
"we have a problem");
1657 for (
size_t j = 0; j <
m_nelem; ++j) {
1658 double abundance_j = 0.0;
1659 for (
size_t i = 0; i <
m_nsp; ++i) {
1666 plogf(
" %10.3g", abundance_j);
1667 gaTPhase[j] += abundance_j;
1675 gibbsTotal += gibbsPhase;
1676 plogf(
" | %18.11E |\n", gibbsPhase);
1678 writeline(
'-',
m_nelem*10 + 58);
1679 plogf(
" TOTAL |%10.3e |", totalMoles);
1680 for (
size_t j = 0; j <
m_nelem; j++) {
1681 plogf(
" %10.3g", gaTPhase[j]);
1683 plogf(
" | %18.11E |\n", gibbsTotal);
1685 writeline(
'-',
m_nelem*10 + 58);
1692 plogf(
"\n\tTotal Dimensionless Gibbs Free Energy = G/RT = %15.7E\n", g);
1693 plogf(
"\nElemental Abundances (kmol): ");
1694 plogf(
" Actual Target Type ElActive\n");
1695 for (
size_t i = 0; i <
m_nelem; ++i) {
1696 writeline(
' ', 26,
false);
1704 writeline(
'-', 93,
true,
true);
1705 plogf(
"Chemical Potentials of the Species: (dimensionless)\n");
1708 plogf(
" Name TKMoles StandStateChemPot "
1709 " ln(AC) ln(X_i) | F z_i phi | ChemPot | (-lnMnaught)");
1710 plogf(
"| (MolNum ChemPot)|");
1711 writeline(
'-', 147,
true,
true);
1712 for (
size_t i = 0; i <
m_nsp; ++i) {
1713 size_t j = x_order[i].second;
1728 lx = log(tmp) - log(tpmoles);
1734 plogf(
"%14.7E |", lx);
1735 plogf(
"%14.7E | ", eContrib);
1740 "we have a problem - doesn't add up");
1752 for (
size_t i = 0; i < 125; i++) {
1755 plogf(
" %20.9E\n", g);
1756 writeline(
'-', 147);
1760 plogf(
"\nCounters: Iterations\n");
1769 for (
size_t j = 0; j <
m_nelem; ++j) {
1771 for (
size_t i = 0; i <
m_nsp; ++i) {
1782 for (
size_t i = 0; i < top; ++i) {
1789 "Problem with charge neutrality condition");
1798 bool multisign =
false;
1799 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1833 plogf(
" --- vcsc_elcorr: Element abundances correction routine");
1835 plogf(
" (m_numComponents != m_nelem)");
1840 for (
size_t i = 0; i <
m_nelem; ++i) {
1843 double l2before = 0.0;
1844 for (
size_t i = 0; i <
m_nelem; ++i) {
1845 l2before += x[i] * x[i];
1847 l2before = sqrt(l2before/
m_nelem);
1852 bool changed =
false;
1853 for (
size_t i = 0; i <
m_nelem; ++i) {
1855 bool multisign =
false;
1856 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1868 if (numNonZero < 2) {
1869 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1879 int numCompNonZero = 0;
1880 size_t compID =
npos;
1890 if (numCompNonZero == 1) {
1916 for (
size_t i = 0; i <
m_nelem; ++i) {
1919 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1922 if (atomComp > 0.0) {
1926 plogf(
" --- vcs_elcorr: Reduced species %s from %g to %g "
1927 "due to %s max bounds constraint\n",
1941 plogf(
" --- vcs_elcorr: Zeroed species %s and changed "
1942 "status to %d due to max bounds constraint\n",
1963 if (fabs(x[i]) > 1.0E-13) {
1980 par = std::min(par, 100.0);
1982 if (par < 1.0 && par > 0.0) {
2006 auto finalize = [&]() {
2008 double l2after = 0.0;
2009 for (
size_t i = 0; i <
m_nelem; ++i) {
2012 l2after = sqrt(l2after/
m_nelem);
2014 plogf(
" --- Elem_Abund: Correct Initial "
2016 for (
size_t i = 0; i <
m_nelem; ++i) {
2021 plogf(
" --- Diff_Norm: %20.12E %20.12E\n",
2029 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
2033 double saveDir = 0.0;
2034 bool goodSpec =
true;
2037 if (fabs(dir) > 1.0E-10) {
2039 if (saveDir < 0.0) {
2043 }
else if (saveDir > 0.0) {
2086 for (
size_t i = 0; i <
m_nelem; ++i) {
2112 for (
size_t i = 0; i <
m_nelem; ++i) {
2115 bool useZeroed =
true;
2156 double test = -1.0E-10;
2159 plogf(
" --- call setInitialMoles\n");
2163 bool abundancesOK =
true;
2165 vector<double> ss(
m_nelem, 0.0);
2166 vector<double> sa(
m_nelem, 0.0);
2167 vector<double> wx(
m_nelem, 0.0);
2168 vector<double> aw(
m_nsp, 0.0);
2170 for (
size_t ik = 0; ik <
m_nsp; ik++) {
2184 plogf(
" --- seMolesLinProg Mole numbers failing element abundances\n");
2185 plogf(
" --- seMolesLinProg Call vcs_elcorr to attempt fix\n");
2188 abundancesOK = (retn < 2);
2190 abundancesOK =
true;
2199 plogf(
"iteration %d\n", iter);
2208 for (
size_t irxn = 0; irxn <
m_numRxnTot; irxn++) {
2212 double dxi_min = 1.0e10;
2214 for (
size_t jcomp = 0; jcomp <
m_nelem; jcomp++) {
2220 int idir = (dg_rt < 0.0 ? 1 : -1);
2226 double nu = sc_irxn[jcomp];
2239 dxi_min = std::min(dxi_min, delta_xi);
2246 double dsLocal = idir*dxi_min;
2269 plogf(
" --- setInitialMoles end\n");
2271 if (!abundancesOK) {
2273 }
else if (iter > 15) {
2280 span<const double> chemPot,
2281 span<const double> tPhMoles)
2287 g += molesSp[kspec] * chemPot[kspec];
2302 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2309 if ((nSpPhase == 1) && (volPhase->
phiVarIndex() == 0)) {
2320 writeline(
'=', 80,
true,
true);
2321 writeline(
'=', 20,
false);
2322 plogf(
" Cantera_to_vprob: START OF PROBLEM STATEMENT ");
2326 plogf(
" Phase IDs of species\n");
2327 plogf(
" species phaseID phaseName ");
2328 plogf(
" Initial_Estimated_kMols\n");
2329 for (
size_t i = 0; i <
m_nsp; i++) {
2342 writeline(
'-', 80,
true,
true);
2343 plogf(
" Information about phases\n");
2344 plogf(
" PhaseName PhaseNum SingSpec EqnState NumSpec "
2347 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2355 writeline(
'=', 80,
true,
true);
2356 writeline(
'=', 20,
false);
2357 plogf(
" Cantera_to_vprob: END OF PROBLEM STATEMENT ");
2373 const char* pprefix =
" --- vcs_inest: ";
2379 plogf(
"%s Initial guess passed element abundances on input\n", pprefix);
2380 plogf(
"%s m_doEstimateEquil = 1 so will use the input mole "
2381 "numbers as estimates\n", pprefix);
2385 plogf(
"%s Initial guess failed element abundances on input\n", pprefix);
2386 plogf(
"%s m_doEstimateEquil = 1 so will discard input "
2387 "mole numbers and find our own estimate\n", pprefix);
2393 vector<double> ss(
m_nelem, 0.0);
2394 vector<double> sa(
m_nelem, 0.0);
2399 plogf(
"%sGo find an initial estimate for the equilibrium problem\n",
2402 double test = -1.0E20;
2410 plogf(
"%s Mole Numbers returned from linear programming (vcs_inest initial guess):\n",
2412 plogf(
"%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix);
2413 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2414 plogf(
"%s ", pprefix);
2418 plogf(
"%s Element Abundance Agreement returned from linear "
2419 "programming (vcs_inest initial guess):\n", pprefix);
2420 plogf(
"%s Element Goal Actual\n", pprefix);
2421 for (
size_t j = 0; j <
m_nelem; j++) {
2424 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2427 plogf(
"%s ", pprefix);
2438 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2466 double TMolesMultiphase = 0.0;
2492 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2493 plogf(
"%s", pprefix);
2499 plogf(
"fe* = %15.5g ff = %15.5g dg* = %15.5g\n",
2513 for (
size_t irxn = 0; irxn < nrxn; ++irxn) {
2547 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2549 plogf(
"%sdirection (", pprefix);
2556 plogf(
" (ssPhase doesn't exist -> stability not checked)");
2573 if (par <= 1.0 && par > 0.0) {
2609 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2615 if (s < 0.0 && ikl == 0) {
2628 double xl = (1.0 - s / (s1 - s)) * 0.5;
2638 par = par * 2.0 * xl;
2645 plogf(
"%s Final Mole Numbers produced by inest:\n",
2647 plogf(
"%s SPECIES MOLE_NUMBER\n", pprefix);
2648 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2649 plogf(
"%s %-12.12s %g\n",
2667 plogf(
"%sInitial guess failed element abundances\n", pprefix);
2668 plogf(
"%sCall vcs_elcorr to attempt fix\n", pprefix);
2674 "Initial guess still fails element abundance equations\n"
2675 "Inability to ever satisfy element abundance constraints is probable");
2679 plogf(
"%sInitial guess now satisfies element abundances\n", pprefix);
2681 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
2682 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
2683 "BUT not NE=%d element abundances\n", pprefix,
2691 plogf(
"%sInitial guess satisfies element abundances\n", pprefix);
2693 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
2694 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
2695 "BUT not NE=%d element abundances\n", pprefix,
2702 plogf(
"%sTotal Dimensionless Gibbs Free Energy = %15.7E\n", pprefix,
2712 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2726 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
2745 plogf(
"\nTCounters: Num_Calls Total_Its\n");
2746 plogf(
" vcs_basopt: %5d %5d\n",
2748 plogf(
" vcs_TP: %5d %5d\n",
2759 writeline(
'=', 80,
true,
true);
2760 writeline(
'=', 20,
false);
2761 plogf(
" VCS_PROB: PROBLEM STATEMENT ");
2765 plogf(
"\tSolve a constant T, P problem:\n");
2769 plogf(
"\t\tPres = %g atm\n", pres_atm);
2771 plogf(
" Phase IDs of species\n");
2772 plogf(
" species phaseID phaseName ");
2773 plogf(
" Initial_Estimated_Moles Species_Type\n");
2774 for (
size_t i = 0; i <
m_nsp; i++) {
2794 writeline(
'-', 80,
true,
true);
2795 plogf(
" Information about phases\n");
2796 plogf(
" PhaseName PhaseNum SingSpec EqnState NumSpec "
2799 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2812 plogf(
"\nElemental Abundances: ");
2813 plogf(
" Target_kmol ElemType ElActive\n");
2814 for (
size_t i = 0; i <
m_nelem; ++i) {
2815 writeline(
' ', 26,
false);
2821 plogf(
"\nChemical Potentials: (J/kmol)\n");
2822 plogf(
" Species (phase) "
2823 " SS0ChemPot StarChemPot\n");
2824 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2827 for (
size_t kindex = 0; kindex < Vphase->
nSpecies(); kindex++) {
2840 writeline(
'=', 80,
true,
true);
2841 writeline(
'=', 20,
false);
2842 plogf(
" VCS_PROB: END OF PROBLEM STATEMENT ");
2853 throw CanteraError(
"VCS_SOLVE::addOnePhaseSpecies",
"Shouldn't be here");
2859 "element not found");
2873 "error: element must have a name");
2891 for (
size_t e = 0; e <
m_nelem; e++) {
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Chemica...
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A class for 2D arrays stored in column-major (Fortran-compatible) form.
void zero()
Set all of the entries to zero.
size_t nColumns() const
Number of columns.
span< double > col(size_t j)
Return a writable span over column j.
virtual void resize(size_t n, size_t m, double v=0.0)
Resize the array, and fill the new entries with 'v'.
Base class for exceptions thrown by Cantera classes.
A class for full (non-sparse) matrices with Fortran-compatible data storage, which adds matrix operat...
A class for multiphase mixtures.
double speciesMoles(size_t kGlob) const
Returns the moles of global species k. units = kmol.
double pressure() const
Pressure [Pa].
double temperature() const
Temperature [K].
string speciesName(size_t kGlob) const
Name of species with global index kGlob.
size_t nElements() const
Number of elements.
ThermoPhase & phase(size_t n)
Return a reference to phase n.
double elementMoles(size_t m) const
Total moles of global element m, summed over all phases.
size_t nSpecies() const
Returns the number of species in the phase.
size_t nDim() const
Returns the number of spatial dimensions (1, 2, or 3)
double molecularWeight(size_t k) const
Molecular weight of species k.
double charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Base class for a phase with thermodynamic properties.
double electricPotential() const
Returns the electric potential of this phase (V).
Class to keep track of time and iterations.
int Its
Current number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
int T_Calls_Inest
Current number of times the initial thermo equilibrium estimator has been called.
int T_Basis_Opts
Total number of optimizations of the components basis set done.
int Basis_Opts
number of optimizations of the components basis set done
int T_Its
Total number of iterations in the main loop of vcs_TP() to solve for thermo equilibrium.
int T_Calls_vcs_TP
Current number of calls to vcs_TP.
vector< double > m_deltaPhaseMoles
Change in the total moles in each phase.
size_t m_numPhases
Number of Phases in the problem.
int m_doEstimateEquil
Setting for whether to do an initial estimate.
vector< double > m_deltaMolNumSpecies
Reaction Adjustments for each species during the current step.
VCS_SOLVE(MultiPhase *mphase, int printLvl=0)
Initialize the sizes within the VCS_SOLVE object.
vector< double > m_spSize
total size of the species
vector< double > m_scSize
Absolute size of the stoichiometric coefficients.
int vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres)
Evaluate the standard state free energies at the current temperature and pressure.
vector< double > m_sm
QR matrix work space used in vcs_basopt()
vector< double > m_wtSpecies
Molecular weight of each species.
vector< size_t > m_indexRxnToSpecies
Mapping between the species index for noncomponent species and the full species index.
void vcs_prep(int printLvl)
This routine is mostly concerned with changing the private data to be consistent with what's needed f...
vector< double > m_sa
Gram-Schmidt work space used in vcs_basopt()
vector< size_t > m_phaseID
Mapping from the species number to the phase number.
vector< string > m_speciesName
Species string name for the kth species.
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.
double m_tolmaj2
Below this, major species aren't refined any more.
vector< double > m_deltaGRxn_new
Delta G(irxn) for the noncomponent species in the mechanism.
Array2D m_np_dLnActCoeffdMolNum
Change in the log of the activity coefficient with respect to the mole number multiplied by the phase...
void vcs_report(int iconv)
Print out a report on the state of the equilibrium problem to standard output.
size_t m_nelem
Number of element constraints in the problem.
vector< double > m_PMVolumeSpecies
Partial molar volumes of the species.
vector< int > m_elementActive
Specifies whether an element constraint is active.
int m_useActCoeffJac
Choice of Hessians.
void vcs_CalcLnActCoeffJac(span< const double > moleSpeciesVCS)
Recalculate all of the activity coefficients in all of the phases based on input mole numbers.
vector< size_t > m_speciesLocalPhaseIndex
Index that keeps track of the index of the species within the local phase.
void vcs_basopt(const bool doJustComponents, double test)
Choose the optimum species basis for the calculations.
vector< string > m_elementName
Vector of strings containing the element names.
vector< int > m_speciesUnknownType
Specifies the species unknown type.
vector< double > m_TmpPhase
Temporary vector of length NPhase.
vector< size_t > m_speciesMapIndex
Index vector that keeps track of the species vector rearrangement.
Array2D m_phaseParticipation
This is 1 if the phase, iphase, participates in the formation reaction irxn, and zero otherwise.
vector< int > m_actConventionSpecies
specifies the activity convention of the phase containing the species
double vcs_phaseStabilityTest(const size_t iph)
Main program to test whether a deleted phase should be brought back into existence.
void vcs_inest()
Create an initial estimate of the solution to the equilibrium problem.
vector< double > m_elemAbundances
Element abundances vector.
vector< double > m_tPhaseMoles_new
total kmols of species in each phase in the tentative soln vector
vector< double > m_actCoeffSpecies_old
Molar-based Activity Coefficients for Species based on old mole numbers.
vector< double > m_SSfeSpecies
Standard state chemical potentials for species K at the current temperature and pressure.
bool vcs_popPhasePossible(const size_t iphasePop) const
Utility function that evaluates whether a phase can be popped into existence.
vector< double > m_lnMnaughtSpecies
specifies the ln(Mnaught) used to calculate the chemical potentials
vector< int > m_elType
Type of the element constraint.
void vcs_elab()
Computes the current elemental abundances vector.
void prob_report(int print_lvl)
Print out the problem specification in all generality as it currently exists in the VCS_SOLVE object.
int vcs_setMolesLinProg()
Estimate the initial mole numbers by constrained linear programming.
vector< double > m_molNumSpecies_old
Total moles of the species.
vector< size_t > m_elementMapIndex
Index vector that keeps track of the rearrangement of the elements.
vector< double > m_aw
work array of mole fractions used in vcs_basopt()
size_t m_numSpeciesRdc
Current number of species in the problems.
vector< double > m_feSpecies_old
Free energy vector from the start of the current iteration.
int m_debug_print_lvl
Debug printing lvl.
void vcs_counters_init(int ifunc)
Initialize the internal counters.
void vcs_reinsert_deleted(size_t kspec)
We make decisions on the initial mole number, and major-minor status here.
vector< double > m_ss
Gram-Schmidt work space used in vcs_basopt()
vector< double > m_chargeSpecies
Charge of each species. Length = number of species.
Array2D m_formulaMatrix
Formula matrix for the problem.
size_t addOnePhaseSpecies(vcs_VolPhase *volPhase, size_t k, size_t kT)
Add elements to the local element list This routines adds entries for the formula matrix for one spec...
Array2D m_stoichCoeffRxnMatrix
Stoichiometric coefficient matrix for the reaction mechanism expressed in Reduced Canonical Form.
size_t m_numRxnRdc
Current number of non-component species in the problem.
VCS_COUNTERS * m_VCount
Timing and iteration counters for the vcs object.
vector< double > m_deltaGRxn_Deficient
Last deltag[irxn] from the previous step with additions for possible births of zeroed phases.
vector< unique_ptr< vcs_VolPhase > > m_VolPhaseList
Array of Phase Structures. Length = number of phases.
double vcs_Hessian_diag_adj(size_t irxn, double hessianDiag_Ideal)
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficient...
size_t m_numComponents
Number of components calculated for the problem.
void vcs_prob_specifyFully()
Fully specify the problem to be solved.
double m_pressurePA
Pressure.
void vcs_SSPhase()
Calculate the status of single species phases.
vector< double > m_feSpecies_new
Dimensionless new free energy for all the species in the mechanism at the new tentative T,...
double m_Faraday_dim
dimensionless value of Faraday's constant, F / RT (1/volt)
void vcs_elem_rearrange()
Rearrange the constraint equations represented by the Formula Matrix so that the operational ones are...
size_t m_nsp
Total number of species in the problems.
vector< double > m_actCoeffSpecies_new
Molar-based Activity Coefficients for Species.
bool vcs_elabcheck(int ibound)
Checks to see if the element abundances are in compliance.
vector< char > m_SSPhase
Boolean indicating whether a species belongs to a single-species phase.
vector< double > m_phasePhi
electric potential of the iph phase
double vcs_Hessian_actCoeff_diag(size_t irxn)
Calculates the diagonal contribution to the Hessian due to the dependence of the activity coefficient...
vector< double > m_elemAbundancesGoal
Element abundances vector Goals.
size_t vcs_RxnStepSizes(int &forceComponentCalc, size_t &kSpecial)
Calculates formation reaction step sizes.
size_t vcs_popPhaseID()
Decision as to whether a phase pops back into existence.
Array2D m_deltaMolNumPhase
Change in the number of moles of phase, iphase, due to the noncomponent formation reaction,...
vector< int > m_phaseActConvention
specifies the activity convention of the phase.
vector< int > m_speciesStatus
Major -Minor status vector for the species in the problem.
vector< double > m_deltaGRxn_tmp
Temporary vector of Rxn DeltaG's.
vector< double > m_TmpPhase2
Temporary vector of length NPhase.
void vcs_switch_elem_pos(size_t ipos, size_t jpos)
Swaps the indices for all of the global data for two elements, ipos and jpos.
double vcs_tmoles()
Calculates the total number of moles of species in all phases.
size_t elementIndex(const string &elementName) const
Return the index of an element by name, or npos if not found.
int m_printLvl
Print level for print routines.
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,...
vector< double > m_tPhaseMoles_old
Total kmols of species in each phase.
double vcs_Total_Gibbs(span< const double > w, span< const double > fe, span< const double > tPhMoles)
Calculate the total dimensionless Gibbs free energy.
int vcs_popPhaseRxnStepSizes(const size_t iphasePop)
Calculates the deltas of the reactions due to phases popping into existence.
size_t m_numRxnTot
Total number of non-component species in the problem.
vector< double > m_molNumSpecies_new
Tentative value of the mole number vector.
double m_temperature
Temperature (Kelvin)
vector< double > m_deltaGRxn_old
Last deltag[irxn] from the previous step.
void vcs_TCounters_report()
Create a report on the plog file containing iteration counters.
int vcs_elcorr(span< double > aa, span< double > x)
This subroutine corrects for element abundances.
size_t addElement(const char *elNameNew, int elType, int elactive)
This routine resizes the number of elements in the VCS_SOLVE object by adding a new element to the en...
double m_totalMolNum
Total number of kmoles in all phases.
Phase information and Phase calculations for vcs.
int speciesUnknownType(const size_t k) const
Returns the type of the species unknown.
size_t elemGlobalIndex(const size_t e) const
Returns the global index of the local element index for the phase.
void setMolesFromVCS(const int stateCalc, span< const double > molesSpeciesVCS={})
Set the moles within the phase.
size_t nSpecies() const
Return the number of species in the phase.
string PhaseName
String name for the phase.
size_t VP_ID_
Original ID of the phase in the problem.
const Array2D & getFormulaMatrix() const
Get a constant form of the Species Formula Matrix.
void sendToVCS_ActCoeff(const int stateCalc, span< double > AC)
Fill in an activity coefficients vector within a VCS_SOLVE object.
size_t phiVarIndex() const
Return the index of the species that represents the the voltage of the phase.
bool m_singleSpecies
If true, this phase consists of a single species.
void setElemGlobalIndex(const size_t eLocal, const size_t eGlobal)
sets a local phase element to a global index value
int exists() const
Retrieve the kth Species structure for the species belonging to this phase.
size_t nElemConstraints() const
Returns the number of element constraints.
size_t spGlobalIndexVCS(const size_t spIndex) const
Return the Global VCS index of the kth species in the phase.
double GStar_calc_one(size_t kspec) const
Gibbs free energy calculation for standard state of one species.
int p_activityConvention
Convention for the activity formulation.
void setCreationMoleNumbers(span< const double > n_k, span< const size_t > creationGlobalRxnNumbers)
Sets the creationMoleNum's within the phase object.
span< const double > creationMoleNumbers(span< size_t > creationGlobalRxnNumbers) const
Return a const reference to the creationMoleNumbers stored in the object.
double G0_calc_one(size_t kspec) const
Gibbs free energy calculation at a temperature for the reference state of a species,...
void setState_TP(const double temperature_Kelvin, const double pressure_PA)
Sets the temperature and pressure in this object and underlying ThermoPhase objects.
string eos_name() const
Return the name corresponding to the equation of state.
void setMoleFractionsState(const double molNum, span< const double > moleFracVec, const int vcsStateStatus)
Set the moles and/or mole fractions within the phase.
double sendToVCS_VolPM(span< double > VolPM) const
Fill in the partial molar volume vector for VCS.
void sendToVCS_GStar(span< double > gstar) const
Fill in the standard state Gibbs free energy vector for VCS.
void setSpGlobalIndexVCS(const size_t spIndex, const size_t spGlobalIndex)
set the Global VCS index of the kth species in the phase
void setExistence(const int existence)
Set the existence flag in the object.
double totalMoles() const
Return the total moles in the phase.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
#define AssertThrowMsg(expr, procedure,...)
Assertion must be true or an error is thrown.
void debuglog(const string &msg, int loglevel)
Write a message to the log only if loglevel > 0.
void writelogendl()
Write an end of line character to the screen and flush output.
void scale(InputIter begin, InputIter end, OutputIter out, S scale_factor)
Multiply elements of an array by a scale factor.
T clip(const T &value, const T &lower, const T &upper)
Clip value such that lower <= value <= upper.
const double Faraday
Faraday constant [C/kmol].
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
void solve(DenseMatrix &A, span< double > b, size_t nrhs, size_t ldb)
Solve Ax = b. Array b is overwritten on exit with x.
bool vcs_doubleEqual(double d1, double d2)
Simple routine to check whether two doubles are equal up to roundoff error.
double vcs_l2norm(span< const double > vec)
determine the l2 norm of a vector of doubles
void checkArraySize(const char *procedure, size_t available, size_t required)
Wrapper for throwing ArraySizeError.
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
Contains declarations for string manipulation functions within Cantera.
Header for the object representing each phase within vcs.
#define VCS_SPECIES_INTERFACIALVOLTAGE
Species refers to an electron in the metal.
#define VCS_SPECIES_TYPE_INTERFACIALVOLTAGE
Unknown refers to the voltage level of a phase.
#define VCS_STATECALC_OLD
State Calculation based on the old or base mole numbers.
#define VCS_DELETE_MINORSPECIES_CUTOFF
Cutoff relative mole number value, below which species are deleted from the equilibrium problem.
#define VCS_SPECIES_COMPONENT
These defines are valid values for spStatus()
#define VCS_SPECIES_MAJOR
Species is a major species.
#define VCS_PHASE_EXIST_NO
Phase doesn't currently exist in the mixture.
#define VCS_PHASE_EXIST_ALWAYS
These defines are valid values for the phase existence flag.
#define VCS_SPECIES_STOICHZERO
Species lies in a multicomponent phase that is active, but species concentration is zero due to stoic...
#define VCS_ELEM_TYPE_ABSPOS
Normal element constraint consisting of positive coefficients for the formula matrix.
#define VCS_STATECALC_NEW
State Calculation based on the new or tentative mole numbers.
#define VCS_SPECIES_TYPE_MOLNUM
Unknown refers to mole number of a single species.
#define VCS_SPECIES_ZEROEDPHASE
Species lies in a multicomponent phase that is zeroed atm.
#define VCS_SPECIES_ACTIVEBUTZERO
Species lies in a multicomponent phase that is active, but species concentration is zero.
#define VCS_ELEM_TYPE_ELECTRONCHARGE
This refers to conservation of electrons.
#define VCS_SPECIES_ZEROEDSS
Species is a SS phase, that is currently zeroed out.
#define VCS_DELETE_PHASE_CUTOFF
Cutoff relative moles below which a phase is deleted from the equilibrium problem.
#define VCS_SMALL_MULTIPHASE_SPECIES
Relative value of multiphase species mole number for a multiphase species which is small.
#define VCS_ELEM_TYPE_CHARGENEUTRALITY
This refers to a charge neutrality of a single phase.
#define VCS_SPECIES_MINOR
Species is a major species.
#define VCS_DELETE_ELEMENTABS_CUTOFF
Cutoff moles below which a phase or species which comprises the bulk of an element's total concentrat...
#define VCS_PHASE_EXIST_YES
Phase is a normal phase that currently exists.
#define VCS_SUCCESS
ERROR CODES.
#define VCS_STATECALC_PHASESTABILITY
State Calculation based on tentative mole numbers for a phase which is currently zeroed,...
#define plogf
define this Cantera function to replace printf
Header file for the internal object that holds the vcs equilibrium problem (see Class VCS_SOLVE and C...