diff --git a/Cantera/python/Cantera/Reactor.py b/Cantera/python/Cantera/Reactor.py index 1dcfe1df8..5f07e2272 100644 --- a/Cantera/python/Cantera/Reactor.py +++ b/Cantera/python/Cantera/Reactor.py @@ -994,7 +994,12 @@ class ReactorNet: def time(self): """The current time [s].""" return _cantera.reactornet_time(self.__reactornet_id) - + + def setTolerances(self, rtol = 1.0e-9, atol = 1.0e-20): + """Set the relative and absolute error tolerances used in + integrating the reactor equations.""" + _cantera.reactornet_setTolerances(self.__reactornet_id, rtol, atol) + def advance(self, time): """Advance the state of the reactor network in time from the current time to time 'time'.""" diff --git a/Cantera/python/ctml_writer.py b/Cantera/python/ctml_writer.py index fb8101daa..e8a5c97ef 100644 --- a/Cantera/python/ctml_writer.py +++ b/Cantera/python/ctml_writer.py @@ -776,6 +776,11 @@ class reaction: self._kf = [self._kf] mdim += 1 ldim -= 3 + + if self._type == 'edge': + if self._beta > 0: + electro = kfnode.addChild('electrochem') + electro['beta'] = `self._beta` for kf in self._kf: @@ -917,10 +922,12 @@ class edge_reaction(reaction): equation = '', kf = None, id = '', - order = '', + order = '', + beta = 0.0, options = []): reaction.__init__(self, equation, kf, id, order, options) self._type = 'edge' + self._beta = beta #-------------- @@ -1516,7 +1523,10 @@ validate() # $Revision$ # $Date$ # $Log$ -# Revision 1.4 2004-07-14 11:24:13 dggoodwin +# Revision 1.5 2004-09-20 10:25:02 dggoodwin +# *** empty log message *** +# +# Revision 1.4 2004/07/14 11:24:13 dggoodwin # *** empty log message *** # # Revision 1.3 2004/06/09 01:02:31 dggoodwin diff --git a/Cantera/python/src/ctreactor_methods.cpp b/Cantera/python/src/ctreactor_methods.cpp index acec23513..5de815f74 100644 --- a/Cantera/python/src/ctreactor_methods.cpp +++ b/Cantera/python/src/ctreactor_methods.cpp @@ -492,6 +492,18 @@ py_reactornet_del(PyObject *self, PyObject *args) return Py_BuildValue("i",0); } +static PyObject* +py_reactornet_setTolerances(PyObject *self, PyObject *args) +{ + int n; + double rtol, atol; + if (!PyArg_ParseTuple(args, "idd:reactornet_setTolerances", &n, &rtol, &atol)) + return NULL; + int iok = reactornet_setTolerances(n, rtol, atol); + if (iok < 0) return reportError(iok); + return Py_BuildValue("i",0); +} + static PyObject* py_reactornet_setInitialTime(PyObject *self, PyObject *args) { diff --git a/Cantera/python/src/methods.h b/Cantera/python/src/methods.h index 37a9de95d..f62b28512 100644 --- a/Cantera/python/src/methods.h +++ b/Cantera/python/src/methods.h @@ -196,6 +196,7 @@ static PyMethodDef ct_methods[] = { {"flowdev_ready", py_flowdev_ready, METH_VARARGS}, //{"reactor_setInitialTime", py_reactor_setInitialTime, METH_VARARGS}, {"reactornet_setInitialTime", py_reactornet_setInitialTime, METH_VARARGS}, + {"reactornet_setTolerances", py_reactornet_setTolerances, METH_VARARGS}, {"flowdev_new", py_flowdev_new, METH_VARARGS}, {"flowdev_massFlowRate", py_flowdev_massFlowRate, METH_VARARGS}, {"flowdev_del", py_flowdev_del, METH_VARARGS},