From 43d795c0afa3c613fb3aee10de7ddf579cf78645 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 7 Jul 2026 20:33:25 +0200 Subject: Fixed Stokes example (yikes) --- examples/stokes_drag_particle_2d_psm_gpu/sim.cpp | 31 ++++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'examples/stokes_drag_particle_2d_psm_gpu/sim.cpp') diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp index 9781691..3ab3dda 100644 --- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp +++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp @@ -134,6 +134,7 @@ saw::error_or setup_initial_conditions( por_f.at(index).at({}) = {1}; rho.at({}) = {1}; auto& vel = vel_f.at(index); + auto eq = equilibrium(rho,vel); df = eq; @@ -149,7 +150,7 @@ saw::error_or setup_initial_conditions( rho.at({}) = {1}; auto& vel = vel_f.at(index); if(info_f.at(index).get() == 2u){ - vel.at({{0u}}) = 0.0; + vel.at({{0u}}) = 0.0002f; } auto eq = equilibrium(rho,vel); @@ -233,16 +234,30 @@ saw::error_or step( } component> opa{p_pos,rad,eps}; - component,encode::Sycl> flow_in{ - [&](){ - uint64_t target_t_i = 16u; + component,encode::Sycl> flow_in{ + [&]() -> saw::data>{ + saw::data> vel; + uint64_t target_t_i = 8u; + if(t_i.get() < target_t_i){ + vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); + }else{ + vel.at({{0u}}) = 0.0002; + } + return vel; + }() + }; + component,encode::Sycl> flow_out{ + [&]() -> saw::data>{ + saw::data> vel; + uint64_t target_t_i = 8u; if(t_i.get() < target_t_i){ - return 1.0 + (0.00002 / target_t_i) * t_i.get(); + vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get(); + }else{ + vel.at({{0u}}) = 0.0002; } - return 1.00002; + return vel; }() }; - component,encode::Sycl> flow_out{1.0}; component> fg; @@ -389,7 +404,7 @@ saw::error_or lbm_main(int argc, char** argv){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - saw::data time_steps{16u*4096ul}; + saw::data time_steps{32u*4096ul}; auto& info_f = lsd_view.template get<"info">(); -- cgit v1.2.3