From 5ba7e8470f29f96ea0a12a78b3d97091fe69a581 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 17 Aug 2026 22:26:02 +0200 Subject: Fix things --- .../common.hpp | 3 +- .../init.hpp | 5 +- .../schaefer_turek_durst_krause_rannbacher/sim.cpp | 8 ++- .../step.hpp | 73 ++++++++++++++++++++++ 4 files changed, 85 insertions(+), 4 deletions(-) (limited to 'examples/schaefer_turek_durst_krause_rannbacher') diff --git a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp index ec6f80f..be9a538 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp @@ -59,7 +59,8 @@ template using MacroStruct = Struct< Member, "momentum">, Member, "density">, - Member, "porosity"> + Member, "porosity">, + Member, "force"> >; template diff --git a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp index aa4919b..af7eb89 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp @@ -95,10 +95,11 @@ saw::error_or init( { saw::data> radius_p; - radius_p.at({}).set(conv.meter_si_to_lbm({{0.16}}).handle().get()); + radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); + std::cout<<"RADIUS: "<> dense_p; dense_p.at({}).set(1); - particles = create_spheroid_particle_group(radius_p, dense_p, {{16u}}); + particles = create_spheroid_particle_group(radius_p, dense_p, {{64u}}); auto& parts = particles.template get<"particles">(); { diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp index 6113f6c..b41f850 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp @@ -111,6 +111,12 @@ saw::error_or lbm_main(const saw::data& args){ return eov; } } + { + auto eov = dev.copy_to_device(*lbm_particle_data_ptr,lbm_sycl_particle_data); + if(eov.is_error()){ + return eov; + } + } sycl_q.wait(); auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); @@ -178,7 +184,7 @@ saw::error_or lbm_main(const saw::data& args){ } } { - auto eov = write_vtk_file(out_dir,"stdkr_2d",time_steps.get(), *lbm_macro_data_ptr); + auto eov = write_vtk_file(out_dir,std::string{"stdkr_2d_"}+an.template get<"coupling">().stl_string(),time_steps.get(), *lbm_macro_data_ptr); if(eov.is_error()){ return eov; } diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp index 1a70f6a..1739edd 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp @@ -91,6 +91,79 @@ saw::error_or step( }); }).wait(); }else if constexpr ( std::is_same_v ){ + q.submit([&](acpp::sycl::handler& h){ + component> fplbm_reset; + h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + saw::data> index; + for(uint64_t i = 0u; i < Desc::D; ++i){ + index.at({{i}}).set(idx[i]); + } + + fplbm_reset.apply(fields,macros,index,t_i); + }); + }).wait(); + + q.submit([&](acpp::sycl::handler& h){ + component> fplbm_one_part; + + h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){ + saw::data> index; + for(uint64_t i = 0u; i < 1u; ++i){ + index.at({{i}}).set(idx[i]); + } + + fplbm_one_part.apply(fields,macros,particles,index,t_i,{0u}); + }); + }).wait(); + + // auto coll_ev = + q.submit([&](acpp::sycl::handler& h){ + component> bgk{0.8}; + component> collision{0.8}; + component> bb; + + component,encode::Sycl> flow_in{ + [&](){ + uint64_t target_t_i = 8u; + if(t_i.get() < target_t_i){ + return 1.0 + (0.01 / target_t_i) * t_i.get(); + } + return 1.01; + }() + }; + component,encode::Sycl> flow_out{1.0}; + + h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + saw::data> index; + for(uint64_t i = 0u; i < Desc::D; ++i){ + index.at({{i}}).set(idx[i]); + } + + auto info = info_f.at(index); + + switch(info.get()){ + case 0u: + break; + case 1u: + bb.apply(fields,index,t_i); + break; + case 2u: + collision.apply(fields,macros,index,t_i); + break; + case 3u: + flow_in.apply(fields,index,t_i); + bgk.apply(fields,macros,index,t_i); + break; + case 4u: + flow_out.apply(fields,index,t_i); + bgk.apply(fields,macros,index,t_i); + break; + default: + break; + } + }); + }).wait(); + }else if constexpr ( std::is_same_v ){ } return saw::make_void(); -- cgit v1.2.3