diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-10 15:21:55 +0200 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-04-10 15:21:55 +0200 |
commit | abeea9920c11231ed24db00e9f68b4490c12a61b (patch) | |
tree | 8cbcc1053a0b69c12c59e8dfdbe576d13520240d /tests/equilibrium.cpp | |
parent | 4ffcce338176350465dbd4245ad443b766d196f0 (diff) |
Reworking from AoS to SoA for data handling
Diffstat (limited to 'tests/equilibrium.cpp')
-rw-r--r-- | tests/equilibrium.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/equilibrium.cpp b/tests/equilibrium.cpp new file mode 100644 index 0000000..88542d2 --- /dev/null +++ b/tests/equilibrium.cpp @@ -0,0 +1,30 @@ +#include <forstio/test/suite.hpp> + +#include "../c++/equilibrium.hpp" + + +namespace { + +template<typename Descriptor> +void check_equilibrium(){ + using namespace kel; + + using dfi = df_info<lbm::sch::Float64,Descriptor>; + + saw::data<lbm::sch::Float64> rho{1.0}; + saw::data<lbm::sch::FixedArray<lbm::sch::Float64,>> vel; + for(saw::data<lbm::sch::UInt64> i{0u}; i < {Descriptor::D}; ++i){ + vel.at(i) = {0.0}; + } + auto eq = lbm::equilibrium<lbm::sch::Float64,Descriptor>(rho,vel); + + for(saw::data<lbm::sch::UInt64> i{0u}; i < {Descriptor::Q}; ++i){ + SAW_CHECK(eq(i) == dfi::weights[i.get()], "No velocity and normalized rho should be exactly the weights"); + } +} + +SAW_TEST("Equilibrium At rest D1Q3"){ + using namespace kel; + check_equilibrium<lbm::sch::Descriptor<1,3>>(); +} +} |