From 0b475ddb7d1557fad9f9455d189ec87d434f7670 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 26 Feb 2026 17:07:17 +0100 Subject: Okay, some llm suggested what I'm doing is wrong But it doesn't really matter if I correct the first step. Still, I'm getting gaslighted that I'm wrong. Not sure what to think tbh --- examples/poiseulle_particles_2d_gpu/sim.cpp | 50 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index 1832965..0f7c97b 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -10,7 +10,7 @@ namespace kel { namespace lbm { -constexpr uint64_t dim_y = 512ul; +constexpr uint64_t dim_y = 256ul; constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; @@ -130,7 +130,9 @@ saw::error_or setup_initial_conditions( auto& rho = rho_f.at(index); rho.at({}) = {1}; auto& vel = vel_f.at(index); - vel.at({{0u}}) = 0.0; + if(info_f.at(index).get() == 2u){ + vel.at({{0u}}) = 0.01; + } auto eq = equilibrium(rho,vel); df = eq; @@ -203,24 +205,24 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ // Need nicer things to handle the flow. I see improvement here // component> collision{0.6}; - // component> collision{0.6}; - component> collision{0.6}; + component> collision{0.65}; + // component> collision{0.65}; component> bb; saw::data> rho_b; rho_b.at({}) = 1.0; saw::data> vel_b; - vel_b.at({{0u}}) = 0.1; + vel_b.at({{0u}}) = 0.015; component> equi{rho_b,vel_b}; component,encode::Sycl> flow_in{ [&](){ - uint64_t target_t_i = 256u; + uint64_t target_t_i = 64u; if(t_i.get() < target_t_i){ - return 1.0 + (0.001 / target_t_i) * t_i.get(); + return 1.0 + (0.015 / target_t_i) * t_i.get(); } - return 1.001; + return 1.015; }() }; component,encode::Sycl> flow_out{1.0}; @@ -238,19 +240,11 @@ saw::error_or step( case 0u: break; case 1u: - bb.apply(fields,index,t_i); + // bb.apply(fields,index,t_i); break; case 2u: - collision.apply(fields,macros,index,t_i); - break; case 3u: - equi.apply(fields,index,t_i); - // flow_in.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); - break; case 4u: - equi.apply(fields,index,t_i); - // flow_out.apply(fields,index,t_i); collision.apply(fields,macros,index,t_i); break; default: @@ -275,6 +269,24 @@ saw::error_or step( } }); }).wait(); + + q.submit([&](acpp::sycl::handler& h){ + h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + switch(info.get()){ + case 1u: + bb.apply(fields,index,t_i); + break; + case 3u: + // equi.apply(fields,index,t_i); + flow_in.apply(fields,index,t_i); + break; + case 4u: + // equi.apply(fields,index,t_i); + flow_out.apply(fields,index,t_i); + break; + } + }); + }).wait(); // Step /* @@ -317,7 +329,7 @@ saw::error_or lbm_main(int argc, char** argv){ {{1.0}} }; - print_lbm_meta(conv,{0.01},{0.01},{0.4 * dim_y}); + print_lbm_meta(conv,{0.05},{0.01},{0.4 * dim_y}); // saw::data> meta{{dim_x,dim_y}}; auto lbm_data_ptr = saw::heap>>(); @@ -380,7 +392,7 @@ saw::error_or lbm_main(int argc, char** argv){ } } sycl_q.wait(); - saw::data time_steps{8096ul}; + saw::data time_steps{4096ul}; for(saw::data i{0u}; i < time_steps and krun; ++i){ { -- cgit v1.2.3