push old state

This commit is contained in:
Max Luebke 2021-11-23 14:12:37 +01:00
parent d188575105
commit 3fa31a8f40
3 changed files with 15 additions and 7 deletions

View File

@ -46,7 +46,8 @@ void BTCS1D(int x, std::vector<double> &c, std::vector<double> &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;

View File

@ -6,6 +6,9 @@
typedef Eigen::Triplet<double> T;
extern void BTCS1D(int x, std::vector<double> &c, std::vector<double> &alpha,
double timestep, std::vector<double> &bc);
extern void BTCS2D(int x, int y, std::vector<double> &c,
std::vector<double> &alpha, double timestep);
#endif // DIFFUSION_H_

View File

@ -7,16 +7,20 @@ using namespace std;
int main(int argc, char *argv[]) {
int x = 4;
int y = 4;
int x = 20;
std::vector<double> alpha(x * y, 1 * pow(10, -9));
std::vector<double> input(x * y, 1 * std::pow(10,-6));
input[x + 1] = 5 * std::pow(10, -6);
std::vector<double> alpha(x, 1 * pow(10, -1));
std::vector<double> input(x, 1 * std::pow(10, -6));
std::vector<double> 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;
}