@@ -210,6 +210,7 @@ class LBWalberlaImpl : public LBWalberlaBase {
210210 }
211211
212212 void operator ()(StreamCollisionModelLeesEdwards &cm, IBlock *b) {
213+ cm.configure (m_storage, b);
213214 cm.setV_s (static_cast <decltype (cm.getV_s ())>(
214215 m_lees_edwards_callbacks->get_shear_velocity ()));
215216 cm (b);
@@ -531,9 +532,7 @@ class LBWalberlaImpl : public LBWalberlaBase {
531532 auto const block_variant = std::variant<IBlock *>(&block);
532533 std::visit (m_run_stream_collide_sweep, cm_variant, block_variant);
533534 }
534- if (auto *cm = std::get_if<StreamCollisionModelThermalized>(&cm_variant)) {
535- cm->setTime_step (cm->getTime_step () + 1u );
536- }
535+ std::visit ([](auto & cm) {cm.setTime_step (cm.getTime_step () + 1u );}, cm_variant);
537536 }
538537
539538 auto has_lees_edwards_bc () const {
@@ -701,8 +700,7 @@ class LBWalberlaImpl : public LBWalberlaBase {
701700 }
702701
703702 void set_collision_model (
704- std::unique_ptr<LeesEdwardsPack> &&lees_edwards_pack) override {
705- assert (m_kT == 0 .);
703+ std::unique_ptr<LeesEdwardsPack> &&lees_edwards_pack, double kT , unsigned int seed) override {
706704#if defined(__CUDACC__)
707705 if constexpr (Architecture == lbmpy::Arch::GPU) {
708706 throw std::runtime_error (" Lees-Edwards LB doesn't support GPU yet" );
@@ -712,6 +710,7 @@ class LBWalberlaImpl : public LBWalberlaBase {
712710 auto const shear_plane_normal = lees_edwards_pack->shear_plane_normal ;
713711 auto const shear_vel = FloatType_c (lees_edwards_pack->get_shear_velocity ());
714712 auto const omega = shear_mode_relaxation_rate ();
713+ auto const omega_odd = odd_mode_relaxation_rate (omega);
715714 if (shear_plane_normal != 1u ) {
716715 throw std::domain_error (
717716 " Lees-Edwards LB only supports shear_plane_normal=\" y\" " );
@@ -728,10 +727,12 @@ class LBWalberlaImpl : public LBWalberlaBase {
728727 }
729728 auto const grid_dimensions = lattice.get_grid_dimensions ();
730729 auto const grid_size = FloatType_c (grid_dimensions[shear_plane_normal]);
730+ m_kT = FloatType_c (kT );
731+ m_seed = seed;
731732 m_collision_model =
732733 std::make_shared<CollisionModel>(StreamCollisionModelLeesEdwards (
733- m_last_applied_force_field_id, m_pdf_field_id, grid_size, omega,
734- shear_vel));
734+ m_last_applied_force_field_id, m_pdf_field_id, grid_size, zero_centered_to_lb (m_kT), omega, omega, omega_odd, omega,
735+ seed, uint32_t { 0u }, shear_vel));
735736 m_lees_edwards_callbacks = std::move (lees_edwards_pack);
736737 m_run_stream_collide_sweep =
737738 StreamCollideSweepVisitor (blocks, m_lees_edwards_callbacks);
@@ -1771,23 +1772,19 @@ class LBWalberlaImpl : public LBWalberlaBase {
17711772 }
17721773
17731774 [[nodiscard]] std::optional<uint64_t > get_rng_state () const override {
1774- auto const cm =
1775- std::get_if<StreamCollisionModelThermalized>(&*m_collision_model);
1776- if (!cm or m_kT == 0 .) {
1775+ if (m_kT == 0 .) {
17771776 return std::nullopt ;
17781777 }
1779- return { static_cast <uint64_t >(cm-> getTime_step ())} ;
1778+ return std::visit ([]( auto const & cm) { return static_cast <uint64_t >(cm. getTime_step ());},*m_collision_model) ;
17801779 }
17811780
17821781 void set_rng_state (uint64_t counter) override {
1783- auto const cm =
1784- std::get_if<StreamCollisionModelThermalized>(&*m_collision_model);
1785- if (!cm or m_kT == 0 .) {
1782+ if (m_kT == 0 .) {
17861783 throw std::runtime_error (" This LB instance is unthermalized" );
17871784 }
17881785 assert (counter <=
17891786 static_cast <uint32_t >(std::numeric_limits<uint_t >::max ()));
1790- cm-> setTime_step (static_cast <uint32_t >(counter));
1787+ std::visit ([counter]( auto & cm) {cm. setTime_step (static_cast <uint32_t >(counter));},*m_collision_model );
17911788 }
17921789
17931790 [[nodiscard]] LatticeWalberla const &get_lattice () const noexcept override {
0 commit comments