mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-24 14:47:44 -05:00
ParallelDebugOutput: only use parallel output when mpi size > 1.
This commit is contained in:
1 parent
2c84414641
commit
dacb4013ed
2 files changed
+20
-11
No files matched your search
@@ -48,6 +48,7 @@ namespace Opm
|
||||
virtual const SimulatorState& globalReservoirState() const = 0 ;
|
||||
virtual const WellState& globalWellState() const = 0 ;
|
||||
virtual bool isIORank() const = 0;
|
||||
virtual bool isParallel() const = 0;
|
||||
virtual int numCells() const = 0 ;
|
||||
virtual const int* globalCell() const = 0;
|
||||
};
|
||||
@@ -79,6 +80,7 @@ namespace Opm
|
||||
virtual const SimulatorState& globalReservoirState() const { return *globalState_; }
|
||||
virtual const WellState& globalWellState() const { return *wellState_; }
|
||||
virtual bool isIORank () const { return true; }
|
||||
virtual bool isParallel () const { return false; }
|
||||
virtual int numCells() const { return grid_.number_of_cells; }
|
||||
virtual const int* globalCell() const { return grid_.global_cell; }
|
||||
};
|
||||
@@ -221,6 +223,8 @@ namespace Opm
|
||||
isIORank_( otherGrid.comm().rank() == ioRank )
|
||||
{
|
||||
const CollectiveCommunication& comm = otherGrid.comm();
|
||||
if( comm.size() > 1 )
|
||||
{
|
||||
std::set< int > send, recv;
|
||||
// the I/O rank receives from all other ranks
|
||||
if( isIORank() )
|
||||
@@ -300,6 +304,7 @@ namespace Opm
|
||||
DistributeIndexMapping distIndexMapping( globalIndex_, otherGrid.globalCell(), localIndexMap_, indexMaps_ );
|
||||
toIORankComm_.exchange( distIndexMapping );
|
||||
}
|
||||
}
|
||||
|
||||
class PackUnPackSimulatorState : public P2PCommunicatorType::DataHandleInterface
|
||||
{
|
||||
@@ -533,6 +538,11 @@ namespace Opm
|
||||
return isIORank_;
|
||||
}
|
||||
|
||||
bool isParallel() const
|
||||
{
|
||||
return toIORankComm_.size() > 1;
|
||||
}
|
||||
|
||||
int numCells () const { return globalIndex_.size(); }
|
||||
const int* globalCell () const
|
||||
{
|
||||
@@ -545,7 +555,6 @@ namespace Opm
|
||||
IndexMapType globalIndex_;
|
||||
IndexMapType localIndexMap_;
|
||||
IndexMapStorageType indexMaps_;
|
||||
//BlackoilState globalReservoirState_;
|
||||
SimulatorState globalReservoirState_;
|
||||
// this needs to be revised
|
||||
WellStateFullyImplicitBlackoil globalWellState_;
|
||||
|
||||
@@ -261,18 +261,19 @@ namespace Opm
|
||||
vtkWriter_->writeTimeStep( timer, localState, localWellState, false );
|
||||
}
|
||||
|
||||
if( parallelOutput_ )
|
||||
bool isIORank = true ;
|
||||
if( parallelOutput_ && parallelOutput_->isParallel() )
|
||||
{
|
||||
|
||||
// collect all solutions to I/O rank
|
||||
const bool isIORank = parallelOutput_->collectToIORank( localState, localWellState );
|
||||
isIORank = parallelOutput_->collectToIORank( localState, localWellState );
|
||||
}
|
||||
|
||||
const SimulatorState& state = (parallelOutput_ && parallelOutput_->isParallel() ) ? parallelOutput_->globalReservoirState() : localState;
|
||||
const WellState& wellState = (parallelOutput_ && parallelOutput_->isParallel() ) ? parallelOutput_->globalWellState() : localWellState;
|
||||
|
||||
// output is only done on I/O rank
|
||||
if( isIORank )
|
||||
{
|
||||
const SimulatorState& state = parallelOutput_->globalReservoirState();
|
||||
const WellState& wellState = parallelOutput_->globalWellState();
|
||||
//std::cout << "number of wells" << wellState.bhp().size() << std::endl;
|
||||
|
||||
// Matlab output
|
||||
if( matlabWriter_ ) {
|
||||
matlabWriter_->writeTimeStep( timer, state, wellState, substep );
|
||||
@@ -320,9 +321,8 @@ namespace Opm
|
||||
*/
|
||||
backupfile_ << std::flush;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end backup
|
||||
} // end isIORank
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in new issue
Block a user