summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-09-22 09:27:15 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-09-22 09:27:15 +0200
commit79196db2ac3d31543056b3b7abe90ad609c51b4f (patch)
treefb8a8bc480d8af824e00ae36cf20dd1ea882f499 /modules
parent54dfad7ac102fe40d71d8818d77801160a7073c1 (diff)
downloadlibs-lbm-79196db2ac3d31543056b3b7abe90ad609c51b4f.tar.gz
Fixing two way coupling
Diffstat (limited to 'modules')
-rw-r--r--modules/core/c++/collision.hpp6
-rw-r--r--modules/core/c++/converter.hpp5
-rw-r--r--modules/core/c++/fplbm.hpp11
-rw-r--r--modules/core/c++/hlbm.hpp5
-rw-r--r--modules/core/c++/psm.hpp5
5 files changed, 29 insertions, 3 deletions
diff --git a/modules/core/c++/collision.hpp b/modules/core/c++/collision.hpp
index 39514b8..ec21b5f 100644
--- a/modules/core/c++/collision.hpp
+++ b/modules/core/c++/collision.hpp
@@ -4,6 +4,7 @@
#include "component.hpp"
#include "equilibrium.hpp"
#include "chunk.hpp"
+#include "lbm_unit.hpp"
namespace kel {
namespace lbm {
@@ -31,6 +32,11 @@ public:
frequency_{saw::data<T>{1} / relaxation_}
{}
+ component(const saw::data<sch::Pure<T>>& relaxation__):
+ relaxation_{relaxation__.handle()},
+ frequency_{saw::data<T>{typename saw::native_data_type<T>::type(1)} / relaxation_}
+ {}
+
using Component = cmpt::BGK;
/**
diff --git a/modules/core/c++/converter.hpp b/modules/core/c++/converter.hpp
index 600db0d..3f0638b 100644
--- a/modules/core/c++/converter.hpp
+++ b/modules/core/c++/converter.hpp
@@ -86,6 +86,11 @@ public:
saw::data<sch::Pure<T>> kinematic_viscosity_si_to_tau(const saw::data<sch::SiKinematicViscosity<T>>& kin_si) const {
return saw::data<sch::Pure<T>>{saw::data<typename saw::unit_division<sch::Pure<T>, sch::LbmKinematicViscosity<T>>::Schema >{df_info<T,Desc>::inv_cs2} * kinematic_viscosity_si_to_lbm(kin_si) + saw::data<sch::Pure<T>>{0.5}};
}
+
+ template<typename Desc>
+ saw::data<sch::Pure<T>> kinematic_viscosity_lbm_to_tau(const saw::data<sch::LbmKinematicViscosity<T>>& kin_lbm) const {
+ return saw::data<sch::Pure<T>>{saw::data<typename saw::unit_division<sch::Pure<T>, sch::LbmKinematicViscosity<T>>::Schema >{df_info<T,Desc>::inv_cs2} * kin_lbm + saw::data<sch::Pure<T>>{0.5}};
+ }
};
}
}
diff --git a/modules/core/c++/fplbm.hpp b/modules/core/c++/fplbm.hpp
index 0ab7903..d0cf023 100644
--- a/modules/core/c++/fplbm.hpp
+++ b/modules/core/c++/fplbm.hpp
@@ -60,6 +60,9 @@ private:
saw::data<T> relaxation_;
saw::data<T> frequency_;
public:
+ using Component = cmpt::FpLbm;
+public:
+
component(typename saw::native_data_type<T>::type relaxation__):
relaxation_{{relaxation__}},
frequency_{saw::data<T>{1} / relaxation_}
@@ -70,8 +73,10 @@ public:
frequency_{saw::data<T>{1} / relaxation_}
{}
- using Component = cmpt::FpLbm;
-
+ component(const saw::data<sch::Pure<T>>& relaxation__):
+ relaxation_{relaxation__.handle()},
+ frequency_{saw::data<T>{typename saw::native_data_type<T>::type(1)} / relaxation_}
+ {}
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,Descriptor::D>> index, saw::data<sch::UInt64> time_step) const {
@@ -359,7 +364,7 @@ public:
}, aabb.template get<"a">(), aabb.template get<"b">());
auto& pirb_acc = pirb.template get<"acceleration">();
- pirb_acc = force_p / (pg.template get<"total_mass">().at({}));
+ pirb_acc = global_force_ + force_p / (pg.template get<"total_mass">().at({}));
for(saw::data<sch::UInt64> i{0u}; i < sub_steps; ++i){
verlet_step_lambda<T,Descriptor::D>(pi,one / sss);
diff --git a/modules/core/c++/hlbm.hpp b/modules/core/c++/hlbm.hpp
index 0df5896..fc61f6a 100644
--- a/modules/core/c++/hlbm.hpp
+++ b/modules/core/c++/hlbm.hpp
@@ -59,6 +59,11 @@ public:
frequency_{typename saw::native_data_type<T>::type(1) / relaxation_}
{}
+ component(const saw::data<sch::Pure<T>>& relaxation__):
+ relaxation_{relaxation__.handle().get()},
+ frequency_{typename saw::native_data_type<T>::type(1) / relaxation_}
+ {}
+
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 {
diff --git a/modules/core/c++/psm.hpp b/modules/core/c++/psm.hpp
index f5a8452..40323b3 100644
--- a/modules/core/c++/psm.hpp
+++ b/modules/core/c++/psm.hpp
@@ -48,6 +48,11 @@ public:
frequency_ = one / relaxation_;
}
+ component(const saw::data<sch::Pure<T>>& relaxation__):
+ relaxation_{relaxation__.handle()},
+ frequency_{saw::data<T>{typename saw::native_data_type<T>::type(1)} / relaxation_}
+ {}
+
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,Descriptor::D>> index, saw::data<sch::UInt64> time_step) const {