From 95b74577fe5c75e3e8497dc16241b7e6b8d30408 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 25 Sep 2026 19:40:33 +0200 Subject: Vacation --- examples/one_particle_sedimentation_2d/sim.cpp | 3 +- .../common.hpp | 13 ++++++++ .../init.hpp | 6 ++-- .../schaefer_turek_durst_krause_rannbacher/sim.cpp | 16 +++++----- .../step.hpp | 12 ++++---- examples/throat_clog_2d/init.hpp | 36 +++++++++++++++------- 6 files changed, 57 insertions(+), 29 deletions(-) (limited to 'examples') diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 86a7b1c..db730d4 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -126,7 +126,7 @@ 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{1024ul * 1024ul}; + saw::data time_steps{1024ul * 1024ul * 64ul}; auto& info_f = lsd_view.template get<"info">(); @@ -220,6 +220,7 @@ saw::error_or k_main(int argc, char** argv){ } } auto& an = args.template get<"args">(); + auto& coupling = an.template get<"coupling">(); if(coupling.stl_view() == "hlbm"){ diff --git a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp index 59d2f9c..ac5c94e 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp @@ -25,6 +25,19 @@ namespace lbm { constexpr uint64_t dim_y = 41u; constexpr uint64_t dim_x = 220u; +template +struct dimensions { + static constexpr std::array calculate(){ + return {dim_x * N + 1u, dim_y * N + 1u}; + } +}; + +template +constexpr std::array dims{ + dim_x * N + 1u, + dim_y * N + 1u +}; + constexpr uint64_t particle_amount = 1ul; namespace sch { diff --git a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp index 96e2917..45cbaa2 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp @@ -41,7 +41,7 @@ saw::error_or init( info_f.at(index).set(3u); }, {{0u,0u}}, - {{1u,dim_y}}, + {{1u,dim_y*N}}, {{0u,1u}} ); @@ -50,8 +50,8 @@ saw::error_or init( [&](auto& index){ info_f.at(index).set(4u); }, - {{dim_x-1u,0u}}, - {{dim_x, dim_y}}, + {{dim_x*N-1u,0u}}, + {{dim_x*N, dim_y*N}}, {{0u,1u}} ); // diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp index 35c04a4..71410b2 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp @@ -34,7 +34,7 @@ saw::error_or lbm_main(const saw::data& args){ } auto& lbm_dir = eo_lbm_dir.get_value(); - auto out_dir = lbm_dir / "stdkr_2d_gpu" / an.template get<"coupling">().stl_view(); + auto out_dir = lbm_dir / "stdkr_2d" / std::to_string(N) / an.template get<"coupling">().stl_view(); { std::error_code ec; @@ -118,7 +118,7 @@ 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{64u*1024ul * N * N}; auto& info_f = lsd_view.template get<"info">(); @@ -140,7 +140,7 @@ saw::error_or lbm_main(const saw::data& args){ } } { - auto eov = write_vtk_file(out_dir,std::string{"ops_2d_"}+an.template get<"coupling">().stl_string(),i.get(), *lbm_macro_data_ptr); + auto eov = write_vtk_file(out_dir,std::string{"stdkr_2d_"}+std::to_string(N)+std::string{"_"}+an.template get<"coupling">().stl_string(),i.get(), *lbm_macro_data_ptr); if(eov.is_error()){ return eov; } @@ -150,7 +150,7 @@ saw::error_or lbm_main(const saw::data& args){ sycl_q.submit([&](acpp::sycl::handler& h){ component> stream; - h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -180,7 +180,7 @@ saw::error_or lbm_main(const saw::data& args){ } } { - auto eov = write_vtk_file(out_dir,std::string{"stdkr_2d_"}+an.template get<"coupling">().stl_string(),time_steps.get(), *lbm_macro_data_ptr); + auto eov = write_vtk_file(out_dir,std::string{"stdkr_2d_"}+std::to_string(N)+std::string{"_"}+an.template get<"coupling">().stl_string(),time_steps.get(), *lbm_macro_data_ptr); if(eov.is_error()){ return eov; } @@ -212,11 +212,11 @@ saw::error_or k_main(int argc, char** argv){ auto& coupling = an.template get<"coupling">(); if(coupling.stl_view() == "hlbm"){ - return lbm_main(args); + return lbm_main(args); } else if(coupling.stl_view() == "fplbm"){ - return lbm_main(args); + return lbm_main(args); } else if(coupling.stl_view() == "psm"){ - return lbm_main(args); + return lbm_main(args); } return saw::make_error("Invalid coupling"); diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp index e88f262..3e5f9ba 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp @@ -23,7 +23,7 @@ saw::error_or step( if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ component> hlbm_reset; - h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -50,7 +50,7 @@ saw::error_or step( component> bb; component,encode::Sycl> flow_out{1.0}; - h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -96,7 +96,7 @@ saw::error_or step( }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){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -126,7 +126,7 @@ saw::error_or step( component> bb; component,encode::Sycl> flow_out{1.0}; - h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -172,7 +172,7 @@ saw::error_or step( }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){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); @@ -202,7 +202,7 @@ saw::error_or step( component> bb; component,encode::Sycl> flow_out{1.0}; - h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ + h.parallel_for(acpp::sycl::range{dim_x*N,dim_y*N}, [=](acpp::sycl::id idx){ saw::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); diff --git a/examples/throat_clog_2d/init.hpp b/examples/throat_clog_2d/init.hpp index 69225be..06ff179 100644 --- a/examples/throat_clog_2d/init.hpp +++ b/examples/throat_clog_2d/init.hpp @@ -35,19 +35,33 @@ saw::error_or init( {{1u,1u}} ); + auto dims = info_f.get_dims(); + auto width = dims.at({{0u}}); + auto height = dims.at({{1u}}); + // + auto w = width.template cast_to(); + auto h = height.template cast_to(); + auto w2 = w * 0.5; + auto h4 = h * 0.25; + + saw::data e{0.1}; + saw::data c = saw::data{1.0} - e; + + saw::data d{0.2}; + auto b = (saw::data{1.0} - d) * 0.5; + + auto p_r = (c*c + b*b) / (b*2); + auto p_i = p_r - b; + + // Circle Top + saw::data> top_pos{w2.get(),h + p_i}; + + // Circle Bot + saw::data> bot_pos{w2.get(),-p_i.get()}; + iterator::apply( [&](auto& index){ - auto dims = info_f.get_dims(); - auto width = dims.at({{0u}}); - auto height = dims.at({{1u}}); - // - auto w2 = width / 2; - auto h4 = height / 4; - // Circle Top - saw::data> top_pos{{w2.get(),(height+h4).get()}}; - - // Circle Bot - saw::data> bot_pos{{w2.get(),-h4.get()}}; + }, {}, -- cgit v1.3.1