summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-03-23 16:41:32 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-03-23 16:41:32 +0100
commit0d3c1a0f68792a04129dc8da8e9b9b113f76e3ec (patch)
tree1bcf2977a1e349eb4b475019eb90742de942a7e4
parentf14adcc650389a3084fdf7955c3716034b33f4f4 (diff)
downloadlibs-lbm-0d3c1a0f68792a04129dc8da8e9b9b113f76e3ec.tar.gz
Found wrong zou he boundary issue. Preparing for fix
-rw-r--r--examples/poiseulle_particles_2d_psm_gpu/sim.cpp20
-rw-r--r--lib/core/c++/boundary.hpp7
-rw-r--r--lib/core/c++/descriptor.hpp18
3 files changed, 22 insertions, 23 deletions
diff --git a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
index a8aeabb..0d356dd 100644
--- a/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_psm_gpu/sim.cpp
@@ -202,7 +202,7 @@ saw::error_or<void> step(
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::PSM,encode::Sycl<saw::encode::Native>> collision{0.65};
+ component<T,Desc,cmpt::PSM,encode::Sycl<saw::encode::Native>> collision{0.8};
component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
@@ -243,13 +243,13 @@ saw::error_or<void> step(
collision.apply(fields,macros,index,t_i);
break;
case 3u:
- //flow_in.apply(fields,index,t_i);
- equi.apply(fields,index,t_i);
+ flow_in.apply(fields,index,t_i);
+ //equi.apply(fields,index,t_i);
collision.apply(fields,macros,index,t_i);
break;
case 4u:
- // flow_out.apply(fields,index,t_i);
- equi.apply(fields,index,t_i);
+ flow_out.apply(fields,index,t_i);
+ // equi.apply(fields,index,t_i);
collision.apply(fields,macros,index,t_i);
break;
default:
@@ -295,12 +295,12 @@ saw::error_or<void> lbm_main(int argc, char** argv){
converter<T> conv {
// delta_x
- {{1.0}},
+ {{1e-3}},
// delta_t
- {{1.0}}
+ {{1e-06}}
};
- print_lbm_meta<T,Desc>(conv,{0.05},{0.01},{0.4 * dim_y});
+ print_lbm_meta<T,Desc>(conv,{0.1},{1e-2},{0.4 * dim_y *1e-3});
// saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}};
auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>();
@@ -382,8 +382,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
sycl_q.wait();
- /*
- {
+ if(i.get() % 1 == 0u){
{
auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr);
if(eov.is_error()){
@@ -397,7 +396,6 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
}
- */
/*
{
{
diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp
index adb473d..bb8eed9 100644
--- a/lib/core/c++/boundary.hpp
+++ b/lib/core/c++/boundary.hpp
@@ -206,16 +206,17 @@ public:
/**
* Get the sum of the unknown dfs and precalculate the direction
*/
- auto sum_unknown_dfs = (rho_setting_ - sum_df) * saw::data<FP>{known_dir};
+ auto sum_unknown_dfs = (rho_setting_ - sum_df);
+ auto unknown_dfs_dir = sum_unknown_dfs * saw::data<FP>{known_dir};
for(saw::data<sch::UInt64> k{0u}; k < saw::data<sch::UInt64>{Descriptor::Q}; ++k){
auto c_k = dfi::directions[k.get()];
if(c_k[0u]*known_dir < 0){
- sum_unknown_dfs += dfs_old.at({k}) * c_k[0u];
+ unknown_dfs_dir += dfs_old.at({k}) * c_k[0u];
}
}
- auto vel_x = sum_unknown_dfs / rho_setting_;
+ auto vel_x = unknown_dfs_dir / rho_setting_;
static_assert(Descriptor::D == 2u and Descriptor::Q == 9u, "Some parts are hard coded sadly");
diff --git a/lib/core/c++/descriptor.hpp b/lib/core/c++/descriptor.hpp
index 73f0cce..9f7399a 100644
--- a/lib/core/c++/descriptor.hpp
+++ b/lib/core/c++/descriptor.hpp
@@ -146,15 +146,15 @@ public:
static constexpr uint64_t Q = 9u;
static constexpr std::array<std::array<int32_t, D>, Q> directions = {{
- { 0, 0},
- {-1, 0},
- { 1, 0},
- { 0,-1},
- { 0, 1},
- {-1,-1},
- { 1, 1},
- {-1, 1},
- { 1,-1}
+ { 0, 0}, // 0
+ {-1, 0}, // 1
+ { 1, 0}, // 2
+ { 0,-1}, // 3
+ { 0, 1}, // 4
+ {-1,-1}, // 5
+ { 1, 1}, // 6
+ {-1, 1}, // 7
+ { 1,-1} // 8
}};
static constexpr std::array<typename saw::native_data_type<T>::type,Q> weights = {