flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
bench.cpp
Go to the documentation of this file.
1// End-to-end: what does the exact-gradient change do to a real dem step? BOX shape (a shell, so
2// contact normals are evaluated per shell point per contact) in a dense periodic box.
3#include <cstdio>
4#include <cstdlib>
5#include <Kokkos_Core.hpp>
6
7#include "sim.hpp"
8using namespace peclet::dem;
9int main(int argc, char** argv) {
10 Kokkos::initialize(argc, argv);
11 {
12 const int N = 400, STEPS = 200;
13 const float DT = (argc > 1) ? (float)std::atof(argv[1]) : 2e-4f;
14 Simulation s(N + 8);
15 s.setDomain(1.f, 1.f, 1.f, true, true, true);
16 s.initializeShape(BOX, 0.035f, 0.f, 0.f);
17 std::uint32_t st = 0xA11CEu;
18 auto u = [&](float lo, float hi) {
19 st = st * 1664525u + 1013904223u;
20 return lo + (hi - lo) * ((float)((st >> 8) & 0xFFFFFFu) / (float)0x1000000u);
21 };
22 std::vector<float> pos(3 * N);
23 for (auto& v : pos)
24 v = u(0.06f, 0.94f);
25 s.setPositions(pos);
26 s.setGravity(0.f, -9.81f, 0.f);
27 s.setDt(DT);
28 // broad+narrow phase ONLY, on a FIXED configuration: idempotent, so both builds do exactly
29 // the same work and the only difference is how the contact normal is computed.
30 for (int k = 0; k < 5; ++k)
31 s.computeOverlaps(); // warm-up
32 Kokkos::fence();
33 Kokkos::Timer t;
34 for (int k = 0; k < STEPS; ++k)
35 s.computeOverlaps();
36 Kokkos::fence();
37 const double ms = 1e3 * t.seconds() / STEPS;
38 std::printf(" %d boxes, %d narrowphase passes: %.4f ms/pass (contacts=%d)\n", N, STEPS, ms,
39 s.numContacts());
40 }
41 Kokkos::finalize();
42 return 0;
43}
int main()
Definition dbg_scene.cpp:13
static constexpr int STEPS
static constexpr int N
static constexpr double DT
static const std::array< int, 6 > BOX[2]