diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-06 21:52:53 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-06 21:52:53 +0200 |
| commit | 2b994f234475a8817fcd60f823f49de59b1085da (patch) | |
| tree | 80c8676d6f746bf52fedbb29df80e95db1604d9e | |
| parent | 88fe73842d394f9b2db18c8797050554eed23da7 (diff) | |
| parent | 377b6596a9cdfb62a261d2cba4c67be3e9d79244 (diff) | |
| download | libs-lbm-2b994f234475a8817fcd60f823f49de59b1085da.tar.gz | |
Merge branch 'dev'
| -rw-r--r-- | examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp | 6 | ||||
| -rw-r--r-- | examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp | 6 | ||||
| -rw-r--r-- | examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | 6 | ||||
| -rw-r--r-- | modules/core/c++/hlbm.hpp | 2 | ||||
| -rw-r--r-- | modules/core/c++/particle/aabb.hpp | 4 | ||||
| -rw-r--r-- | modules/core/tests/particles.cpp | 33 |
6 files changed, 43 insertions, 14 deletions
diff --git a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp index 0a9b2fb..fb31f47 100644 --- a/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_fplbm_gpu/sim.cpp @@ -216,11 +216,11 @@ saw::error_or<void> step( component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ - uint64_t target_t_i = 64u; + uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ - return 1.0 + (0.0002 / target_t_i) * t_i.get(); + return 1.0 + (0.00002 / target_t_i) * t_i.get(); } - return 1.0002; + return 1.00002; }() }; component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0}; diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp index 49e6d43..9a04211 100644 --- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp @@ -216,11 +216,11 @@ saw::error_or<void> step( component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ - uint64_t target_t_i = 64u; + uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ - return 1.0 + (0.0002 / target_t_i) * t_i.get(); + return 1.0 + (0.00002 / target_t_i) * t_i.get(); } - return 1.0002; + return 1.00002; }() }; component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0}; diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp index 9aa27a6..9781691 100644 --- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp @@ -235,11 +235,11 @@ saw::error_or<void> step( component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ - uint64_t target_t_i = 64u; + uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ - return 1.0 + (0.0002 / target_t_i) * t_i.get(); + return 1.0 + (0.00002 / target_t_i) * t_i.get(); } - return 1.0002; + return 1.00002; }() }; component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0}; diff --git a/modules/core/c++/hlbm.hpp b/modules/core/c++/hlbm.hpp index d57a2e7..9a89697 100644 --- a/modules/core/c++/hlbm.hpp +++ b/modules/core/c++/hlbm.hpp @@ -174,7 +174,7 @@ public: uint64_t i_opp = dfi::opposite_index[i]; - saw::data<T> dfs_added = dfs.at({i}) + dfs_old_f.at(n_ind_i).at({i_opp}); + saw::data<T> dfs_added = dfs.at({i}) - dfs_old_f.at(n_ind_i).at({i_opp}); saw::data<sch::Scalar<T>> dfs_added_v; dfs_added_v.at({}) = dfs_added; auto ei_dfs = e_i * dfs_added_v; diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index 1773dea..18426d5 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -35,13 +35,13 @@ public: auto& a = aabb.template get<"a">(); auto& b = aabb.template get<"b">(); - const saw::data<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().template get<"radius">().at({0u}); + const saw::data<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().at({0u}).template get<"radius">(); saw::data<sch::Vector<T,D>> lower; saw::data<sch::Vector<T,D>> upper; for(uint64_t i{0u}; i < D; ++i){ - lower.at({{i}}) = pirb_pos.at({{i}}) >= rad_d.at({}) ? (pirb_pos.at({{i}}) - rad_d.at({})) : saw::data<T>{0}; + lower.at({{i}}) = ((pirb_pos.at({{i}}) >= rad_d.at({})) ? (pirb_pos.at({{i}}) - rad_d.at({})) : saw::data<T>{0}); a.at({i}) = lower.at({{i}}).template cast_to<sch::UInt64>(); upper.at({{i}}) = pirb_pos.at({{i}}) + rad_d.at({}); b.at({i}) = (upper.at({{i}})+saw::data<T>{1}).template cast_to<sch::UInt64>(); diff --git a/modules/core/tests/particles.cpp b/modules/core/tests/particles.cpp index 8c21608..d11fa4f 100644 --- a/modules/core/tests/particles.cpp +++ b/modules/core/tests/particles.cpp @@ -280,13 +280,42 @@ SAW_TEST("Spheroid Particle / AABB"){ constexpr uint64_t D = 2u; saw::data<sch::Scalar<T>> radi,dense; - radi.at({}) = 2.0f; + radi.at({}) = 2.2f; dense.at({}) = 1.0f; auto spheroid_pgrp = lbm::create_spheroid_particle_group<T,D>(radi,dense,{8u}); - // auto res = lbm::particle_aabb<sch::ParticleGroup<T,D,lbm::coll::Spheroid<T>>>::calculate(spheroid_pgrp,{{0u}},{}); + auto& rb_array = spheroid_pgrp.template get<"particles">(); + rb_array = {1u}; + auto& rb = rb_array.at({0u}).template get<"rigid_body">(); + auto& rb_pos = rb.template get<"position">(); + { + rb_pos.at({{0u}}).set(4.1f); + rb_pos.at({{1u}}).set(2.9f); + } + + auto res = lbm::particle_aabb<lbm::sch::ParticleGroup<T,D,lbm::coll::Spheroid<T>>>::calculate(spheroid_pgrp,{{0u}},{{64u,32u}}); + + { + auto res_check = [&](const auto& tbp){ + lbm::iterator<1u>::apply([&](const auto& index){ + std::cout<<tbp.at(index).get()<<" "; + },{{0u}},{{D}},{{0u}}); + std::cout<<std::endl; + }; + + res_check(res.template get<"a">()); + res_check(res.template get<"b">()); + } + auto& rva = res.template get<"a">(); + auto& rvb = res.template get<"b">(); + + SAW_EXPECT(rva.at({{0u}}).get() == 1, std::string{"Expected another value for rva at 0: "} + std::to_string(rva.at({{0u}}).get())); + SAW_EXPECT(rva.at({{1u}}).get() == 0, std::string{"Expected another value for rva at 1: "} + std::to_string(rva.at({{1u}}).get())); + + SAW_EXPECT(rvb.at({{0u}}).get() == 7, std::string{"Expected another value for rvb at 0: "} + std::to_string(rvb.at({{0u}}).get())); + SAW_EXPECT(rvb.at({{1u}}).get() == 6, std::string{"Expected another value for rvb at 1: "} + std::to_string(rvb.at({{1u}}).get())); // std::cout<<res<<std::endl; } |
