diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-10-18 18:01:14 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-10-18 18:01:14 +0200 |
| commit | 24bf28a8fb9cc8c3a90b77de9b60728bece7885d (patch) | |
| tree | dfcbfcb8775bf96847d4a187695158b968902889 /lib/tests/equilibrium.cpp | |
| parent | a980da34513a9ad41e309e66432fcb80ddaf2e31 (diff) | |
| download | libs-lbm-24bf28a8fb9cc8c3a90b77de9b60728bece7885d.tar.gz | |
Moving project structure for more less compilation
Diffstat (limited to 'lib/tests/equilibrium.cpp')
| -rw-r--r-- | lib/tests/equilibrium.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/tests/equilibrium.cpp b/lib/tests/equilibrium.cpp new file mode 100644 index 0000000..9201e55 --- /dev/null +++ b/lib/tests/equilibrium.cpp @@ -0,0 +1,40 @@ +#include <forstio/test/suite.hpp> + +#include "../c++/equilibrium.hpp" + + +namespace { + +template<typename Descriptor> +void check_equilibrium(){ + using namespace kel; + + using dfi = lbm::df_info<lbm::sch::Float64,Descriptor>; + + saw::data<lbm::sch::Float64> rho{1.0}; + saw::data<lbm::sch::FixedArray<lbm::sch::Float64,Descriptor::D>> vel; + for(saw::data<lbm::sch::UInt64> i{0u}; i.get() < 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.get() < Descriptor::Q; ++i){ + SAW_EXPECT(eq.at(i).get() == dfi::weights[i.get()], std::string{"No velocity and normalized rho should be exactly the weights: "} + std::to_string(eq.at(i).get()) + std::string{" "} + std::to_string(dfi::weights[i.get()])); + } +} + +SAW_TEST("Equilibrium at rest D1Q3"){ + using namespace kel; + check_equilibrium<lbm::sch::Descriptor<1,3>>(); +} + +SAW_TEST("Equilibrium at rest D2Q5"){ + using namespace kel; + check_equilibrium<lbm::sch::Descriptor<2,5>>(); +} + +SAW_TEST("Equilibrium at rest D2Q9"){ + using namespace kel; + check_equilibrium<lbm::sch::Descriptor<2,9>>(); +} +} |
