diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-16 21:57:44 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-16 21:57:44 +0200 |
| commit | ad802c003f3081eede724aeaaa5f52410ce8c7d6 (patch) | |
| tree | e011c4b99ecbe1c807603859ab0a74c84ca83745 | |
| parent | 879188f7c55b4f8383002b6bf09ef32dd592ab90 (diff) | |
| parent | 8bc7955f5d95521f7c932b9551a3b71a62117630 (diff) | |
| download | libs-lbm-ad802c003f3081eede724aeaaa5f52410ce8c7d6.tar.gz | |
Merge branch 'dev'
| -rw-r--r-- | examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp | 19 | ||||
| -rw-r--r-- | modules/core/c++/hlbm.hpp | 14 | ||||
| -rw-r--r-- | modules/core/c++/particle/aabb.hpp | 10 |
3 files changed, 19 insertions, 24 deletions
diff --git a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp index 749c951..a4cae03 100644 --- a/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp +++ b/examples/moving_poiseulle_particles_2d_hlbm_gpu/sim.cpp @@ -13,7 +13,7 @@ namespace lbm { constexpr uint64_t dim_y = 256ul; constexpr uint64_t dim_x = dim_y * 20ul; -// constexpr uint64_t particle_amount = 1ul; +constexpr uint64_t particle_amount = 1ul; namespace sch { using namespace saw::schema; @@ -149,14 +149,13 @@ saw::error_or<void> setup_initial_conditions( rad.at({}) = 2.0f; saw::data<sch::Scalar<T>> dense; dense.at({}) = 1.0f; - particles = create_spheroid_particle_group<T,Desc::D,1u>(rad,dense,{16u}); + particles = create_spheroid_particle_group<T,Desc::D,particle_amount>(rad,dense,{16u}); { auto& rb = particles.template get<"particles">().at({0u}).template get<"rigid_body">(); auto& rbp = rb.template get<"position">(); - rbp.at({0u}) = 0.25 * dim_x; - rbp.at({1u}) = 0.5 * dim_y; + rbp.at({{0u}}) = 0.25 * dim_x; + rbp.at({{1u}}) = 0.5 * dim_y; auto& rbp_old = rbp; - } return saw::make_void(); @@ -175,24 +174,22 @@ saw::error_or<void> step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component<T,Desc,cmpt::HlbmParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part; + component<T,Desc,cmpt::HlbmOneParticle,encode::Sycl<saw::encode::Native>> hlbm_one_part; - h.parallel_for(acpp::sycl::range<1u>{1u}, [=](acpp::sycl::id<1u> idx){ + h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){ saw::data<sch::FixedArray<sch::UInt64,1u>> index; for(uint64_t i = 0u; i < 1u; ++i){ index.at({{i}}).set(idx[i]); } hlbm_one_part.apply(fields,macros,particles,index,t_i); - }); }).wait(); // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.65}; + component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8}; component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb; - component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb; component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ @@ -225,12 +222,10 @@ saw::error_or<void> 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: diff --git a/modules/core/c++/hlbm.hpp b/modules/core/c++/hlbm.hpp index 1c625bb..cc35f9b 100644 --- a/modules/core/c++/hlbm.hpp +++ b/modules/core/c++/hlbm.hpp @@ -13,6 +13,7 @@ namespace lbm { namespace cmpt { struct HlbmInit {}; struct Hlbm {}; +struct HlbmOneParticle {}; struct HlbmParticle {}; struct HlbmOneParticleMomentumExchange {}; } @@ -101,7 +102,7 @@ public: }; template<typename T, typename Desc, typename Encode> -class component<T, Desc, cmpt::HlbmParticle, Encode> final { +class component<T, Desc, cmpt::HlbmOneParticle, Encode> final { private: /* template<typename CellFieldSchema, typename MacroFieldSchema, typename ParticleSchema, uint64_t i> @@ -124,6 +125,7 @@ public: auto& parts = part_spheroid_group.template get<"particles">(); auto parts_size = parts.meta().at({0u}); + auto& pi = parts.at(index); auto& pirb = pi.template get<"rigid_body">(); auto& pirb_pos = pirb.template get<"position">(); @@ -131,10 +133,8 @@ public: saw::data<sch::FixedArray<sch::UInt64,Desc::D>> start; saw::data<sch::FixedArray<sch::UInt64,Desc::D>> stop; - auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(part_spheroid_group,index,mvel.meta()); + auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(part_spheroid_group,{{0u}},mvel.meta()); if(eo_aabb.is_error()){ - std::cerr<<"Prepping error"<<std::endl; - std::cerr<<eo_aabb.get_error().get_category()<<std::endl; return; } auto& aabb = eo_aabb.get_value(); @@ -146,13 +146,13 @@ public: iterator<Desc::D>::apply([&](const auto& index){ // ask for the d_k value here. // For every value im iterating over I need sth - std::cout<<"Pos: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + // std::cout<<"Pos: "<<index.at({0u}).get()<<" "<<index.at({1u}).get()<<std::endl; + + },start,stop); // Check } - - } }; diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index 983fd97..da39ec2 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -23,23 +23,24 @@ public: >; public: template<typename Sch, typename Encode> - static constexpr saw::error_or<saw::data<AABB>> calculate(const saw::data<Sch,Encode>& p_grp, const saw::data<sch::FixedArray<sch::UInt64,1u>>& i, const saw::data<sch::FixedArray<sch::UInt64,D>>& meta){ + static constexpr saw::error_or<saw::data<AABB>> calculate(const saw::data<Sch,Encode>& p_grp, const saw::data<sch::FixedArray<sch::UInt64,1u>>& index, const saw::data<sch::FixedArray<sch::UInt64,D>>& meta){ static_assert(PC > 0u, "Can't calculate from no particles"); - if(not (i.at({0u}).get() < PC) ){ + if(not (index.at({{0u}}).get() < PC) ){ + std::cerr.flush(); return saw::make_error<saw::err::critical>("Too large i in particle_aabb"); } saw::data<AABB> aabb; auto& parts = p_grp.template get<"particles">(); - auto& pi = parts.at(i); + auto& pi = parts.at(index); auto& pirb = pi.template get<"rigid_body">(); auto& pirb_pos = pirb.template get<"position">(); auto& a = aabb.template get<"a">(); auto& b = aabb.template get<"b">(); - const saw::data<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().at(i).template get<"radius">(); + const saw::data<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().at({{0u}}).template get<"radius">(); saw::data<sch::Vector<T,D>> lower; saw::data<sch::Vector<T,D>> upper; @@ -52,7 +53,6 @@ public: } return aabb; - } }; |
