From b79e5cf1a3c07cad4edcad2c909318a5a5b6115e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 5 Feb 2026 18:05:18 +0100 Subject: Fixing boundary conditions --- examples/poiseulle_particles_2d_gpu/sim.cpp | 6 +++--- lib/core/c++/boundary.hpp | 2 +- lib/core/c++/write_vtk.hpp | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index bdd93b0..305ef80 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -7,8 +7,8 @@ namespace kel { namespace lbm { -constexpr uint64_t dim_x = 1024u; -constexpr uint64_t dim_y = 512u; +constexpr uint64_t dim_x = 2048u; +constexpr uint64_t dim_y = 1024u; namespace sch { using namespace saw::schema; @@ -119,7 +119,7 @@ saw::error_or step( // Need nicer things to handle the flow. I see improvement here component> collision{0.6}; component> bb; - component,encode::Sycl> flow_in{1.001}; + component,encode::Sycl> flow_in{1.01}; component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index ec16edf..6d83c79 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -117,7 +117,7 @@ public: for(saw::data k{0u}; k < saw::data{Descriptor::Q}; ++k){ auto c_k = dfi::directions[k.get()]; - if(c_k[0u]*known_dir > 0){ + if(c_k[0u]*known_dir < 0){ sum_unknown_dfs += dfs_old.at({k}) * c_k[0u]; } } diff --git a/lib/core/c++/write_vtk.hpp b/lib/core/c++/write_vtk.hpp index 3c60a66..751ec50 100644 --- a/lib/core/c++/write_vtk.hpp +++ b/lib/core/c++/write_vtk.hpp @@ -67,12 +67,14 @@ struct lbm_vtk_writer> { template struct lbm_vtk_writer> { + template static saw::error_or apply_d(std::ostream& vtk_file, const saw::data>& field, saw::data>& index){ - - if constexpr ( d < sizeof...(D)){ - for(index.at({d}) = 0u; index.at({d}) < field.get_dims().at({d}); ++index.at({d})){ - auto eov = apply_d(vtk_file, field, index); + // VTK wants to iterate over z,y,x instead of x,y,z + // We could reorder the dimensions, but eh + if constexpr ( d > 0u){ + for(index.at({d-1u}) = 0u; index.at({d-1u}) < field.get_dims().at({d-1u}); ++index.at({d-1u})){ + auto eov = apply_d(vtk_file, field, index); } }else{ auto eov = lbm_vtk_writer::apply(vtk_file, field.at(index)); @@ -94,7 +96,7 @@ struct lbm_vtk_writer> { } { - auto eov = apply_d<0u>(vtk_file, field, index); + auto eov = apply_d(vtk_file, field, index); if(eov.is_error()){ return eov; } -- cgit v1.2.3