Fix boundary conditions in gradient and second derivative operators for Reactor_PFR
This commit is contained in:
8
dependencies/reactor_class.js
vendored
8
dependencies/reactor_class.js
vendored
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user