diff --git a/Cantera/python/Cantera/OneD/onedim.py b/Cantera/python/Cantera/OneD/onedim.py index 34c932798..3710100a0 100644 --- a/Cantera/python/Cantera/OneD/onedim.py +++ b/Cantera/python/Cantera/OneD/onedim.py @@ -546,8 +546,11 @@ class Stack: >>> s.setTimeStep(1.0e-5, [1, 2, 5, 10]) """ - _cantera.sim1D_setTimeStep(self._hndl, stepsize, - asarray(nsteps)) + # 3/20/09 + # The use of asarray seems to set the nsteps array to be of + # type double. This needs to be checked out further. + # Probably a function of python version and Numerics version + _cantera.sim1D_setTimeStep(self._hndl, stepsize, asarray(nsteps)) def getInitialSoln(self): """Load the initial solution from each domain into the global diff --git a/Cantera/python/Cantera/mixture.py b/Cantera/python/Cantera/mixture.py index b0f4d7ae6..45b078fe2 100644 --- a/Cantera/python/Cantera/mixture.py +++ b/Cantera/python/Cantera/mixture.py @@ -318,6 +318,71 @@ class Mixture: """ i = _cantera.mix_equilibrate(self.__mixid, XY, err, maxsteps, maxiter, loglevel) + + def vcs_equilibrate(self, XY = "TP", estimateEquil = 0, printLvl = 0, + solver = 2, rtol = 1.0e-9, + maxsteps = 1000, maxiter = 1000, loglevel = 0): + """Set the mixture to a state of chemical equilibrium. + + This method uses a version of the VCS algorithm to find the + composition that minimizes the total Gibbs free energy of the + mixture, subject to element conservation constraints. For a + description of the theory, see Smith and Missen, "Chemical + Reaction Equilibrium." The VCS algorithm is implemented in + Cantera kernel class MultiPhaseEquil. + + The VCS algorithm solves for the equilibrium composition for + specified temperature and pressure. If any other property pair + other than "TP" is specified, then an outer iteration loop is + used to adjust T and/or P so that the specified property + values are obtained. + + XY - Two-letter string specifying the two properties to hold fixed. + Currently, 'TP', 'HP', and 'SP' are implemented. Default: 'TP'. + + printLvl - Controls the amount of diagnostic output written to cout. If + printLvl = 0, no diagnostic output is written. For values > 0, + more detailed information is written to cout. + The default is printLvl = 0. + + solver - Determines which solver is used. + - 1 MultiPhaseEquil solver + - 2 VCSnonideal Solver (default) + + err - Error tolerance. Iteration will continue until (Delta + mu)/RT is less than this value for each reaction. Default: + 1.0e-9. Note that this default is very conservative, and good + equilibrium solutions may be obtained with larger error + tolerances. + + maxsteps - Maximum number of steps to take while solving the + equilibrium problem for specified T and P. Default: 1000. + + maxiter - Maximum number of temperature and/or pressure iterations. + This is only relevant if a property pair other than (T,P) is + specified. Default: 200. + + loglevel - Controls the amount of diagnostic output written to html. If + loglevel = 0, no diagnostic output is written. For values > 0, + more detailed information is written to the log file as + loglevel increases. The default is loglevel = 0. + + The logfile is written in HTML format, and may be viewed with + any web browser. The default log file name is + "equilibrium_log.html", but if this file exists, the log + information will be written to "equilibrium_log{n}.html", + where {n} is an integer chosen so that the log file does not + already exist. Therefore, if 'equilibrate' is called multiple + times, multiple log files will be written, with names + "equilibrate_log.html", "equilibrate_log1.html", + "equilibrate_log2.html", and so on. Existing log files will + not be overwritten. + + + """ + i = _cantera.mix_vcs_equilibrate(self.__mixid, XY, estimateEquil, + printLvl, solver, rtol, maxsteps, + maxiter, loglevel) def selectSpecies(self, f, species): """Given an array 'f' of floating-point species properties,