[Reactor] Divide residuals by sqrt(n_vars) in advance_to_steady_state

This commit is contained in:
Thomas Fiala 2015-11-02 13:00:32 +01:00 committed by Ray Speth
parent 304364c203
commit de133f1a3d

View file

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