Commit 40d8709d authored by Dominik Schuster's avatar Dominik Schuster
Browse files

Fixed restart synchronization problem

parent 8a4dd42a
......@@ -811,10 +811,6 @@ namespace fluidizedBed {
WALBERLA_LOG_INFO_ON_ROOT("Initializing data from checkpoint file!");
WALBERLA_LOG_RESULT_ON_ROOT("Reading body from checkpoint file");
bodyStorageID = blocks->loadBlockData(checkpointPathBodies, pe::createStorageDataHandling<BodyTypeTuple>());
WALBERLA_LOG_RESULT_ON_ROOT("Reading pdf from checkpoint file");
shared_ptr<lbm::internal::PdfFieldHandling<LatticeModel_T> > pdfDataHandling =
......@@ -823,6 +819,10 @@ namespace fluidizedBed {
// add pdf field
pdfFieldID = (blocks->getBlockStorage()).loadBlockData(checkpointPathPdf, pdfDataHandling, "pdf field (fzyx)");
WALBERLA_LOG_RESULT_ON_ROOT("Reading body from checkpoint file");
bodyStorageID = blocks->loadBlockData(checkpointPathBodies, pe::createStorageDataHandling<BodyTypeTuple>());
} else {
std::mt19937 rnd(MPIManager::instance()->rank());
......@@ -912,12 +912,12 @@ namespace fluidizedBed {
mpi::allReduceInplace(numberCreatedParticlesA, mpi::SUM);
mpi::allReduceInplace(numberCreatedParticlesB, mpi::SUM);
}
/*
WALBERLA_ROOT_SECTION() {
std::cout << "Number of created particles A is: " << numberCreatedParticlesA << std::endl;
std::cout << "Number of created particles B is: " << numberCreatedParticlesB << std::endl << std::endl;
}
*/
///////////////////
// PACKED BED ////
//////////////////
......@@ -1064,8 +1064,6 @@ namespace fluidizedBed {
uint_t(1), field::fzyx);
}
syncCall();
// Communication scheme
std::function<void()> commFunction;
......@@ -1073,28 +1071,35 @@ namespace fluidizedBed {
scheme.addPackInfo(make_shared<lbm::PdfFieldPackInfo<LatticeModel_T> >(pdfFieldID));
commFunction = scheme;
commFunction();
////////////////////////
// ADD DATA TO BLOCKS //
////////////////////////
// add flag field
BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>(blocks, "flag field");
// add body field
BlockDataID bodyFieldID = field::addToStorage<BodyField_T>(blocks, "body field", NULL, field::fzyx);
std::function<void(void)> syncCall2 = std::bind(pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID,
static_cast<WcTimingTree *>(NULL), overlap, false);
syncCall2();
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt) {
pe::ccd::ICCD* ccd = blockIt->getData<pe::ccd::ICCD>(ccdID);
ccd->reloadBodies();
}
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt){
pe::ccd::ICCD *ccd = blockIt->getData<pe::ccd::ICCD>(ccdID);
std::cout << "Bodies: " << ccd->getObservedBodyCount() << std::endl ;
}
int numberSpheres = 0;
// add flag field
BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>(blocks, "flag field");
for (auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt) {
for (auto bodyIt = pe::ShadowBodyIterator::begin(*blockIt, bodyStorageID); bodyIt != pe::ShadowBodyIterator::end(); ++bodyIt) {
if (bodyIt->isFixed() || !bodyIt->isFinite())
continue;
// add body field
BlockDataID bodyFieldID = field::addToStorage<BodyField_T>(blocks, "body field", NULL, field::fzyx);
++numberSpheres;
}
}
// Object for keeping track of time
shared_ptr<lbm::TimeTracker> timeTrack = make_shared<lbm::TimeTracker>();
......@@ -1189,7 +1194,7 @@ namespace fluidizedBed {
timeloop.addFuncAfterTimeStep(
makeSharedFunctor( field::makeStabilityChecker< lbm::PdfField< LatticeModel_T >, FlagField_T >(
blocks, pdfFieldID, flagFieldID, FBfunc::Fluid_Flag, uint_t(1), true, true ) ), "LBM stability check" );
blocks, pdfFieldID, flagFieldID, FBfunc::Fluid_Flag, uint_t(1), false, true ) ), "LBM stability check" );
// sweep for updating the pe body mapping into the LBM simulation
timeloop.add() << Sweep(
......
Markdown is supported
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