57 double kT,
unsigned int seed) {
58 auto const omega = shear_mode_relaxation_rate();
59 auto const omega_odd = odd_mode_relaxation_rate(omega);
60 auto const blocks = get_lattice().get_blocks();
61 m_kT = FloatType_c(kT);
64 m_last_applied_force_field_id, m_pdf_field_id, zero_centered_to_lb(m_kT),
65 omega, omega, omega_odd, omega, seed, uint32_t{0u});
66 m_collision_model = std::make_shared<CollisionModel>(std::move(obj));
67 m_run_stream_collide_sweep = StreamCollideSweepVisitor(blocks);
68 setup_streaming_communicator();
81 std::unique_ptr<LeesEdwardsPack> &&lees_edwards_pack) {
83#if defined(__CUDACC__) and defined(WALBERLA_BUILD_WITH_CUDA)
85 throw std::runtime_error(
"Lees-Edwards LB doesn't support GPU yet");
88 auto const shear_direction = lees_edwards_pack->shear_direction;
89 auto const shear_plane_normal = lees_edwards_pack->shear_plane_normal;
90 auto const shear_vel = FloatType_c(lees_edwards_pack->get_shear_velocity());
91 auto const omega = shear_mode_relaxation_rate();
92 auto const omega_odd = odd_mode_relaxation_rate(omega);
93 if (shear_plane_normal != 1u) {
94 throw std::domain_error(
95 "Lees-Edwards LB only supports shear_plane_normal=\"y\"");
97 auto const &lattice = get_lattice();
98 auto const n_ghost_layers = lattice.get_ghost_layers();
99 auto const blocks = lattice.get_blocks();
100 if (lattice.get_node_grid()[shear_direction] != 1 or
101 blocks->getSize(shear_direction) != 1ul or
102 blocks->getSize(shear_plane_normal) !=
103 lattice.get_node_grid()[shear_plane_normal]) {
104 throw std::domain_error(
"LB LEbc doesn't support domain decomposition "
105 "along the shear direction, nor multiple blocks "
106 "along the normal direction");
108 auto const &grid_dimensions = lattice.get_grid_dimensions();
109 auto const block_origin = lattice.get_local_grid_range(
false).first;
110 auto const lebc_slab_origin = block_origin[shear_plane_normal];
111 auto const lebc_slab_total_thickness = grid_dimensions[shear_plane_normal];
112 auto const lebc_bot_index = 0 - lebc_slab_origin;
113 auto const lebc_top_index = lebc_slab_total_thickness - lebc_slab_origin;
114 m_collision_model = std::make_shared<CollisionModel>(
116 m_last_applied_force_field_id, m_pdf_field_id, lebc_bot_index,
117 lebc_top_index, omega, omega, omega_odd, omega, shear_vel));
118 m_lees_edwards_callbacks = std::move(lees_edwards_pack);
119 m_run_stream_collide_sweep =
120 StreamCollideSweepVisitor(blocks, m_lees_edwards_callbacks);
121 m_lees_edwards_pdf_interpol_sweep =
122 std::make_shared<InterpolateAndShiftAtBoundary<_PdfField, FloatType>>(
123 blocks, m_pdf_field_id, m_pdf_tmp_field_id, n_ghost_layers,
124 shear_direction, shear_plane_normal,
125 m_lees_edwards_callbacks->get_pos_offset);
126 m_lees_edwards_vel_interpol_sweep =
127 std::make_shared<InterpolateAndShiftAtBoundary<_VectorField, FloatType>>(
128 blocks, m_velocity_field_id, m_vel_tmp_field_id, n_ghost_layers,
129 shear_direction, shear_plane_normal,
130 m_lees_edwards_callbacks->get_pos_offset,
131 m_lees_edwards_callbacks->get_shear_velocity);
132 m_lees_edwards_last_applied_force_interpol_sweep =
133 std::make_shared<InterpolateAndShiftAtBoundary<_VectorField, FloatType>>(
134 blocks, m_last_applied_force_field_id, m_vel_tmp_field_id,
135 n_ghost_layers, shear_direction, shear_plane_normal,
136 m_lees_edwards_callbacks->get_pos_offset);
137 setup_streaming_communicator();