diff --git a/src/Simulation.cpp b/src/Simulation.cpp index 8bc7761ceb..8ac7991f1a 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -355,7 +355,7 @@ void Simulation::readXML(XMLfileUnits& xmlconfig) { Simulation::exit(1); } delete _domainDecomposition; - _domainDecomposition = new GeneralDomainDecomposition(getcutoffRadius() + skin, _domain, forceLatchingToLinkedCellsGrid); + _domainDecomposition = new GeneralDomainDecomposition(getcutoffRadius() + skin, _domain, forceLatchingToLinkedCellsGrid, _numberOfTimesteps); } else { global_log->error() << "Unknown parallelisation type: " << parallelisationtype << endl; Simulation::exit(1); diff --git a/src/parallel/GeneralDomainDecomposition.cpp b/src/parallel/GeneralDomainDecomposition.cpp index a18c344699..b73bf4f4f8 100644 --- a/src/parallel/GeneralDomainDecomposition.cpp +++ b/src/parallel/GeneralDomainDecomposition.cpp @@ -14,12 +14,13 @@ #include -GeneralDomainDecomposition::GeneralDomainDecomposition(double interactionLength, Domain* domain, bool forceGrid) +GeneralDomainDecomposition::GeneralDomainDecomposition(double interactionLength, Domain* domain, bool forceGrid, unsigned long numTimesteps) : _boxMin{0.}, _boxMax{0.}, _domainLength{domain->getGlobalLength(0), domain->getGlobalLength(1), domain->getGlobalLength(2)}, _interactionLength{interactionLength}, - _forceLatchingToLinkedCellsGrid{forceGrid} {} + _forceLatchingToLinkedCellsGrid{forceGrid}, + _numTimesteps{numTimesteps} {} void GeneralDomainDecomposition::initializeALL() { global_log->info() << "initializing ALL load balancer..." << std::endl; @@ -252,6 +253,7 @@ void GeneralDomainDecomposition::readXML(XMLfileUnits& xmlconfig) { #endif xmlconfig.getNodeValue("updateFrequency", _rebuildFrequency); + _rebuildFrequency = std::min(_rebuildFrequency, _numTimesteps); global_log->info() << "GeneralDomainDecomposition update frequency: " << _rebuildFrequency << endl; xmlconfig.getNodeValue("initialPhaseTime", _initPhase); diff --git a/src/parallel/GeneralDomainDecomposition.h b/src/parallel/GeneralDomainDecomposition.h index 6d06d36361..18ea47a90f 100644 --- a/src/parallel/GeneralDomainDecomposition.h +++ b/src/parallel/GeneralDomainDecomposition.h @@ -22,7 +22,7 @@ class GeneralDomainDecomposition : public DomainDecompMPIBase { * @param domain * @param forceGrid */ - GeneralDomainDecomposition(double interactionLength, Domain* domain, bool forceGrid); + GeneralDomainDecomposition(double interactionLength, Domain* domain, bool forceGrid, unsigned long numTimesteps); // documentation see father class (DomainDecompBase.h) ~GeneralDomainDecomposition() override; @@ -189,6 +189,7 @@ class GeneralDomainDecomposition : public DomainDecompMPIBase { size_t _steps{0}; size_t _rebuildFrequency{10000}; + unsigned long _numTimesteps; size_t _initPhase{0}; size_t _initFrequency{500};