From 761e4912e14324ccf713b9309336816cd3283b38 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 1 Jul 2026 00:15:10 +0200 Subject: stokes drag impl and run --- examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | 60 +++++++++++++++++++----- 1 file changed, 49 insertions(+), 11 deletions(-) (limited to 'examples/stokes_drag_particle_2d_psm_gpu/sim.cpp') diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp index 6942cc7..7a14e3f 100644 --- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -13,7 +14,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; @@ -158,11 +159,33 @@ saw::error_or setup_initial_conditions( df_f.get_dims(), {{1u,1u}} ); + + saw::data> eps; + eps.at({}).set(1.5f); + saw::data> rad; + rad.at({}).set(dim_y*0.1); + saw::data> p_pos; + { + p_pos.at({{0u}}) = dim_x * 0.25; + p_pos.at({{1u}}) = dim_y * 0.5; + } + + /* + component opa{p_pos,rad,eps}; + iterator::apply( + [&](auto& index){ + opa.apply(macros,index,{}); + }, + {},// 0-index + df_f.get_dims() + ); + */ + /* iterator::apply( [&](auto& index){ saw::data> middle, ind_vec; - middle.at({{0u}}) = dim_x * 0.5; + middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; ind_vec.at({{0u}}) = index.at({{0u}}).template cast_to(); @@ -177,6 +200,7 @@ saw::error_or setup_initial_conditions( {},// 0-index df_f.get_dims() ); + */ return saw::make_void(); } @@ -193,6 +217,7 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ + component> bgk{0.8}; component> collision{0.8}; component> bb; component,encode::Sycl> abb; @@ -200,7 +225,7 @@ saw::error_or step( saw::data> eps; eps.at({}).set(1.5f); saw::data> rad; - rad.at({}).set(dim_y*0.1*0.25); + rad.at({}).set(dim_y*0.1 / 4.0); saw::data> p_pos; { p_pos.at({{0u}}) = dim_x * 0.5; @@ -219,6 +244,7 @@ saw::error_or step( }; component,encode::Sycl> flow_out{1.0}; + component> fg; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ saw::data> index; @@ -237,16 +263,17 @@ saw::error_or step( case 2u: opa.apply(macros,index,t_i); collision.apply(fields,macros,index,t_i); + fg.apply(fields,macros,index,t_i); break; case 3u: flow_in.apply(fields,index,t_i); //equi.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); + bgk.apply(fields,macros,index,t_i); break; case 4u: flow_out.apply(fields,index,t_i); // equi.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); + bgk.apply(fields,macros,index,t_i); break; case 5u: // Corners @@ -391,6 +418,22 @@ 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; @@ -430,12 +473,7 @@ 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