summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-08-24 19:47:22 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-08-24 19:47:22 +0200
commitdf4fbe3f6776ba25d7267fdb50ce48eca26b9fba (patch)
treeed211c81d68102c8035e61d6110aba242017b486 /examples
parent4f8ba172c7c6cbe278cbf20927df543cd6c58c28 (diff)
parent692b413fec56fbb5c6198813df369106721c33f5 (diff)
downloadlibs-lbm-df4fbe3f6776ba25d7267fdb50ce48eca26b9fba.tar.gz
Merge branch 'dev'
Diffstat (limited to 'examples')
-rw-r--r--examples/one_particle_sedimentation_2d/common.hpp14
-rw-r--r--examples/one_particle_sedimentation_2d/init.hpp4
-rw-r--r--examples/one_particle_sedimentation_2d/sim.cpp2
-rw-r--r--examples/one_particle_sedimentation_2d/step.hpp1
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/sim.cpp15
-rw-r--r--examples/schaefer_turek_durst_krause_rannbacher/step.hpp24
6 files changed, 38 insertions, 22 deletions
diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp
index 37e0402..954557d 100644
--- a/examples/one_particle_sedimentation_2d/common.hpp
+++ b/examples/one_particle_sedimentation_2d/common.hpp
@@ -14,15 +14,17 @@ namespace kel {
namespace lbm {
/**
- * length 2.2m
- * height 0.41m
+ * length 20mm
+ * height 80mm
* viscosity 10^-3
- * particle diameter 0.1m
- * position at (0.16m,0.2m)
+ * particle radius 1.25mm
+ * position at (10mm,40mm)
+ * particle density 0.00125g/mm³
+ * fluid density 0.001g/mm³
*/
-constexpr uint64_t dim_y = 512ul;
-constexpr uint64_t dim_x = 256ul;
+constexpr uint64_t dim_y = 800ul;
+constexpr uint64_t dim_x = 200ul;
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 a35c6e8..d9b8a37 100644
--- a/examples/one_particle_sedimentation_2d/init.hpp
+++ b/examples/one_particle_sedimentation_2d/init.hpp
@@ -87,8 +87,8 @@ saw::error_or<void> 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.16}}).handle();
- p_pos.at({{1u}}) = conv.meter_si_to_lbm({{0.2}}).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 7c9a56c..b0b374c 100644
--- a/examples/one_particle_sedimentation_2d/sim.cpp
+++ b/examples/one_particle_sedimentation_2d/sim.cpp
@@ -46,7 +46,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
converter<T> conv {
// delta_x
- {{0.41 / dim_y}},
+ {{0.02 / dim_x}},
// delta_t
{{1.067e-4}}
};
diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp
index 07f51d1..20b7f4b 100644
--- a/examples/one_particle_sedimentation_2d/step.hpp
+++ b/examples/one_particle_sedimentation_2d/step.hpp
@@ -30,7 +30,6 @@ saw::error_or<void> step(
for(uint64_t i = 0u; i < Desc::D; ++i){
index.at({{i}}).set(idx[i]);
}
-
hlbm_reset.apply(fields,macros,index,t_i);
});
}).wait();
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
index b9b3778..59f61d9 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/sim.cpp
@@ -48,7 +48,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
// delta_x
{{0.41 / dim_y}},
// delta_t
- {{1.067e-4}}
+ {{1.067e-4 * 0.5}}
};
print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.5 * dim_y});
@@ -122,7 +122,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
auto lsdm_view = make_view(lbm_sycl_macro_data);
auto lsdp_view = make_view(lbm_sycl_particle_data);
- saw::data<sch::UInt64> time_steps{64u*1024ul};
+ saw::data<sch::UInt64> time_steps{128u*1024ul};
auto& info_f = lsd_view.template get<"info">();
@@ -136,6 +136,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
sycl_q.wait();
+ /*
if(i.get() % 64u == 0u){
{
auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr);
@@ -144,12 +145,13 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
}
}
{
- auto eov = write_csv_file(out_dir,"stdkr_2d",i.get(), *lbm_macro_data_ptr);
+ auto eov = write_vtk_file(out_dir,std::string{"stdkr_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;
@@ -189,7 +191,12 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){
return eov;
}
}
-
+ {
+ auto eov = write_csv_file(out_dir,"stdkr_2d",time_steps.get(), *lbm_macro_data_ptr);
+ if(eov.is_error()){
+ return eov;
+ }
+ }
sycl_q.wait();
return saw::make_void();
}
diff --git a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
index cbdfd10..beb123b 100644
--- a/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
+++ b/examples/schaefer_turek_durst_krause_rannbacher/step.hpp
@@ -19,8 +19,6 @@ saw::error_or<void> step(
auto& q = dev.get_handle();
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
-
-
if constexpr ( std::is_same_v<Coll, method::Hlbm> ){
q.submit([&](acpp::sycl::handler& h){
@@ -48,7 +46,7 @@ saw::error_or<void> step(
}).wait();
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{1.0};
+ component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.75};
component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
@@ -74,9 +72,19 @@ saw::error_or<void> step(
component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
[&]() -> saw::data<sch::Vector<T,Desc::D>> {
saw::data<sch::Vector<T,Desc::D>> vel;
+ saw::data<T> scale;
+ {
+ scale.set([&](){
+ if(t_i.get() > 1024u){
+ return 1.0f;
+ }
+
+ return t_i.get() / 1024.0f;
+ }());
+ }
{
auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle();
- vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle();
+ vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle() * scale;
vel.at({{1u}}) = 0.0f;
}
return vel;
@@ -123,8 +131,8 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
- component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.75};
+ component<T,Desc,cmpt::FpLbm,encode::Sycl<saw::encode::Native>> collision{0.75};
component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
@@ -199,8 +207,8 @@ saw::error_or<void> step(
// auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
- component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{1.0};
- component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{1.0};
+ component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> bgk{0.75};
+ component<T,Desc,cmpt::Psm,encode::Sycl<saw::encode::Native>> collision{0.75};
component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};