BUG: collated fails with controlDict watch files

- files might have been set during token reading so only on
  known on master processor.
  Broadcast names to all processors (even alhough they are only
  checked on master) so that the watched states remain synchronised
This commit is contained in:
mattijs 2023-06-21 13:00:00 +01:00 committed by Mark Olesen
parent 32386d0b39
commit 09edb23c1d
2 changed files with 21 additions and 4 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -38,18 +39,28 @@ using namespace Foam;
int main(int argc, char *argv[])
{
argList::noParallel();
argList::addBoolOption("setTime", "Time::setTime(..) for each instance");
// timeSelector::addOptions();
timeSelector::addOptions(true, true);
#include "setRootCase.H"
#include "createTime.H"
Info<< "Times found:" << runTime.times() << endl;
Info<< "Using fileHandler: " << fileHandler().type() << endl;
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
Info<< "Times selected:" << timeDirs << endl;
Pout<< "Times selected:" << timeDirs << endl;
if (args.found("setTime"))
{
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timei], timei);
}
}
Info<< "\nEnd\n" << endl;
return 0;

View File

@ -397,6 +397,12 @@ void Foam::Time::setMonitoring(const bool forceProfiling)
if (runTimeModifiable_)
{
// Monitor all files that controlDict depends on
// Files might have been set during token reading so only on master
// processor. Broadcast names to all processors
// (even although they are only checked on master)
// so that the watched states are synchronised
Pstream::broadcast(controlDict_.files(), UPstream::worldComm);
fileHandler().addWatches(controlDict_, controlDict_.files());
}