summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-07-06 16:28:14 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-07-06 16:28:14 +0200
commit320e35c072f5f41f9c76c57f72d12e75cc229ae7 (patch)
tree96a257ccd844e69a083215586fdab80688aef021 /modules/core
parentaf4b3f8f9bf7b19c169d9fbd0a2b49668af8ad10 (diff)
parentec19b2e871133bc8c2f2c75d09000c4865acfde2 (diff)
downloadlibs-lbm-320e35c072f5f41f9c76c57f72d12e75cc229ae7.tar.gz
Merge branch 'dev'
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/c++/hlbm.hpp16
-rw-r--r--modules/core/tests/particles.cpp14
2 files changed, 22 insertions, 8 deletions
diff --git a/modules/core/c++/hlbm.hpp b/modules/core/c++/hlbm.hpp
index 346ec04..d57a2e7 100644
--- a/modules/core/c++/hlbm.hpp
+++ b/modules/core/c++/hlbm.hpp
@@ -14,7 +14,6 @@ namespace cmpt {
struct HlbmInit {};
struct Hlbm {};
struct HlbmParticle {};
-
struct HlbmOneParticleMomentumExchange {};
}
@@ -96,7 +95,6 @@ public:
dfs_old_f.at(index).at({i}) = dfs_old_f.at(index).at({i}) + frequency_ * (eq.at(i) - dfs_old_f.at(index).at({i}));
}
- porosity.at({}) = 1.0;
D.at({}) = 0.0;
N = {};
}
@@ -155,25 +153,33 @@ public:
template<typename T, typename Desc, typename Encode>
class component<T, Desc, cmpt::HlbmOneParticleMomentumExchange, Encode> final {
public:
- template<typename CellFieldSchema, typename MacroFieldSchema, typename ParticleSchema>
+ template<typename CellFieldSchema, typename MacroFieldSchema>
void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<MacroFieldSchema,Encode>& macros, saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index, saw::data<sch::UInt64> time_step) const {
//
using dfi = df_info<T,Desc>;
bool is_even = ((time_step.get() % 2) == 0);
auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">();
+ auto& dfs = dfs_old_f.at(index);
saw::data<sch::Vector<T,Desc::D>> momentum;
for(uint64_t i = 0u; i < Desc::Q; ++i){
- saw::data<sch::Vector<sch::Int32,Desc::D>> e_i;
+ saw::data<sch::Vector<T,Desc::D>> e_i;
+ saw::data<sch::FixedArray<sch::UInt64,Desc::D>> n_ind_i;
for(uint64_t k{0u}; k < Desc::D; ++k){
e_i.at({{k}}) = dfi::directions[i][k];
+ n_ind_i.at({k}) = (dfi::directions[i])[k];
}
uint64_t i_opp = dfi::opposite_index[i];
- momentum = momentum + e_i * (dfs_old_f.at({{i}}) + dfs_old_f.at({{i_opp}}));
+ saw::data<T> dfs_added = dfs.at({i}) + dfs_old_f.at(n_ind_i).at({i_opp});
+ saw::data<sch::Scalar<T>> dfs_added_v;
+ dfs_added_v.at({}) = dfs_added;
+ auto ei_dfs = e_i * dfs_added_v;
+
+ momentum = momentum + ei_dfs;
}
auto& force_f = macros.template get<"force">();
diff --git a/modules/core/tests/particles.cpp b/modules/core/tests/particles.cpp
index f474e3b..8c21608 100644
--- a/modules/core/tests/particles.cpp
+++ b/modules/core/tests/particles.cpp
@@ -276,10 +276,18 @@ SAW_TEST("Verlet integration test 2D"){
SAW_TEST("Spheroid Particle / AABB"){
using namespace kel;
- auto spheroid_pgrp = lbm::create_spheroid_particle_group<sch::Float64, lbm::coll::Spheroid<sch::Float64>>({},{},{8u});
+ using T = sch::Float64;
+ constexpr uint64_t D = 2u;
- auto res = lbm::particle_aabb<sch::Float64,sch::ParticleGroup<T,D,coll::Spheroid<T>>>::calculate(spheroid_pgrp);
+ saw::data<sch::Scalar<T>> radi,dense;
+ radi.at({}) = 2.0f;
+ dense.at({}) = 1.0f;
+ auto spheroid_pgrp = lbm::create_spheroid_particle_group<T,D>(radi,dense,{8u});
- std::cout<<res<<std::endl;
+ // auto res = lbm::particle_aabb<sch::ParticleGroup<T,D,lbm::coll::Spheroid<T>>>::calculate(spheroid_pgrp,{{0u}},{});
+
+
+
+ // std::cout<<res<<std::endl;
}
}