From 85df04e2156f2e35625557354c2924d2e7938fc3 Mon Sep 17 00:00:00 2001
From: "p.vanderwilt"
Date: Thu, 19 Jun 2025 00:16:54 +0200
Subject: [PATCH] Fix major bug in calculation of dC_out in tick_fe method to
account for outflow
---
dependencies/reactor_class.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dependencies/reactor_class.js b/dependencies/reactor_class.js
index f1695e7..db8b3bb 100644
--- a/dependencies/reactor_class.js
+++ b/dependencies/reactor_class.js
@@ -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