summaryrefslogtreecommitdiff
path: root/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stokes_drag_particle_2d_psm_gpu/sim.cpp')
-rw-r--r--examples/stokes_drag_particle_2d_psm_gpu/sim.cpp75
1 files changed, 23 insertions, 52 deletions
diff --git a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
index 9781691..9d678a8 100644
--- a/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
+++ b/examples/stokes_drag_particle_2d_psm_gpu/sim.cpp
@@ -134,6 +134,8 @@ saw::error_or<void> setup_initial_conditions(
por_f.at(index).at({}) = {1};
rho.at({}) = {1};
auto& vel = vel_f.at(index);
+ vel.at({{0u}}) = 0.0002f;
+
auto eq = equilibrium<T,Desc>(rho,vel);
df = eq;
@@ -148,9 +150,6 @@ saw::error_or<void> setup_initial_conditions(
auto& rho = rho_f.at(index);
rho.at({}) = {1};
auto& vel = vel_f.at(index);
- if(info_f.at(index).get() == 2u){
- vel.at({{0u}}) = 0.0;
- }
auto eq = equilibrium<T,Desc>(rho,vel);
df = eq;
@@ -160,48 +159,6 @@ saw::error_or<void> setup_initial_conditions(
{{1u,1u}}
);
- saw::data<sch::Scalar<T>> eps;
- eps.at({}).set(1.5f);
- saw::data<sch::Scalar<T>> rad;
- rad.at({}).set(dim_y*0.1);
- 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> opa{p_pos,rad,eps};
- iterator<Desc::D>::apply(
- [&](auto& index){
- opa.apply(macros,index,{});
- },
- {},// 0-index
- df_f.get_dims()
- );
- */
-
- /*
- iterator<Desc::D>::apply(
- [&](auto& index){
- saw::data<sch::Vector<T,Desc::D>> middle, ind_vec;
- 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>();
- ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to<T>();
-
- auto dist = middle - ind_vec;
- auto dist_2 = saw::math::dot(dist,dist);
- if(dist_2.at({}).get() < dim_y*dim_y*0.01){
- porous_f.at(index).at({}) = 0.0;
- }
- },
- {},// 0-index
- df_f.get_dims()
- );
- */
-
return saw::make_void();
}
@@ -233,16 +190,30 @@ saw::error_or<void> step(
}
component<T,Desc,cmpt::OneParticleAt,encode::Sycl<saw::encode::Native>> opa{p_pos,rad,eps};
- component<T,Desc,cmpt::ZouHeHorizontal<true>,encode::Sycl<saw::encode::Native>> flow_in{
- [&](){
- uint64_t target_t_i = 16u;
+ component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{
+ [&]() -> saw::data<sch::Vector<T,Desc::D>>{
+ saw::data<sch::Vector<T,Desc::D>> vel;
+ uint64_t target_t_i = 8u;
+ if(t_i.get() < target_t_i){
+ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
+ }else{
+ vel.at({{0u}}) = 0.0002;
+ }
+ return vel;
+ }()
+ };
+ component<T,Desc,cmpt::ZouHeVelocityX<false>,encode::Sycl<saw::encode::Native>> flow_out{
+ [&]() -> saw::data<sch::Vector<T,Desc::D>>{
+ saw::data<sch::Vector<T,Desc::D>> vel;
+ uint64_t target_t_i = 8u;
if(t_i.get() < target_t_i){
- return 1.0 + (0.00002 / target_t_i) * t_i.get();
+ vel.at({{0u}}) = (0.0002 / target_t_i) * t_i.get();
+ }else{
+ vel.at({{0u}}) = 0.0002;
}
- return 1.00002;
+ return vel;
}()
};
- component<T,Desc,cmpt::ZouHeHorizontal<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0};
component<T,Desc,cmpt::ForceGather, encode::Sycl<saw::encode::Native>> fg;
@@ -389,7 +360,7 @@ saw::error_or<void> lbm_main(int argc, char** argv){
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};
+ saw::data<sch::UInt64> time_steps{32u*4096ul};
auto& info_f = lsd_view.template get<"info">();