summaryrefslogtreecommitdiff
path: root/examples/poiseulle_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/poiseulle_2d.cpp')
-rw-r--r--examples/poiseulle_2d.cpp56
1 files changed, 52 insertions, 4 deletions
diff --git a/examples/poiseulle_2d.cpp b/examples/poiseulle_2d.cpp
index 0ec4fc0..2f60ffd 100644
--- a/examples/poiseulle_2d.cpp
+++ b/examples/poiseulle_2d.cpp
@@ -44,6 +44,55 @@ using CavityFieldD2Q9 = CellField<D2Q9, CellStruct<D2Q9>>;
}
}
+void set_geometry(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+ using namespace kel::lbm;
+
+ auto meta = latt.meta();
+ for(saw::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
+ for(saw::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
+ auto& cell = latt({{i,j}});
+ auto& info = cell.template get<"info">();
+
+
+ }
+ }
+
+}
+
+void set_initial_conditions(saw::data<kel::lbm::sch::CavityFieldD2Q9>& latt){
+ using namespace kel::lbm;
+
+ typename saw::native_data_type<sch::T>::type rho = 1.0;
+ auto meta = latt.meta();
+
+ // Collide
+ for(saw::data<sch::UInt64> i{0u}; i < meta.at(0u); ++i){
+ for(saw::data<sch::UInt64> j{0u}; j < meta.at(1u); ++j ){
+ auto& cell = latt({{i,j}});
+ auto& info = cell.template get<"info">();
+
+ }
+ }
+ /*
+ {
+ std::array<typename saw::native_data_type<sch::T>::type, sch::D2Q9::D> vel = {0.0, 0.0};
+ auto eq = equilibrium<sch::D2Q9>(rho, vel);
+
+ apply_for_cells([&eq](auto& cell, std::size_t i, std::size_t j){
+ (void) i;
+ (void) j;
+ auto& dfs = cell.template get<"dfs">();
+ auto& dfs_old = cell.template get<"dfs_old">();
+ auto info = cell.template get<"info">()(0u).get();
+ for(uint64_t k = 0; k < sch::D2Q9::Q; ++k){
+ dfs(k).set(eq[k]);
+ dfs_old(k).set(eq[k]);
+ }
+ }, latt);
+ }
+ */
+}
+
int main(int argc, char** argv){
using namespace kel::lbm;
@@ -52,7 +101,7 @@ int main(int argc, char** argv){
cfg_file_name = argv[1];
}
- auto eo_conf = load_lbm_config<sch::Float64,sch::Descriptor<2,9>>(cfg_file_name);
+ auto eo_conf = load_lbm_config<sch::Float64,sch::Descriptor<2u,9u>>(cfg_file_name);
if(eo_conf.is_error()){
auto& err = eo_conf.get_error();
std::cerr<<"[Error]: "<<err.get_category();
@@ -72,10 +121,9 @@ int main(int argc, char** argv){
{conf.template get<"delta_t">()}
};
- print_lbm_meta<sch::Float64,sch::Descriptor<2,9>>(conv, {conf.template get<"kinematic_viscosity">()});
-
- saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{128, 128}};
+ print_lbm_meta<sch::Float64,sch::Descriptor<2u,9u>>(conv, {conf.template get<"kinematic_viscosity">()});
+ saw::data<sch::FixedArray<sch::UInt64,sch::D2Q9::D>> dim{{1024, 128}};
saw::data<sch::CavityFieldD2Q9, saw::encode::Native> lattice{dim};
return 0;