From 0c0087ef9482634273ec1a23d3a915754f94926d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 11 Nov 2026 01:16:44 +0100 Subject: Snapshot. Migration to Lbm Unit --- examples/poiseulle_particles_2d_ibm_gpu/sim.cpp | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'examples/poiseulle_particles_2d_ibm_gpu') diff --git a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp index b051c4e..dd284dd 100644 --- a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp @@ -15,7 +15,7 @@ namespace lbm { constexpr uint64_t dim_y = 256ul; constexpr uint64_t dim_x = dim_y * 20ul; -// constexpr uint64_t particle_amount = 1ul; +constexpr uint64_t particle_amount = 1ul; namespace sch { @@ -45,7 +45,7 @@ using RhoChunk = Chunk, 0u, dim_x, dim_y>; template using MacroStruct = Struct< - Member, "momentum">, + Member, "velocity">, Member, "density">, Member, "force"> >; @@ -56,11 +56,8 @@ using MacroStruct = Struct< //>; template -using ParticleSpheroidGroup = ParticleGroup< - T, - Desc::D, - sch::ParticleCollisionSpheroid ->; +using ParticleSpheroidGroup = + ParticleGroup>; } @@ -112,7 +109,7 @@ kel::lbm::error_or setup_initial_conditions( // auto& df_f = fields.template get<"dfs_old">(); auto& rho_f = macros.template get<"density">(); - auto& vel_f = macros.template get<"momentum">(); + auto& vel_f = macros.template get<"velocity">(); auto& force_f = macros.template get<"force">(); iterator::apply( @@ -152,20 +149,22 @@ kel::lbm::error_or setup_initial_conditions( // Particles { + // The radius is a per particle property now, and a lattice length. + kel::lbm::data>> rad_p; + rad_p.at({}).set(2.0); kel::lbm::data> dense_p; dense_p.at({}).set(1); auto& spheroid_grp = particles; - spheroid_grp = create_spheroid_particle_group( + spheroid_grp = create_spheroid_particle_group( + rad_p, dense_p, {32u} ); { auto& p = spheroid_grp.template get<"particles">(); - p = {{{1u}}}; - iterator<1u>::apply( [&](auto& index){ auto& p_ind = p.at(index); @@ -180,7 +179,7 @@ kel::lbm::error_or setup_initial_conditions( p_pos_old = p_pos; }, {}, - p.meta() + p.get_dims() ); } } @@ -217,13 +216,12 @@ kel::lbm::error_or step( q.submit([&](acpp::sycl::handler& h){ h.parallel_for(acpp::sycl::range<1u>{1u}, [=](acpp::sycl::id<1u> idx){ - auto& vel_f = macros.template get<"momentum">(); + auto& vel_f = macros.template get<"velocity">(); auto& dense_f = macros.template get<"density">(); auto& ps = particles; auto& mask = ps.template get<"mask">(); auto& mask_step = ps.template get<"mask_step">().at({}); - auto& p_dense = ps.template get<"density">().at({}); auto& com = ps.template get<"center_of_mass">(); auto& parts = ps.template get<"particles">(); @@ -235,7 +233,8 @@ kel::lbm::error_or step( /// In this case it's simple since I'm too lazy to do scaling and rotation /// Technically scale => rotate => translate /// Here it's only translate - auto& p_i_rb_pos = p_i_rb.template get<"position">(); + // Unwrapped: the IBM shift works in raw lattice offsets. + auto& p_i_rb_pos = p_i_rb.template get<"position">().handle(); iterator::apply([&](const auto& index){ /// Calculate the shift from the mask @@ -371,9 +370,9 @@ kel::lbm::error_or lbm_main(int argc, char** argv){ converter conv { // delta_x - {{1.0}}, + {1.0}, // delta_t - {{1.0}} + {1.0} }; print_lbm_meta(conv,{0.1},{1e-4},{0.4 * dim_y}); -- cgit v1.3.1