summaryrefslogtreecommitdiff
path: root/examples/schaefer_turek_durst_krause_rannbacher
diff options
context:
space:
mode:
Diffstat (limited to 'examples/schaefer_turek_durst_krause_rannbacher')
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/sim.cpp2
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/step.hpp76
2 files changed, 78 insertions, 0 deletions
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
index b41f850..b3422a5 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
@@ -214,6 +214,8 @@ saw::error_or<void> k_main(int argc, char** argv){
return lbm_main<FloatT,DescT,method::Hlbm>(args);
} else if(coupling.stl_view() == "fplbm"){
return lbm_main<FloatT,DescT,method::FpLbm>(args);
+ } else if(coupling.stl_view() == "psm"){
+ return lbm_main<FloatT,DescT,method::Psm>(args);
}
return saw::make_error<saw::err::critical>("Invalid coupling");
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
index 554a6ea..cbdfd10 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
@@ -172,6 +172,82 @@ saw::error_or<void> step(
});
}).wait();
}else if constexpr ( std::is_same_v<Coll, method::Psm> ){
+ q.submit([&](acpp::sycl::handler& h){
+ component<T,Desc,cmpt::PsmReset,encode::Sycl<saw::encode::Native>> fplbm_reset;
+ 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;
+ for(uint64_t i = 0u; i < Desc::D; ++i){
+ index.at({{i}}).set(idx[i]);
+ }
+
+ fplbm_reset.apply(fields,macros,index,t_i);
+ });
+ }).wait();
+
+ q.submit([&](acpp::sycl::handler& h){
+ component<T,Desc,cmpt::PsmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+
+ h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
+ saw::data<sch::FixedArray<sch::UInt64,1u>> index;
+ for(uint64_t i = 0u; i < 1u; ++i){
+ index.at({{i}}).set(idx[i]);
+ }
+
+ fplbm_one_part.apply(fields,macros,particles,index,t_i,{0u});
+ });
+ }).wait();
+
+ // auto coll_ev =
+ q.submit([&](acpp::sycl::handler& h){
+ component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
+ component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{1.0};
+ component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
+ component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
+
+ 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;
+ for(uint64_t i = 0u; i < Desc::D; ++i){
+ index.at({{i}}).set(idx[i]);
+ }
+
+ auto info = info_f.at(index);
+
+ switch(info.get()){
+ case 0u:
+ break;
+ case 1u:
+ bb.apply(fields,index,t_i);
+ break;
+ case 2u:
+ collision.apply(fields,macros,index,t_i);
+ break;
+ case 3u:
+ {
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ [&]() -> saw::data<sch::Vector<T,Desc::D>> {
+ saw::data<sch::Vector<T,Desc::D>> vel;
+ {
+ auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{1u}}) = 0.0f;
+ }
+ return vel;
+ }()
+ };
+ flow_in.apply(fields,index,t_i);
+ }
+ bgk.apply(fields,macros,index,t_i);
+ break;
+ case 4u:
+ flow_out.apply(fields,index,t_i);
+ bgk.apply(fields,macros,index,t_i);
+ break;
+ default:
+ break;
+ }
+ });
+ }).wait();
+
}
return saw::make_void();