From f5d2e90039e88626eff4a72235deaa70d50ae4d7 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Fri, 24 Jul 2020 15:57:18 +0200
Subject: [PATCH] Fluctuating MRT: propagate the RNG counter to all copies of
 the lattice model

---
 tests/lbm/codegen/FluctuatingMRT.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/lbm/codegen/FluctuatingMRT.cpp b/tests/lbm/codegen/FluctuatingMRT.cpp
index 46ceaea05..9fccc77af 100644
--- a/tests/lbm/codegen/FluctuatingMRT.cpp
+++ b/tests/lbm/codegen/FluctuatingMRT.cpp
@@ -84,9 +84,11 @@ int main( int argc, char ** argv )
    blockforest::communication::UniformBufferedScheme< CommunicationStencil_T > communication( blocks );
    communication.addPackInfo( make_shared< lbm::PdfFieldPackInfo< LatticeModel_T > >( pdfFieldId ) );
 
-   // add LBM sweep and communication to time loop
+   // set the RNG counter to match the time step and propagate it to the fields' copies of the lattice model
    timeloop.add() << BeforeFunction( [&](){ latticeModel.time_step_ = uint32_c(timeloop.getCurrentTimeStep()); }, "set RNG counter" )
-                  << BeforeFunction( communication, "communication" )
+                  << Sweep( [&]( IBlock * block ){ block->getData< PdfField_T >( pdfFieldId )->resetLatticeModel( latticeModel ); }, "set RNG counter" );
+   // add LBM sweep and communication to time loop
+   timeloop.add() << BeforeFunction( communication, "communication" )
                   << Sweep( LatticeModel_T::Sweep( pdfFieldId ), "LB stream & collide" );
 
    // LBM stability check
-- 
GitLab