set boundary conditions hard
This commit is contained in:
parent
8d27274101
commit
76640da6cb
@ -8,9 +8,11 @@
|
|||||||
#include <Eigen/src/OrderingMethods/Ordering.h>
|
#include <Eigen/src/OrderingMethods/Ordering.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
const int BTCSDiffusion::BC_NEUMANN = 0;
|
const int BTCSDiffusion::BC_NEUMANN = 0;
|
||||||
const int BTCSDiffusion::BC_DIRICHLET = 1;
|
const int BTCSDiffusion::BC_DIRICHLET = 1;
|
||||||
@ -125,6 +127,8 @@ void BTCSDiffusion::simulate1D(std::vector<double> &c, double bc_left,
|
|||||||
// A_line++;
|
// A_line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << A_matrix << std::endl;
|
||||||
|
|
||||||
// Eigen::SparseMatrix<double> A(size, size);
|
// Eigen::SparseMatrix<double> A(size, size);
|
||||||
// A.setFromTriplets(tripletList.begin(), tripletList.end());
|
// A.setFromTriplets(tripletList.begin(), tripletList.end());
|
||||||
|
|
||||||
@ -152,15 +156,17 @@ void BTCSDiffusion::setTimestep(double time_step) {
|
|||||||
void BTCSDiffusion::simulate(std::vector<double> &c,
|
void BTCSDiffusion::simulate(std::vector<double> &c,
|
||||||
std::vector<double> &alpha) {
|
std::vector<double> &alpha) {
|
||||||
if (this->grid_dim == 1) {
|
if (this->grid_dim == 1) {
|
||||||
double bc_left = getBCFromTuple(0);
|
// double bc_left = getBCFromTuple(0);
|
||||||
double bc_right = getBCFromTuple(1);
|
// double bc_right = getBCFromTuple(1);
|
||||||
|
double bc_left = 5. * std::pow(10,-6);
|
||||||
|
double bc_right = c[this->dim_x -1];
|
||||||
|
|
||||||
simulate1D(c, bc_left, bc_right, alpha);
|
simulate1D(c, bc_left, bc_right, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double BTCSDiffusion::getBCFromTuple(int index) {
|
double BTCSDiffusion::getBCFromTuple(int index, std::vector<double> &c) {
|
||||||
double val = std::get<1>(bc[index]);
|
double val = std::get<0>(bc[index]);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ private:
|
|||||||
void simulate2D(std::vector<double> &c);
|
void simulate2D(std::vector<double> &c);
|
||||||
void simulate3D(std::vector<double> &c);
|
void simulate3D(std::vector<double> &c);
|
||||||
|
|
||||||
double getBCFromTuple(int index);
|
double getBCFromTuple(int index, std::vector<double> &c);
|
||||||
|
|
||||||
boundary_condition bc;
|
boundary_condition bc;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user