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); } }