summaryrefslogtreecommitdiff
path: root/examples/poiseulle_particles_2d_gpu/step.hpp
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-06-08 20:15:59 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-06-08 20:15:59 +0200
commit3a27bca74e7645874e52f101d467aff8ff7d78f4 (patch)
treeb5f742bd3f146a9747c159f9fd8d099a6d566c1f /examples/poiseulle_particles_2d_gpu/step.hpp
parent5ea4875b96bfacd4c5f0125c9e7b64b70f0ccfb9 (diff)
parent932fbf86d60df48623ad5fbc9d60e572bb68ef12 (diff)
downloadlibs-lbm-master.tar.gz
Merge branch 'dev'HEADmaster
Diffstat (limited to 'examples/poiseulle_particles_2d_gpu/step.hpp')
-rw-r--r--examples/poiseulle_particles_2d_gpu/step.hpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/examples/poiseulle_particles_2d_gpu/step.hpp b/examples/poiseulle_particles_2d_gpu/step.hpp
new file mode 100644
index 0000000..a4e44b4
--- /dev/null
+++ b/examples/poiseulle_particles_2d_gpu/step.hpp
@@ -0,0 +1,90 @@
+#pragma once
+
+#include "common.hpp"
+
+namespace kel {
+namespace lbm {
+
+template<typename T, typename Desc>
+saw::error_or<void> step(
+ saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields,
+ saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros,
+ saw::data<sch::Ptr<sch::ParticleSpheroidGroup<T,Desc>>,encode::Sycl<saw::encode::Native>>& particles,
+ saw::data<sch::UInt64> t_i,
+ device& dev
+){
+ auto& q = dev.get_handle();
+ auto& info_f = fields.template get<"info">();
+ auto& porous_f = macros.template get<"porosity">();
+
+ // 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::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
+
+ saw::data<sch::Scalar<T>> rho_b;
+ rho_b.at({}) = 1.0;
+ saw::data<sch::Vector<T,Desc::D>> vel_b;
+ vel_b.at({{0u}}) = 0.015;
+
+ component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b};
+
+ component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ [&](){
+ uint64_t target_t_i = 64u;
+ if(t_i.get() < target_t_i){
+ return 1.0 + (0.0002 / target_t_i) * t_i.get();
+ }
+ return 1.0002;
+ }()
+ };
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+
+
+ h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
+ saw::data<sch::FixedArray<sch::UInt64,Desc::D>> 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);
+ // 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:
+ break;
+ }
+ });
+ }).wait();
+
+
+ // Step
+ /*
+ q.submit([&](acpp::sycl::handler& h){
+ // h.depends_on(collision_ev);
+ }).wait();
+ */
+
+ return saw::make_void();
+}
+
+}
+}