From 8c2e629878ab1c73c73ae92d76e8883ccfa032a2 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 25 Aug 2026 21:48:13 +0200 Subject: Feierabend? --- examples/one_particle_sedimentation_2d/common.hpp | 3 ++- examples/one_particle_sedimentation_2d/sim.cpp | 4 +-- examples/one_particle_sedimentation_2d/step.hpp | 33 ++++++----------------- 3 files changed, 12 insertions(+), 28 deletions(-) (limited to 'examples/one_particle_sedimentation_2d') diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp index 954557d..18d6584 100644 --- a/examples/one_particle_sedimentation_2d/common.hpp +++ b/examples/one_particle_sedimentation_2d/common.hpp @@ -62,7 +62,8 @@ using MacroStruct = Struct< Member, "momentum">, Member, "density">, Member, "porosity">, - Member, "force"> + Member, "force">, + Member, "external_force"> >; template diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index b0b374c..a722fc3 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -48,10 +48,10 @@ saw::error_or lbm_main(const saw::data& args){ // delta_x {{0.02 / dim_x}}, // delta_t - {{1.067e-4}} + {{1.5e-6}} }; - print_lbm_meta(conv,{1e-3},{1e-4},{0.5 * dim_y}); + print_lbm_meta(conv,{1e-3},{1e-4},{0.02}); // saw::data> meta{{dim_x,dim_y}}; auto lbm_data_ptr = saw::heap>>(); diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp index 20b7f4b..86064ae 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -19,8 +19,7 @@ saw::error_or step( auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); auto& porous_f = macros.template get<"porosity">(); - - + auto& ext_force_f = macros.template get<"external_force">(); if constexpr ( std::is_same_v ){ q.submit([&](acpp::sycl::handler& h){ @@ -31,6 +30,7 @@ saw::error_or step( index.at({{i}}).set(idx[i]); } hlbm_reset.apply(fields,macros,index,t_i); + }); }).wait(); q.submit([&](acpp::sycl::handler& h){ @@ -49,7 +49,6 @@ saw::error_or step( q.submit([&](acpp::sycl::handler& h){ component> collision{1.0}; component> bb; - component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ saw::data> index; @@ -67,27 +66,6 @@ saw::error_or step( break; case 2u: collision.apply(fields,macros,index,t_i); - break; - case 3u: - { - 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: - flow_out.apply(fields,index,t_i); - collision.apply(fields,macros,index,t_i); break; default: break; @@ -104,11 +82,16 @@ saw::error_or step( } fplbm_reset.apply(fields,macros,index,t_i); + + // TODO apply external force + // auto& ext_force = ext_force_f.at(index); }); }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> fplbm_one_part; + saw::data> gf; + gf.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle(); + component> fplbm_one_part{gf}; h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){ saw::data> index; -- cgit v1.2.3