Fix COD balance
This commit is contained in:
@@ -34,7 +34,7 @@ class Reactor {
|
|||||||
|
|
||||||
this.Fs = Array(config.n_inlets).fill(0); // fluid debits per inlet [m3 d-1]
|
this.Fs = Array(config.n_inlets).fill(0); // fluid debits per inlet [m3 d-1]
|
||||||
this.Cs_in = Array.from(Array(config.n_inlets), () => new Array(NUM_SPECIES).fill(0)); // composition influents
|
this.Cs_in = Array.from(Array(config.n_inlets), () => new Array(NUM_SPECIES).fill(0)); // composition influents
|
||||||
this.OTR = 0.0; // oxygen transfer rate [g O2 d-1]
|
this.OTR = 0.0; // oxygen transfer rate [g O2 d-1 m-3]
|
||||||
this.temperature = 20; // temperature [C]
|
this.temperature = 20; // temperature [C]
|
||||||
|
|
||||||
this.kla = config.kla; // if NaN, use externaly provided OTR [d-1]
|
this.kla = config.kla; // if NaN, use externaly provided OTR [d-1]
|
||||||
@@ -68,7 +68,7 @@ class Reactor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for OTR (Oxygen Transfer Rate).
|
* Setter for OTR (Oxygen Transfer Rate).
|
||||||
* @param {object} input - Input object (msg) containing payload with OTR value [g O2 d-1].
|
* @param {object} input - Input object (msg) containing payload with OTR value [g O2 d-1 m-3].
|
||||||
*/
|
*/
|
||||||
set setOTR(input) {
|
set setOTR(input) {
|
||||||
this.OTR = input.payload;
|
this.OTR = input.payload;
|
||||||
@@ -89,7 +89,7 @@ class Reactor {
|
|||||||
* Calculate the oxygen transfer rate (OTR) based on the dissolved oxygen concentration and temperature.
|
* Calculate the oxygen transfer rate (OTR) based on the dissolved oxygen concentration and temperature.
|
||||||
* @param {number} S_O - Dissolved oxygen concentration [g O2 m-3].
|
* @param {number} S_O - Dissolved oxygen concentration [g O2 m-3].
|
||||||
* @param {number} T - Temperature in Celsius, default to 20 C.
|
* @param {number} T - Temperature in Celsius, default to 20 C.
|
||||||
* @returns {number} - Calculated OTR [g O2 d-1].
|
* @returns {number} - Calculated OTR [g O2 d-1 m-3].
|
||||||
*/
|
*/
|
||||||
_calcOTR(S_O, T = 20.0) { // caculate the OTR using basic correlation, default to temperature: 20 C
|
_calcOTR(S_O, T = 20.0) { // caculate the OTR using basic correlation, default to temperature: 20 C
|
||||||
let S_O_sat = 14.652 - 4.1022e-1 * T + 7.9910e-3 * T*T + 7.7774e-5 * T*T*T;
|
let S_O_sat = 14.652 - 4.1022e-1 * T + 7.9910e-3 * T*T + 7.7774e-5 * T*T*T;
|
||||||
@@ -229,9 +229,13 @@ class Reactor_PFR extends Reactor {
|
|||||||
const transfer = Array.from(Array(this.n_x), () => new Array(NUM_SPECIES).fill(0));
|
const transfer = Array.from(Array(this.n_x), () => new Array(NUM_SPECIES).fill(0));
|
||||||
|
|
||||||
if (isNaN(this.kla)) { // calculate OTR if kla is not NaN, otherwise use externally calculated OTR
|
if (isNaN(this.kla)) { // calculate OTR if kla is not NaN, otherwise use externally calculated OTR
|
||||||
transfer.forEach((x) => { x[S_O_INDEX] = this.OTR; });
|
for (let i = 1; i < this.n_x - 1; i++) {
|
||||||
|
transfer[i][S_O_INDEX] = this.OTR * this.n_x/(this.n_x-2);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
transfer.forEach((x, i) => { x[S_O_INDEX] = this._calcOTR(this.state[i][S_O_INDEX], this.temperature); });
|
for (let i = 1; i < this.n_x - 1; i++) {
|
||||||
|
transfer[i][S_O_INDEX] = this._calcOTR(this.state[i][S_O_INDEX], this.temperature) * this.n_x/(this.n_x-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dC_total = math.multiply(math.add(dispersion, advection, reaction, transfer), time_step);
|
const dC_total = math.multiply(math.add(dispersion, advection, reaction, transfer), time_step);
|
||||||
|
|||||||
Reference in New Issue
Block a user