From de133f1a3da0573975a067aef9cbeef9a851a04a Mon Sep 17 00:00:00 2001 From: Thomas Fiala Date: Mon, 2 Nov 2015 13:00:32 +0100 Subject: [PATCH] [Reactor] Divide residuals by sqrt(n_vars) in advance_to_steady_state --- interfaces/cython/cantera/reactor.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/cython/cantera/reactor.pyx b/interfaces/cython/cantera/reactor.pyx index 1c97a7279..ecdeec3d8 100644 --- a/interfaces/cython/cantera/reactor.pyx +++ b/interfaces/cython/cantera/reactor.pyx @@ -1006,7 +1006,7 @@ cdef class ReactorNet: only changes below a certain threshold. The residual is computed using feature scaling: - .. math:: r = \frac{x(t + \Delta t) - x(t)}{\text{max}(x) + \text{atol}} + .. math:: r = \left| \frac{x(t + \Delta t) - x(t)}{\text{max}(x) + \text{atol}} \right| \cdot \frac{1}{\sqrt{n_x}} :param max_steps: Maximum number of steps to be taken @@ -1046,7 +1046,7 @@ cdef class ReactorNet: max_state_values = np.maximum(max_state_values, state) # determine feature_scaled residual residual = np.linalg.norm((state - previous_state) - / (max_state_values + atol)) + / (max_state_values + atol)) / np.sqrt(self.n_vars) if return_residuals: residuals[step] = residual if residual < residual_threshold: