diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-21 15:00:09 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-21 15:00:09 +0200 |
| commit | b5d8593b9a2f0f58cb228444dcd09a2c5002e039 (patch) | |
| tree | ea7c01818300a2dea17a31b979540f7aa2e3b937 /examples/poiseulle_particles_2d_ibm_gpu/sim.cpp | |
| parent | f07f88088cfacaad3f94dc667f08ee2c2f38a093 (diff) | |
| download | libs-lbm-b5d8593b9a2f0f58cb228444dcd09a2c5002e039.tar.gz | |
Prep for proper com in circle group
Diffstat (limited to 'examples/poiseulle_particles_2d_ibm_gpu/sim.cpp')
| -rw-r--r-- | examples/poiseulle_particles_2d_ibm_gpu/sim.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp index ea49d51..e68d7da 100644 --- a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp @@ -1,6 +1,7 @@ #include <kel/lbm/sycl/lbm.hpp> #include <kel/lbm/lbm.hpp> #include <kel/lbm/particle.hpp> +#include <kel/lbm/math/n_linear.hpp> #include <forstio/io/io.hpp> #include <forstio/remote/filesystem/easy.hpp> @@ -266,7 +267,39 @@ saw::error_or<void> step( */ q.submit([&](acpp::sycl::handler& h){ h.parallel_for(acpp::sycl::range<1u>{1u}, [=](acpp::sycl::id<1u> idx){ - + auto& vel = macros.template get<"velocity">(); + + auto& ps = particles; + auto& mask = ps.template get<"mask">(); + auto& dense = ps.template get<"density">().at({}); + auto& com = ps.template get<"center_of_mass">(); + + auto& parts = ps.template get<"particles">(); + + auto& p_i = parts.at({{0u}}); + + auto& p_i_rb = p_i.template get<"rigid_body">(); + /// 0. Iterate over mask and calculate position in LBM grid + /// In this case it's simple since I'm too lazy to do scaling and rotation + /// Technically scale => rotate => translate + /// Here it's only translate + auto& p_i_rb_pos = p_i_rb.template get<"position">(); + + iterator<Desc::D>::apply([&](const auto& index){ + /// Calculate the shift from the mask + saw::data<sch::Vector<T,Desc::D>> index_shift; + for(uint64_t i = 0u; i < Desc::D; ++i){ + index_shift.at({{i}}) = index.at({i}).template cast_to<T>() - com.at({{i}}); + } + + + /// TODO 1. Calculate force pickup from neigbouring u_vel cells + auto inter_vel = n_linear_interpolate(vel,index_shift); + + /// TODO 3. Distribute force to fluid + + + }, {}, mask.meta()); }); }).wait(); |
