[Python/1D] Make current solution residuals accessible

This commit is contained in:
Ray Speth 2017-01-31 16:57:36 -05:00
parent 78d5809d6f
commit 6a52908d85
2 changed files with 13 additions and 1 deletions

View file

@ -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

View file

@ -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: