From bffab324ca4d71c0eacb2389f1441638ac465b2e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 27 Jun 2025 10:00:10 +0200 Subject: Moving towards poiseulle --- examples/cavity_2d.cpp | 19 ---------- examples/particle_ibm.cpp | 94 ----------------------------------------------- examples/poiseulle_2d.cpp | 12 +++--- 3 files changed, 7 insertions(+), 118 deletions(-) (limited to 'examples') diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 2860674..6ecdb23 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -105,25 +105,8 @@ public: */ namespace cmpt { struct MovingWall {}; -struct BBTwo {}; } -template -class component { -public: - - void apply(saw::data>& dfs){ - using dfi = df_info; - - // Technically use .copy() - auto df_cpy = dfs; - - for(uint64_t i = 1u; i < Desc::Q; ++i){ - dfs({i}) = df_cpy({dfi::opposite_index.at(i)}); - } - } -}; - /** * Full-Way moving wall Bounce back, something is not right here. * Technically it should reflect properly. @@ -244,8 +227,6 @@ void lbm_step( component coll{0.5384}; component bb; - component bb_two; - component bb_lid; bb_lid.lid_vel = {0.1,0.0}; diff --git a/examples/particle_ibm.cpp b/examples/particle_ibm.cpp index 0ce034e..d54dbdc 100644 --- a/examples/particle_ibm.cpp +++ b/examples/particle_ibm.cpp @@ -49,100 +49,6 @@ using MacroStruct = Struct< using CavityFieldD2Q9 = CellField>; } -namespace cmpt { -struct BounceBack{}; -struct MovingWall {}; -struct BGK {}; -struct ConstRhoBGK {}; -} - -/** - * A reason for why a component based design is really good can be seen in my LR solver example - * - * Add Expression Templates and you're golden. - */ -template -class component; - -/** - * Full-Way BounceBack. I suspect that the moving wall requires half-way bounce back. - */ -template -class component { -public: - - void apply(saw::data>& dfs){ - using dfi = df_info; - - // Technically use .copy() - auto df_cpy = dfs; - - for(uint64_t i = 1u; i < Desc::Q; ++i){ - dfs({i}) = df_cpy({dfi::opposite_index.at(i)}); - } - } -}; - -/** - * Full-Way moving wall Bounce back, something is not right here. - * Technically it should reflect properly. - */ -template -class component { -public: - std::array::type, Desc::D> lid_vel; - -public: - void apply( - saw::data>& dfs - ){ - using dfi = df_info; - - // Technically use .copy() - /* - auto dfs_cpy = dfs; - - for(uint64_t i = 0u; i < Desc::Q; ++i){ - dfs({dfi::opposite_index.at(i)}) = dfs_cpy({i}) - 2.0 * dfi::weights[i] * 1.0 * ( lid_vel[0] * dfi::directions[i][0] + lid_vel[1] * dfi::directions[i][1]) * dfi::inv_cs2; - } - */ - } -}; - -template -class component { -public: - typename saw::native_data_type::type relaxation_; -public: - void apply(saw::data>& dfs){ - typename saw::native_data_type::type rho; - std::array::type, Desc::D> vel; - compute_rho_u(dfs,rho,vel); - auto eq = equilibrium(rho,vel); - - for(uint64_t i = 0u; i < Desc::Q; ++i){ - dfs({i}).set(dfs({i}).get() + (1.0 / relaxation_) * (eq[i] - dfs({i}).get())); - } - } -}; - -template -class component { -public: - typename saw::native_data_type::type relaxation_; - typename saw::native_data_type::type rho_; -public: - void apply(saw::data>& dfs){ - std::array::type, Desc::D> vel; - compute_const_rho_u(dfs,rho_,vel); - auto eq = equilibrium(rho_,vel); - - for(uint64_t i = 0u; i < Desc::Q; ++i){ - dfs({i}).set(dfs({i}).get() + (1.0 / relaxation_) * (eq[i] - dfs({i}).get())); - } - } -}; - } } diff --git a/examples/poiseulle_2d.cpp b/examples/poiseulle_2d.cpp index f5a7981..0ec4fc0 100644 --- a/examples/poiseulle_2d.cpp +++ b/examples/poiseulle_2d.cpp @@ -1,4 +1,6 @@ -#include "../c++/descriptor.hpp" +#include "../c++/lbm.hpp" +#include "../c++/collision.hpp" +#include "../c++/boundary.hpp" #include @@ -17,14 +19,14 @@ using namespace saw::schema; * Q factor */ using T = Float32; -using D2Q5 = Descriptor<2,5>; -using D2Q9 = Descriptor<2,9>; +using D2Q5 = Descriptor<2u,5u>; +using D2Q9 = Descriptor<2u,9u>; template -using DfCell = Cell; +using DfCell = Cell; template -using CellInfo = Cell; +using CellInfo = Cell; /** * Basic type for simulation -- cgit v1.2.3