summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-02-09 16:59:56 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-02-09 16:59:56 +0100
commit93f4ac0090c0bb7b80948f25781377b59b60c8b1 (patch)
tree2f5cfdacc4bc6f07f4f2a163be92e878f60a52e7 /examples
parent5fee9c698f5f1ebe6ef8bf07f5a75e04dab92681 (diff)
downloadlibs-lbm-93f4ac0090c0bb7b80948f25781377b59b60c8b1.tar.gz
Initializing to expected velocity
Diffstat (limited to 'examples')
-rw-r--r--examples/poiseulle_particles_2d_gpu/sim.cpp20
1 files changed, 18 insertions, 2 deletions
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<void> 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<Desc::D>::apply(
[&](auto& index){
auto& df = df_f.at(index);
@@ -105,6 +105,22 @@ saw::error_or<void> setup_initial_conditions(
df_f.get_dims()
);
+ iterator<Desc::D>::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<T,Desc>(rho,vel);
+
+ df = eq;
+ },
+ {},// 0-index
+ df_f.get_dims(),
+ {{1u,1u}}
+ );
+
return saw::make_void();
}
@@ -127,7 +143,7 @@ saw::error_or<void> step(
saw::data<sch::Scalar<T>> rho_b;
rho_b.at({}) = 1.0;
saw::data<sch::Vector<T,Desc::D>> vel_b;
- vel_b.at({{0u}}) = 0.01;
+ vel_b.at({{0u}}) = 0.1;
component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b};