From 573bfdc0bbffdb1d68259bc348e36d57471d56be Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 24 Jun 2025 16:49:31 +0200 Subject: Broken cavity2d. why? --- examples/cavity_2d.cpp | 22 +++++++++++++++++----- examples/poiseulle_2d.cpp | 4 ---- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'examples') diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 5683d85..bb6c6d8 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -237,7 +237,8 @@ void set_initial_conditions(saw::data& latt){ void lbm_step( saw::data& latt, - bool even_step + bool even_step, + uint64_t time_step ){ using namespace kel::lbm; using dfi = df_info; @@ -251,6 +252,20 @@ void lbm_step( component bb_lid; bb_lid.lid_vel = {0.1,0.0}; + auto dim = latt.meta(); + + for(saw::data i{0u}; i < dim.at(0u); ++i){ + for(saw::data j{0u}; j < dim.at(1u); ++j ){ + auto& cell = latt({{i,j}}); + auto& info = cell.template get<"info">(); + + switch(info({0u}).get()){ + case 1u: { + coll.apply(latt, {{i,j}}, time_step); + } break; + } + } + } // Collide apply_for_cells([&](auto& cell, std::size_t i, std::size_t j){ auto& df = even_step ? cell.template get<"dfs_old">() : cell.template get<"dfs">(); @@ -258,9 +273,6 @@ void lbm_step( auto info_val = info({0u}).get(); switch(info_val){ - case 1u: - coll.apply(df); - break; case 2u: // bb.apply(df); bb_lid.apply(df); @@ -460,7 +472,7 @@ int main(){ ++file_no; } - lbm_step(lattice, even_step); + lbm_step(lattice, even_step, step); even_step = not even_step; } diff --git a/examples/poiseulle_2d.cpp b/examples/poiseulle_2d.cpp index 4ecf500..f5a7981 100644 --- a/examples/poiseulle_2d.cpp +++ b/examples/poiseulle_2d.cpp @@ -72,13 +72,9 @@ int main(int argc, char** argv){ print_lbm_meta>(conv, {conf.template get<"kinematic_viscosity">()}); - saw::data> dim{{128, 128}}; saw::data lattice{dim}; - - - return 0; } -- cgit v1.2.3