From 571e79c4d0b72202186fd11314cf268723b1844d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 23 Mar 2026 17:33:05 +0100 Subject: Fixed boundary setting --- examples/poiseulle_particles_2d_psm_gpu/sim.cpp | 25 +++++++++++++++++++++++-- lib/core/c++/boundary.hpp | 5 ++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp index 0d356dd..7702808 100644 --- a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp @@ -83,7 +83,24 @@ saw::error_or setup_initial_conditions( info_f.get_dims(), {{1u,1u}} ); - + // Corners + /// Inflow + iterator::apply( + [&](auto& index){ + info_f.at(index).set(5u); + }, + {{0u,0u}}, + {{1u,dim_y}} + ); + /// Outflow + iterator::apply( + [&](auto& index){ + info_f.at(index).set(5u); + }, + {{dim_x-1u,0u}}, + {{dim_x, dim_y}} + ); + // Overwrite with // Inflow iterator::apply( [&](auto& index){ @@ -251,7 +268,11 @@ saw::error_or step( flow_out.apply(fields,index,t_i); // equi.apply(fields,index,t_i); collision.apply(fields,macros,index,t_i); - break; + break; + case 5u: + // Corners + bb.apply(fields,index,t_i); + break; default: break; } diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index 217013d..4dbbdf8 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -174,14 +174,13 @@ class component, Encode> final { private: saw::data rho_setting_; public: - component(const saw::data& density_setting__): - rho_setting_{density_setting__} + component(const saw::data& rho_setting__): + rho_setting_{rho_setting__} {} template void apply(const saw::data& field, saw::data> index, saw::data time_step) const { using dfi = df_info; - constexpr int known_dir = Dir ? 1 : -1; bool is_even = ((time_step.get() % 2) == 0); -- cgit v1.2.3