mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-15 18:38:23 +01:00
fix: remove factor 2 in 'middle' coefficient of explicit part (closed)
test: add test case with homogeneous field and same values as const boundary condition
This commit is contained in:
parent
f651c1d158
commit
61d6cfc5cb
@ -140,7 +140,7 @@ constexpr T calcExplicitConcentrationsBoundaryConstant(T conc_center, T conc_bc,
|
|||||||
T alpha_neighbor, T sy) {
|
T alpha_neighbor, T sy) {
|
||||||
return sy * calcAlphaIntercell(alpha_center, alpha_neighbor) * conc_center +
|
return sy * calcAlphaIntercell(alpha_center, alpha_neighbor) * conc_center +
|
||||||
(1 - sy * (calcAlphaIntercell(alpha_center, alpha_center) +
|
(1 - sy * (calcAlphaIntercell(alpha_center, alpha_center) +
|
||||||
2 * alpha_center)) *
|
alpha_center)) *
|
||||||
conc_center +
|
conc_center +
|
||||||
sy * alpha_center * conc_bc;
|
sy * alpha_center * conc_bc;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "TestUtils.hpp"
|
#include "TestUtils.hpp"
|
||||||
|
|
||||||
|
#include <Eigen/src/Core/Matrix.h>
|
||||||
#include <doctest/doctest.h>
|
#include <doctest/doctest.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -119,3 +120,34 @@ TEST_CASE("Simulation environment") {
|
|||||||
CHECK_THROWS(sim.setTimestep(-0.3));
|
CHECK_THROWS(sim.setTimestep(-0.3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Closed Boundaries - no change expected") {
|
||||||
|
|
||||||
|
constexpr std::uint32_t nrows = 5;
|
||||||
|
constexpr std::uint32_t ncols = 5;
|
||||||
|
|
||||||
|
tug::Grid64 grid(nrows, ncols);
|
||||||
|
|
||||||
|
auto concentrations = Eigen::MatrixXd::Constant(nrows, ncols, 1.0);
|
||||||
|
auto alphax = Eigen::MatrixXd::Constant(nrows, ncols, 1E-5);
|
||||||
|
auto alphay = Eigen::MatrixXd::Constant(nrows, ncols, 1E-5);
|
||||||
|
|
||||||
|
grid.setConcentrations(concentrations);
|
||||||
|
grid.setAlpha(alphax, alphay);
|
||||||
|
|
||||||
|
tug::Boundary bc(grid);
|
||||||
|
bc.setBoundarySideConstant(tug::BC_SIDE_LEFT, 1.0);
|
||||||
|
bc.setBoundarySideConstant(tug::BC_SIDE_RIGHT, 1.0);
|
||||||
|
bc.setBoundarySideConstant(tug::BC_SIDE_TOP, 1.0);
|
||||||
|
bc.setBoundarySideConstant(tug::BC_SIDE_BOTTOM, 1.0);
|
||||||
|
|
||||||
|
tug::Simulation<double> sim(grid, bc);
|
||||||
|
sim.setTimestep(1);
|
||||||
|
sim.setIterations(1);
|
||||||
|
|
||||||
|
MatrixXd input_values(concentrations);
|
||||||
|
sim.run();
|
||||||
|
|
||||||
|
CHECK(checkSimilarityV2(input_values, grid.getConcentrations(), 1E-12) ==
|
||||||
|
true);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user