Update calculation of t0_c

- Added time dependency by multiplying spacial context with current time step
This commit is contained in:
Max Luebke 2022-02-17 17:02:25 +01:00
parent 0dad4f93fd
commit 78ef8c2833
3 changed files with 9 additions and 7 deletions

View File

@ -93,7 +93,7 @@ c(i,N-1) & \text{else}
*** Inlet
$p(i,j) = \alpha(i,j)\frac{c(i-1,j) - 2\cdot c(i,j) + c(i+1,j)}{\Delta x^2}$[fn:1]
$p(i,j) = \frac{\Delta t}{2}\alpha(i,j)\frac{c(i-1,j) - 2\cdot c(i,j) + c(i+1,j)}{\Delta x^2}$[fn:1]
$b(i,j) = \begin{cases}
bc(i,j).\text{value} & \text{if } bc(i,N-1) = \text{constant} \\

View File

@ -139,6 +139,7 @@ void BTCSDiffusion::simulate1D(Eigen::Map<DVectorRowMajor> &c,
void BTCSDiffusion::simulate2D(Eigen::Map<DMatrixRowMajor> &c,
Eigen::Map<const DMatrixRowMajor> &alpha) {
double local_dt = this->time_step/ 2.;
DMatrixRowMajor tmp_vector;
int n_cols = c.cols();
@ -158,7 +159,7 @@ void BTCSDiffusion::simulate2D(Eigen::Map<DMatrixRowMajor> &c,
fillMatrixFromRow(alpha.row(i), n_cols, i, left_constant, right_constant,
deltas[0], this->time_step / 2);
fillVectorFromRowADI(c, alpha.row(i), i, deltas[0], left, right);
fillVectorFromRowADI(c, alpha.row(i), i, deltas[0], left, right, local_dt);
}
solveLES();
@ -190,7 +191,7 @@ void BTCSDiffusion::simulate2D(Eigen::Map<DMatrixRowMajor> &c,
fillMatrixFromRow(alpha.col(i), n_cols, i, left_constant, right_constant,
deltas[1], this->time_step / 2);
fillVectorFromRowADI(c, alpha.row(i), i, deltas[1], left, right);
fillVectorFromRowADI(c, alpha.row(i), i, deltas[1], left, right, local_dt);
}
solveLES();
@ -274,9 +275,9 @@ void BTCSDiffusion::fillVectorFromRowADI(Eigen::Map<DMatrixRowMajor> &c,
: getBCFromFlux(tmp_bc, c(row, j), alpha[j]));
double t0_c =
alpha[j] *
time_step * alpha[j] *
((y_values[0] - 2 * y_values[1] + y_values[2]) / (delta * delta));
b_vector[offset * row + (j + 1)] = -c(row, j) - t0_c;
b_vector[offset * row + (j + 1)] = -c(row, j) - (t0_c);
}
}

View File

@ -153,8 +153,9 @@ private:
bool left_constant, bool right_constant, double delta,
double time_step);
void fillVectorFromRowADI(Eigen::Map<DMatrixRowMajor> &c,
const Eigen::VectorXd alpha, int row, double delta,
boundary_condition left, boundary_condition right);
const Eigen::VectorXd alpha, int row, double delta,
boundary_condition left, boundary_condition right,
double time_step);
void simulate3D(std::vector<double> &c);
inline double getBCFromFlux(boundary_condition bc, double nearest_value,
double neighbor_alpha);