From 576b566d09194e923f73e0aa5a576bfdb5cfe945 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 3 Sep 2026 13:42:38 +0200 Subject: Dangling --- examples/one_particle_sedimentation_2d/common.hpp | 2 +- examples/one_particle_sedimentation_2d/init.hpp | 2 +- examples/one_particle_sedimentation_2d/sim.cpp | 3 +- .../common.hpp | 46 +++++++++++----------- .../init.hpp | 6 +-- .../schaefer_turek_durst_krause_rannbacher/sim.cpp | 28 +++++++------ .../step.hpp | 16 ++++---- 7 files changed, 54 insertions(+), 49 deletions(-) (limited to 'examples') diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp index 18d6584..ffb7f40 100644 --- a/examples/one_particle_sedimentation_2d/common.hpp +++ b/examples/one_particle_sedimentation_2d/common.hpp @@ -23,8 +23,8 @@ namespace lbm { * fluid density 0.001g/mm³ */ -constexpr uint64_t dim_y = 800ul; constexpr uint64_t dim_x = 200ul; +constexpr uint64_t dim_y = 800ul; constexpr uint64_t particle_amount = 1ul; diff --git a/examples/one_particle_sedimentation_2d/init.hpp b/examples/one_particle_sedimentation_2d/init.hpp index d9b8a37..8bcc236 100644 --- a/examples/one_particle_sedimentation_2d/init.hpp +++ b/examples/one_particle_sedimentation_2d/init.hpp @@ -75,7 +75,7 @@ saw::error_or init( { saw::data> radius_p; - radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); + radius_p.at({}).set(conv.meter_si_to_lbm({{0.00125}}).handle().get()); std::cout<<"RADIUS: "<> dense_p; dense_p.at({}).set(1); diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index a722fc3..8bf8205 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -51,7 +51,8 @@ saw::error_or lbm_main(const saw::data& args){ {{1.5e-6}} }; - print_lbm_meta(conv,{1e-3},{1e-4},{0.02}); + print_lbm_meta(conv,{1e-3},{1e-4},{2}); + std::cout<<"Position: "<> meta{{dim_x,dim_y}}; auto lbm_data_ptr = saw::heap>>(); diff --git a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp index a85cd50..59d2f9c 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/common.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/common.hpp @@ -19,6 +19,7 @@ namespace lbm { * viscosity 10^-3 * particle diameter 0.1m * position at (0.16m,0.2m) + * velocity of 0.3 m/s from 1.2/0.41 * x - 1.2/0.41² * x² at x=0.41/2 */ constexpr uint64_t dim_y = 41u; @@ -29,38 +30,39 @@ constexpr uint64_t particle_amount = 1ul; namespace sch { using namespace saw::schema; -using InfoChunk = Chunk; +template +using InfoChunk = Chunk; -template -using DfChunk = Chunk, 1u, dim_x, dim_y>; +template +using DfChunk = Chunk, 1u, dim_x*N, dim_y*N>; -template -using ScalarChunk = Chunk, 0u, dim_x, dim_y>; +template +using ScalarChunk = Chunk, 0u, dim_x*N, dim_y*N>; -template -using VectorChunk = Chunk, 0u, dim_x, dim_y>; +template +using VectorChunk = Chunk, 0u, dim_x*N, dim_y*N>; -template +template using ChunkStruct = Struct< - Member, - Member, "dfs">, - Member, "dfs_old">, - Member, "particle_N">, - Member, "particle_D"> + Member, "info">, + Member, "dfs">, + Member, "dfs_old">, + Member, "particle_N">, + Member, "particle_D"> >; -template -using VelChunk = Chunk, 0u, dim_x, dim_y>; +template +using VelChunk = Chunk, 0u, dim_x*N, dim_y*N>; -template -using RhoChunk = Chunk, 0u, dim_x, dim_y>; +template +using RhoChunk = Chunk, 0u, dim_x*N, dim_y*N>; -template +template using MacroStruct = Struct< - Member, "momentum">, - Member, "density">, - Member, "porosity">, - Member, "force"> + Member, "momentum">, + Member, "density">, + Member, "porosity">, + Member, "force"> >; template diff --git a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp index af7eb89..96e2917 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/init.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/init.hpp @@ -5,11 +5,11 @@ namespace kel { namespace lbm { -template +template saw::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, + saw::data>& fields, + saw::data>& macros, saw::data>& particles ){ (void) conv; diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp index a152789..eeb1c54 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp @@ -46,19 +46,21 @@ saw::error_or lbm_main(const saw::data& args){ converter conv { // delta_x - {{0.41 / dim_y}}, + {{0.41 / (dim_y*N)}}, // delta_t - {{1.067e-4}} + {{3e-3/(N*N)}} }; - print_lbm_meta(conv,{1e-3},{1e-4},{0.5 * dim_y}); + print_lbm_meta(conv,{1e-3},{0.3},{0.1}); + + std::cout<<"Inflow free flow velocity: "<> meta{{dim_x,dim_y}}; - auto lbm_data_ptr = saw::heap>>(); - auto lbm_macro_data_ptr = saw::heap>>(); + auto lbm_data_ptr = saw::heap>>(); + auto lbm_macro_data_ptr = saw::heap>>(); auto lbm_particle_data_ptr = saw::heap>>(); - std::cout<<"Estimated Bytes: "<,sch::MacroStruct>().get()<,sch::MacroStruct>().get()< lbm_main(const saw::data& args){ sycl_q.wait(); { - auto eov = init(conv,*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); + auto eov = init(conv,*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); if(eov.is_error()){ return eov; } } - saw::data, encode::Sycl> lbm_sycl_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; + saw::data, encode::Sycl> lbm_sycl_data{sycl_q}; + saw::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; saw::data, encode::Sycl> lbm_sycl_particle_data{sycl_q}; sycl_q.wait(); @@ -123,7 +125,7 @@ saw::error_or lbm_main(const saw::data& args){ for(saw::data i{0u}; i < time_steps and krun; ++i){ // BC + Collision { - auto eov = step(conv,lsd_view,lsdm_view,lsdp_view,i,dev); + auto eov = step(conv,lsd_view,lsdm_view,lsdp_view,i,dev); if(eov.is_error()){ return eov; } @@ -212,11 +214,11 @@ saw::error_or k_main(int argc, char** argv){ auto& coupling = an.template get<"coupling">(); if(coupling.stl_view() == "hlbm"){ - return lbm_main(args); + return lbm_main(args); } else if(coupling.stl_view() == "fplbm"){ - return lbm_main(args); + return lbm_main(args); } else if(coupling.stl_view() == "psm"){ - return lbm_main(args); + return lbm_main(args); } return saw::make_error("Invalid coupling"); diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp index 9a75e6f..e88f262 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp @@ -5,11 +5,11 @@ namespace kel { namespace lbm { -template +template saw::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, + saw::data>,encode::Sycl>& fields, + saw::data>,encode::Sycl>& macros, saw::data>,encode::Sycl>& particles, saw::data t_i, device& dev @@ -46,7 +46,7 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> collision{1.0}; + component> collision{0.59}; component> bb; component,encode::Sycl> flow_out{1.0}; @@ -121,8 +121,8 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{1.0}; + component> bgk{0.59}; + component> collision{0.59}; component> bb; component,encode::Sycl> flow_out{1.0}; @@ -197,8 +197,8 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> bgk{1.0}; - component> collision{1.0}; + component> bgk{0.59}; + component> collision{0.59}; component> bb; component,encode::Sycl> flow_out{1.0}; -- cgit v1.3.1 From 54dfad7ac102fe40d71d8818d77801160a7073c1 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 7 Sep 2026 13:36:54 +0200 Subject: FpLbm two way couple doing weird things --- examples/one_particle_sedimentation_2d/sim.cpp | 2 +- examples/one_particle_sedimentation_2d/step.hpp | 2 +- examples/schaefer_turek_durst_krause_rannbacher/sim.cpp | 4 +--- modules/core/c++/fplbm.hpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 8bf8205..0cb3ce0 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -145,7 +145,7 @@ saw::error_or lbm_main(const saw::data& args){ } } { - auto eov = write_csv_file(out_dir,"ops_2d",i.get(), *lbm_macro_data_ptr); + auto eov = write_vtk_file(out_dir,"ops_2d",i.get(), *lbm_macro_data_ptr); 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 86064ae..c3a3b8a 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -175,7 +175,7 @@ saw::error_or step( index.at({{i}}).set(idx[i]); } - fplbm_one_part.apply(fields,macros,particles,index,t_i,{16u}); + fplbm_one_part.apply(fields,macros,particles,index,t_i,{32u}); }); }).wait(); diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp index eeb1c54..35c04a4 100644 --- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp +++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp @@ -132,7 +132,6 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - /* if(i.get() % 64u == 0u){ { auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr); @@ -141,13 +140,12 @@ saw::error_or lbm_main(const saw::data& args){ } } { - auto eov = write_vtk_file(out_dir,std::string{"stdkr_2d_"}+an.template get<"coupling">().stl_string(),i.get(), *lbm_macro_data_ptr); + auto eov = write_vtk_file(out_dir,std::string{"ops_2d_"}+an.template get<"coupling">().stl_string(),i.get(), *lbm_macro_data_ptr); if(eov.is_error()){ return eov; } } } - */ // Stream sycl_q.submit([&](acpp::sycl::handler& h){ component> stream; diff --git a/modules/core/c++/fplbm.hpp b/modules/core/c++/fplbm.hpp index f50cb1b..0ab7903 100644 --- a/modules/core/c++/fplbm.hpp +++ b/modules/core/c++/fplbm.hpp @@ -352,7 +352,7 @@ public: // vel_s is technically time the density of the particle? - force = ( vel_s - mom) * two * flip_por; + force = global_force_ * por + ( vel_s - mom) * two * flip_por; // force = (vel_s - mom) * flip_por / (flip_por / two + one); force_p = force_p - force; -- cgit v1.3.1