From 4ec94c97879aafef15f7663135745e4ba61e62cf Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 17 May 2021 00:15:33 +0200 Subject: Extract first public LiterateLB version --- tangle/LLBM/kernel/bouzidi.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tangle/LLBM/kernel/bouzidi.h (limited to 'tangle/LLBM/kernel/bouzidi.h') diff --git a/tangle/LLBM/kernel/bouzidi.h b/tangle/LLBM/kernel/bouzidi.h new file mode 100644 index 0000000..b1abd2c --- /dev/null +++ b/tangle/LLBM/kernel/bouzidi.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include + +template +struct BouzidiConfig { + std::size_t* boundary; // boundary cell to be interpolated + std::size_t* solid; // adjacent solid cell + std::size_t* fluid; // adjacent fluid cell + S* distance; // precomputed distance factor q + S* correction; // correction for moving walls + pop_index_t* missing; // population to be reconstructed +}; + +struct BouzidiO { + +using call_tag = tag::call_by_list_index; + +template +__device__ static void apply( + LatticeView lattice + , std::size_t index + , std::size_t count + , BouzidiConfig config +) { + pop_index_t& iPop = config.missing[index]; + pop_index_t jPop = descriptor::opposite(iPop); + pop_index_t kPop = config.boundary[index] == config.fluid[index] ? iPop : jPop; + + S f_bound_j = *lattice.pop(jPop, config.boundary[index]); + S f_fluid_j = *lattice.pop(kPop, config.fluid[index]); + S* f_next_i = lattice.pop(iPop, config.solid[index]); + + *f_next_i = config.distance[index] * f_bound_j + + (1. - config.distance[index]) * f_fluid_j + + config.correction[index]; +} + +}; -- cgit v1.2.3