From 6a52908d8571b171bc5685944f185f0aefef4bc3 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 31 Jan 2017 16:57:36 -0500 Subject: [PATCH] [Python/1D] Make current solution residuals accessible --- interfaces/cython/cantera/_cantera.pxd | 1 + interfaces/cython/cantera/onedim.pyx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index caf457c6e..a1e4ae3c9 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -725,6 +725,7 @@ cdef extern from "cantera/oneD/Sim1D.h": int domainIndex(string) except +translate_exception double value(size_t, size_t, size_t) except +translate_exception double workValue(size_t, size_t, size_t) except +translate_exception + void eval(double ) except +translate_exception size_t size() void solveAdjoint(const double*, double*) except +translate_exception void getResidual(double, double*) except +translate_exception diff --git a/interfaces/cython/cantera/onedim.pyx b/interfaces/cython/cantera/onedim.pyx index 54ffe522b..7bbb8bcfe 100644 --- a/interfaces/cython/cantera/onedim.pyx +++ b/interfaces/cython/cantera/onedim.pyx @@ -649,9 +649,20 @@ cdef class Sim1D: dom, comp = self._get_indices(domain, component) self.sim.setValue(dom, comp, point, value) + def eval(self, rdt=0.0): + """ + Evaluate the governing equations using the current solution estimate, + storing the residual in the array which is accessible with the + `work_value` function. + + :param rdt: + Reciprocal of the time-step + """ + self.sim.eval(rdt) + def work_value(self, domain, component, point): """ - Internal work array value at one point. After calling eval, this array + Internal work array value at one point. After calling `eval`, this array contains the values of the residual function. :param domain: