#include "../c++/lbm.hpp" #include "../c++/collision.hpp" #include "../c++/boundary.hpp" #include "../c++/iterator.hpp" #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<2u,5u>; using D2Q9 = Descriptor<2u,9u>; template using DfCell = Cell; template using CellInfo = Cell; /** * Basic type for simulation */ template using CellStruct = Struct< Member, "dfs">, Member, "dfs_old">, Member, "info"> >; template using MacroStruct = Struct< Member, "velocity">, Member >; using CavityFieldD2Q9 = CellField>; } } } void set_geometry(saw::data& latt){ using namespace kel::lbm; auto meta = latt.meta(); /** * Set ghost */ iterate_over([&](const saw::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); info({0u}).set(0u); }, {{0u,0u}}, meta); /** * Set wall */ iterate_over([&](const saw::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); info({0u}).set(2u); }, {{0u,0u}}, meta, {1u}); /** * Set fluid */ iterate_over([&](const saw::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); info({0u}).set(1u); }, {{0u,0u}}, meta, {2u}); /** * Set inflow */ iterate_over([&](const saw::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); info({0u}).set(3u); }, {{1u,0u}}, {{2u,meta.at({1u})}}, {0u}); /** * Set outflow */ iterate_over([&](const saw::data>& index){ auto& cell = latt(index); auto& info = cell.template get<"info">(); info({0u}).set(4u); }, {{meta.at({0u})-2u,0u}}, {{meta.at({0u})-1u, meta.at({1u})}}, {0u}); } void set_initial_conditions(saw::data& latt){ using namespace kel::lbm; auto meta = latt.meta(); } 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{{1024, 128}}; saw::data lattice{dim}; saw::data,sch::D2Q9::D>> macros{dim}; for(uint64_t i = 0u; i < 256u; ++i){ { std::string vtk_f_name{"tmp/poiseulle_2d_"}; vtk_f_name += std::to_string(i) + ".vtk"; write_vtk_file(vtk_f_name, macros); } // lbm_step(lattice, i); } return 0; }