Skip to content
Snippets Groups Projects
Commit c35be28d authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Merge branch 'fluctuating-mrt' into 'master'

Fluctuating MRT: propagate the RNG counter to all copies of the lattice model

See merge request walberla/walberla!320
parents 9aea8976 d6daf268
Branches
Tags
No related merge requests found
......@@ -74,8 +74,9 @@ int main( int argc, char ** argv )
BlockDataID pdfFieldId = lbm::addPdfFieldToStorage( blocks, "pdf field", latticeModel, initialVelocity, real_t(1) );
BlockDataID flagFieldId = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" );
// create and initialize boundary handling
// create and initialize flag field
const FlagUID fluidFlagUID( "Fluid" );
geometry::setNonBoundaryCellsToDomain<FlagField_T>(*blocks, flagFieldId, fluidFlagUID);
// create time loop
SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps );
......@@ -84,9 +85,14 @@ 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 ){
auto field = block->getData< PdfField_T >( pdfFieldId );
field->latticeModel().time_step_ = latticeModel.time_step_;
}, "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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment