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",
448 "Index out of bounds due to logic error.");
451 Fephase = exp(-deltaGRxn) - 1.0;
453 note =
"(ready to be birthed)";
454 if (Fephase > FephaseMax) {
456 FephaseMax = Fephase;
457 note =
"(chosen to be birthed)";
461 note =
"(not stable)";
463 "VCS_SOLVE::vcs_popPhaseID",
"shouldn't be here");
467 plogf(
" --- %18s %5d %10.3g %10.3g %s\n",
475 if (Fephase > FephaseMax) {
477 FephaseMax = Fephase;
480 FephaseMax = std::max(FephaseMax, Fephase);
483 plogf(
" --- %18s %5d %11.3g %11.3g\n",
488 plogf(
" --- %18s %5d blocked %11.3g\n",
497 plogf(
" ---------------------------------------------------------------------\n");
509 vector<size_t> creationGlobalRxnNumbers(Vphase->
nSpecies(),
npos);
517 "called for a phase that exists!");
519 plogf(
" --- vcs_popPhaseRxnStepSizes() called to pop phase %s %d into existence\n",
565 vector<double> fracDelta(Vphase->
nSpecies());
566 vector<double> X_est(Vphase->
nSpecies());
568 copy(storedDelta.begin(), storedDelta.end(), fracDelta.begin());
570 double sumFrac = 0.0;
571 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
572 sumFrac += fracDelta[k];
574 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
575 X_est[k] = fracDelta[k] / sumFrac;
578 double deltaMolNumPhase = tPhaseMoles;
583 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
585 double delmol = deltaMolNumPhase * X_est[k];
589 throw CanteraError(
"VCS_SOLVE::vcs_popPhaseRxnStepSizes",
590 "Index out of bounds due to logic error.");
595 molNumSpecies_tmp[j] += stoicC * delmol;
601 double ratioComp = 0.0;
604 if (molNumSpecies_tmp[j] < 0.0) {
608 damp = std::min(damp, delta0 / deltaJ * 0.9);
613 if ((jph != iphasePop) && (!
m_SSPhase[j])) {
614 double fdeltaJ = fabs(deltaJ);
627 if (ratioComp > 1.0E-30 && ratioComp < 0.001) {
628 damp = 0.001 / ratioComp;
630 if (damp <= 1.0E-6) {
634 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
650 size_t iphDel =
npos;
654 for (
int j = 0; j < 82; j++) {
658 plogf(
" --- Subroutine vcs_RxnStepSizes called - Details:\n");
660 for (
int j = 0; j < 82; j++) {
664 plogf(
" --- Species KMoles Rxn_Adjustment DeltaG\n");
674 for (
size_t irxn = 0; irxn <
m_numRxnRdc; ++irxn) {
702 if (Vphase->
exists() > 0 && trphmoles > 0.0) {
718 plogf(
" %12.4E %12.4E %12.4E\n",
730 plogf(
" %12.4E %12.4E %12.4E\n",
822 if ((k == kspec) && (
m_SSPhase[kspec] != 1)) {
832 plogf(
" %12.4E %12.4E %12.4E\n",
840 for (
size_t j = 0; j <
m_nsp; j++) {
856 plogf(
" %12.4E %12.4E %12.4E\n",
859 plogf(
" --- vcs_RxnStepSizes Special section to set up to delete %s\n",
863 forceComponentCalc = 1;
876 plogf(
" %12.4E %12.4E %12.4E\n",
893 const size_t nsp = Vphase->
nSpecies();
894 int minNumberIterations = 3;
896 minNumberIterations = 1;
900 bool doSuccessiveSubstitution =
true;
901 double funcPhaseStability;
902 vector<double> X_est(nsp, 0.0);
903 vector<double> delFrac(nsp, 0.0);
904 vector<double> E_phi(nsp, 0.0);
905 vector<double> fracDelta_old(nsp, 0.0);
906 vector<double> fracDelta_raw(nsp, 0.0);
907 vector<size_t> creationGlobalRxnNumbers(nsp,
npos);
916 vector<double> fracDelta_new(nsp, 0.0);
918 copy(storedDelta.begin(), storedDelta.end(), fracDelta_new.begin());
920 vector<size_t> componentList;
921 for (
size_t k = 0; k < nsp; k++) {
924 componentList.push_back(k);
928 double normUpdate = 0.1 *
vcs_l2norm(fracDelta_new);
929 double damp = 1.0E-2;
931 if (doSuccessiveSubstitution) {
934 plogf(
" --- vcs_phaseStabilityTest() called\n");
935 plogf(
" --- Its X_old[%2d] FracDel_old[%2d] deltaF[%2d] FracDel_new[%2d]"
936 " normUpdate damp FuncPhaseStability\n", KP, KP, KP, KP);
937 plogf(
" --------------------------------------------------------------"
938 "--------------------------------------------------------\n");
940 plogf(
" --- vcs_phaseStabilityTest() called for phase %d\n", iph);
943 for (
size_t k = 0; k < nsp; k++) {
944 if (fracDelta_new[k] < 1.0E-13) {
945 fracDelta_new[k] =1.0E-13;
948 bool converged =
false;
949 double dirProd = 0.0;
950 for (
int its = 0; its < 200 && (!converged); its++) {
951 double dampOld = damp;
952 double normUpdateOld = normUpdate;
953 fracDelta_old = fracDelta_new;
954 double dirProdOld = dirProd;
958 for (
size_t i = 0; i < componentList.size(); i++) {
959 size_t kc = componentList[i];
961 fracDelta_old[kc] = 0.0;
962 for (
size_t k = 0; k < nsp; k++) {
972 double sumFrac = 0.0;
973 for (
size_t k = 0; k < nsp; k++) {
974 sumFrac += fracDelta_old[k];
978 if (sumFrac <= 0.0) {
981 double sum_Xcomp = 0.0;
982 for (
size_t k = 0; k < nsp; k++) {
983 X_est[k] = fracDelta_old[k] / sumFrac;
985 sum_Xcomp += X_est[k];
998 for (
size_t i = 0; i < componentList.size(); i++) {
999 size_t kc = componentList[i];
1006 for (
size_t i = 0; i < componentList.size(); i++) {
1008 for (
size_t k = 0; k < Vphase->
nSpecies(); k++) {
1025 funcPhaseStability = sum_Xcomp - 1.0;
1026 for (
size_t k = 0; k < nsp; k++) {
1033 funcPhaseStability += E_phi[k];
1040 for (
size_t k = 0; k < nsp; k++) {
1042 double b = E_phi[k] / sum * (1.0 - sum_Xcomp);
1044 fracDelta_raw[k] = b;
1050 for (
size_t i = 0; i < componentList.size(); i++) {
1051 size_t kc = componentList[i];
1053 fracDelta_raw[kc] = 0.0;
1054 for (
size_t k = 0; k < nsp; k++) {
1064 for (
size_t k = 0; k < nsp; k++) {
1065 delFrac[k] = fracDelta_raw[k] - fracDelta_old[k];
1070 for (
size_t k = 0; k < nsp; k++) {
1071 dirProd += fracDelta_old[k] * delFrac[k];
1073 bool crossedSign =
false;
1074 if (dirProd * dirProdOld < 0.0) {
1079 if (dampOld < 0.25) {
1080 damp = 2.0 * dampOld;
1083 if (normUpdate *1.5 > normUpdateOld) {
1084 damp = 0.5 * dampOld;
1085 }
else if (normUpdate *2.0 > normUpdateOld) {
1086 damp = 0.8 * dampOld;
1089 if (normUpdate > normUpdateOld * 2.0) {
1090 damp = 0.6 * dampOld;
1091 }
else if (normUpdate > normUpdateOld * 1.2) {
1092 damp = 0.9 * dampOld;
1096 for (
size_t k = 0; k < nsp; k++) {
1097 if (fabs(damp * delFrac[k]) > 0.3*fabs(fracDelta_old[k])) {
1098 damp = std::max(0.3*fabs(fracDelta_old[k]) / fabs(delFrac[k]),
1099 1.0E-8/fabs(delFrac[k]));
1101 if (delFrac[k] < 0.0 && 2.0 * damp * (-delFrac[k]) > fracDelta_old[k]) {
1102 damp = fracDelta_old[k] / (2.0 * -delFrac[k]);
1104 if (delFrac[k] > 0.0 && 2.0 * damp * delFrac[k] > fracDelta_old[k]) {
1105 damp = fracDelta_old[k] / (2.0 * delFrac[k]);
1108 damp = std::max(damp, 0.000001);
1109 for (
size_t k = 0; k < nsp; k++) {
1110 fracDelta_new[k] = fracDelta_old[k] + damp * delFrac[k];
1114 plogf(
" --- %3d %12g %12g %12g %12g %12g %12g %12g\n", its, X_est[KP], fracDelta_old[KP],
1115 delFrac[KP], fracDelta_new[KP], normUpdate, damp, funcPhaseStability);
1118 if (normUpdate < 1.0E-5 * damp) {
1120 if (its < minNumberIterations) {
1135 throw CanteraError(
"VCS_SOLVE::vcs_phaseStabilityTest",
"not done yet");
1138 plogf(
" ------------------------------------------------------------"
1139 "-------------------------------------------------------------\n");
1141 if (funcPhaseStability > 0.0) {
1142 plogf(
" --- phase %d with func = %g is to be born\n", iph, funcPhaseStability);
1144 plogf(
" --- phase %d with func = %g stays dead\n", iph, funcPhaseStability);
1147 return funcPhaseStability;
1157 for (
size_t k = 0; k <
m_nsp; k++) {
1181 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1183 for (
size_t e = 0; e <
m_nelem; e++) {
1186 m_spSize[kspec] = (sz > 0.0) ? sz : 1.0;
1203 double test = -1.0e-10;
1204 bool modifiedSoln =
false;
1207 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1212 if (fabs(sum) < 1.0E-6) {
1213 modifiedSoln =
true;
1216 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1246 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
1265 for (
size_t e = 0; e < m_mix->
nElements(); e++) {
1268 if (sum < 1.0E-20) {
1269 throw CanteraError(
"VCS_SOLVE::vcs_prep",
"The problem is not well posed"
1270 " because the total number of element moles is zero.");
1284 plogf(
" --- Subroutine elem_rearrange() called to ");
1285 plogf(
"check stoich. coefficient matrix\n");
1286 plogf(
" --- and to rearrange the element ordering once\n");
1292 double test = -1.0E10;
1295 for (
size_t i = 0; i <
m_nelem; ++i) {
1298 if (test == aw[i]) {
1307 while (jr < ncomponents) {
1316 for (
size_t ielem = jr; ielem <
m_nelem; ielem++) {
1324 "Shouldn't be here. Algorithm misfired.");
1341 for (
size_t j = 0; j < ncomponents; ++j) {
1348 for (
size_t j = 0; j < jl; ++j) {
1350 for (
size_t i = 0; i < ncomponents; ++i) {
1351 ss[j] += sm[i + jr*ncomponents] * sm[i + j*ncomponents];
1358 for (
size_t j = 0; j < jl; ++j) {
1359 for (
size_t i = 0; i < ncomponents; ++i) {
1360 sm[i + jr*ncomponents] -= ss[j] * sm[i + j*ncomponents];
1368 for (
size_t ml = 0; ml < ncomponents; ++ml) {
1369 sa[jr] += pow(sm[ml + jr*ncomponents], 2);
1372 if (sa[jr] > 1.0e-6) {
1379 plogf(
" --- %-2.2s(%9.2g) replaces %-2.2s(%9.2g) as element %3d\n",
1384 std::swap(aw[jr], aw[k]);
1398 "vcs_switch_elem_pos",
1399 "inappropriate args: {} {}", ipos, jpos);
1419 for (
size_t j = 0; j <
m_nsp; ++j) {
1427 double diag = hessianDiag_Ideal;
1429 if (hessianDiag_Ideal <= 0.0) {
1431 "We shouldn't be here");
1433 if (hessActCoef >= 0.0) {
1434 diag += hessActCoef;
1435 }
else if (fabs(hessActCoef) < 0.6666 * hessianDiag_Ideal) {
1436 diag += hessActCoef;
1438 diag -= 0.6666 * hessianDiag_Ideal;
1477 if (!Vphase->m_singleSpecies && !Vphase->isIdealSoln()) {
1491 vector<pair<double, size_t>> x_order;
1492 for (
size_t i = 0; i <
m_nsp; i++) {
1505 plogf(
"\t\t VCS_TP REPORT\n");
1509 plogf(
" ERROR: CONVERGENCE CRITERION NOT SATISFIED.\n");
1510 }
else if (iconv == 1) {
1511 plogf(
" RANGE SPACE ERROR: Equilibrium Found but not all Element Abundances are Satisfied\n");
1516 double totalVolume = 0.0;
1517 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
1522 totalVolume += Volp;
1527 plogf(
"\t\ttotal Volume = %15.5g m**3\n", totalVolume);
1532 plogf(
" Species Equilibrium kmoles ");
1533 plogf(
"Mole Fraction ChemPot/RT SpecUnkType\n");
1537 writeline(
' ', 13,
false);
1544 size_t j = x_order[i].second;
1546 writeline(
' ', 13,
false);
1556 throw CanteraError(
"VCS_SOLVE::vcs_report",
"we have a problem");
1561 plogf(
"\n SPECIES WITH LESS THAN 1.0E-32 KMOLES:\n\n");
1565 plogf(
" %14.7E %14.7E %12.4E",
1583 plogf(
" |ComponentID|");
1588 plogf(
" | Components|");
1593 plogf(
" NonComponent | Moles |");
1597 plogf(
" | DG/RT Rxn |\n");
1599 for (
size_t irxn = 0; irxn <
m_numRxnTot; irxn++) {
1601 plogf(
" %3d ", kspec);
1614 vector<double> gaTPhase(
m_nelem, 0.0);
1615 double totalMoles = 0.0;
1616 double gibbsPhase = 0.0;
1617 double gibbsTotal = 0.0;
1620 writeline(
'-',
m_nelem*10 + 58);
1621 plogf(
" | ElementID |");
1622 for (
size_t j = 0; j <
m_nelem; j++) {
1626 plogf(
" | Element |");
1627 for (
size_t j = 0; j <
m_nelem; j++) {
1631 plogf(
" PhaseName |KMolTarget |");
1632 for (
size_t j = 0; j <
m_nelem; j++) {
1635 plogf(
" | Gibbs Total |\n");
1636 writeline(
'-',
m_nelem*10 + 58);
1637 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
1638 plogf(
" %3d ", iphase);
1645 throw CanteraError(
"VCS_SOLVE::vcs_report",
"we have a problem");
1648 for (
size_t j = 0; j <
m_nelem; ++j) {
1649 double abundance_j = 0.0;
1650 for (
size_t i = 0; i <
m_nsp; ++i) {
1657 plogf(
" %10.3g", abundance_j);
1658 gaTPhase[j] += abundance_j;
1666 gibbsTotal += gibbsPhase;
1667 plogf(
" | %18.11E |\n", gibbsPhase);
1669 writeline(
'-',
m_nelem*10 + 58);
1670 plogf(
" TOTAL |%10.3e |", totalMoles);
1671 for (
size_t j = 0; j <
m_nelem; j++) {
1672 plogf(
" %10.3g", gaTPhase[j]);
1674 plogf(
" | %18.11E |\n", gibbsTotal);
1676 writeline(
'-',
m_nelem*10 + 58);
1683 plogf(
"\n\tTotal Dimensionless Gibbs Free Energy = G/RT = %15.7E\n", g);
1684 plogf(
"\nElemental Abundances (kmol): ");
1685 plogf(
" Actual Target Type ElActive\n");
1686 for (
size_t i = 0; i <
m_nelem; ++i) {
1687 writeline(
' ', 26,
false);
1695 writeline(
'-', 93,
true,
true);
1696 plogf(
"Chemical Potentials of the Species: (dimensionless)\n");
1699 plogf(
" Name TKMoles StandStateChemPot "
1700 " ln(AC) ln(X_i) | F z_i phi | ChemPot | (-lnMnaught)");
1701 plogf(
"| (MolNum ChemPot)|");
1702 writeline(
'-', 147,
true,
true);
1703 for (
size_t i = 0; i <
m_nsp; ++i) {
1704 size_t j = x_order[i].second;
1719 lx = log(tmp) - log(tpmoles);
1725 plogf(
"%14.7E |", lx);
1726 plogf(
"%14.7E | ", eContrib);
1731 "we have a problem - doesn't add up");
1743 for (
size_t i = 0; i < 125; i++) {
1746 plogf(
" %20.9E\n", g);
1747 writeline(
'-', 147);
1751 plogf(
"\nCounters: Iterations\n");
1760 for (
size_t j = 0; j <
m_nelem; ++j) {
1762 for (
size_t i = 0; i <
m_nsp; ++i) {
1773 for (
size_t i = 0; i < top; ++i) {
1780 "Problem with charge neutrality condition");
1789 bool multisign =
false;
1790 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1824 plogf(
" --- vcsc_elcorr: Element abundances correction routine");
1826 plogf(
" (m_numComponents != m_nelem)");
1831 for (
size_t i = 0; i <
m_nelem; ++i) {
1834 double l2before = 0.0;
1835 for (
size_t i = 0; i <
m_nelem; ++i) {
1836 l2before += x[i] * x[i];
1838 l2before = sqrt(l2before/
m_nelem);
1843 bool changed =
false;
1844 for (
size_t i = 0; i <
m_nelem; ++i) {
1846 bool multisign =
false;
1847 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1859 if (numNonZero < 2) {
1860 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1870 int numCompNonZero = 0;
1871 size_t compID =
npos;
1881 if (numCompNonZero == 1) {
1907 for (
size_t i = 0; i <
m_nelem; ++i) {
1910 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
1913 if (atomComp > 0.0) {
1917 plogf(
" --- vcs_elcorr: Reduced species %s from %g to %g "
1918 "due to %s max bounds constraint\n",
1932 plogf(
" --- vcs_elcorr: Zeroed species %s and changed "
1933 "status to %d due to max bounds constraint\n",
1954 if (fabs(x[i]) > 1.0E-13) {
1971 par = std::min(par, 100.0);
1973 if (par < 1.0 && par > 0.0) {
1997 auto finalize = [&]() {
1999 double l2after = 0.0;
2000 for (
size_t i = 0; i <
m_nelem; ++i) {
2003 l2after = sqrt(l2after/
m_nelem);
2005 plogf(
" --- Elem_Abund: Correct Initial "
2007 for (
size_t i = 0; i <
m_nelem; ++i) {
2012 plogf(
" --- Diff_Norm: %20.12E %20.12E\n",
2020 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
2024 double saveDir = 0.0;
2025 bool goodSpec =
true;
2028 if (fabs(dir) > 1.0E-10) {
2030 if (saveDir < 0.0) {
2034 }
else if (saveDir > 0.0) {
2077 for (
size_t i = 0; i <
m_nelem; ++i) {
2103 for (
size_t i = 0; i <
m_nelem; ++i) {
2106 bool useZeroed =
true;
2147 double test = -1.0E-10;
2150 plogf(
" --- call setInitialMoles\n");
2154 bool abundancesOK =
true;
2156 vector<double> ss(
m_nelem, 0.0);
2157 vector<double> sa(
m_nelem, 0.0);
2158 vector<double> wx(
m_nelem, 0.0);
2159 vector<double> aw(
m_nsp, 0.0);
2161 for (
size_t ik = 0; ik <
m_nsp; ik++) {
2175 plogf(
" --- seMolesLinProg Mole numbers failing element abundances\n");
2176 plogf(
" --- seMolesLinProg Call vcs_elcorr to attempt fix\n");
2179 abundancesOK = (retn < 2);
2181 abundancesOK =
true;
2190 plogf(
"iteration %d\n", iter);
2199 for (
size_t irxn = 0; irxn <
m_numRxnTot; irxn++) {
2203 double dxi_min = 1.0e10;
2205 for (
size_t jcomp = 0; jcomp <
m_nelem; jcomp++) {
2211 int idir = (dg_rt < 0.0 ? 1 : -1);
2217 double nu = sc_irxn[jcomp];
2230 dxi_min = std::min(dxi_min, delta_xi);
2237 double dsLocal = idir*dxi_min;
2260 plogf(
" --- setInitialMoles end\n");
2262 if (!abundancesOK) {
2264 }
else if (iter > 15) {
2271 span<const double> chemPot,
2272 span<const double> tPhMoles)
2278 g += molesSp[kspec] * chemPot[kspec];
2293 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2300 if ((nSpPhase == 1) && (volPhase->
phiVarIndex() == 0)) {
2311 writeline(
'=', 80,
true,
true);
2312 writeline(
'=', 20,
false);
2313 plogf(
" Cantera_to_vprob: START OF PROBLEM STATEMENT ");
2317 plogf(
" Phase IDs of species\n");
2318 plogf(
" species phaseID phaseName ");
2319 plogf(
" Initial_Estimated_kMols\n");
2320 for (
size_t i = 0; i <
m_nsp; i++) {
2333 writeline(
'-', 80,
true,
true);
2334 plogf(
" Information about phases\n");
2335 plogf(
" PhaseName PhaseNum SingSpec EqnState NumSpec "
2338 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2346 writeline(
'=', 80,
true,
true);
2347 writeline(
'=', 20,
false);
2348 plogf(
" Cantera_to_vprob: END OF PROBLEM STATEMENT ");
2364 const char* pprefix =
" --- vcs_inest: ";
2370 plogf(
"%s Initial guess passed element abundances on input\n", pprefix);
2371 plogf(
"%s m_doEstimateEquil = 1 so will use the input mole "
2372 "numbers as estimates\n", pprefix);
2376 plogf(
"%s Initial guess failed element abundances on input\n", pprefix);
2377 plogf(
"%s m_doEstimateEquil = 1 so will discard input "
2378 "mole numbers and find our own estimate\n", pprefix);
2384 vector<double> ss(
m_nelem, 0.0);
2385 vector<double> sa(
m_nelem, 0.0);
2390 plogf(
"%sGo find an initial estimate for the equilibrium problem\n",
2393 double test = -1.0E20;
2401 plogf(
"%s Mole Numbers returned from linear programming (vcs_inest initial guess):\n",
2403 plogf(
"%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix);
2404 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2405 plogf(
"%s ", pprefix);
2409 plogf(
"%s Element Abundance Agreement returned from linear "
2410 "programming (vcs_inest initial guess):\n", pprefix);
2411 plogf(
"%s Element Goal Actual\n", pprefix);
2412 for (
size_t j = 0; j <
m_nelem; j++) {
2415 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2418 plogf(
"%s ", pprefix);
2429 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2457 double TMolesMultiphase = 0.0;
2483 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2484 plogf(
"%s", pprefix);
2490 plogf(
"fe* = %15.5g ff = %15.5g dg* = %15.5g\n",
2504 for (
size_t irxn = 0; irxn < nrxn; ++irxn) {
2538 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2540 plogf(
"%sdirection (", pprefix);
2547 plogf(
" (ssPhase doesn't exist -> stability not checked)");
2564 if (par <= 1.0 && par > 0.0) {
2600 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2606 if (s < 0.0 && ikl == 0) {
2619 double xl = (1.0 - s / (s1 - s)) * 0.5;
2629 par = par * 2.0 * xl;
2636 plogf(
"%s Final Mole Numbers produced by inest:\n",
2638 plogf(
"%s SPECIES MOLE_NUMBER\n", pprefix);
2639 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2640 plogf(
"%s %-12.12s %g\n",
2658 plogf(
"%sInitial guess failed element abundances\n", pprefix);
2659 plogf(
"%sCall vcs_elcorr to attempt fix\n", pprefix);
2665 "Initial guess still fails element abundance equations\n"
2666 "Inability to ever satisfy element abundance constraints is probable");
2670 plogf(
"%sInitial guess now satisfies element abundances\n", pprefix);
2672 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
2673 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
2674 "BUT not NE=%d element abundances\n", pprefix,
2682 plogf(
"%sInitial guess satisfies element abundances\n", pprefix);
2684 plogf(
"%sElement Abundances RANGE ERROR\n", pprefix);
2685 plogf(
"%s - Initial guess satisfies NC=%d element abundances, "
2686 "BUT not NE=%d element abundances\n", pprefix,
2693 plogf(
"%sTotal Dimensionless Gibbs Free Energy = %15.7E\n", pprefix,
2703 for (
size_t kspec = 0; kspec <
m_nsp; ++kspec) {
2717 for (
size_t kspec = 0; kspec <
m_nsp; kspec++) {
2736 plogf(
"\nTCounters: Num_Calls Total_Its\n");
2737 plogf(
" vcs_basopt: %5d %5d\n",
2739 plogf(
" vcs_TP: %5d %5d\n",
2750 writeline(
'=', 80,
true,
true);
2751 writeline(
'=', 20,
false);
2752 plogf(
" VCS_PROB: PROBLEM STATEMENT ");
2756 plogf(
"\tSolve a constant T, P problem:\n");
2760 plogf(
"\t\tPres = %g atm\n", pres_atm);
2762 plogf(
" Phase IDs of species\n");
2763 plogf(
" species phaseID phaseName ");
2764 plogf(
" Initial_Estimated_Moles Species_Type\n");
2765 for (
size_t i = 0; i <
m_nsp; i++) {
2785 writeline(
'-', 80,
true,
true);
2786 plogf(
" Information about phases\n");
2787 plogf(
" PhaseName PhaseNum SingSpec EqnState NumSpec "
2790 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2803 plogf(
"\nElemental Abundances: ");
2804 plogf(
" Target_kmol ElemType ElActive\n");
2805 for (
size_t i = 0; i <
m_nelem; ++i) {
2806 writeline(
' ', 26,
false);
2812 plogf(
"\nChemical Potentials: (J/kmol)\n");
2813 plogf(
" Species (phase) "
2814 " SS0ChemPot StarChemPot\n");
2815 for (
size_t iphase = 0; iphase <
m_numPhases; iphase++) {
2818 for (
size_t kindex = 0; kindex < Vphase->
nSpecies(); kindex++) {
2831 writeline(
'=', 80,
true,
true);
2832 writeline(
'=', 20,
false);
2833 plogf(
" VCS_PROB: END OF PROBLEM STATEMENT ");
2844 throw CanteraError(
"VCS_SOLVE::addOnePhaseSpecies",
"Shouldn't be here");
2850 "element not found");
2864 "error: element must have a name");
2882 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...