Added support for constant cells inside the grid.

This commit is contained in:
Max Luebke 2022-02-03 15:07:49 +01:00
parent 54d1a396f4
commit e3d10336a9

View File

@ -134,6 +134,13 @@ void BTCSDiffusion::simulate1D(std::vector<double> &c, boundary_condition left,
// A_matrix.insert(size + 1, size + 1) = 1;
for (int i = 1; i < size - right_is_constant; i++) {
if (bc[i + !(left_is_constant)].type == BTCSDiffusion::BC_CONSTANT) {
A_matrix.insert(i,i) = 1;
b_vector[i] = bc[i + !(left_is_constant)].value;
continue;
}
double sx = (alpha[i + !(left_is_constant)] * time_step) / (dx * dx);
A_matrix.insert(i, i) = -1. - 2. * sx;