From 9f1322978535e10c57eb83872d50cb416ce713bf Mon Sep 17 00:00:00 2001
From: "p.vanderwilt"
Date: Tue, 24 Jun 2025 16:38:07 +0200
Subject: [PATCH] Fix boundary conditions in gradient and second derivative
operators for Reactor_PFR
---
dependencies/reactor_class.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dependencies/reactor_class.js b/dependencies/reactor_class.js
index 9e02fca..adf744f 100644
--- a/dependencies/reactor_class.js
+++ b/dependencies/reactor_class.js
@@ -179,20 +179,20 @@ class Reactor_PFR {
}
makeDoperator() { // create the upwind scheme gradient operator
- const I = math.diag(Array(this.n_x).fill(-1), 0);
- const A = math.resize(math.diag(Array(this.n_x).fill(1), 1), [this.n_x, this.n_x]);
+ const I = math.diag(Array(this.n_x).fill(1), 0);
+ const A = math.resize(math.diag(Array(this.n_x).fill(-1), -1), [this.n_x, this.n_x]);
I[0][0] = 0;
I[0][1] = -1;
- I[this.n_x-1][this.n_x-1] = 0; // Neumann boundary condition at x=L
return math.add(I, A);
}
- makeD2operator() { // create the upwind scheme second derivative operator
+ makeD2operator() { // create the central second derivative operator
const I = math.diag(Array(this.n_x).fill(-2), 0);
const A = math.resize(math.diag(Array(this.n_x).fill(1), 1), [this.n_x, this.n_x]);
const B = math.resize(math.diag(Array(this.n_x).fill(1), -1), [this.n_x, this.n_x]);
I[0][0] = 0;
I[0][1] = -1;
+ I[0][0] = -1; // Dichelet boundary condition at outlet
return math.add(I, A, B);
}
}