diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/cavity_2d.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 654a9ac..5683d85 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -2,6 +2,7 @@ #include "../c++/macroscopic.hpp" #include "../c++/lbm.hpp" #include "../c++/component.hpp" +#include "../c++/collision.hpp" /** */ @@ -106,8 +107,6 @@ public: namespace cmpt { struct BounceBack{}; struct MovingWall {}; -struct BGK {}; -struct ConstRhoBGK {}; } @@ -155,23 +154,6 @@ public: */ } }; - -template<typename Desc> -class component<sch::T, Desc, cmpt::BGK> { -public: - typename saw::native_data_type<sch::T>::type relaxation_; -public: - void apply(saw::data<sch::DfCell<Desc>>& dfs){ - typename saw::native_data_type<sch::T>::type rho; - std::array<typename saw::native_data_type<sch::T>::type, Desc::D> vel; - compute_rho_u<sch::T,Desc>(dfs,rho,vel); - auto eq = equilibrium<Desc>(rho,vel); - - for(uint64_t i = 0u; i < Desc::Q; ++i){ - dfs({i}).set(dfs({i}).get() + (1.0 / relaxation_) * (eq[i] - dfs({i}).get())); - } - } -}; } } @@ -260,8 +242,10 @@ void lbm_step( using namespace kel::lbm; using dfi = df_info<sch::T,sch::D2Q9>; - component<sch::T, sch::D2Q9, cmpt::BGK> coll; - coll.relaxation_ = 0.5384; + /** + * Relaxation parameter \tau + */ + component<sch::T, sch::D2Q9, cmpt::BGK> coll{0.5384}; component<sch::T, sch::D2Q9, cmpt::BounceBack> bb; component<sch::T, sch::D2Q9, cmpt::MovingWall> bb_lid; |