Add recirculation pump node with input handling and flow management

This commit is contained in:
2025-06-16 16:53:07 +02:00
parent d0f8ada144
commit 5281696a21
6 changed files with 105 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ class Reactor_CSTR {
this.Vl = volume; // fluid volume reactor [m3]
this.Fs = Array(n_inlets).fill(0.0); // fluid debits per inlet [m3 d-1]
this.Cs_in = Array.from(Array(n_inlets), () => new Array(13)).fill(0.0); // composition influent
this.Cs_in = Array.from(Array(n_inlets), () => new Array(13).fill(0.0)); // composition influents
this.OTR = 0.0; // oxygen transfer rate [g O2 d-1]
this.currentTime = Date.now(); // milliseconds since epoch [ms]
@@ -51,8 +51,8 @@ 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(this.Cs_in, this.Fs/this.Vl)[0];
const dC_out = math.multiply(this.state, math.sum(this.Fs)/this.Vl);
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 T_O = Array(13).fill(0.0);
T_O[0] = this.OTR;