summaryrefslogtreecommitdiff
path: root/examples/stokes_drag_particle_2d_hlbm_gpu
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stokes_drag_particle_2d_hlbm_gpu')
-rw-r--r--examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp60
1 files changed, 26 insertions, 34 deletions
diff --git a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
index a8ba21f..18b5258 100644
--- a/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_hlbm_gpu/sim.cpp
@@ -13,7 +13,7 @@ namespace lbm {
constexpr uint64_t dim_y = 1024ul;
constexpr uint64_t dim_x = dim_y * 2ul;
-constexpr uint64_t particle_amount = 1ul;
+// constexpr uint64_t particle_amount = 1ul;
namespace sch {
using namespace saw::schema;
@@ -48,6 +48,7 @@ template<typename T, typename Desc>
using MacroStruct = Struct<
Member<VelChunk<T,Desc>, "velocity">,
Member<RhoChunk<T>, "density">,
+ Member<VelChunk<T,Desc>, "force">,
Member<ScalarChunk<T,Desc>, "porosity">
>;
@@ -99,7 +100,6 @@ saw::error_or<void> setup_initial_conditions(
{{dim_x-1u,0u}},
{{dim_x, dim_y}}
);
- // Overwrite with
// Inflow
iterator<Desc::D>::apply(
[&](auto& index){
@@ -157,11 +157,12 @@ saw::error_or<void> setup_initial_conditions(
df_f.get_dims(),
{{1u,1u}}
);
-
+
+ /*
iterator<Desc::D>::apply(
[&](auto& index){
saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
- middle.at({{0u}}) = dim_x * 0.5;
+ middle.at({{0u}}) = dim_x * 0.25;
middle.at({{1u}}) = dim_y * 0.5;
ind_vec.at({{0u}}) = index.at({{0u}}).template cast_to<T>();
@@ -176,6 +177,7 @@ saw::error_or<void> setup_initial_conditions(
{},// 0-index
df_f.get_dims()
);
+ */
return saw::make_void();
}
@@ -191,17 +193,25 @@ saw::error_or<void> step(
auto& info_f = fields.template get<"info">();
auto& porous_f = macros.template get<"porosity">();
+ // auto coll_ev =
q.submit([&](acpp::sycl::handler& h){
+ component<T,Desc,cmpt::BGK, encode::Sycl<saw::encode::Native>> bgk{0.8};
component<T,Desc,cmpt::Hlbm,encode::Sycl<saw::encode::Native>> collision{0.8};
component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb;
component<T,Desc,cmpt::AntiBounceBack<0u>,encode::Sycl<saw::encode::Native>> abb;
- saw::data<sch::Scalar<T>> rho_b;
- rho_b.at({}) = 1.0;
- saw::data<sch::Vector<T,Desc::D>> vel_b;
- vel_b.at({{0u}}) = 0.015;
-
- component<T,Desc,cmpt::Equilibrium,encode::Sycl<saw::encode::Native>> equi{rho_b,vel_b};
+ saw::data<sch::Scalar<T>> eps;
+ eps.at({}).set(1.5f);
+ saw::data<sch::Scalar<T>> rad;
+ rad.at({}).set(dim_y*0.1/4.0);
+ saw::data<sch::Vector<T,Desc::D>> p_pos;
+ {
+ p_pos.at({{0u}}) = dim_x * 0.5;
+ p_pos.at({{1u}}) = dim_y * 0.5;
+ }
+ component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
+
+ component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
[&](){
@@ -230,22 +240,22 @@ saw::error_or<void> step(
abb.apply(fields,index,t_i);
break;
case 2u:
+ opa.apply(macros,index,t_i);
collision.apply(fields,macros,index,t_i);
+ fg.apply(fields,macros,index,t_i);
break;
case 3u:
flow_in.apply(fields,index,t_i);
- //equi.apply(fields,index,t_i);
- collision.apply(fields,macros,index,t_i);
+ // equi.apply(fields,index,t_i);
+ bgk.apply(fields,macros,index,t_i);
break;
case 4u:
flow_out.apply(fields,index,t_i);
// equi.apply(fields,index,t_i);
- collision.apply(fields,macros,index,t_i);
- break;
+ bgk.apply(fields,macros,index,t_i);
+ break;
case 5u:
- // Corners
bb.apply(fields,index,t_i);
- break;
default:
break;
}
@@ -355,9 +365,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
sycl_q.wait();
auto lsd_view = make_view(lbm_sycl_data);
auto lsdm_view = make_view(lbm_sycl_macro_data);
-
saw::data<sch::UInt64> time_steps{16u*4096ul};
-
auto& info_f = lsd_view.template get<"info">();
for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){
@@ -369,22 +377,6 @@ saw::error_or<void> lbm_main(int argc, char** argv){
}
}
sycl_q.wait();
- /*
- if(i.get() % 32u == 0u){
- {
- auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr);
- if(eov.is_error()){
- return eov;
- }
- }
- {
- auto eov = write_vtk_file(out_dir,"m",i.get(), *lbm_macro_data_ptr);
- if(eov.is_error()){
- return eov;
- }
- }
- }
- */
if(i.get() % 32u == 0u){
{
auto eov = dev.copy_to_host(lbm_sycl_macro_data,*lbm_macro_data_ptr);