Minor bug fixes, code perfomance and clarity improvements #5

Merged
p.vanderwilt merged 7 commits from dev-Pieter into main 2025-11-12 09:27:38 +00:00
Showing only changes of commit ffb4080f14 - Show all commits

View File

@@ -365,11 +365,10 @@ class Reactor_PFR extends Reactor {
* for outlet, apply regular Danckwerts BC (Neumann BC with no flux)
*/
_applyBoundaryConditions() {
// Upstream BC
if (this.upstreamReactor) {
// Open boundary
for (let i = 0; i < BC_PADDING; i++) {
this.extendedState[i] = this.upstreamReactor.state.at(i-BC_PADDING);
}
this.extendedState.splice(0, BC_PADDING, ...this.upstreamReactor.state.slice(-BC_PADDING));
} else {
if (math.sum(this.Fs) > 0) {
// Danckwerts BC
@@ -383,11 +382,10 @@ class Reactor_PFR extends Reactor {
}
}
// Downstream BC
if (this.downstreamReactor) {
// Open boundary
for (let i = 0; i < BC_PADDING; i++) {
this.extendedState[this.n_x+BC_PADDING+i] = this.downstreamReactor.state[i];
}
this.extendedState.splice(this.n_x+BC_PADDING, BC_PADDING, ...this.downstreamReactor.state.slice(0, BC_PADDING));
} else {
// Neumann BC (no flux)
this.extendedState.fill(this.extendedState.at(-1-BC_PADDING), BC_PADDING+this.n_x);