32 int estimateEquil,
int printLvl,
34 doublereal rtol,
int maxsteps,
int maxiter,
67 rtol, maxsteps, maxiter, loglevel);
71 addLogEntry(
"MultiPhaseEquil solver returned an error code: ", retn);
80 }
else if (solver == 1) {
85 (void)
equilibrate(*m, XY, rtol, maxsteps, maxiter, loglevel-1);
99 }
else if (solver == 0) {
104 bool useThermoPhaseElementPotentials =
false;
105 if (estimateEquil == 0) {
106 useThermoPhaseElementPotentials =
true;
109 useThermoPhaseElementPotentials, loglevel-1);
116 "ChemEquil equilibrium solver failed");
145 int estimateEquil,
int printLvl,
int solver,
146 doublereal tol,
int maxsteps,
int maxiter,
151 tol, maxsteps, maxiter, loglevel);
156 int estimateEquil,
int printLvl,
int solver,
157 doublereal tol,
int maxsteps,
int maxiter,
int loglevel)
159 static int counter = 0;
172 int printLvlSub = std::max(0, printLvl-1);
179 int err = eqsolve->
equilibrate(ixy, estimateEquil, printLvlSub, tol, maxsteps, loglevel);
189 string reportFile =
"vcs_equilibrate_res.csv";
191 reportFile =
"vcs_equilibrate_res_" +
int2str(counter) +
".csv";
204 }
else if (solver == 1) {
205 if (ixy == TP || ixy == HP || ixy == SP || ixy == TV) {
207 double err = s.
equilibrate(ixy, tol, maxsteps, maxiter, loglevel);
222 addLogEntry(
"multiphase equilibrium can be done only for TP, HP, SP, or TV");
229 throw CanteraError(
"vcs_equilibrate_1",
"unknown solver");
235 double& funcStab,
int printLvl,
int loglevel)
238 static int counter = 0;
240 addLogEntry(
"multiphase phase stability function");
246 int printLvlSub = std::max(0, printLvl-1);
260 string reportFile =
"vcs_phaseStability.csv";
262 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.
ThermoPhase object for the ideal molal equation of state (see Thermodynamic Properties and class Idea...
std::string int2str(const int n, const std::string &fmt)
Convert an int to a string using a format converter.
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.
doublereal relTolerance
Relative tolerance.
void beginLogGroup(const std::string &title, int loglevel)
Create a new group for log messages.
string lastErrorMessage()
Retrieve the last error message in a string.
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)
doublereal equilibrate(MultiPhase &s, const char *XY, doublereal tol, int maxsteps, int maxiter, int loglevel)
Equilibrate a MultiPhase object.
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...
Cantera's Interface to the Multiphase chemical equilibrium solver.
void reportCSV(const std::string &reportFile)
Report the equilibrium answer in a comma separated table format.
Base class for a phase with thermodynamic properties.
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
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.
A class for multiphase mixtures.
Internal declarations for the VCSnonideal package.
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...
Header for the Interface class for the vcs thermo equilibrium solver package,.
Header file for an ideal solid solution model with incompressible thermodynamics (see Thermodynamic P...
std::string id() const
Return the string id for the phase.
Base class for exceptions thrown by Cantera classes.
void setElementPotentials(const vector_fp &lambda)
Stores the element potentials in the ThermoPhase 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.
void endLogGroup(const std::string &title)
Close the current group of log messages.
Interface class for the vcsnonlinear solver.
void addLogEntry(const std::string &tag, const std::string &value)
Add an entry to an HTML log file.
int determine_PhaseStability(int iph, double &funcStab, int printLvl=0, int logLevel=-99)
Determine the phase stability of a phase at the current conditions.
void init()
Process phases and build atomic composition array.
Contains declarations for string manipulation functions within Cantera.
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.