From 2bae8b93faf614b1acb5df7269087b4f3786da5a Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 30 Jun 2026 23:52:02 +0200 Subject: Final run --- examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp | 60 ++++++++--------------- 1 file changed, 20 insertions(+), 40 deletions(-) (limited to 'examples/stokes_drag_particle_2d_hlbm_gpu') diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp index a8ba21f..81498e2 100644 --- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp @@ -13,7 +13,7 @@ namespace lbm { constexpr uint64_t dim_y = 1024ul; constexpr uint64_t dim_x = dim_y * 2ul; -constexpr uint64_t particle_amount = 1ul; +// constexpr uint64_t particle_amount = 1ul; namespace sch { using namespace saw::schema; @@ -47,6 +47,7 @@ using RhoChunk = Chunk, 0u, dim_x, dim_y>; template using MacroStruct = Struct< Member, "velocity">, + Member, "force">, Member, "density">, Member, "porosity"> >; @@ -158,25 +159,6 @@ saw::error_or setup_initial_conditions( {{1u,1u}} ); - iterator::apply( - [&](auto& index){ - saw::data> middle, ind_vec; - middle.at({{0u}}) = dim_x * 0.5; - middle.at({{1u}}) = dim_y * 0.5; - - ind_vec.at({{0u}}) = index.at({{0u}}).template cast_to(); - ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); - - auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); - if(dist_2.at({}).get() < dim_y*dim_y*0.01){ - porous_f.at(index).at({}) = 0.0; - } - }, - {},// 0-index - df_f.get_dims() - ); - return saw::make_void(); } @@ -196,12 +178,16 @@ saw::error_or step( component> bb; component,encode::Sycl> abb; - saw::data> rho_b; - rho_b.at({}) = 1.0; - saw::data> vel_b; - vel_b.at({{0u}}) = 0.015; - - component> equi{rho_b,vel_b}; + saw::data> eps; + eps.at({}).set(1.5f); + saw::data> rad; + rad.at({}).set(dim_y*0.1*0.25); + saw::data> p_pos; + { + p_pos.at({{0u}}) = dim_x * 0.5; + p_pos.at({{1u}}) = dim_y * 0.5; + } + component> opa{p_pos,rad,eps}; component,encode::Sycl> flow_in{ [&](){ @@ -230,6 +216,7 @@ saw::error_or step( abb.apply(fields,index,t_i); break; case 2u: + opa.apply(macros,index,t_i); collision.apply(fields,macros,index,t_i); break; case 3u: @@ -385,20 +372,7 @@ saw::error_or lbm_main(int argc, char** argv){ } } */ - if(i.get() % 32u == 0u){ - { - auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); - if(eov.is_error()){ - return eov; - } - } - { - auto eov = write_csv_file(out_dir,"m",i.get(), *lbm_macro_data_ptr); - if(eov.is_error()){ - return eov; - } - } - } + // Stream sycl_q.submit([&](acpp::sycl::handler& h){ component> stream; @@ -438,6 +412,12 @@ saw::error_or lbm_main(int argc, char** argv){ return eov; } } + { + auto eov = write_csv_file(out_dir,"m",time_steps.get(), *lbm_macro_data_ptr); + if(eov.is_error()){ + return eov; + } + } sycl_q.wait(); return saw::make_void(); -- cgit v1.2.3