diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-01 00:15:41 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-01 00:15:41 +0200 |
| commit | 89b1992988569add71f3b2f858a38a001d141d3b (patch) | |
| tree | b4d4519bb6df9b1f91778484cd5bc361c9356a47 /examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | |
| parent | 53ecaeeee3a24c016b4fd3c6a577ac22ac47775a (diff) | |
| parent | 761e4912e14324ccf713b9309336816cd3283b38 (diff) | |
| download | libs-lbm-89b1992988569add71f3b2f858a38a001d141d3b.tar.gz | |
Merge branch 'dev'
Diffstat (limited to 'examples/stokes_drag_particle_2d_psm_gpu/sim.cpp')
| -rw-r--r-- | examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp index 0ff6e6b..7a14e3f 100644 --- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_psm_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/particle/particle_opa.hpp> #include <forstio/io/io.hpp> #include <forstio/remote/filesystem/easy.hpp> @@ -13,7 +14,7 @@ namespace lbm { constexpr uint64_t dim_y = 1024ul; constexpr uint64_t dim_x = dim_y * 2ul; -constexpr uint64_t particle_amount = 1ul; +// constexpr uint64_t particle_amount = 1ul; namespace sch { using namespace saw::schema; @@ -48,6 +49,7 @@ template<typename T, typename Desc> using MacroStruct = Struct< Member<VelChunk<T,Desc>, "velocity">, Member<RhoChunk<T>, "density">, + Member<VelChunk<T,Desc>, "force">, Member<ScalarChunk<T,Desc>, "porosity"> >; @@ -157,11 +159,33 @@ saw::error_or<void> setup_initial_conditions( df_f.get_dims(), {{1u,1u}} ); + + saw::data<sch::Scalar<T>> eps; + eps.at({}).set(1.5f); + saw::data<sch::Scalar<T>> rad; + rad.at({}).set(dim_y*0.1); + saw::data<sch::Vector<T,Desc::D>> p_pos; + { + p_pos.at({{0u}}) = dim_x * 0.25; + p_pos.at({{1u}}) = dim_y * 0.5; + } + + /* + component<T,Desc,cmpt::OneParticleAt> opa{p_pos,rad,eps}; + iterator<Desc::D>::apply( + [&](auto& index){ + opa.apply(macros,index,{}); + }, + {},// 0-index + df_f.get_dims() + ); + */ + /* iterator<Desc::D>::apply( [&](auto& index){ saw::data<sch::Vector<T,Desc::D>> middle, ind_vec; - middle.at({{0u}}) = dim_x * 0.5; + middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; ind_vec.at({{0u}}) = index.at({{0u}}).template cast_to<T>(); @@ -176,6 +200,7 @@ saw::error_or<void> setup_initial_conditions( {},// 0-index df_f.get_dims() ); + */ return saw::make_void(); } @@ -192,16 +217,21 @@ saw::error_or<void> step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ + component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8}; 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; - saw::data<sch::Scalar<T>> rho_b; - rho_b.at({}) = 1.0; - saw::data<sch::Vector<T,Desc::D>> vel_b; - vel_b.at({{0u}}) = 0.015; - - component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b}; + saw::data<sch::Scalar<T>> eps; + eps.at({}).set(1.5f); + saw::data<sch::Scalar<T>> rad; + rad.at({}).set(dim_y*0.1 / 4.0); + saw::data<sch::Vector<T,Desc::D>> p_pos; + { + p_pos.at({{0u}}) = dim_x * 0.5; + p_pos.at({{1u}}) = dim_y * 0.5; + } + component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps}; component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ @@ -214,6 +244,7 @@ saw::error_or<void> step( }; component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0}; + component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg; h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){ saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index; @@ -230,17 +261,19 @@ saw::error_or<void> step( abb.apply(fields,index,t_i); break; case 2u: + opa.apply(macros,index,t_i); collision.apply(fields,macros,index,t_i); + fg.apply(fields,macros,index,t_i); break; case 3u: flow_in.apply(fields,index,t_i); //equi.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); + bgk.apply(fields,macros,index,t_i); break; case 4u: flow_out.apply(fields,index,t_i); // equi.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); + bgk.apply(fields,macros,index,t_i); break; case 5u: // Corners @@ -385,6 +418,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){ } } */ + /* if(i.get() % 32u == 0u){ { auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); @@ -399,6 +433,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){ } } } + */ // Stream sycl_q.submit([&](acpp::sycl::handler& h){ component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream; |
