From d5c375f297806b948f5f278664b355c1740f7b35 Mon Sep 17 00:00:00 2001 From: Robert Kloefkorn Date: Tue, 29 Mar 2016 10:48:24 +0200 Subject: [PATCH] SimulatorFullyImplicitOutput: added flag for async output. --- .../SimulatorFullyImplicitBlackoilOutput.cpp | 12 +++++++++--- .../SimulatorFullyImplicitBlackoilOutput.hpp | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp index f57eb5872..372ed44b9 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.cpp @@ -307,9 +307,15 @@ namespace Opm // serial output is only done on I/O rank if( isIORank ) { - // spawn write thread that calls eclWriter.writeTimeStepSerial - WriterCall call( *this, timer, state, wellState, substep ); - std::async( std::move( call ) ); + if( asyncOutput_ ) { + // spawn write thread that calls eclWriter.writeTimeStepSerial + WriterCall call( *this, timer, state, wellState, substep ); + std::async( std::move( call ) ); + } + else { + // just write the data to disk + writeTimeStepSerial( timer, state, wellState, substep ); + } } } diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp index 1cd42e9e4..ad02b75c4 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp @@ -261,6 +261,7 @@ namespace Opm std::unique_ptr< OutputWriter > matlabWriter_; std::unique_ptr< EclipseWriter > eclWriter_; EclipseStateConstPtr eclipseState_; + const bool asyncOutput_ ; }; @@ -293,7 +294,8 @@ namespace Opm parallelOutput_->numCells(), parallelOutput_->globalCell() ) : 0 ), - eclipseState_(eclipseState) + eclipseState_(eclipseState), + asyncOutput_( output_ ? param.getDefault("async_output", bool( false ) ) : false ) { // For output. if (output_ && parallelOutput_->isIORank() ) {