diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-06 16:28:14 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-06 16:28:14 +0200 |
| commit | 320e35c072f5f41f9c76c57f72d12e75cc229ae7 (patch) | |
| tree | 96a257ccd844e69a083215586fdab80688aef021 /modules/core/c++ | |
| parent | af4b3f8f9bf7b19c169d9fbd0a2b49668af8ad10 (diff) | |
| parent | ec19b2e871133bc8c2f2c75d09000c4865acfde2 (diff) | |
| download | libs-lbm-320e35c072f5f41f9c76c57f72d12e75cc229ae7.tar.gz | |
Merge branch 'dev'
Diffstat (limited to 'modules/core/c++')
| -rw-r--r-- | modules/core/c++/hlbm.hpp | 16 |
1 files changed, 11 insertions, 5 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">(); |
