Implement simple BCs
This commit is contained in:
@@ -30,6 +30,7 @@ class Reactor {
|
|||||||
this.parent = []; // Gets assigned via child registration
|
this.parent = []; // Gets assigned via child registration
|
||||||
|
|
||||||
this.upstreamReactor = null;
|
this.upstreamReactor = null;
|
||||||
|
this.downstreamReactor = null;
|
||||||
|
|
||||||
this.asm = new ASM3();
|
this.asm = new ASM3();
|
||||||
|
|
||||||
@@ -116,10 +117,6 @@ class Reactor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setDownstreamReactor() {
|
|
||||||
this.downstreamReactor = this.parent.find((x) => x.config.functionality.softwareType == "reactor");
|
|
||||||
}
|
|
||||||
|
|
||||||
_connectMeasurement(measurementChild) {
|
_connectMeasurement(measurementChild) {
|
||||||
if (!measurementChild) {
|
if (!measurementChild) {
|
||||||
this.logger.warn("Invalid measurement provided.");
|
this.logger.warn("Invalid measurement provided.");
|
||||||
@@ -158,7 +155,7 @@ class Reactor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.upstreamReactor = reactorChild;
|
this.upstreamReactor = reactorChild;
|
||||||
reactorChild.setDownstreamReactor();
|
reactorChild.downstreamReactor = this;
|
||||||
|
|
||||||
reactorChild.emitter.on("stateChange", (data) => {
|
reactorChild.emitter.on("stateChange", (data) => {
|
||||||
this.logger.debug(`State change of upstream reactor detected.`);
|
this.logger.debug(`State change of upstream reactor detected.`);
|
||||||
@@ -346,7 +343,7 @@ class Reactor_PFR extends Reactor {
|
|||||||
*/
|
*/
|
||||||
_applyBoundaryConditions(state) {
|
_applyBoundaryConditions(state) {
|
||||||
if (this.upstreamReactor) {
|
if (this.upstreamReactor) {
|
||||||
state[0] = this.upstreamReactor.state[this.n_x-1];
|
state[0] = this.upstreamReactor.state.at(-1);
|
||||||
} else {
|
} else {
|
||||||
if (math.sum(this.Fs) > 0) { // Danckwerts BC
|
if (math.sum(this.Fs) > 0) { // Danckwerts BC
|
||||||
const BC_C_in = math.multiply(1 / math.sum(this.Fs), [this.Fs], this.Cs_in)[0];
|
const BC_C_in = math.multiply(1 / math.sum(this.Fs), [this.Fs], this.Cs_in)[0];
|
||||||
@@ -361,7 +358,7 @@ class Reactor_PFR extends Reactor {
|
|||||||
state[this.n_x-1] = this.downstreamReactor.state[0];
|
state[this.n_x-1] = this.downstreamReactor.state[0];
|
||||||
} else {
|
} else {
|
||||||
// Neumann BC (no flux)
|
// Neumann BC (no flux)
|
||||||
state[this.n_x-1] = state[this.n_x-2];
|
state[this.n_x-1] = state.at(-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user