From 530bd236a0aee9c22b87de236164c59afe6adae7 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 25 Jul 2026 23:17:18 +0200 Subject: dangling --- examples/poiseulle_particles_2d_gpu/sim.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'examples/poiseulle_particles_2d_gpu') diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index 865babf..bb5787f 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -22,18 +22,11 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(int argc, char** argv){ +saw::error_or lbm_main(const saw::data& args){ using namespace kel::lbm; using dfi = df_info; - auto eo_args = saw::parse_args(argc,argv); - if(eo_args.is_error()){ - return std::move(eo_args.get_error()); - } - auto& args = eo_args.get_value(); - (void)args; - auto eo_lbm_dir = output_directory(); if(eo_lbm_dir.is_error()){ return std::move(eo_lbm_dir.get_error()); @@ -198,14 +191,28 @@ saw::error_or lbm_main(int argc, char** argv){ using FloatT = kel::lbm::sch::Float32; -saw::error_or kmain(int argc, char** argv){ +saw::error_or k_main(int argc, char** argv){ using namespace kel::lbm; + + saw::data args; + { + auto eov = saw::parse_args(args,argc,argv); + return eov; + } + auto& an = args.template get<"args">(); + auto& coupling = an.template get<"coupling">(); + + if(coupling.view() == "hlbm"){ + return lbm_main(args); + //}else if(coupling.view() == "psm"){ + // return kmain(args); + } - // auto eo_args = saw::parse_args< + return saw::make_error("Invalid coupling"); } int main(int argc, char** argv){ - auto eov = lbm_main(argc, argv); + auto eov = k_main(argc, argv); if(eov.is_error()){ auto& err = eov.get_error(); std::cerr<<"[Error] "< Date: Mon, 27 Jul 2026 13:32:05 +0200 Subject: Cleaning up simulation setup --- examples/poiseulle_particles_2d_gpu/common.hpp | 2 +- examples/poiseulle_particles_2d_gpu/sim.cpp | 16 ++++++++-------- examples/poiseulle_particles_2d_gpu/step.hpp | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'examples/poiseulle_particles_2d_gpu') diff --git a/examples/poiseulle_particles_2d_gpu/common.hpp b/examples/poiseulle_particles_2d_gpu/common.hpp index 6c05b64..90b7687 100644 --- a/examples/poiseulle_particles_2d_gpu/common.hpp +++ b/examples/poiseulle_particles_2d_gpu/common.hpp @@ -55,7 +55,7 @@ using MacroStruct = Struct< >; template -using ParticleSpheroidGroup = ParticleGroup>; +using ParticleSpheroidGroup = ParticleGroup>; } } diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index bb5787f..a4f08f0 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -22,7 +22,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +saw::error_or lbm_main(const saw::data& args){ using namespace kel::lbm; using dfi = df_info; @@ -111,7 +111,6 @@ saw::error_or lbm_main(const saw::data& args){ } } sycl_q.wait(); - auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); @@ -188,13 +187,13 @@ saw::error_or lbm_main(const saw::data& args){ return saw::make_void(); } - using FloatT = kel::lbm::sch::Float32; +using DescT = kel::lbm::sch::D2Q9; saw::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + saw::data args; { auto eov = saw::parse_args(args,argc,argv); return eov; @@ -202,17 +201,18 @@ saw::error_or k_main(int argc, char** argv){ auto& an = args.template get<"args">(); auto& coupling = an.template get<"coupling">(); - if(coupling.view() == "hlbm"){ - return lbm_main(args); + if(coupling.stl_view() == "hlbm"){ + return lbm_main(args); //}else if(coupling.view() == "psm"){ - // return kmain(args); + // return kmain(args); } return saw::make_error("Invalid coupling"); } + int main(int argc, char** argv){ - auto eov = k_main(argc, argv); + auto eov = k_main(argc, argv); if(eov.is_error()){ auto& err = eov.get_error(); std::cerr<<"[Error] "< step( auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); - component> particle; + // component> particle; // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ component> collision{0.8}; component> bb; - component,encode::Sycl> abb; saw::data> rho_b; rho_b.at({}) = 1.0; @@ -77,11 +76,13 @@ saw::error_or step( }); }).wait(); + /* q.submit([&](acpp::sycl::handler& h){ h.parallel_for(acpp::sycl::range<1u>{1u}, [=](acpp::sycl::id<1u> idx){ particle.apply(fields,macros,particles,{{0u}},t_i); }); }).wait(); + */ // Step /* -- cgit v1.2.3 From a826f7d9d4bb48565036dd665cb4c6a54622010d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 27 Jul 2026 21:53:27 +0200 Subject: Dangling --- examples/poiseulle_particles_2d_gpu/init.hpp | 6 +-- examples/poiseulle_particles_2d_gpu/sim.cpp | 8 ++-- examples/poiseulle_particles_2d_gpu/step.hpp | 55 ++++++++++++++-------------- 3 files changed, 34 insertions(+), 35 deletions(-) (limited to 'examples/poiseulle_particles_2d_gpu') diff --git a/examples/poiseulle_particles_2d_gpu/init.hpp b/examples/poiseulle_particles_2d_gpu/init.hpp index 617b296..cdce25e 100644 --- a/examples/poiseulle_particles_2d_gpu/init.hpp +++ b/examples/poiseulle_particles_2d_gpu/init.hpp @@ -5,8 +5,8 @@ namespace kel { namespace lbm { -template -saw::error_or setup_initial_conditions( +template +saw::error_or init( const converter& conv, saw::data>& fields, saw::data>& macros, @@ -117,7 +117,7 @@ saw::error_or setup_initial_conditions( radius_p.at({}).set(2); saw::data> 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, {{16u}}); } return saw::make_void(); diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index a4f08f0..fd6cdca 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -81,7 +81,7 @@ saw::error_or lbm_main(const saw::data& args){ sycl_q.wait(); { - auto eov = setup_initial_conditions(conv,*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); + auto eov = init(conv,*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); if(eov.is_error()){ return eov; } @@ -115,21 +115,21 @@ 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{16u*4096ul}; + saw::data time_steps{64u*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,lsd_view,lsdm_view,lsdp_view,i,dev); if(eov.is_error()){ return eov; } } sycl_q.wait(); - if(i.get() % 32u == 0u){ + if(i.get() % 64u == 0u){ { auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); if(eov.is_error()){ diff --git a/examples/poiseulle_particles_2d_gpu/step.hpp b/examples/poiseulle_particles_2d_gpu/step.hpp index c1b148f..37eb4e7 100644 --- a/examples/poiseulle_particles_2d_gpu/step.hpp +++ b/examples/poiseulle_particles_2d_gpu/step.hpp @@ -5,7 +5,7 @@ namespace kel { namespace lbm { -template +template saw::error_or step( const converter& conv, saw::data>,encode::Sycl>& fields, @@ -17,28 +17,44 @@ saw::error_or step( auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); + + q.submit([&](acpp::sycl::handler& h){ + component> hlbm_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]); + } + + hlbm_reset.apply(fields,macros,index,t_i); + }); + }).wait(); + + q.submit([&](acpp::sycl::handler& h){ + component> hlbm_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]); + } - // component> particle; + hlbm_one_part.apply(fields,macros,particles,index,t_i,{16u}); + }); + }).wait(); // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ component> collision{0.8}; component> bb; - 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}; - component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ - return 1.0 + (0.0002 / target_t_i) * t_i.get(); + return 1.0 + (0.01 / target_t_i) * t_i.get(); } - return 1.0002; + return 1.01; }() }; component,encode::Sycl> flow_out{1.0}; @@ -62,12 +78,10 @@ saw::error_or step( break; case 3u: flow_in.apply(fields,index,t_i); - // equi.apply(fields,index,t_i); collision.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); break; default: @@ -76,21 +90,6 @@ saw::error_or step( }); }).wait(); - /* - q.submit([&](acpp::sycl::handler& h){ - h.parallel_for(acpp::sycl::range<1u>{1u}, [=](acpp::sycl::id<1u> idx){ - particle.apply(fields,macros,particles,{{0u}},t_i); - }); - }).wait(); - */ - - // Step - /* - q.submit([&](acpp::sycl::handler& h){ - // h.depends_on(collision_ev); - }).wait(); - */ - return saw::make_void(); } -- cgit v1.2.3