Merge branch '5-set-values-less-than-machine-epsilon-to-0' into 'main'

Resolve "Set values less than machine epsilon to 0"

Closes #5

See merge request mluebke/diffusion!14
This commit is contained in:
Max Lübke 2022-05-09 10:00:13 +02:00
commit 7c12999085

View File

@ -13,6 +13,7 @@
#include <chrono> #include <chrono>
#include <cstddef> #include <cstddef>
#include <iomanip> #include <iomanip>
#include <iostream>
#include <iterator> #include <iterator>
#include <ostream> #include <ostream>
#include <tuple> #include <tuple>
@ -24,7 +25,7 @@
#define omp_get_thread_num() 0 #define omp_get_thread_num() 0
#endif #endif
#include <iostream> #define DOUBLE_MACHINE_EPSILON 1.93e-34
constexpr int BTCS_MAX_DEP_PER_CELL = 3; constexpr int BTCS_MAX_DEP_PER_CELL = 3;
constexpr int BTCS_2D_DT_SIZE = 2; constexpr int BTCS_2D_DT_SIZE = 2;
@ -303,7 +304,8 @@ void Diffusion::BTCSDiffusion::fillVectorFromRow(
} }
double t0_c_j = time_step * alpha[j] * (t0_c[j] / (dx * dx)); double t0_c_j = time_step * alpha[j] * (t0_c[j] / (dx * dx));
b_vector[j + 1] = -c[j] - t0_c_j; double value = (c[j] < DOUBLE_MACHINE_EPSILON ? .0 : c[j]);
b_vector[j + 1] = -value - t0_c_j;
} }
// this is not correct currently.We will fix this when we are able to define // this is not correct currently.We will fix this when we are able to define