From 1dc57770fe88b0564463d67a77a4c35f403c5d7f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 23 Apr 2025 20:19:36 +0200 Subject: Working on mask generation of static solid particles --- examples/cavity_2d.cpp | 28 ----------------- examples/poiseulle_2d.cpp | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 28 deletions(-) (limited to 'examples') diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 4df4f2b..d40e06e 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -48,34 +48,6 @@ using CellStruct = Struct< using CavityFieldD2Q9 = CellField>; } -/** - * Unsure if feasible. I would have a rho normalization on the dfs and then I would use the const rho_computation - */ -template -void compute_const_rho_u ( - saw::data>& dfs, - const typename saw::native_data_type::type rho, - std::array::type, 2>& vel - ) -{ - using dfi = df_info; - - saw::native_data_type::type real_rho = 0; - std::fill(vel.begin(), vel.end(), 0); - - for(size_t i = 0; i < Desc::Q; ++i){ - real_rho += dfs(i).get(); - vel[0] += dfi::directions[i][0] * dfs(i).get(); - vel[1] += dfi::directions[i][1] * dfs(i).get(); - } - for(size_t i = 0; i < Desc::Q; ++i){ - dfs(i).set(dfs(i).get() * (rho/real_rho)); - } - - vel[0] *= real_rho / (rho*rho); - vel[1] *= real_rho / (rho*rho); -} - /** * Calculates the equilibrium for each direction */ diff --git a/examples/poiseulle_2d.cpp b/examples/poiseulle_2d.cpp index be3efbc..4ecf500 100644 --- a/examples/poiseulle_2d.cpp +++ b/examples/poiseulle_2d.cpp @@ -2,7 +2,83 @@ #include +namespace kel { +namespace lbm { +namespace sch { +using namespace saw::schema; + +/** + * Basic distribution function + * Base type + * D + * Q + * Scalar factor + * D factor + * Q factor + */ +using T = Float32; +using D2Q5 = Descriptor<2,5>; +using D2Q9 = Descriptor<2,9>; + +template +using DfCell = Cell; + +template +using CellInfo = Cell; + +/** + * Basic type for simulation + */ +template +using CellStruct = Struct< + Member, "dfs">, + Member, "dfs_old">, + Member, "info"> +>; + + +using CavityFieldD2Q9 = CellField>; +} +} +} + int main(int argc, char** argv){ + using namespace kel::lbm; + + std::string_view cfg_file_name = "config.json"; + if(argc > 1){ + cfg_file_name = argv[1]; + } + + auto eo_conf = load_lbm_config>(cfg_file_name); + if(eo_conf.is_error()){ + auto& err = eo_conf.get_error(); + std::cerr<<"[Error]: "< conv{ + {conf.template get<"delta_x">()}, + {conf.template get<"delta_t">()} + }; + + print_lbm_meta>(conv, {conf.template get<"kinematic_viscosity">()}); + + + saw::data> dim{{128, 128}}; + + saw::data lattice{dim}; + + + return 0; } -- cgit v1.2.3