21 int estimateEquil,
int printLvl,
23 doublereal rtol,
int maxsteps,
int maxiter,
26 warn_deprecated(
"vcs_equilibrate",
"Use ThermoPhase::equilibrate instead. "
27 "To be removed after Cantera 2.2.");
42 rtol, maxsteps, maxiter, loglevel);
49 }
else if (solver == 1) {
54 (void)
equilibrate(*m, XY, rtol, maxsteps, maxiter, loglevel-1);
62 }
else if (solver == 0) {
67 bool useThermoPhaseElementPotentials =
false;
68 if (estimateEquil == 0) {
69 useThermoPhaseElementPotentials =
true;
72 useThermoPhaseElementPotentials, loglevel-1);
76 "ChemEquil equilibrium solver failed");
98 int estimateEquil,
int printLvl,
int solver,
99 doublereal tol,
int maxsteps,
int maxiter,
104 tol, maxsteps, maxiter, loglevel);
109 int estimateEquil,
int printLvl,
int solver,
110 doublereal tol,
int maxsteps,
int maxiter,
int loglevel)
112 warn_deprecated(
"vcs_equilibrate_1",
"Use MultiPhase::equilibrate instead. "
113 "To be removed after Cantera 2.2.");
114 static int counter = 0;
117 int printLvlSub = std::max(0, printLvl-1);
124 int err = eqsolve->
equilibrate(ixy, estimateEquil, printLvlSub, tol, maxsteps, loglevel);
130 string reportFile =
"vcs_equilibrate_res.csv";
132 reportFile =
"vcs_equilibrate_res_" +
int2str(counter) +
".csv";
143 }
else if (solver == 1) {
144 if (ixy == TP || ixy == HP || ixy == SP || ixy == TV) {
146 s.
equilibrate(ixy, tol, maxsteps, maxiter, loglevel);
156 throw CanteraError(
"vcs_equilibrate_1",
"unknown solver");
162 double& funcStab,
int printLvl,
int loglevel)
165 static int counter = 0;
166 int printLvlSub = std::max(0, printLvl-1);
174 string reportFile =
"vcs_phaseStability.csv";
176 reportFile =
"vcs_phaseStability_" +
int2str(counter) +
".csv";
Class ChemEquil implements a chemical equilibrium solver for single-phase solutions.
EquilOpt options
Options controlling how the calculation is carried out.
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
doublereal relTolerance
Relative tolerance.
This file contains the definition of some high level general equilibration routines.
void addPhase(ThermoPhase *p, doublereal moles)
Add a phase to the mixture.
int equilibrate(thermo_t &s, const char *XY, bool useThermoPhaseElementPotentials=false, int loglevel=0)
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
doublereal equilibrate(MultiPhase &s, const char *XY, doublereal tol, int maxsteps, int maxiter, int loglevel)
Equilibrate a MultiPhase object.
doublereal equilibrate(int XY, doublereal err=1.0e-9, int maxsteps=1000, int maxiter=200, int loglevel=-99)
Set the mixture to a state of chemical equilibrium.
void reportCSV(const std::string &reportFile)
Report the equilibrium answer in a comma separated table format.
Base class for a phase with thermodynamic properties.
Cantera's Interface to the Multiphase chemical equilibrium solver.
A class for multiphase mixtures.
int vcs_determine_PhaseStability(MultiPhase &s, int iphase, double &funcStab, int printLvl, int loglevel)
Determine the phase stability of a single phase given the current conditions in a MultiPhase object...
Base class for exceptions thrown by Cantera classes.
int equilibrate(int XY, int estimateEquil=0, int printLvl=0, doublereal err=1.0e-6, int maxsteps=VCS_MAXSTEPS, int loglevel=-99)
Equilibrate the solution using the current element abundances stored in the MultiPhase object...
int vcs_equilibrate(MultiPhase &s, const char *XY, int estimateEquil, int printLvl, int solver, doublereal tol, int maxsteps, int maxiter, int loglevel)
Set a multi-phase chemical solution to chemical equilibrium.
int determine_PhaseStability(int iph, double &funcStab, int printLvl=0, int logLevel=-99)
Determine the phase stability of a phase at the current conditions.
Interface class for the vcsnonlinear solver.
void init()
Process phases and build atomic composition array.
Contains declarations for string manipulation functions within Cantera.
void setElementPotentials(const vector_fp &lambda)
Stores the element potentials in the ThermoPhase object.
int maxIterations
Maximum number of iterations.
int _equilflag(const char *xy)
map property strings to integers
int vcs_equilibrate_1(MultiPhase &s, int ixy, int estimateEquil, int printLvl, int solver, doublereal tol, int maxsteps, int maxiter, int loglevel)
Set a multi-phase chemical solution to chemical equilibrium.
void save()
Function to put this error onto Cantera's error stack.