From f4824b822cac7208cd87bd5fbb12a9c182f674a8 Mon Sep 17 00:00:00 2001
From: "p.vanderwilt"
Date: Tue, 1 Jul 2025 13:04:32 +0200
Subject: [PATCH] Improved wieghted finite differencing
---
dependencies/reactor_class.js | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/dependencies/reactor_class.js b/dependencies/reactor_class.js
index 0d73705..2c8d3b8 100644
--- a/dependencies/reactor_class.js
+++ b/dependencies/reactor_class.js
@@ -211,18 +211,15 @@ class Reactor_PFR {
const B = math.resize(math.diag(Array(this.n_x).fill(2/3), 1), [this.n_x, this.n_x]);
const C = math.resize(math.diag(Array(this.n_x).fill(-1/12), 2), [this.n_x, this.n_x]);
const D = math.add(I, A, B, C);
- D[1][0] = -1;
- D[1][1] = 0;
- D[1][2] = 1;
- D[1][3] = 0;
const NearBoundary = Array(this.n_x).fill(0.0);
- NearBoundary[1] = -25/12;
- NearBoundary[2] = 4;
- NearBoundary[3] = -3;
- NearBoundary[4] = 4/3;
- NearBoundary[5] = -1/4;
+ NearBoundary[0] = -1/4;
+ NearBoundary[1] = -5/6;
+ NearBoundary[2] = 3/2;
+ NearBoundary[3] = -1/2;
+ NearBoundary[4] = 1/12;
+ D[1] = NearBoundary;
NearBoundary.reverse();
- D[this.n_x-2] = NearBoundary;
+ D[this.n_x-2] = math.multiply(-1, NearBoundary);
D[0] = Array(this.n_x).fill(0); // set by BCs elsewhere
D[this.n_x-1] = Array(this.n_x).fill(0);
return D;