def calc_species_residual(self, Y, source_Y, Yb): x = self.x R = np.zeros(self.n, dtype=Y.dtype) R = -diff_up(self.x, Y)*self.mdot + self.alpha*diff2(self.x, Y) + source_Y R[0] = -(Y[0] - Yb) R[-1] = -1/(x[-1] - x[-2])*(Y[-1] - Y[-2]) #R[-1] = -1/(x[-1] - x[-2])*(1.5*Y[-1] - 2.0*Y[-2] + 0.5*Y[-3]) return R
def calc_temperature_residual(self, T, source_T): x = self.x R = np.zeros(self.n, dtype=T.dtype) R = -diff_up(self.x, T)*self.mdot + self.alpha*diff2(self.x, T) + source_T R[0] = -(T[0] - self.S_minf[0]) R[-1] = -1/(x[-1] - x[-2])*(T[-1] - T[-2]) #R[-1] = -1/(x[-1] - x[-2])*(1.5*T[-1] - 2.0*T[-2] + 0.5*T[-3]) return R