From e821d617802ebbfff756844e4d9720342fc78a4e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 13 Nov 2026 14:12:49 +0100 Subject: Swarm POC --- examples/throat_clog_2d/init.hpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'examples/throat_clog_2d/init.hpp') diff --git a/examples/throat_clog_2d/init.hpp b/examples/throat_clog_2d/init.hpp index fab51b3..7683942 100644 --- a/examples/throat_clog_2d/init.hpp +++ b/examples/throat_clog_2d/init.hpp @@ -157,47 +157,23 @@ kel::lbm::error_or init( ); { + // A radius is a lattice length now. kel::lbm::data>> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({0.05}).handle().get()); std::cout<<"RADIUS: "<> dense_p; dense_p.at({}).set(1); - particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); + particles = create_spheroid_particle_group(radius_p, dense_p, {64u}); auto& parts = particles.template get<"particles">(); - /** - * Seed the particles upstream of the throat on a staggered grid. - * - * Spacing is 2.4 radii, so they start clear of one another -- any - * initial overlap would be resolved as a contact on the first step and - * fire them apart. - */ - const auto radius = radius_p.at({}).get(); - const auto pitch = radius * 2.4; - - const auto x0 = conv.meter_si_to_lbm({0.10}).handle().get(); - const auto y_mid = conv.meter_si_to_lbm({0.25}).handle().get(); - - constexpr uint64_t per_column = 4ul; - - for(uint64_t i = 0u; i < particle_amount; ++i){ - auto col = i / per_column; - auto row = i % per_column; - - // Offset alternate columns by half a pitch so they interleave. - auto y_off = (static_cast(row) - (per_column - 1u) * 0.5) * pitch - + ((col % 2u == 1u) ? pitch * 0.5 : 0.0); - - auto& p = parts.at({i}); + { + auto& p = parts.at({0u}); auto& prb = p.template get<"rigid_body">(); auto& p_pos = prb.template get<"position">(); auto& p_pos_old = prb.template get<"position_old">(); + p_pos.at({{0u}}) = conv.meter_si_to_lbm({0.1}).handle(); + p_pos.at({{1u}}) = conv.meter_si_to_lbm({0.32}).handle(); - p_pos.at({{0u}}).set(x0 + static_cast(col) * pitch); - p_pos.at({{1u}}).set(y_mid + y_off); - - // Start at rest: position_old defaults to zero, which would read - // as an enormous velocity. p_pos_old = p_pos; } } -- cgit v1.3.1