summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix27
-rw-r--r--examples/poiseulle_particles_2d_ibm_gpu/sim.cpp5
-rw-r--r--lib/core/c++/particle/particle.hpp19
3 files changed, 21 insertions, 30 deletions
diff --git a/default.nix b/default.nix
index 4ae4b71..c4fe8d1 100644
--- a/default.nix
+++ b/default.nix
@@ -40,38 +40,13 @@ let
};
};
- sci_tools = let
- scitoolsSrc = stdenv.mkDerivation {
- name = "scitools-src";
-
- src = builtins.fetchurl {
- url = "https://git.keldu.de/apps-science_tools/snapshot/master.tar.gz";
- sha256 = "e91c18fef798dd7b3afbd1615c2e320b90a74aa2d7ef726801a76e3f7f77ae81";
- };
-
- phases = [ "unpackPhase" "installPhase" ];
-
- unpackPhase = ''
- mkdir source
- tar -xzf "$src" -C source --strip-components=1
- '';
-
- installPhase = ''
- cp -r source $out
- '';
- };
- in
- (import "${scitoolsSrc}/default.nix" {
- inherit stdenv clang-tools forstio;
- });
-
forstio = let
forstioSrc = stdenv.mkDerivation {
name = "forstio-src";
src = builtins.fetchurl {
url = "https://git.keldu.de/forstio-forstio/snapshot/master.tar.gz";
- sha256 = "sha256:17zsz10lj5dgqw3fmassgqlhbwgpd7zznbq8cl0sw1v816w3ca8z";
+ sha256 = "sha256:026scvd9015blphbj49d0cv5wfrxh1szzdv3p212wzk4iw643akj";
};
phases = [ "unpackPhase" "installPhase" ];
diff --git a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
index e68d7da..2e0aee6 100644
--- a/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
+++ b/examples/poiseulle_particles_2d_ibm_gpu/sim.cpp
@@ -292,12 +292,11 @@ saw::error_or<void> step(
index_shift.at({{i}}) = index.at({i}).template cast_to<T>() - com.at({{i}});
}
-
/// TODO 1. Calculate force pickup from neigbouring u_vel cells
- auto inter_vel = n_linear_interpolate(vel,index_shift);
+ // auto inter_vel = n_linear_interpolate(vel,index_shift);
/// TODO 3. Distribute force to fluid
-
+
}, {}, mask.meta());
});
diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp
index 938131b..7249e6a 100644
--- a/lib/core/c++/particle/particle.hpp
+++ b/lib/core/c++/particle/particle.hpp
@@ -71,6 +71,10 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre
auto& mask = part.template get<"mask">();
auto& density = part.template get<"density">().at({{0u}});
+ auto& total_mass = part.template get<"total_mass">();
+ // Paranoia
+ total_mass.at({}) = {};
+
static_assert(D >= 1u and D <= 3u, "Dimensions only supported for Dim 1,2 & 3.");
density = density_p;
@@ -86,6 +90,7 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre
mask = {mask_dims};
auto& com = part.template get<"center_of_mass">();
+ // Paranoia
for(uint64_t i = 0u; i < D; ++i){
com.at({{i}}) = {};
}
@@ -97,12 +102,24 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre
saw::data<sch::Vector<T,D>> center;
for(uint64_t i = 0u; i < D; ++i){
- com.at({{i}}) = ;
+ center.at({{i}}).set(radius);
}
iterator<D>::apply([&](const auto& index){
++ele_ctr;
+ saw::data<sch::Vector<T,D>> offset_index = saw::math::vectorize_data(index).template cast_to<T>() - center;
+
+
+
+ auto& dpi = mask.at(index);
+
+ for(uint64_t i = 0u; i < D; ++i){
+ com.at({{i}}) = com.at({{i}}) + index.at({i}).template cast_to<T>() * dpi.at({});
+ }
+
+ total_mass = total_mass + dpi;
+
},{},mask_dims);
return part;