From eaa598784db491d37bdb1b9ff87d6e6bc9979476 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 18 Aug 2026 21:51:11 +0200 Subject: Feierabend --- .../step.hpp | 56 ++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp index 1739edd..554a6ea 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp @@ -19,6 +19,8 @@ saw::error_or step( auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); + + if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ @@ -48,16 +50,6 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ component> collision{1.0}; component> bb; - - component,encode::Sycl> flow_in{ - [&](){ - uint64_t target_t_i = 16u; - if(t_i.get() < target_t_i){ - return 1.0 + (0.01 / target_t_i) * t_i.get(); - } - return 1.001; - }() - }; component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ @@ -78,7 +70,20 @@ saw::error_or step( collision.apply(fields,macros,index,t_i); break; case 3u: - flow_in.apply(fields,index,t_i); + { + component,encode::Sycl> flow_in{ + [&]() -> saw::data> { + saw::data> vel; + { + auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::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); + } collision.apply(fields,macros,index,t_i); break; case 4u: @@ -118,19 +123,9 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{0.8}; - component> collision{0.8}; + component> bgk{1.0}; + component> collision{1.0}; component> bb; - - component,encode::Sycl> flow_in{ - [&](){ - uint64_t target_t_i = 8u; - if(t_i.get() < target_t_i){ - return 1.0 + (0.01 / target_t_i) * t_i.get(); - } - return 1.01; - }() - }; component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ @@ -151,7 +146,20 @@ saw::error_or step( collision.apply(fields,macros,index,t_i); break; case 3u: - flow_in.apply(fields,index,t_i); + { + component,encode::Sycl> flow_in{ + [&]() -> saw::data> { + saw::data> vel; + { + auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to()).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast::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: -- cgit v1.2.3