summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix5
-rw-r--r--examples/poiseulle_moving_particle_2d_psm_gpu/SConscript2
-rw-r--r--examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp2
-rw-r--r--lib/core/c++/particle/particle.hpp1
-rw-r--r--lib/core/c++/particle/particle_opa.hpp20
5 files changed, 26 insertions, 4 deletions
diff --git a/default.nix b/default.nix
index 29f4ba4..dc75b57 100644
--- a/default.nix
+++ b/default.nix
@@ -151,6 +151,11 @@ in rec {
inherit pname version stdenv forstio adaptive-cpp;
inherit kel;
};
+
+ poiseulle_moving_particle_2d_psm_gpu = pkgs.callPackage ./examples/poiseulle_moving_particle_2d_psm_gpu/.nix/derivation.nix {
+ inherit pname version stdenv forstio adaptive-cpp;
+ inherit kel;
+ };
poiseulle_particles_2d_gpu = pkgs.callPackage ./examples/poiseulle_particles_2d_gpu/.nix/derivation.nix {
inherit pname version stdenv forstio adaptive-cpp;
diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript
index eb856b6..b062091 100644
--- a/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript
+++ b/examples/poiseulle_moving_particle_2d_psm_gpu/SConscript
@@ -23,7 +23,7 @@ env.headers += examples_env.headers;
# Cavity2D
examples_objects = [];
examples_env.add_source_files(examples_objects, ['sim.cpp'], shared=False);
-examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/poiseulle_particles_2d_psm_gpu', [examples_objects]);
+examples_env.poiseulle_2d_gpu = examples_env.Program('#bin/poiseulle_moving_particle_2d_psm_gpu', [examples_objects]);
# Set Alias
env.examples = [
diff --git a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
index 3001ba9..0c10d38 100644
--- a/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
+++ b/examples/poiseulle_moving_particle_2d_psm_gpu/sim.cpp
@@ -199,7 +199,7 @@ saw::error_or<void> step(
component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{1.0};
component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
- component<T,Desc,cmpt::OneParticleAt, encode::Sycl<saw::encode::Native>> opa;
+ component<T,Desc,cmpt::OneParticleAt, encode::Sycl<saw::encode::Native>> opa{{},{}};
h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){
saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index;
diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp
index 13ed37b..8e75e5a 100644
--- a/lib/core/c++/particle/particle.hpp
+++ b/lib/core/c++/particle/particle.hpp
@@ -8,6 +8,7 @@
#include "schema.hpp"
#include "aabb.hpp"
+#include "particle_opa.hpp"
namespace kel {
namespace lbm {
diff --git a/lib/core/c++/particle/particle_opa.hpp b/lib/core/c++/particle/particle_opa.hpp
index 470c4e9..4588a55 100644
--- a/lib/core/c++/particle/particle_opa.hpp
+++ b/lib/core/c++/particle/particle_opa.hpp
@@ -1,6 +1,7 @@
#pragma once
-#include "component.hpp"
+#include "common.hpp"
+#include "../component.hpp"
namespace kel {
namespace lbm {
@@ -12,8 +13,19 @@ template<typename T, typename Descriptor, typename Encode>
class component<T,Descriptor,cmpt::OneParticleAt, Encode> final {
private:
+ saw::data<sch::Vector<T,Descriptor::D>> pos_;
+ saw::data<sch::Scalar<T>> rad_;
+ saw::data<sch::Scalar<T>> eps_;
public:
- component() = default;
+ component(
+ const saw::data<sch::Vector<T,Descriptor::D>> pos__,
+ const saw::data<sch::Scalar<T>> rad__,
+ const saw::data<sch::Scalar<T>> eps__
+ ):
+ pos_{pos__},
+ rad_{rad__},
+ eps_{eps__}
+ {}
template<typename MacroFieldSchema>
void apply(const saw::data<MacroFieldSchema, Encode>& macros, const saw::data<sch::FixedArray<sch::UInt64,Descriptor::D>> index, saw::data<sch::UInt64> time_step) const {
@@ -24,6 +36,10 @@ public:
auto& porous = porous_f.at(index);
+ auto pos_ind = saw::math::vectorize_data(index);
+
+ auto diff = pos_ind - pos_;
+ auto diff_dot = saw::math::dot(diff,diff);
}
};
}