From 08f2d21521c107fef57abf20d81707020aa3bd47 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 16 Sep 2025 19:36:41 +0200 Subject: Dangling afternoon changes --- c++/hlbm.hpp | 24 ++++++++++++++++++++++++ examples/poiseulle_particles_channel_2d.cpp | 19 +++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 c++/hlbm.hpp diff --git a/c++/hlbm.hpp b/c++/hlbm.hpp new file mode 100644 index 0000000..1c665ce --- /dev/null +++ b/c++/hlbm.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "macroscopic.hpp" +#include "component.hpp" +#include "equilibrium.hpp" + +namespace kel { +namespace lbm { +namespace cmpt { +struct HLBM {}; +} + +/** + * HLBM collision operator for LBM + */ +template +class component { +private: +public: + component() = default; +}; + +} +} diff --git a/examples/poiseulle_particles_channel_2d.cpp b/examples/poiseulle_particles_channel_2d.cpp index 737488b..9f7475d 100644 --- a/examples/poiseulle_particles_channel_2d.cpp +++ b/examples/poiseulle_particles_channel_2d.cpp @@ -245,7 +245,7 @@ void add_particles(kel::lbm::particle_system& part_sys){ for(uint64_t j = 0; j < 1; ++j){ pos.at({{0u}}) = {static_cast::type>(32u + j * 8u)}; pos.at({{1u}}) = {static_cast::type>(64u + i * 8u)}; - old_pos.at({{1u}}) = pos.at({{0u}}); + old_pos = pos; auto eov = part_sys.add_particle(part); if(eov.is_error()){ @@ -372,9 +372,16 @@ void couple_particles_to_lattice( if(n_info.get() <= 1u or (n_macro_cell_particle.get() != i.get() and n_macro_cell_particle.get() > 0u) ) { // add to p_acc - // TODO add if particle is close - p_acc.at({{0u}}) = p_acc.at({{0u}}) + saw::data{2 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to(); - p_acc.at({{1u}}) = p_acc.at({{1u}}) + saw::data{2 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to(); + saw::data dist_dot{ + (p_pos.at({{0u}})-n_p_cell_pos.at({{0u}}).template cast_to()) * dfi::directions[dfi::opposite_index[k.get()]][0u]+ + (p_pos.at({{1u}})-n_p_cell_pos.at({{1u}}).template cast_to()) * dfi::directions[dfi::opposite_index[k.get()]][1u] + }; + + if(dist_dot.get() > 0){ + // TODO add if particle is close + p_acc.at({{0u}}) = p_acc.at({{0u}}) + saw::data{100 * dfi::directions[dfi::opposite_index[k.get()]][0u]}.template cast_to(); + p_acc.at({{1u}}) = p_acc.at({{1u}}) + saw::data{100 * dfi::directions[dfi::opposite_index[k.get()]][1u]}.template cast_to(); + } } } /// 2. Add force pushing away from wall @@ -402,7 +409,7 @@ void lbm_step( /** * 1. Relaxation parameter \tau */ - component coll{0.5384}; + component coll{0.59}; component bb; component> inlet{1.1 * dfi::cs2 * 2.0 / 3.0}; component> outlet{1.0 * dfi::cs2 * 2.0 / 3.0}; @@ -537,7 +544,7 @@ int main(int argc, char** argv){ saw::data,sch::D2Q9::D>> macros{dim}; - uint64_t lbm_steps = 4096u * 4u; + uint64_t lbm_steps = 10000u; for(uint64_t i = 0u; i < lbm_steps; ++i){ print_progress_bar(i,lbm_steps-1u); bool even_step = ((i % 2u) == 0u); -- cgit v1.2.3