mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-15 18:38:23 +01:00
fix(velocities): prevent redundant velocity calculations
This commit is contained in:
parent
d8c8a734aa
commit
16b361c85b
@ -119,13 +119,17 @@ public:
|
||||
void run() {
|
||||
this->setDomain(velocities.domainX(), velocities.domainY());
|
||||
|
||||
velocities.run();
|
||||
if constexpr (hyd_mode == HYDRAULIC_MODE::STEADY_STATE) {
|
||||
if (!velocities.isSteady()) {
|
||||
velocities.run();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->getIterations(); i++) {
|
||||
if constexpr (hyd_mode == HYDRAULIC_MODE::TRANSIENT) {
|
||||
velocities.run();
|
||||
}
|
||||
adv();
|
||||
startAdvection();
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +137,7 @@ private:
|
||||
/**
|
||||
* @brief function calculating material transport for one timestep
|
||||
*/
|
||||
void adv() {
|
||||
void startAdvection() {
|
||||
const std::size_t rows = this->rows();
|
||||
const std::size_t cols = this->cols();
|
||||
const T volume = this->deltaCol() * this->deltaRow();
|
||||
|
||||
@ -43,6 +43,7 @@ private:
|
||||
T timestep{-1};
|
||||
T epsilon{1E-5};
|
||||
int numThreads{omp_get_num_procs()};
|
||||
bool steady{false};
|
||||
|
||||
RowMajMat<T> velocitiesX;
|
||||
RowMajMat<T> velocitiesY;
|
||||
@ -118,6 +119,8 @@ public:
|
||||
this->permKY = alphaY;
|
||||
}
|
||||
|
||||
bool isSteady() const { return steady; }
|
||||
|
||||
/**
|
||||
* @brief Set the timestep per iteration
|
||||
*
|
||||
@ -219,6 +222,9 @@ public:
|
||||
oldConcentrations = this->getConcentrationMatrix();
|
||||
(void)calculate_hydraulic_flow(input);
|
||||
} while (!checkConvergance(oldConcentrations));
|
||||
|
||||
steady = true;
|
||||
|
||||
} else {
|
||||
if (timestep == -1) {
|
||||
throw_invalid_argument("Timestep is not set");
|
||||
|
||||
@ -20,9 +20,7 @@ VELOCITIES_TEST(SteadyStateCenter) {
|
||||
tug::RowMajMat<double> hydHeads =
|
||||
tug::RowMajMat<double>::Constant(rows, cols, 1);
|
||||
|
||||
tug::RowMajMat<double> permKX =
|
||||
tug::RowMajMat<double>::Constant(rows, cols, K);
|
||||
tug::RowMajMat<double> permKY =
|
||||
tug::RowMajMat<double> permK =
|
||||
tug::RowMajMat<double>::Constant(rows, cols, K);
|
||||
|
||||
tug::Velocities<double, tug::HYDRAULIC_MODE::STEADY_STATE,
|
||||
@ -30,14 +28,10 @@ VELOCITIES_TEST(SteadyStateCenter) {
|
||||
velo(hydHeads);
|
||||
|
||||
velo.setDomain(100, 100);
|
||||
velo.setPermKX(permKX);
|
||||
velo.setPermKY(permKY);
|
||||
velo.setPermKX(permK);
|
||||
velo.setPermKY(permK);
|
||||
|
||||
tug::Boundary<double> &bcH = velo.getBoundaryConditions();
|
||||
bcH.setBoundarySideConstant(tug::BC_SIDE_LEFT, 1);
|
||||
bcH.setBoundarySideConstant(tug::BC_SIDE_RIGHT, 1);
|
||||
bcH.setBoundarySideConstant(tug::BC_SIDE_TOP, 1);
|
||||
bcH.setBoundarySideConstant(tug::BC_SIDE_BOTTOM, 1);
|
||||
|
||||
bcH.setInnerBoundary(center_row, center_col, 10);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user