diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-09 11:21:55 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-02-09 11:21:55 +0100 |
| commit | 6b10cae1ffa2521ce3c7e6aec85513a24d25934b (patch) | |
| tree | 97f9b3662df3d689da2a21d68723a60cceeb6b54 /lib/core/c++ | |
| parent | 22659a4a4af8be137bcd702b89f1f44cd0fe2455 (diff) | |
| download | libs-lbm-6b10cae1ffa2521ce3c7e6aec85513a24d25934b.tar.gz | |
Set equilibrium boundary for sim
Diffstat (limited to 'lib/core/c++')
| -rw-r--r-- | lib/core/c++/boundary.hpp | 18 | ||||
| -rw-r--r-- | lib/core/c++/collision.hpp | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp index b70ffbf..d5f3022 100644 --- a/lib/core/c++/boundary.hpp +++ b/lib/core/c++/boundary.hpp @@ -69,22 +69,28 @@ public: template<typename FP, typename Descriptor, typename Encode> class component<FP, Descriptor, cmpt::Equilibrium, Encode> final { private: - saw::data<FP> density_; - saw::data<FP> velocity_; + saw::data<sch::Scalar<FP>> density_; + saw::data<sch::Vector<FP,Descriptor::D>> velocity_; public: component( - saw::data<FP> density__, - saw::Data<FP> velocity__ + saw::data<sch::Scalar<FP>> density__, + saw::data<sch::Vector<FP,Descriptor::D>> velocity__ ): density_{density__}, velocity_{velocity__} {} template<typename CellFieldSchema> - void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>>& index, saw::data<sch::UInt64> time_step)const{ - using dfi = df_info<T,Descriptor>; + void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>>& index, saw::data<sch::UInt64> time_step) const { + + bool is_even = ((time_step.get() % 2u) == 0u); + using dfi = df_info<FP,Descriptor>; auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); + + auto eq = equilibrium<FP,Descriptor>(density_,velocity_); + + dfs_old_f.at(index) = eq; } }; diff --git a/lib/core/c++/collision.hpp b/lib/core/c++/collision.hpp index a05e263..6c39646 100644 --- a/lib/core/c++/collision.hpp +++ b/lib/core/c++/collision.hpp @@ -52,8 +52,8 @@ public: // auto& dfs_f = (is_even) ? field.template get<"dfs">() : field.template get<"dfs_old">(); auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - saw::data<T> rho; - saw::data<sch::FixedArray<T,Descriptor::D>> vel; + saw::data<sch::Scalar<T>> rho; + saw::data<sch::Vector<T,Descriptor::D>> vel; compute_rho_u<T,Descriptor>(dfs_old_f.at(index),rho,vel); auto eq = equilibrium<T,Descriptor>(rho,vel); |
