diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-05 15:59:23 +0200 |
| commit | c0549d71b2109f10c1238db8b22362e7826ba61b (patch) | |
| tree | 16cd5264fcc3afe912e1b1b67738c8940d6d1177 /modules/core/tests/equilibrium.cpp | |
| parent | 9a3147bc79caf3c0fb1a9cdee29d156b5ff092c7 (diff) | |
| download | libs-lbm-c0549d71b2109f10c1238db8b22362e7826ba61b.tar.gz | |
Just rename from lib to modules
Diffstat (limited to 'modules/core/tests/equilibrium.cpp')
| -rw-r--r-- | modules/core/tests/equilibrium.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/core/tests/equilibrium.cpp b/modules/core/tests/equilibrium.cpp new file mode 100644 index 0000000..20a1f08 --- /dev/null +++ b/modules/core/tests/equilibrium.cpp @@ -0,0 +1,41 @@ +#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::Scalar<lbm::sch::Float64>> rho; + rho.at({}).set(1.0); + saw::data<lbm::sch::Vector<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>>(); +} +} |
