From 93f4ac0090c0bb7b80948f25781377b59b60c8b1 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 9 Feb 2026 16:59:56 +0100 Subject: Initializing to expected velocity --- examples/poiseulle_particles_2d_gpu/sim.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'examples/poiseulle_particles_2d_gpu/sim.cpp') diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index 42d8413..f91d54f 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -90,7 +90,7 @@ saw::error_or setup_initial_conditions( auto& df_f = fields.template get<"dfs_old">(); auto& rho_f = macros.template get<"density">(); auto& vel_f = macros.template get<"velocity">(); - + iterator::apply( [&](auto& index){ auto& df = df_f.at(index); @@ -105,6 +105,22 @@ saw::error_or setup_initial_conditions( df_f.get_dims() ); + iterator::apply( + [&](auto& index){ + auto& df = df_f.at(index); + auto& rho = rho_f.at(index); + rho.at({}) = {1}; + auto& vel = vel_f.at(index); + vel.at({{0u}}) = 0.1; + auto eq = equilibrium(rho,vel); + + df = eq; + }, + {},// 0-index + df_f.get_dims(), + {{1u,1u}} + ); + return saw::make_void(); } @@ -127,7 +143,7 @@ saw::error_or step( saw::data> rho_b; rho_b.at({}) = 1.0; saw::data> vel_b; - vel_b.at({{0u}}) = 0.01; + vel_b.at({{0u}}) = 0.1; component> equi{rho_b,vel_b}; -- cgit v1.2.3