Fix major bug in calculation of dC_out in tick_fe method to account for outflow

This commit is contained in:
2025-06-19 00:16:54 +02:00
parent 5bd094f4a6
commit 85df04e215

View File

@@ -59,7 +59,7 @@ class Reactor_CSTR {
tick_fe(time_step) { // tick reactor state using forward Euler method
const r = this.asm.compute_dC(this.state);
const dC_in = math.multiply(math.divide([this.Fs], this.Vl), this.Cs_in)[0];
const dC_out = math.multiply(math.sum(this.Fs)/this.Vl, this.state);
const dC_out = math.multiply(-1*math.sum(this.Fs)/this.Vl, this.state);
const t_O = Array(13).fill(0.0);
t_O[0] = isNaN(this.kla) ? this.OTR : this.calcOTR(this.state[0]); // calculate OTR if kla is not NaN, otherwise use externaly calculated OTR