mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-14 01:48:23 +01:00
Fix tidy infos in library.
This commit is contained in:
parent
374a7ef9d9
commit
aea3a7afc3
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
constexpr double center_eq(double sx) { return -1. - 2. * sx; }
|
||||||
|
|
||||||
Diffusion::BTCSDiffusion::BTCSDiffusion(unsigned int dim) : grid_dim(dim) {
|
Diffusion::BTCSDiffusion::BTCSDiffusion(unsigned int dim) : grid_dim(dim) {
|
||||||
|
|
||||||
@ -87,8 +88,8 @@ void Diffusion::BTCSDiffusion::simulate_base(DVectorRowMajor &c,
|
|||||||
reserveMemory(size, BTCS_MAX_DEP_PER_CELL);
|
reserveMemory(size, BTCS_MAX_DEP_PER_CELL);
|
||||||
|
|
||||||
fillMatrixFromRow(alpha.row(0), bc.row(0), size, dx, time_step);
|
fillMatrixFromRow(alpha.row(0), bc.row(0), size, dx, time_step);
|
||||||
fillVectorFromRow(c, alpha, bc, Eigen::VectorXd::Constant(size, 0), size,
|
fillVectorFromRow(c, alpha, bc, Eigen::VectorXd::Constant(size, 0), size, dx,
|
||||||
dx, time_step);
|
time_step);
|
||||||
|
|
||||||
solveLES();
|
solveLES();
|
||||||
|
|
||||||
@ -230,8 +231,8 @@ inline void Diffusion::BTCSDiffusion::fillMatrixFromRow(
|
|||||||
A_matrix.insert(A_size - 2, A_size - 2) = 1;
|
A_matrix.insert(A_size - 2, A_size - 2) = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 1 + (int)left_constant, k = j - 1; k < size - (int)right_constant;
|
for (int j = 1 + (int)left_constant, k = j - 1;
|
||||||
j++, k++) {
|
k < size - (int)right_constant; j++, k++) {
|
||||||
double sx = (alpha[k] * time_step) / (dx * dx);
|
double sx = (alpha[k] * time_step) / (dx * dx);
|
||||||
|
|
||||||
if (bc[k].type == Diffusion::BC_CONSTANT) {
|
if (bc[k].type == Diffusion::BC_CONSTANT) {
|
||||||
@ -239,7 +240,7 @@ inline void Diffusion::BTCSDiffusion::fillMatrixFromRow(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
A_matrix.insert(j, j) = -1. - 2. * sx;
|
A_matrix.insert(j, j) = center_eq(sx);
|
||||||
A_matrix.insert(j, (j - 1)) = sx;
|
A_matrix.insert(j, (j - 1)) = sx;
|
||||||
A_matrix.insert(j, (j + 1)) = sx;
|
A_matrix.insert(j, (j + 1)) = sx;
|
||||||
}
|
}
|
||||||
@ -266,15 +267,6 @@ inline void Diffusion::BTCSDiffusion::fillVectorFromRow(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// double y_values[3];
|
|
||||||
// y_values[0] =
|
|
||||||
// (row != 0 ? c(row - 1, j) : getBCFromFlux(tmp_bc, c(row, j),
|
|
||||||
// alpha[j]));
|
|
||||||
// y_values[1] = c(row, j);
|
|
||||||
// y_values[2] =
|
|
||||||
// (row != nrow - 1 ? c(row + 1, j)
|
|
||||||
// : getBCFromFlux(tmp_bc, c(row, j), alpha[j]));
|
|
||||||
|
|
||||||
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;
|
b_vector[j + 1] = -c[j] - t0_c_j;
|
||||||
}
|
}
|
||||||
@ -317,11 +309,12 @@ void Diffusion::BTCSDiffusion::simulate(double *c, double *alpha,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double Diffusion::BTCSDiffusion::getBCFromFlux(boundary_condition bc,
|
inline auto Diffusion::BTCSDiffusion::getBCFromFlux(boundary_condition bc,
|
||||||
double neighbor_c,
|
double neighbor_c,
|
||||||
double neighbor_alpha) {
|
double neighbor_alpha)
|
||||||
|
-> double {
|
||||||
|
|
||||||
double val;
|
double val = 0;
|
||||||
|
|
||||||
if (bc.type == Diffusion::BC_CLOSED) {
|
if (bc.type == Diffusion::BC_CLOSED) {
|
||||||
val = neighbor_c;
|
val = neighbor_c;
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace Diffusion {
|
namespace Diffusion {
|
||||||
/*!
|
/*!
|
||||||
* Class implementing a solution for a 1/2/3D diffusion equation using backward
|
* Class implementing a solution for a 1/2/3D diffusion equation using backward
|
||||||
@ -126,9 +125,9 @@ private:
|
|||||||
Eigen::Map<const DMatrixRowMajor> &alpha,
|
Eigen::Map<const DMatrixRowMajor> &alpha,
|
||||||
Eigen::Map<const BCMatrixRowMajor> &bc);
|
Eigen::Map<const BCMatrixRowMajor> &bc);
|
||||||
|
|
||||||
auto calc_t0_c(const DMatrixRowMajor &c,
|
auto calc_t0_c(const DMatrixRowMajor &c, const DMatrixRowMajor &alpha,
|
||||||
const DMatrixRowMajor &alpha,
|
const BCMatrixRowMajor &bc, double time_step, double dx)
|
||||||
const BCMatrixRowMajor &bc, double time_step, double dx) -> DMatrixRowMajor;
|
-> DMatrixRowMajor;
|
||||||
|
|
||||||
inline void fillMatrixFromRow(const DVectorRowMajor &alpha,
|
inline void fillMatrixFromRow(const DVectorRowMajor &alpha,
|
||||||
const BCVectorRowMajor &bc, int size, double dx,
|
const BCVectorRowMajor &bc, int size, double dx,
|
||||||
@ -141,8 +140,10 @@ private:
|
|||||||
void simulate3D(std::vector<double> &c);
|
void simulate3D(std::vector<double> &c);
|
||||||
|
|
||||||
inline void reserveMemory(int size, int max_count_per_line);
|
inline void reserveMemory(int size, int max_count_per_line);
|
||||||
inline double getBCFromFlux(Diffusion::boundary_condition bc,
|
inline static auto getBCFromFlux(Diffusion::boundary_condition bc,
|
||||||
double nearest_value, double neighbor_alpha);
|
double neighbor_c, double neighbor_alpha)
|
||||||
|
-> double;
|
||||||
|
|
||||||
void solveLES();
|
void solveLES();
|
||||||
void updateInternals();
|
void updateInternals();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user