Expand reactor class to build a simple CSTR model. Moved some functionality from asm3_class to reactor.

This commit is contained in:
2025-06-11 16:24:27 +02:00
parent 341af6db4d
commit 603a1d2283
2 changed files with 25 additions and 7 deletions

View File

@@ -62,7 +62,6 @@ class ASM3 {
}
constructor() {
// S_O, S_I, S_S, S_NH, S_N2, S_NO, S_HCO, X_I, X_S, X_H, X_STO, X_A, X_TS
this.stoi_matrix = this._initialise_stoi_matrix()
}
@@ -96,7 +95,7 @@ class ASM3 {
}
compute_rates(state) { // computes reaction rates. state is optional
// state: S_O, S_I, S_S, S_NH, S_N2, S_NO, S_HCO, X_I, X_S, X_H, X_STO, X_A, X_TS
const rates = Array(12);
const [S_O, S_I, S_S, S_NH, S_N2, S_NO, S_HCO, X_I, X_S, X_H, X_STO, X_A, X_TS] = state;
const { k_H, K_X, k_STO, nu_NO, K_O, K_NO, K_S, K_STO, mu_H_max, K_NH, K_HCO, b_H_O, b_H_NO, b_STO_O, b_STO_NO, mu_A_max, K_A_NH, K_A_O, K_A_HCO, b_A_O, b_A_NO } = this.kin_params;
@@ -123,6 +122,7 @@ class ASM3 {
}
compute_dC(state){ // compute changes in concentrations
// state: S_O, S_I, S_S, S_NH, S_N2, S_NO, S_HCO, X_I, X_S, X_H, X_STO, X_A, X_TS
return math.multiply(this.stoi_matrix, this.compute_rates(state));
}
}