push old state
This commit is contained in:
parent
d188575105
commit
3fa31a8f40
@ -46,7 +46,8 @@ void BTCS1D(int x, std::vector<double> &c, std::vector<double> &alpha,
|
|||||||
|
|
||||||
A_line++;
|
A_line++;
|
||||||
tripletList.push_back(T(A_line, size-1, 1));
|
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;
|
// std::cout << b << std::endl;
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
typedef Eigen::Triplet<double> T;
|
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,
|
extern void BTCS2D(int x, int y, std::vector<double> &c,
|
||||||
std::vector<double> &alpha, double timestep);
|
std::vector<double> &alpha, double timestep);
|
||||||
#endif // DIFFUSION_H_
|
#endif // DIFFUSION_H_
|
||||||
|
|||||||
16
src/main.cpp
16
src/main.cpp
@ -7,16 +7,20 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
int x = 4;
|
int x = 20;
|
||||||
int y = 4;
|
|
||||||
|
|
||||||
std::vector<double> alpha(x * y, 1 * pow(10, -9));
|
std::vector<double> alpha(x, 1 * pow(10, -1));
|
||||||
std::vector<double> input(x * y, 1 * std::pow(10,-6));
|
std::vector<double> input(x, 1 * std::pow(10, -6));
|
||||||
input[x + 1] = 5 * 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 + 2] = 5.5556554 * std::pow(10, -6);
|
||||||
// input[x + 3] = 5.234564213 * 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user