diff options
Diffstat (limited to 'examples/poiseulle_particles_2d_hlbm_gpu')
| -rw-r--r-- | examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp index b09aa64..b1bd37d 100644 --- a/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_hlbm_gpu/sim.cpp @@ -48,6 +48,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"> >; @@ -140,7 +141,8 @@ saw::error_or<void> setup_initial_conditions( df_f.get_dims(), {{1u,1u}} ); - + + /* iterator<Desc::D>::apply( [&](auto& index){ saw::data<sch::Vector<T,Desc::D>> middle, ind_vec; @@ -159,6 +161,7 @@ saw::error_or<void> setup_initial_conditions( {},// 0-index df_f.get_dims() ); + */ return saw::make_void(); } @@ -176,16 +179,23 @@ saw::error_or<void> step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.65}; + component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8}; + component<T,Desc,cmpt::Hlbm,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); + 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,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps}; + + component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg; component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{ [&](){ @@ -214,32 +224,19 @@ saw::error_or<void> step( bb.apply(fields,index,t_i); break; case 2u: + opa.apply(macros,index,t_i); collision.apply(fields,macros,index,t_i); - { - saw::data<sch::Vector<T,Desc::D>> middle; - middle.at({{0u}}) = dim_x * 0.25; - middle.at({{1u}}) = dim_y * 0.5; - - saw::data<sch::Vector<T,Desc::D>> ind_vec; - ind_vec.at({{0u}}) = index.at({{0u}}).template cast_to<T>(); - ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>(); - - auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); - if(dist_2.at({}).get() < dim_y*dim_y*0.01){ - porous_f.at(index).at({}) = 0.0; - } - } + 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; default: break; |
