diff --git a/src/diffusion.cpp b/src/diffusion.cpp index 726fdf2..5b398a2 100644 --- a/src/diffusion.cpp +++ b/src/diffusion.cpp @@ -46,7 +46,8 @@ void BTCS1D(int x, std::vector &c, std::vector &alpha, A_line++; tripletList.push_back(T(A_line, size-1, 1)); - b[A_line] = bc[1]; + // b[A_line] = bc[1]; + b[A_line] = c[c.size()-1]; // std::cout << b << std::endl; diff --git a/src/diffusion.hpp b/src/diffusion.hpp index 6645f8c..9d80e45 100644 --- a/src/diffusion.hpp +++ b/src/diffusion.hpp @@ -6,6 +6,9 @@ typedef Eigen::Triplet T; +extern void BTCS1D(int x, std::vector &c, std::vector &alpha, + double timestep, std::vector &bc); + extern void BTCS2D(int x, int y, std::vector &c, std::vector &alpha, double timestep); #endif // DIFFUSION_H_ diff --git a/src/main.cpp b/src/main.cpp index be66bcc..3613d17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,16 +7,20 @@ using namespace std; int main(int argc, char *argv[]) { - int x = 4; - int y = 4; + int x = 20; - std::vector alpha(x * y, 1 * pow(10, -9)); - std::vector input(x * y, 1 * std::pow(10,-6)); - input[x + 1] = 5 * std::pow(10, -6); + std::vector alpha(x, 1 * pow(10, -1)); + std::vector input(x, 1 * std::pow(10, -6)); + std::vector bc; + + bc.push_back(5. * std::pow(10, -6)); + bc.push_back(1. * std::pow(10, -6)); // input[x + 2] = 5.5556554 * std::pow(10, -6); // input[x + 3] = 5.234564213 * std::pow(10, -6); - BTCS2D(x, y, input, alpha, 1.); + for (int i = 0; i < 100; i++) { + BTCS1D(x, input, alpha, 1., bc); + } return 0; }