Cantera  2.1.2
equil.h
Go to the documentation of this file.
1 /**
2  * @file equil.h
3  * This file contains the definition of some high level general equilibration
4  * routines.
5  */
6 
7 // Copyright 2001 California Institute of Technology
8 
9 #ifndef CT_KERNEL_EQUIL_H
10 #define CT_KERNEL_EQUIL_H
11 
12 #include "MultiPhase.h"
13 #include "vcs_defs.h"
14 
15 namespace Cantera
16 {
17 /*!
18  * @defgroup equilfunctions Equilibrium Solver Capability
19  *
20  * Cantera has several different equilibrium routines.
21  */
22 
23 //! Equilibrate a ThermoPhase object
24 /*!
25  * Set a single-phase chemical solution to chemical equilibrium. This is a
26  * convenience function that uses one or the other of the two chemical
27  * equilibrium solvers. The XY parameter indicates what two thermodynamic
28  * quantities, other than element composition, are to be held constant during
29  * the equilibration process.
30  *
31  * @param s ThermoPhase object that will be equilibrated.
32  * @param XY String representation of what two properties
33  * are being held constant
34  * @param solver ID of the solver to be used to equilibrate the phase.
35  * If solver = 0, the ChemEquil solver will be used,
36  * and if solver = 1, the
37  * MultiPhaseEquil solver will be used (slower than ChemEquil,
38  * but more stable). If solver < 0 (default, then ChemEquil will
39  * be tried first, and if it fails MultiPhaseEquil will be tried.
40  * @param rtol Relative tolerance
41  * @param maxsteps Maximum number of steps to take to find the solution
42  * @param maxiter For the MultiPhaseEquil solver only, this is
43  * the maximum number of outer temperature or pressure iterations
44  * to take when T and/or P is not held fixed.
45  * @param loglevel loglevel Controls amount of diagnostic output. loglevel
46  * = 0 suppresses diagnostics, and increasingly-verbose messages
47  * are written as loglevel increases. The messages are written to
48  * a file in HTML format for viewing in a web browser.
49  * @see HTML_logs
50  *
51  * @return The number of iterations it took to equilibrate the system.
52  *
53  * @ingroup equilfunctions
54  */
55 int equilibrate(thermo_t& s, const char* XY,
56  int solver = -1, doublereal rtol = 1.0e-9, int maxsteps = VCS_MAXSTEPS,
57  int maxiter = 100, int loglevel = -99);
58 
59 //! Equilibrate a MultiPhase object
60 /*!
61  * Equilibrate a MultiPhase object. The XY parameter indicates what two
62  * thermodynamic quantities, other than element composition, are to be held
63  * constant during the equilibration process.
64  *
65  * This is the top-level driver for multiphase equilibrium. It doesn't do
66  * much more than call the equilibrate method of class MultiPhase, except
67  * that it adds some messages to the logfile, if loglevel is set > 0.
68  *
69  * @param s MultiPhase object that will be equilibrated.
70  * @param XY String representation of what is being held constant
71  * @param rtol Relative tolerance
72  * @param maxsteps Maximum number of steps
73  * @param maxiter Maximum iterations
74  * @param loglevel loglevel
75  *
76  * @return The number of iterations it took to equilibrate the system.
77  *
78  * @ingroup equilfunctions
79  */
80 doublereal equilibrate(MultiPhase& s, const char* XY,
81  doublereal rtol = 1.0e-9, int maxsteps = 5000, int maxiter = 100,
82  int loglevel = -99);
83 
84 }
85 
86 #endif
#define VCS_MAXSTEPS
Maximum steps in the inner loop.
Definition: vcs_defs.h:105
doublereal equilibrate(MultiPhase &s, const char *XY, doublereal tol, int maxsteps, int maxiter, int loglevel)
Equilibrate a MultiPhase object.
Definition: equilibrate.cpp:14
Headers for the MultiPhase object that is used to set up multiphase equilibrium problems (see Equilib...
ThermoPhase thermo_t
typedef for the ThermoPhase class
Definition: ThermoPhase.h:1684
Defines and definitions within the vcs package.