From 9b1ccde40d24ac5e8e22557fc762283382d3e985 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 20 Mar 2026 15:38:47 +0100 Subject: Changing to anti bounce back --- examples/poiseulle_particles_2d_bgk_gpu/sim.cpp | 5 ++-- examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp | 34 ++++++++---------------- examples/poiseulle_particles_2d_psm_gpu/sim.cpp | 7 ++--- lib/core/c++/boundary.hpp | 14 +++++++--- lib/core/c++/grid.hpp | 2 +- 5 files changed, 27 insertions(+), 35 deletions(-) diff --git a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp b/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp index f5d3f72..6bf4f84 100644 --- a/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_bgk_gpu/sim.cpp @@ -181,9 +181,8 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ // Need nicer things to handle the flow. I see improvement here component> collision{0.65}; - // component> collision{0.65}; - // component> collision{0.65}; component> bb; + component,encode::Sycl> abb; saw::data> rho_b; rho_b.at({}) = 1.0; @@ -216,7 +215,7 @@ saw::error_or step( case 0u: break; case 1u: - bb.apply(fields,index,t_i); + abb.apply(fields,index,t_i); break; case 2u: collision.apply(fields,macros,index,t_i); diff --git a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp index 1992ede..a5ef912 100644 --- a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp @@ -200,14 +200,11 @@ saw::error_or step( auto& p_rad = p_coll.template get<"radius">(); } - // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - // Need nicer things to handle the flow. I see improvement here - component> collision{0.65}; - // component> collision{0.65}; - // component> collision{0.65}; + component> collision{0.65}; component> bb; + component,encode::Sycl> abb; saw::data> rho_b; rho_b.at({}) = 1.0; @@ -240,7 +237,7 @@ saw::error_or step( case 0u: break; case 1u: - bb.apply(fields,index,t_i); + abb.apply(fields,index,t_i); break; case 2u: collision.apply(fields,macros,index,t_i); @@ -286,7 +283,7 @@ saw::error_or lbm_main(int argc, char** argv){ } auto& lbm_dir = eo_lbm_dir.get_value(); - auto out_dir = lbm_dir / "poiseulle_particles_2d_gpu"; + auto out_dir = lbm_dir / "poiseulle_particles_2d_hlbm_gpu"; { std::error_code ec; @@ -372,8 +369,7 @@ saw::error_or lbm_main(int argc, char** argv){ } } sycl_q.wait(); - saw::data time_steps{4096ul}; - + saw::data time_steps{16u*4096ul}; auto& info_f = lsd_view.template get<"info">(); for(saw::data i{0u}; i < time_steps and krun; ++i){ @@ -385,20 +381,6 @@ saw::error_or lbm_main(int argc, char** argv){ } } sycl_q.wait(); - { - { - auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); - if(eov.is_error()){ - return eov; - } - } - { - auto eov = write_vtk_file(out_dir,"m",i.get(), *lbm_macro_data_ptr); - if(eov.is_error()){ - return eov; - } - } - } /* { { @@ -442,6 +424,12 @@ saw::error_or lbm_main(int argc, char** argv){ // After Loop sycl_q.wait(); + { + auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); + if(eov.is_error()){ + return eov; + } + } { auto eov = write_vtk_file(out_dir,"m",time_steps.get(), *lbm_macro_data_ptr); if(eov.is_error()){ diff --git a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp index ff636ca..a8aeabb 100644 --- a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp @@ -201,13 +201,10 @@ saw::error_or step( } - // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - // Need nicer things to handle the flow. I see improvement here - //component> collision{0.65}; - // component> collision{0.65}; component> collision{0.65}; component> bb; + component,encode::Sycl> abb; saw::data> rho_b; rho_b.at({}) = 1.0; @@ -240,7 +237,7 @@ saw::error_or step( case 0u: break; case 1u: - bb.apply(fields,index,t_i); + abb.apply(fields,index,t_i); break; case 2u: collision.apply(fields,macros,index,t_i); diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index 3503681..adb473d 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -114,10 +114,18 @@ public: // Technically use .copy() auto& dfs_old = dfs_old_f.at(index); auto df_cpy = dfs_old; + + static_assert(Descriptor::D == 2u and Descriptor::Q == 9u, "Some parts are hard coded sadly"); - for(uint64_t i = 0u; i < Descriptor::Q; ++i){ - dfs_old.at({i}) = df_cpy.at({dfi::opposite_index.at(i)}); - } + dfs_old.at({0u}) = df_cpy.at({0u}); + dfs_old.at({1u}) = df_cpy.at({1u}); + dfs_old.at({2u}) = df_cpy.at({2u}); + dfs_old.at({3u}) = df_cpy.at({4u}); + dfs_old.at({4u}) = df_cpy.at({3u}); + dfs_old.at({5u}) = df_cpy.at({7u}); + dfs_old.at({6u}) = df_cpy.at({8u}); + dfs_old.at({7u}) = df_cpy.at({5u}); + dfs_old.at({8u}) = df_cpy.at({6u}); } }; diff --git a/lib/core/c++/grid.hpp b/lib/core/c++/grid.hpp index be86e18..c9a3b05 100644 --- a/lib/core/c++/grid.hpp +++ b/lib/core/c++/grid.hpp @@ -27,8 +27,8 @@ public: } }; +template void clean_grid(saw::data& info_field){ - } } } -- cgit v1.2.3