diff options
Diffstat (limited to 'examples/one_particle_sedimentation_2d')
| -rw-r--r-- | examples/one_particle_sedimentation_2d/common.hpp | 2 | ||||
| -rw-r--r-- | examples/one_particle_sedimentation_2d/init.hpp | 10 | ||||
| -rw-r--r-- | examples/one_particle_sedimentation_2d/sim.cpp | 11 | ||||
| -rw-r--r-- | examples/one_particle_sedimentation_2d/step.hpp | 11 |
4 files changed, 18 insertions, 16 deletions
diff --git a/examples/one_particle_sedimentation_2d/common.hpp b/examples/one_particle_sedimentation_2d/common.hpp index e28622f..f5382e0 100644 --- a/examples/one_particle_sedimentation_2d/common.hpp +++ b/examples/one_particle_sedimentation_2d/common.hpp @@ -58,7 +58,7 @@ using RhoChunk = Chunk<Scalar<T>, 0u, dim_x, dim_y>; template<typename T, typename Desc> using MacroStruct = Struct< - Member<VelChunk<T,Desc>, "momentum">, + Member<VelChunk<T,Desc>, "velocity">, Member<RhoChunk<T>, "density">, Member<ScalarChunk<T,Desc>, "porosity">, Member<VelChunk<T,Desc>, "force">, diff --git a/examples/one_particle_sedimentation_2d/init.hpp b/examples/one_particle_sedimentation_2d/init.hpp index 989ec4f..94ad3db 100644 --- a/examples/one_particle_sedimentation_2d/init.hpp +++ b/examples/one_particle_sedimentation_2d/init.hpp @@ -37,7 +37,7 @@ kel::lbm::error_or<void> init( auto& df_f = fields.template get<"dfs_old">(); auto& rho_f = macros.template get<"density">(); - auto& vel_f = macros.template get<"momentum">(); + auto& vel_f = macros.template get<"velocity">(); auto& por_f = macros.template get<"porosity">(); iterator<Desc::D>::apply( @@ -74,8 +74,8 @@ kel::lbm::error_or<void> init( ); { - kel::lbm::data<sch::Scalar<T>> radius_p; - radius_p.at({}).set(conv.meter_si_to_lbm({{0.00125}}).handle().get()); + kel::lbm::data<sch::LbmMeter<sch::Scalar<T>>> radius_p; + radius_p.at({}).set(conv.meter_si_to_lbm({0.00125}).handle().get()); std::cout<<"RADIUS: "<<radius_p.at({}).get()<<std::endl; kel::lbm::data<sch::Scalar<T>> dense_p; dense_p.at({}).set(1); @@ -87,8 +87,8 @@ kel::lbm::error_or<void> init( auto& prb = p.template get<"rigid_body">(); auto& p_pos = prb.template get<"position">(); auto& p_posold = prb.template get<"position_old">(); - p_pos.at({{0u}}) = conv.meter_si_to_lbm({{0.01}}).handle(); - p_pos.at({{1u}}) = conv.meter_si_to_lbm({{0.04}}).handle(); + p_pos.at({{0u}}) = conv.meter_si_to_lbm({0.01}).handle(); + p_pos.at({{1u}}) = conv.meter_si_to_lbm({0.04}).handle(); p_posold = p_pos; } diff --git a/examples/one_particle_sedimentation_2d/sim.cpp b/examples/one_particle_sedimentation_2d/sim.cpp index 7c8456f..c9fae4d 100644 --- a/examples/one_particle_sedimentation_2d/sim.cpp +++ b/examples/one_particle_sedimentation_2d/sim.cpp @@ -2,12 +2,13 @@ #include "init.hpp" #include "step.hpp" -#include <forstio/codec/args.hpp> /** * For deciding what parameters to use maybe? */ namespace args { +using namespace kel::lbm::sch; + using LbmArgsStruct = Struct< Member<String, "coupling"> @@ -45,16 +46,16 @@ kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){ converter<T> conv { // delta_x - {{0.02 / dim_x}}, + {0.02 / dim_x}, // delta_t - {{3e-7}} + {3e-7} }; kel::lbm::data<sch::SiKinematicViscosity<T>> kin_vis_si{1e-3}; auto kin_vis_lbm = conv.kinematic_viscosity_si_to_lbm(kin_vis_si); auto tau = conv.template kinematic_viscosity_lbm_to_tau<Desc>(kin_vis_lbm); print_lbm_meta<T,Desc>(conv,kin_vis_si,{1e-4},{2}); - std::cout<<"Position: "<<conv.meter_si_to_lbm({{0.01}}).handle().get()<<", "<<conv.meter_si_to_lbm({{0.04}}).handle().get()<<std::endl; + std::cout<<"Position: "<<conv.meter_si_to_lbm({0.01}).handle().get()<<", "<<conv.meter_si_to_lbm({0.04}).handle().get()<<std::endl; // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}}; auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>(); @@ -220,7 +221,7 @@ kel::lbm::error_or<void> k_main(int argc, char** argv){ kel::lbm::data<args::LbmArgs> args; { - auto eov = saw::parse_args(args,argc,argv); + auto eov = kel::lbm::parse_args(args,argc,argv); if(eov.is_error()){ return eov; } diff --git a/examples/one_particle_sedimentation_2d/step.hpp b/examples/one_particle_sedimentation_2d/step.hpp index de42dec..f28586a 100644 --- a/examples/one_particle_sedimentation_2d/step.hpp +++ b/examples/one_particle_sedimentation_2d/step.hpp @@ -90,7 +90,8 @@ kel::lbm::error_or<void> step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - kel::lbm::data<sch::Vector<T,Desc::D>> gf; + // Gravity is an acceleration, which is what the integrator expects. + kel::lbm::data<sch::LbmAcceleration<sch::Vector<T,Desc::D>>> gf; gf.at({{1u}}) = conv.acceleration_si_to_lbm({-9.81}).handle(); component<T,Desc,cmpt::FpLbmOneParticle,encode::Sycl<kel::lbm::enc::Native>> fplbm_one_part{gf}; @@ -134,8 +135,8 @@ kel::lbm::error_or<void> step( [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> { kel::lbm::data<sch::Vector<T,Desc::D>> vel; { - auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + auto y_si = conv.meter_lbm_to_si(as_unit<sch::LbmMeter<T>>(index.at({{1u}}).template cast_to<T>())).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -210,8 +211,8 @@ kel::lbm::error_or<void> step( [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> { kel::lbm::data<sch::Vector<T,Desc::D>> vel; { - auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + auto y_si = conv.meter_lbm_to_si(as_unit<sch::LbmMeter<T>>(index.at({{1u}}).template cast_to<T>())).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}).handle(); vel.at({{1u}}) = 0.0f; } return vel; |
