From 79196db2ac3d31543056b3b7abe90ad609c51b4f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 22 Sep 2026 09:27:15 +0200 Subject: Fixing two way coupling --- examples/one_particle_sedimentation_2d/sim.cpp | 21 ++++++++++++++++----- examples/one_particle_sedimentation_2d/step.hpp | 11 ++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 0cb3ce0..86a7b1c 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -48,10 +48,13 @@ saw::error_or lbm_main(const saw::data& args){ // delta_x {{0.02 / dim_x}}, // delta_t - {{1.5e-6}} + {{3e-7}} }; + saw::data> kin_vis_si{1e-3}; + auto kin_vis_lbm = conv.kinematic_viscosity_si_to_lbm(kin_vis_si); + auto tau = conv.template kinematic_viscosity_lbm_to_tau(kin_vis_lbm); - print_lbm_meta(conv,{1e-3},{1e-4},{2}); + print_lbm_meta(conv,kin_vis_si,{1e-4},{2}); std::cout<<"Position: "<> meta{{dim_x,dim_y}}; @@ -123,21 +126,29 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul}; + saw::data time_steps{1024ul * 1024ul}; auto& info_f = lsd_view.template get<"info">(); for(saw::data i{0u}; i < time_steps and krun; ++i){ // BC + Collision { - auto eov = step(conv,lsd_view,lsdm_view,lsdp_view,i,dev); + auto eov = step( + conv, + tau, + lsd_view, + lsdm_view, + lsdp_view, + i, + dev + ); if(eov.is_error()){ return eov; } } sycl_q.wait(); - if(i.get() % 64u == 0u){ + if(i.get() % 1024u == 0u){ { auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); if(eov.is_error()){ diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp index c3a3b8a..4bc9dde 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -8,6 +8,7 @@ namespace lbm { template saw::error_or step( const converter& conv, + const saw::data>& tau, saw::data>,encode::Sycl>& fields, saw::data>,encode::Sycl>& macros, saw::data>,encode::Sycl>& particles, @@ -47,7 +48,7 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{1.0}; + component> collision{tau}; component> bb; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ @@ -99,14 +100,14 @@ saw::error_or step( index.at({{i}}).set(idx[i]); } - fplbm_one_part.apply(fields,macros,particles,index,t_i,{16u}); + fplbm_one_part.apply(fields,macros,particles,index,t_i,{32u}); }); }).wait(); // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{1.0}; + component> bgk{tau}; + component> collision{tau}; component> bb; component,encode::Sycl> flow_out{1.0}; @@ -182,7 +183,7 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ component> bgk{1.0}; - component> collision{1.0}; + component> collision{tau}; component> bb; component,encode::Sycl> flow_out{1.0}; -- cgit v1.3.1