diff --git a/src/BTCSDiffusion.cpp b/src/BTCSDiffusion.cpp index d5d7ac1..1db5f60 100644 --- a/src/BTCSDiffusion.cpp +++ b/src/BTCSDiffusion.cpp @@ -8,15 +8,16 @@ #include #include -const int BTCSDiffusion::BC_NEUMANN = 0; -const int BTCSDiffusion::BC_DIRICHLET = 1; +const int BTCSDiffusion::BC_CONSTANT = 0; +const int BTCSDiffusion::BC_CLOSED = 1; +const int BTCSDiffusion::BC_FLUX = 2; BTCSDiffusion::BTCSDiffusion(int x) : n_x(x) { this->grid_dim = 1; this->dx = 1. / (x - 1); // per default use Neumann condition with gradient of 0 at the end of the grid - this->bc.resize(2, std::tuple(BTCSDiffusion::BC_NEUMANN, 0.)); + this->bc.resize(2, std::tuple(BTCSDiffusion::BC_CONSTANT, 0.)); } BTCSDiffusion::BTCSDiffusion(int x, int y) : n_x(x), n_y(y) { @@ -109,10 +110,10 @@ double BTCSDiffusion::getBCFromTuple(int index, double neighbor_c, double val = -1; int type = std::get<0>(bc[index]); - if (type == BTCSDiffusion::BC_NEUMANN) { + if (type == BTCSDiffusion::BC_CONSTANT) { val = neighbor_c + (this->time_step / (dx * dx)) * neighbor_alpha * std::get<1>(bc[index]); - } else if (type == BTCSDiffusion::BC_DIRICHLET) { + } else if (type == BTCSDiffusion::BC_CLOSED) { val = std::get<1>(bc[index]); } else { // TODO: implement error handling here. Type was set to wrong value. diff --git a/src/BTCSDiffusion.hpp b/src/BTCSDiffusion.hpp index 355c646..9720ec9 100644 --- a/src/BTCSDiffusion.hpp +++ b/src/BTCSDiffusion.hpp @@ -35,13 +35,19 @@ class BTCSDiffusion { public: /*! - * Defines a Neumann boundary condition. + * Defines a constant/Dirichlet boundary condition. */ - static const int BC_NEUMANN; + static const int BC_CONSTANT; + /*! - * Defines a Dirichlet boundary condition. + * Defines a closed/Neumann boundary condition. */ - static const int BC_DIRICHLET; + static const int BC_CLOSED; + + /*! + * Defines a flux/Cauchy boundary condition. + */ + static const int BC_FLUX; /*! * Create 1D-diffusion module.