summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-10-07 18:27:16 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-10-07 18:27:16 +0200
commit0d77c9879b4b31b975abc5ce7873b8156e25d24c (patch)
tree021c25ff88a2eff5f271e4e13cb89b4036c56175
parent8f9f0cdc2c04ee2eaba61b8ea93a189b75a7bc9c (diff)
downloadlibs-lbm-0d77c9879b4b31b975abc5ce7873b8156e25d24c.tar.gz
Redoing stuff and breaking things
-rw-r--r--examples/throat_clog_2d/common.hpp4
-rw-r--r--examples/throat_clog_2d/sim.cpp10
-rw-r--r--examples/throat_clog_2d/step.hpp6
-rw-r--r--modules/core/c++/fplbm.hpp7
4 files changed, 15 insertions, 12 deletions
diff --git a/examples/throat_clog_2d/common.hpp b/examples/throat_clog_2d/common.hpp
index be9a538..fc4f8a9 100644
--- a/examples/throat_clog_2d/common.hpp
+++ b/examples/throat_clog_2d/common.hpp
@@ -21,8 +21,8 @@ namespace lbm {
* position at (0.16m,0.2m)
*/
-constexpr uint64_t dim_y = 512ul;
-constexpr uint64_t dim_x = static_cast<uint64_t>(dim_y * (220.0 / 41.0));
+constexpr uint64_t dim_y = 64ul;
+constexpr uint64_t dim_x = static_cast<uint64_t>(dim_y * (220.0 / 64.0));
constexpr uint64_t particle_amount = 1ul;
diff --git a/examples/throat_clog_2d/sim.cpp b/examples/throat_clog_2d/sim.cpp
index 9a21a96..26ac26b 100644
--- a/examples/throat_clog_2d/sim.cpp
+++ b/examples/throat_clog_2d/sim.cpp
@@ -46,9 +46,9 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
converter<T> conv {
// delta_x
- {{0.41 / dim_y}},
+ {{0.64 / dim_y}},
// delta_t
- {{1.067e-4 * 0.5}}
+ {{1.067e-2}}
};
print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.5 * dim_y});
@@ -136,8 +136,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
- /*
- if(i.get() % 64u == 0u){
+ if(i.get() % 256u == 0u){
{
auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr);
if(eov.is_error()){
@@ -145,13 +144,12 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& 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{"throat_clog_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<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream;
diff --git a/examples/throat_clog_2d/step.hpp b/examples/throat_clog_2d/step.hpp
index beb123b..1146890 100644
--- a/examples/throat_clog_2d/step.hpp
+++ b/examples/throat_clog_2d/step.hpp
@@ -117,7 +117,9 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part;
+ saw::data<sch::Vector<T,Desc::D>> grav;
+ grav.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle();
+ component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<saw::encode::Native>> fplbm_one_part{grav};
h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){
saw::data<sch::FixedArray<sch::UInt64,1u>> index;
@@ -125,7 +127,7 @@ saw::error_or<void> step(
index.at({{i}}).set(idx[i]);
}
- fplbm_one_part.apply(fields,macros,particles,index,t_i,{0u});
+ fplbm_one_part.apply(fields,macros,particles,index,t_i,{4u});
});
}).wait();
diff --git a/modules/core/c++/fplbm.hpp b/modules/core/c++/fplbm.hpp
index aefc568..b141cae 100644
--- a/modules/core/c++/fplbm.hpp
+++ b/modules/core/c++/fplbm.hpp
@@ -230,8 +230,11 @@ public:
auto& pirb_acc = pirb.template get<"acceleration">();
pirb_acc = global_force_ + force_p / (pg.template get<"total_mass">().at({}));
- for(saw::data<sch::UInt64> i{0u}; i < sub_steps; ++i){
- verlet_step_lambda<T,Descriptor::D>(pi,one / sss);
+ if(sub_steps.get() > 0u){
+ auto sss_inv = one / sss;
+ for(saw::data<sch::UInt64> i{0u}; i < sub_steps; ++i){
+ verlet_step_lambda<T,Descriptor::D>(pi,sss_inv);
+ }
}
}
};