diff options
Diffstat (limited to 'examples/particle_ibm.cpp')
-rw-r--r-- | examples/particle_ibm.cpp | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/examples/particle_ibm.cpp b/examples/particle_ibm.cpp index 0ce034e..d54dbdc 100644 --- a/examples/particle_ibm.cpp +++ b/examples/particle_ibm.cpp @@ -49,100 +49,6 @@ using MacroStruct = Struct< using CavityFieldD2Q9 = CellField<D2Q9, CellStruct<D2Q9>>; } -namespace cmpt { -struct BounceBack{}; -struct MovingWall {}; -struct BGK {}; -struct ConstRhoBGK {}; -} - -/** - * A reason for why a component based design is really good can be seen in my LR solver example - * - * Add Expression Templates and you're golden. - */ -template<typename Kind, typename Desc> -class component; - -/** - * Full-Way BounceBack. I suspect that the moving wall requires half-way bounce back. - */ -template<typename Desc> -class component<cmpt::BounceBack,Desc> { -public: - - void apply(saw::data<sch::DfCell<Desc>>& dfs){ - using dfi = df_info<sch::T,Desc>; - - // Technically use .copy() - auto df_cpy = dfs; - - for(uint64_t i = 1u; i < Desc::Q; ++i){ - dfs({i}) = df_cpy({dfi::opposite_index.at(i)}); - } - } -}; - -/** - * Full-Way moving wall Bounce back, something is not right here. - * Technically it should reflect properly. - */ -template<typename Desc> -class component<cmpt::MovingWall, Desc> { -public: - std::array<typename saw::native_data_type<sch::T>::type, Desc::D> lid_vel; - -public: - void apply( - saw::data<sch::DfCell<Desc>>& dfs - ){ - using dfi = df_info<sch::T,Desc>; - - // Technically use .copy() - /* - auto dfs_cpy = dfs; - - for(uint64_t i = 0u; i < Desc::Q; ++i){ - dfs({dfi::opposite_index.at(i)}) = dfs_cpy({i}) - 2.0 * dfi::weights[i] * 1.0 * ( lid_vel[0] * dfi::directions[i][0] + lid_vel[1] * dfi::directions[i][1]) * dfi::inv_cs2; - } - */ - } -}; - -template<typename Desc> -class component<cmpt::BGK, Desc> { -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())); - } - } -}; - -template<typename Desc> -class component<cmpt::ConstRhoBGK, Desc> { -public: - typename saw::native_data_type<sch::T>::type relaxation_; - typename saw::native_data_type<sch::T>::type rho_; -public: - void apply(saw::data<sch::DfCell<Desc>>& dfs){ - std::array<typename saw::native_data_type<sch::T>::type, Desc::D> vel; - compute_const_rho_u<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())); - } - } -}; - } } |