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