From b7b37e92318ffcf31a71dbb0f850e6a73dab3b54 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Tue, 1 Mar 2022 11:08:24 +0100 Subject: [PATCH] Update indexing + Bug fix - Wrong stopping criteria @ filling of matrix - Fill left and right side of b_vector with values from c instead of b_vector --- src/BTCSDiffusion.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/BTCSDiffusion.cpp b/src/BTCSDiffusion.cpp index d615d75..814a6a0 100644 --- a/src/BTCSDiffusion.cpp +++ b/src/BTCSDiffusion.cpp @@ -171,8 +171,6 @@ void Diffusion::BTCSDiffusion::simulate1D( fillVectorFromRowADI(c, alpha, bc, Eigen::VectorXd::Constant(size, 0), size, dx, time_step); - std::cout << A_matrix << std::endl; - solveLES(); c = x_vector.segment(1, size); @@ -275,7 +273,7 @@ inline void Diffusion::BTCSDiffusion::fillMatrixFromRow( if (right_constant) A_matrix.insert(A_size - 2, A_size - 2) = 1; - for (int j = 1 + left_constant, k = j - 1; j < size - (1 - right_constant); + for (int j = 1 + left_constant, k = j - 1; k < size - right_constant; j++, k++) { double sx = (alpha[k] * time_step) / (dx * dx); @@ -327,12 +325,12 @@ inline void Diffusion::BTCSDiffusion::fillVectorFromRowADI( if (!left_constant) { // this is not correct currently.We will fix this when we are able to define // FLUX boundary conditions - b_vector[0] = getBCFromFlux(left, b_vector[1], alpha[0]); + b_vector[0] = getBCFromFlux(left, c[0], alpha[0]); } if (!right_constant) { b_vector[b_size - 1] = - getBCFromFlux(right, b_vector[size - 2], alpha[size - 1]); + getBCFromFlux(right, c[size - 1], alpha[size - 1]); } }