summaryrefslogtreecommitdiff
path: root/examples/stokes_drag_particle_2d_hlbm_gpu
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-07-07 20:33:25 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-07-07 20:33:25 +0200
commit43d795c0afa3c613fb3aee10de7ddf579cf78645 (patch)
tree1b0e4885b57a5428a2b3e6873925ec43900110e3 /examples/stokes_drag_particle_2d_hlbm_gpu
parent377b6596a9cdfb62a261d2cba4c67be3e9d79244 (diff)
downloadlibs-lbm-43d795c0afa3c613fb3aee10de7ddf579cf78645.tar.gz
Fixed Stokes example (yikes)
Diffstat (limited to 'examples/stokes_drag_particle_2d_hlbm_gpu')
-rw-r--r--examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
index 9a04211..68c0b35 100644
--- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
@@ -147,7 +147,7 @@ saw::error_or<void> setup_initial_conditions(
rho.at({}) = {1};
auto& vel = vel_f.at(index);
if(info_f.at(index).get() == 2u){
- vel.at({{0u}}) = 0.0;
+ vel.at({{0u}}) = 0.0002f;
}
auto eq = equilibrium<T,Desc>(rho,vel);
@@ -214,17 +214,30 @@ saw::error_or<void> step(
component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&](){
- uint64_t target_t_i = 16u;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ [&]() -> saw::data<sch::Vector<T,Desc::D>>{
+ saw::data<sch::Vector<T,Desc::D>> vel;
+ uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
- return 1.0 + (0.00002 / target_t_i) * t_i.get();
+ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
+ }else{
+ vel.at({{0u}}) = 0.0002;
}
- return 1.00002;
+ return vel;
+ }()
+ };
+ component<T,Desc,cmpt::ZouHeVelocityX<false>,encode::Sycl<saw::encode::Native>> flow_out{
+ [&]() -> saw::data<sch::Vector<T,Desc::D>>{
+ saw::data<sch::Vector<T,Desc::D>> vel;
+ uint64_t target_t_i = 8u;
+ if(t_i.get() < target_t_i){
+ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
+ }else{
+ vel.at({{0u}}) = 0.0002;
+ }
+ return vel;
}()
};
- 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;
@@ -367,7 +380,9 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
- saw::data<sch::UInt64> time_steps{16u*4096ul};
+
+ saw::data<sch::UInt64> time_steps{32u*4096ul};
+
auto& info_f = lsd_view.template get<"info">();
for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){