From 0c0087ef9482634273ec1a23d3a915754f94926d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 11 Nov 2026 01:16:44 +0100 Subject: Snapshot. Migration to Lbm Unit --- examples/one_particle_sedimentation_2d/common.hpp | 2 +- examples/one_particle_sedimentation_2d/init.hpp | 10 +++++----- examples/one_particle_sedimentation_2d/sim.cpp | 11 ++++++----- examples/one_particle_sedimentation_2d/step.hpp | 11 ++++++----- 4 files changed, 18 insertions(+), 16 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 e28622f..f5382e0 100644 --- a/examples/one_particle_sedimentation_2d/common.hpp +++ b/examples/one_particle_sedimentation_2d/common.hpp @@ -58,7 +58,7 @@ using RhoChunk = Chunk, 0u, dim_x, dim_y>; template using MacroStruct = Struct< - Member, "momentum">, + Member, "velocity">, Member, "density">, Member, "porosity">, Member, "force">, diff --git a/examples/one_particle_sedimentation_2d/init.hpp b/examples/one_particle_sedimentation_2d/init.hpp index 989ec4f..94ad3db 100644 --- a/examples/one_particle_sedimentation_2d/init.hpp +++ b/examples/one_particle_sedimentation_2d/init.hpp @@ -37,7 +37,7 @@ kel::lbm::error_or init( auto& df_f = fields.template get<"dfs_old">(); auto& rho_f = macros.template get<"density">(); - auto& vel_f = macros.template get<"momentum">(); + auto& vel_f = macros.template get<"velocity">(); auto& por_f = macros.template get<"porosity">(); iterator::apply( @@ -74,8 +74,8 @@ kel::lbm::error_or init( ); { - kel::lbm::data> radius_p; - radius_p.at({}).set(conv.meter_si_to_lbm({{0.00125}}).handle().get()); + kel::lbm::data>> radius_p; + radius_p.at({}).set(conv.meter_si_to_lbm({0.00125}).handle().get()); std::cout<<"RADIUS: "<> dense_p; dense_p.at({}).set(1); @@ -87,8 +87,8 @@ kel::lbm::error_or init( auto& prb = p.template get<"rigid_body">(); auto& p_pos = prb.template get<"position">(); auto& p_posold = prb.template get<"position_old">(); - p_pos.at({{0u}}) = conv.meter_si_to_lbm({{0.01}}).handle(); - p_pos.at({{1u}}) = conv.meter_si_to_lbm({{0.04}}).handle(); + p_pos.at({{0u}}) = conv.meter_si_to_lbm({0.01}).handle(); + p_pos.at({{1u}}) = conv.meter_si_to_lbm({0.04}).handle(); p_posold = p_pos; } diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 7c8456f..c9fae4d 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -2,12 +2,13 @@ #include "init.hpp" #include "step.hpp" -#include /** * For deciding what parameters to use maybe? */ namespace args { +using namespace kel::lbm::sch; + using LbmArgsStruct = Struct< Member @@ -45,16 +46,16 @@ kel::lbm::error_or lbm_main(const kel::lbm::data& args){ converter conv { // delta_x - {{0.02 / dim_x}}, + {0.02 / dim_x}, // delta_t - {{3e-7}} + {3e-7} }; kel::lbm::data> kin_vis_si{1e-3}; auto kin_vis_lbm = conv.kinematic_viscosity_si_to_lbm(kin_vis_si); auto tau = conv.template kinematic_viscosity_lbm_to_tau(kin_vis_lbm); print_lbm_meta(conv,kin_vis_si,{1e-4},{2}); - std::cout<<"Position: "<> meta{{dim_x,dim_y}}; auto lbm_data_ptr = kel::lbm::heap>>(); @@ -220,7 +221,7 @@ kel::lbm::error_or k_main(int argc, char** argv){ kel::lbm::data args; { - auto eov = saw::parse_args(args,argc,argv); + auto eov = kel::lbm::parse_args(args,argc,argv); if(eov.is_error()){ return eov; } diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp index de42dec..f28586a 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -90,7 +90,8 @@ kel::lbm::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - kel::lbm::data> gf; + // Gravity is an acceleration, which is what the integrator expects. + kel::lbm::data>> gf; gf.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle(); component> fplbm_one_part{gf}; @@ -134,8 +135,8 @@ kel::lbm::error_or step( [&]() -> kel::lbm::data> { kel::lbm::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(); + auto y_si = conv.meter_lbm_to_si(as_unit>(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; @@ -210,8 +211,8 @@ kel::lbm::error_or step( [&]() -> kel::lbm::data> { kel::lbm::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(); + auto y_si = conv.meter_lbm_to_si(as_unit>(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; -- cgit v1.3.1