00001 /*********************************************************************** 00002 * $RCSfile: equil.h,v $ 00003 * $Author: hkmoffa $ 00004 * $Date: 2010-01-03 19:46:26 -0500 (Sun, 03 Jan 2010) $ 00005 * $Revision: 368 $ 00006 ***********************************************************************/ 00007 // Copyright 2001 California Institute of Technology 00008 00009 /** 00010 * @file equil.h 00011 * This file contains the definition of some high level general equilibration 00012 * routines and the text for the module \ref equilfunctions. 00013 * 00014 * It also contains the Module doxygen text for the Equilibration Solver 00015 * capability within %Cantera. see \ref equilfunctions 00016 */ 00017 #ifndef CT_KERNEL_EQUIL_H 00018 #define CT_KERNEL_EQUIL_H 00019 00020 //#include "ChemEquil.h" 00021 #include "MultiPhase.h" 00022 00023 namespace Cantera { 00024 00025 /*! 00026 * @defgroup equilfunctions Equilibrium Solver Capability 00027 * 00028 * Cantera has several different equilibrium routines. 00029 */ 00030 //@{ 00031 //@} 00032 00033 00034 //----------------------------------------------------------- 00035 // convenience functions 00036 //----------------------------------------------------------- 00037 00038 //! Equilibrate a ThermoPhase object 00039 /*! 00040 * Set a single-phase chemical solution to chemical equilibrium. 00041 * This is a convenience function that uses one or the other of 00042 * the two chemical equilibrium solvers. The XY parameter indicates what two 00043 * thermodynamic quantities, other than element composition, are to be held 00044 * constant during the equilibration process. 00045 * 00046 * @param s ThermoPhase object that will be equilibrated. 00047 * @param XY String representation of what two properties 00048 * are being held constant 00049 * @param solver ID of the solver to be used to equlibrate the phase. 00050 * If solver = 0, the ChemEquil solver will be used, 00051 * and if solver = 1, the 00052 * MultiPhaseEquil solver will be used (slower than ChemEquil, 00053 * but more stable). If solver < 0 (default, then ChemEquil will 00054 * be tried first, and if it fails MultiPhaseEquil will be tried. 00055 * @param rtol Relative tolerance 00056 * @param maxsteps Maximum number of steps to take to find the solution 00057 * @param maxiter For the MultiPhaseEquil solver only, this is 00058 * the maximum number of outer temperature or pressure iterations 00059 * to take when T and/or P is not held fixed. 00060 * @param loglevel loglevel Controls amount of diagnostic output. loglevel 00061 * = 0 suppresses diagnostics, and increasingly-verbose messages 00062 * are written as loglevel increases. The messages are written to 00063 * a file in HTML format for viewing in a web browser. 00064 * @see HTML_logs 00065 * 00066 * @return 00067 * Return variable is equal to the number of subroutine attempts 00068 * it took to equilibrate the system. 00069 * 00070 * 00071 * @ingroup equilfunctions 00072 * @ingroup equil 00073 */ 00074 int equilibrate(thermo_t& s, const char* XY, 00075 int solver = -1, doublereal rtol = 1.0e-9, int maxsteps = 5000, 00076 int maxiter = 100, int loglevel = -99); 00077 00078 //! Equilibrate a MultiPhase object 00079 /*! 00080 * Equilibrate a MultiPhase object. The XY parameter indicates what two 00081 * thermodynamic quantities, other than element composition, are to be held 00082 * constant during the equilibration process. 00083 * 00084 * This is the top-level driver for multiphase equilibrium. It 00085 * doesn't do much more than call the equilibrate method of class 00086 * MultiPhase, except that it adds some messages to the logfile, 00087 * if loglevel is set > 0. 00088 * 00089 * @param s MultiPhase object that will be equilibrated. 00090 * @param XY String representation of what is being held constant 00091 * @param rtol Relative tolerance 00092 * @param maxsteps Maximum number of steps 00093 * @param maxiter Maximum iterations 00094 * @param loglevel loglevel 00095 * 00096 * @return 00097 * Return variable is equal to the number of subroutine attempts 00098 * it took to equilibrate the system. 00099 * 00100 * @ingroup equilfunctions 00101 * @ingroup equil 00102 */ 00103 doublereal equilibrate(MultiPhase& s, const char* XY, 00104 doublereal rtol = 1.0e-9, int maxsteps = 5000, int maxiter = 100, 00105 int loglevel = -99); 00106 00107 } 00108 00109 #endif