29 s.setDomainBc(1, 3, 0.0, 0.0, 0.0);
30 s.setDomainBc(2, 1, 0.0, 0.0, 0.0);
31 s.setDomainBc(3, 1, 0.0, 0.0, 0.0);
38int main(
int argc,
char** argv) {
39 Kokkos::initialize(argc, argv);
41 const int nx = 16, ny = 8, nz = 4;
49 s.setBackflowStab(0.0);
50 std::vector<double> u((std::size_t)nx * ny * nz);
51 for (
int z = 0; z < nz; ++z)
52 for (
int y = 0; y < ny; ++y)
53 for (
int x = 0; x < nx; ++x)
54 u[(std::size_t)x + (std::size_t)y * nx + (std::size_t)z * nx * ny] =
55 (y < ny / 2) ? -
U : 3.0 *
U;
58 const auto ob = s.outflowBackflow();
60 "[backflow] reversed outlet: max_reverse %.3f fraction %.3f energy_influx %.3e "
61 "(%ld / %ld faces)\n",
62 ob.maxReverse, ob.fraction, ob.energyInflux, ob.reversed, ob.total);
63 CHECK(ob.total == (
long)ny * nz);
64 CHECK(ob.reversed > 0);
65 CHECK(ob.fraction > 0.3 && ob.fraction < 0.7);
66 CHECK(ob.maxReverse > 0.5 *
U && ob.maxReverse < 1.5 *
U);
67 CHECK(ob.energyInflux > 0.0);
73 for (
int it = 0; it < 5; ++it)
75 const auto ob = s.outflowBackflow();
76 std::printf(
"[backflow] developing channel: max_reverse %.3e fraction %.3f (%ld / %ld)\n",
77 ob.maxReverse, ob.fraction, ob.reversed, ob.total);
78 CHECK(ob.reversed == 0 && ob.maxReverse == 0.0 && ob.energyInflux == 0.0);
79 CHECK(ob.total == (
long)ny * nz);
87 const auto ob = s.outflowBackflow();
88 CHECK(ob.total == 0 && ob.reversed == 0 && ob.maxReverse == 0.0);
91 std::printf(
"[backflow] PASS (exec %s)\n", Kokkos::DefaultExecutionSpace::name());
93 std::fprintf(stderr,
"[backflow] FAILED (%d checks)\n",
failures);