summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-07-28 20:28:48 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-07-28 20:28:48 +0200
commit6fa5e2f97c215a0c56679514af74e88f81200d47 (patch)
tree85b9cf33c76abe0605f3a13fed53f5359c1f6a3e /modules
parent38783c5a86033d63fcbd3af57bb037ff665bfa01 (diff)
downloadlibs-lbm-6fa5e2f97c215a0c56679514af74e88f81200d47.tar.gz
Fixing up fplbm
Diffstat (limited to 'modules')
-rw-r--r--modules/core/c++/fplbm.hpp76
1 files changed, 13 insertions, 63 deletions
diff --git a/modules/core/c++/fplbm.hpp b/modules/core/c++/fplbm.hpp
index 34806aa..31b66c4 100644
--- a/modules/core/c++/fplbm.hpp
+++ b/modules/core/c++/fplbm.hpp
@@ -114,8 +114,8 @@ private:
public:
component() = default;
- 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 {
+ template<typename CellFieldSchema, typename MacroFieldSchema, typename ParticleSchema>
+ void apply(const saw::data<CellFieldSchema, Encode>& field, const saw::data<MacroFieldSchema,Encode>& macros, const saw::data<ParticleSchema,Encode>& pg, saw::data<sch::FixedArray<sch::UInt64,1u>> index, saw::data<sch::UInt64> time_step, saw::data<sch::UInt64> sub_steps) const {
// void apply(saw::data<CellFieldSchema, Encode>& field, saw::data<sch::FixedArray<sch::UInt64, Descriptor::D>> index, saw::data<sch::UInt64> time_step){
bool is_even = ((time_step.get() % 2) == 0);
@@ -129,76 +129,26 @@ public:
// Temporary find a better way
auto& force_f = macros.template get<"force">();
-
/**
* The other methods all work with a flipped porosity.
* For compat reasons this is also flipped
*/
- auto porosity = por_f.at(index);
- saw::data<sch::Scalar<T>> one;
- one.at({}) = 1.0;
- auto flip_porosity = one - porosity;
-
- saw::data<sch::Scalar<T>>& rho = rho_f.at(index);
-
- saw::data<sch::Scalar<T>> half;
- half.at({}).set(0.5);
- saw::data<sch::Vector<T,Descriptor::D>>& vel = vel_f.at(index);// + total_force * ( half / rho );
-
- compute_rho_u<T,Descriptor>(dfs_old_f.at(index),rho,vel);
- auto eq = equilibrium<T,Descriptor>(rho,vel);
-
- using dfi = df_info<T,Descriptor>;
-
- saw::data<sch::Scalar<T>> min_two;
- min_two.at({}).set(-2);
-
- // Maybe ?
- auto& force = force_f.at(index);
- force = vel * rho * min_two * flip_porosity;
-
- saw::data<sch::Scalar<T>> dfi_inv_cs2;
- dfi_inv_cs2.at({}).set(dfi::inv_cs2);
-
- // auto vel = vel_f.at(index);
-
- for(uint64_t i = 0u; i < Descriptor::Q; ++i){
- // saw::data<T> ci_min_u{0};
- saw::data<sch::Vector<T,Descriptor::D>> ci;
- for(uint64_t d = 0u; d < Descriptor::D; ++d){
- ci.at({{d}}).set(static_cast<typename saw::native_data_type<T>::type>(dfi::directions[i][d]));
- }
- auto ci_dot_u = saw::math::dot(ci,vel);
-
- // saw::data<sch::Vector<T,Descriptor::D>> F_i;
- // F_i = f * ((c_i - u) * ics2 + <c_i,u> * c_i * ics2 * ics2) * w_i;
- saw::data<sch::Scalar<T>> w;
- w.at({}).set(dfi::weights[i]);
-
- /*
- saw::data<sch::Scalar<T>> F_i_sum;
- for(uint64_t d = 0u; d < Descriptor::D; ++d){
- saw::data<sch::Scalar<T>> F_i_d;
- F_i_d.at({}) = F_i.at({{d}});
- F_i_sum = F_i_sum + F_i_d;
- }
- */
- auto term1 = (ci-vel) * dfi_inv_cs2;
- auto term2 = ci * (ci_dot_u * dfi_inv_cs2 * dfi_inv_cs2);
-
- auto force_projection = saw::math::dot(term1 + term2, force);
+ // TODO - Change to tuple later
+ auto parts = pg.template get<"particles">();
- auto F_i = w * force_projection;
+ auto parts_size = parts.meta.at({0u});
+ auto pi = parts.at(index);
- dfs.at({i}) = dfs.at({i})
- + frequency_
- * (eq.at(i) - dfs.at({i}) )
- + F_i.at({})
- * (saw::data<T>{1} - saw::data<T>{0.5f} * frequency_);
+ auto eo_aabb = particle_aabb<typename ParticleSchema::ValueType>::calculate(pg,{{0u}},vel_f.meta());
+ if(eo_aabb.is_error()){
+ return;
}
- }
+ auto& aabb = eo_aabb.get_value();
+ iterator<Desc::D>::apply([&](const auto& index_f) -> void {
+ }, start, stop);
+ }
};
template<typename T, typename Descriptor, typename Encode>