From 73e084f9adad7a1eb78fbc7569acd3876fb797ee Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 4 Nov 2016 14:47:59 +0100 Subject: [PATCH 01/11] Added ctest for restart files --- compareECLFiles.cmake | 27 +++++++++++++++++++++++++++ tests/run-restart-regressionTest.sh | 24 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100755 tests/run-restart-regressionTest.sh diff --git a/compareECLFiles.cmake b/compareECLFiles.cmake index 36a4bb3e5..717c75ba1 100644 --- a/compareECLFiles.cmake +++ b/compareECLFiles.cmake @@ -27,6 +27,28 @@ macro (add_test_compareECLFiles casename filename) TEST_ARGS ${OPM_DATA_ROOT}/${casename}/${filename}.DATA ) endmacro (add_test_compareECLFiles) +########################################################################### +# TEST: compareECLRestartFiles +########################################################################### + +# Input: +# - casename: basename (no extension) +# +macro (add_test_compareECLRestartFiles casename filename) + + set(RESULT_PATH ${BASE_RESULT_PATH}/restart/${casename}) + # Add test that runs flow and outputs the results to file + opm_add_test(compareECLRestartFiles_${filename} NO_COMPILE + EXE_NAME flow + DRIVER_ARGS ${OPM_DATA_ROOT}/${casename} ${RESULT_PATH} + ${CMAKE_BINARY_DIR}/bin + ${filename} + ${abs_tol} ${rel_tol} + ${COMPARE_SUMMARY_COMMAND} + ${COMPARE_ECL_COMMAND} + TEST_ARGS ${OPM_DATA_ROOT}/${casename}/${filename}) +endmacro (add_test_compareECLRestartFiles) + if(NOT TARGET test-suite) add_custom_target(test-suite) @@ -37,3 +59,8 @@ opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-regressionTest.sh "") add_test_compareECLFiles(spe1 SPE1CASE2) add_test_compareECLFiles(spe3 SPE3CASE1) add_test_compareECLFiles(spe9 SPE9_CP_SHORT) + +# Restart tests +opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-restart-regressionTest.sh "") + +add_test_compareECLRestartFiles(spe9 SPE9_CP_SHORT) diff --git a/tests/run-restart-regressionTest.sh b/tests/run-restart-regressionTest.sh new file mode 100755 index 000000000..67f7b09ef --- /dev/null +++ b/tests/run-restart-regressionTest.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +INPUT_DATA_PATH="$1" +RESULT_PATH="$2" +BINPATH="$3" +FILENAME="$4" +ABS_TOL="$5" +REL_TOL="$6" +COMPARE_SUMMARY_COMMAND="$7" +COMPARE_ECL_COMMAND="$8" +EXE_NAME="${9}" +shift 9 +TEST_ARGS="$@" + +rm -Rf ${RESULT_PATH} +mkdir -p ${RESULT_PATH} +cd ${RESULT_PATH} +${BINPATH}/${EXE_NAME} ${TEST_ARGS}.DATA timestep.adaptive=false +${BINPATH}/${EXE_NAME} ${TEST_ARGS}_RESTART.DATA timestep.adaptive=false + +${COMPARE_SUMMARY_COMMAND} -R ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL} + +${COMPARE_ECL_COMMAND} -l ${RESULT_PATH}/${FILENAME} ${RESULT_PATH}/${FILENAME}_RESTART ${ABS_TOL} ${REL_TOL} From 511a9039ab21dc5daab9501a7bffc13bfbd124c2 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 4 Nov 2016 15:30:37 +0100 Subject: [PATCH 02/11] rename the 'flow' binary to 'flow_legacy' and set a symbolic link this is a precursor of merging flow_ebos into the master branch. hopefully, this won't break any existing setups... --- CMakeLists.txt | 19 ++++++++++++++----- CMakeLists_files.cmake | 4 ++-- examples/{flow.cpp => flow_legacy.cpp} | 0 3 files changed, 16 insertions(+), 7 deletions(-) rename examples/{flow.cpp => flow_legacy.cpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4edb01aa5..88c2acc1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,7 +127,7 @@ endif (NOT EIGEN3_FOUND) if (HAVE_OPM_DATA) - add_test( NAME flow_SPE1CASE2 COMMAND flow ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ) + add_test( NAME flow_SPE1CASE2 COMMAND flow_legacy ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ) add_test( NAME flow_sequential_SPE1 COMMAND flow_sequential ${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA ) add_test( NAME flow_MSW2DH__ COMMAND flow_multisegment ${OPM_DATA_ROOT}/wells_test_suite/MSW/2D_H__/2D_H__.DATA) @@ -135,14 +135,23 @@ if (HAVE_OPM_DATA) if (ERT_PYTHON_PATH) include(OpmPythonTest) - opm_add_python_test( check_INIT_SPE1 ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $ ${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA ${OPM_DATA_ROOT}/spe1/eclipse-simulation/SPE1CASE1.INIT + opm_add_python_test( check_INIT_SPE1 ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $ ${OPM_DATA_ROOT}/spe1/SPE1CASE1.DATA ${OPM_DATA_ROOT}/spe1/eclipse-simulation/SPE1CASE1.INIT TRANX TRANY TRANZ PORO PORV PERMX DX DY DZ DEPTH PVTNUM SATNUM EQLNUM FIPNUM ) - opm_add_python_test( check_INIT_NORNE ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $ ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA ${OPM_DATA_ROOT}/norne/ECL.2014.2/NORNE_ATW2013.INIT PORO PORV PERMX ) + opm_add_python_test( check_INIT_NORNE ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $ ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA ${OPM_DATA_ROOT}/norne/ECL.2014.2/NORNE_ATW2013.INIT PORO PORV PERMX ) opm_add_python_test( check_RESTART_SPE1CASE2 ${PROJECT_SOURCE_DIR}/tests/check_RESTART.py - $ ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ${OPM_DATA_ROOT}/spe1/SPE1CASE2_RESTART.DATA ) + $ ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ${OPM_DATA_ROOT}/spe1/SPE1CASE2_RESTART.DATA ) endif() include (${CMAKE_CURRENT_SOURCE_DIR}/compareECLFiles.cmake) -endif() + endif() + + # create a symbolic link from flow to flow_legacy +ADD_CUSTOM_TARGET(flow ALL + COMMAND ${CMAKE_COMMAND} -E create_symlink "flow_legacy" "${CMAKE_BINARY_DIR}/bin/flow") +install( + FILES "${CMAKE_BINARY_DIR}/bin/flow" + DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" + ) + diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 2347fd232..9d719ea0b 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -103,7 +103,7 @@ list (APPEND TEST_DATA_FILES # find tutorials examples -name '*.c*' -printf '\t%p\n' | sort list (APPEND EXAMPLE_SOURCE_FILES examples/find_zero.cpp - examples/flow.cpp + examples/flow_legacy.cpp examples/flow_sequential.cpp examples/flow_multisegment.cpp examples/flow_solvent.cpp @@ -124,7 +124,7 @@ list (APPEND PROGRAM_SOURCE_FILES examples/sim_2p_incomp.cpp examples/sim_2p_incomp_ad.cpp examples/sim_2p_comp_reorder.cpp - examples/flow.cpp + examples/flow_legacy.cpp examples/flow_sequential.cpp examples/flow_solvent.cpp examples/opm_init_check.cpp diff --git a/examples/flow.cpp b/examples/flow_legacy.cpp similarity index 100% rename from examples/flow.cpp rename to examples/flow_legacy.cpp From 407ee5fb6ebcf03449f4d91066b545466c97d555 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 7 Nov 2016 12:32:20 +0100 Subject: [PATCH 03/11] add restart test for SPE1CASE2_ACTNUM to cover restarts on decks with ACTNUM --- compareECLFiles.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/compareECLFiles.cmake b/compareECLFiles.cmake index 717c75ba1..1c572b8d3 100644 --- a/compareECLFiles.cmake +++ b/compareECLFiles.cmake @@ -64,3 +64,4 @@ add_test_compareECLFiles(spe9 SPE9_CP_SHORT) opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-restart-regressionTest.sh "") add_test_compareECLRestartFiles(spe9 SPE9_CP_SHORT) +add_test_compareECLRestartFiles(spe1 SPE1CASE2_ACTNUM) From 077dc02481a9bd3d1c227f216c19c3a1b91fa782 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Mon, 7 Nov 2016 19:35:53 +0100 Subject: [PATCH 04/11] Fix using local active cells for writing eclipse files in parallel. Previously, the eclipseGrid used by EclipseWriter was constructed from the one in the EclipseState with the current CpGrid. Unfortunately the latter was the distributed version resembling only the local part that the processor works on. Therefore the information about the active cells was wrong when writing results (which raised an exception in the writer). With this commit we construct the EclipseWriter before distributing the grid and use this writer later on in the OutputWriter. --- examples/sim_poly_fi2p_comp_ad.cpp | 7 ++++++- opm/autodiff/FlowMain.hpp | 8 +++++--- opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp | 4 +++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/sim_poly_fi2p_comp_ad.cpp b/examples/sim_poly_fi2p_comp_ad.cpp index 17bc8bfa6..e1d4d77fb 100644 --- a/examples/sim_poly_fi2p_comp_ad.cpp +++ b/examples/sim_poly_fi2p_comp_ad.cpp @@ -239,8 +239,13 @@ try std::cout << "\n\n================ Starting main simulation loop ===============\n" << std::flush; + std::unique_ptr + eclipseWriter(new Opm::EclipseWriter(*eclipseState, + UgGridHelpers + ::createEclipseGrid( cGrid , + eclipseState->getInputGrid()))); Opm::BlackoilOutputWriter - outputWriter(cGrid, param, *eclipseState, pu, + outputWriter(cGrid, param, *eclipseState, eclipseWriter, pu, new_props->permeability() ); SimulatorReport fullReport; diff --git a/opm/autodiff/FlowMain.hpp b/opm/autodiff/FlowMain.hpp index 95092e7e2..3ac00166e 100644 --- a/opm/autodiff/FlowMain.hpp +++ b/opm/autodiff/FlowMain.hpp @@ -228,6 +228,7 @@ namespace Opm // distributeData() boost::any parallel_information_; // setupOutputWriter() + std::unique_ptr eclipse_writer_; std::unique_ptr output_writer_; // setupLinearSolver std::unique_ptr fis_solver_; @@ -754,9 +755,9 @@ namespace Opm if( output && output_ecl && output_cout_) { const EclipseGrid& inputGrid = eclipse_state_->getInputGrid(); - EclipseWriter writer(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid )); - writer.writeInitAndEgrid(geoprops_->simProps(grid), - geoprops_->nonCartesianConnections()); + eclipse_writer_.reset(new EclipseWriter(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid ))); + eclipse_writer_->writeInitAndEgrid(geoprops_->simProps(grid), + geoprops_->nonCartesianConnections()); } } @@ -772,6 +773,7 @@ namespace Opm output_writer_.reset(new BlackoilOutputWriter(grid_init_->grid(), param_, *eclipse_state_, + eclipse_writer_, Opm::phaseUsageFromDeck(*deck_), fluidprops_->permeability())); } diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp index 4348b9a26..7f7cef102 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp @@ -214,6 +214,7 @@ namespace Opm BlackoilOutputWriter(const Grid& grid, const parameter::ParameterGroup& param, const Opm::EclipseState& eclipseState, + std::unique_ptr& eclWriter, const Opm::PhaseUsage &phaseUsage, const double* permeability ); @@ -328,6 +329,7 @@ namespace Opm BlackoilOutputWriter(const Grid& grid, const parameter::ParameterGroup& param, const Opm::EclipseState& eclipseState, + std::unique_ptr& eclWriter, const Opm::PhaseUsage &phaseUsage, const double* permeability ) : output_( param.getDefault("output", true) ), @@ -343,7 +345,7 @@ namespace Opm new BlackoilMatlabWriter< Grid >( grid, outputDir_ ) : 0 ), eclWriter_( output_ && parallelOutput_->isIORank() && param.getDefault("output_ecl", true) ? - new EclipseWriter(eclipseState,UgGridHelpers::createEclipseGrid( grid , eclipseState.getInputGrid())) + eclWriter.release() : 0 ), eclipseState_(eclipseState), asyncOutput_() From 3f7f81ef0305293488ba5f7d274dc784d192ed2c Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Tue, 8 Nov 2016 18:59:08 +0000 Subject: [PATCH 05/11] Cater variable name change in BCRSMatrix of DUNE 2.5 One of the variables now has a trailing underline. --- opm/autodiff/DuneMatrix.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opm/autodiff/DuneMatrix.hpp b/opm/autodiff/DuneMatrix.hpp index 40124dc17..f3b121cc9 100644 --- a/opm/autodiff/DuneMatrix.hpp +++ b/opm/autodiff/DuneMatrix.hpp @@ -91,7 +91,11 @@ namespace Opm nnz = ia[rows]; #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 3) +#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5) + this->allocationSize_ = nnz; +#else this->allocationSize = nnz; +#endif this->avg = 0; this->overflowsize = -1.0; #endif From 2bdc46c557ad25fc96838588e472fbfcf17bb0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Wed, 9 Nov 2016 10:46:26 +0100 Subject: [PATCH 06/11] Remove Solution.sdc assignment --- opm/autodiff/Compat.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/opm/autodiff/Compat.hpp b/opm/autodiff/Compat.hpp index 9bb208bc1..12b775e73 100644 --- a/opm/autodiff/Compat.hpp +++ b/opm/autodiff/Compat.hpp @@ -105,8 +105,6 @@ inline std::vector< double >& stripe( const std::vector< double >& v, sol.insert( "SSOL", UnitSystem::measure::identity, reservoir.getCellData( BlackoilSolventState::SSOL ) , data::TargetType::RESTART_SOLUTION ); } - sol.sdc = &reservoir; - return sol; } From 85c0bbcc103207774578e908aec4e0f72af22503 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 9 Nov 2016 10:08:56 +0000 Subject: [PATCH 07/11] Indent nested #if --- opm/autodiff/DuneMatrix.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/autodiff/DuneMatrix.hpp b/opm/autodiff/DuneMatrix.hpp index f3b121cc9..f35b274c5 100644 --- a/opm/autodiff/DuneMatrix.hpp +++ b/opm/autodiff/DuneMatrix.hpp @@ -91,11 +91,11 @@ namespace Opm nnz = ia[rows]; #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 3) -#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5) + #if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5) this->allocationSize_ = nnz; -#else + #else this->allocationSize = nnz; -#endif + #endif this->avg = 0; this->overflowsize = -1.0; #endif From 3eba3353d0b9f0ef93a4bec579177e8f6b17f7f9 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 10 Nov 2016 12:41:13 +0100 Subject: [PATCH 08/11] Correctly mark transfer of ownership for ouptut writer --- examples/sim_poly_fi2p_comp_ad.cpp | 2 +- opm/autodiff/FlowMain.hpp | 2 +- opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/sim_poly_fi2p_comp_ad.cpp b/examples/sim_poly_fi2p_comp_ad.cpp index e1d4d77fb..2be72276d 100644 --- a/examples/sim_poly_fi2p_comp_ad.cpp +++ b/examples/sim_poly_fi2p_comp_ad.cpp @@ -245,7 +245,7 @@ try ::createEclipseGrid( cGrid , eclipseState->getInputGrid()))); Opm::BlackoilOutputWriter - outputWriter(cGrid, param, *eclipseState, eclipseWriter, pu, + outputWriter(cGrid, param, *eclipseState, std::move(eclipseWriter), pu, new_props->permeability() ); SimulatorReport fullReport; diff --git a/opm/autodiff/FlowMain.hpp b/opm/autodiff/FlowMain.hpp index 3ac00166e..a254fd033 100644 --- a/opm/autodiff/FlowMain.hpp +++ b/opm/autodiff/FlowMain.hpp @@ -773,7 +773,7 @@ namespace Opm output_writer_.reset(new BlackoilOutputWriter(grid_init_->grid(), param_, *eclipse_state_, - eclipse_writer_, + std::move(eclipse_writer_), Opm::phaseUsageFromDeck(*deck_), fluidprops_->permeability())); } diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp index 7f7cef102..ea0dffb40 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp @@ -214,7 +214,7 @@ namespace Opm BlackoilOutputWriter(const Grid& grid, const parameter::ParameterGroup& param, const Opm::EclipseState& eclipseState, - std::unique_ptr& eclWriter, + std::unique_ptr&& eclWriter, const Opm::PhaseUsage &phaseUsage, const double* permeability ); @@ -329,7 +329,7 @@ namespace Opm BlackoilOutputWriter(const Grid& grid, const parameter::ParameterGroup& param, const Opm::EclipseState& eclipseState, - std::unique_ptr& eclWriter, + std::unique_ptr&& eclWriter, const Opm::PhaseUsage &phaseUsage, const double* permeability ) : output_( param.getDefault("output", true) ), @@ -345,8 +345,8 @@ namespace Opm new BlackoilMatlabWriter< Grid >( grid, outputDir_ ) : 0 ), eclWriter_( output_ && parallelOutput_->isIORank() && param.getDefault("output_ecl", true) ? - eclWriter.release() - : 0 ), + std::move(eclWriter) + : std::move(std::unique_ptr()) ), eclipseState_(eclipseState), asyncOutput_() { From 747c93e898d9325d3d2879c0e85de9200c4bd2a5 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 10 Nov 2016 13:28:21 +0100 Subject: [PATCH 09/11] Removed ternary operator in inline initialization. This made the code rather hard to read. Now we do the initialization in the constructor body if needed. --- .../SimulatorFullyImplicitBlackoilOutput.hpp | 81 ++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp index ea0dffb40..ef879d17f 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp @@ -338,49 +338,58 @@ namespace Opm output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ), lastBackupReportStep_( -1 ), phaseUsage_( phaseUsage ), - vtkWriter_( output_ && param.getDefault("output_vtk",false) ? - new BlackoilVTKWriter< Grid >( grid, outputDir_ ) : 0 ), - matlabWriter_( output_ && parallelOutput_->isIORank() && - param.getDefault("output_matlab", false) ? - new BlackoilMatlabWriter< Grid >( grid, outputDir_ ) : 0 ), - eclWriter_( output_ && parallelOutput_->isIORank() && - param.getDefault("output_ecl", true) ? - std::move(eclWriter) - : std::move(std::unique_ptr()) ), eclipseState_(eclipseState), asyncOutput_() { // For output. - if (output_ && parallelOutput_->isIORank() ) { - // Ensure that output dir exists - boost::filesystem::path fpath(outputDir_); - try { - create_directories(fpath); - } - catch (...) { - OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); + if ( output_ ) + { + if ( param.getDefault("output_vtk",false) ) + { + vtkWriter_ + .reset(new BlackoilVTKWriter< Grid >( grid, outputDir_ )); } - // create output thread if enabled and rank is I/O rank - // async output is enabled by default if pthread are enabled -#if HAVE_PTHREAD - const bool asyncOutputDefault = false; -#else - const bool asyncOutputDefault = false; -#endif - if( param.getDefault("async_output", asyncOutputDefault ) ) - { -#if HAVE_PTHREAD - asyncOutput_.reset( new ThreadHandle() ); -#else - OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output"); -#endif - } + if( parallelOutput_->isIORank() ) { - std::string backupfilename = param.getDefault("backupfile", std::string("") ); - if( ! backupfilename.empty() ) - { - backupfile_.open( backupfilename.c_str() ); + if ( param.getDefault("output_matlab", false ) ) + { + matlabWriter_ + .reset(new BlackoilMatlabWriter< Grid >( grid, outputDir_ )); + } + + eclWriter_ = std::move(eclWriter); + + // Ensure that output dir exists + boost::filesystem::path fpath(outputDir_); + try { + create_directories(fpath); + } + catch (...) { + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); + } + + // create output thread if enabled and rank is I/O rank + // async output is enabled by default if pthread are enabled +#if HAVE_PTHREAD + const bool asyncOutputDefault = false; +#else + const bool asyncOutputDefault = false; +#endif + if( param.getDefault("async_output", asyncOutputDefault ) ) + { +#if HAVE_PTHREAD + asyncOutput_.reset( new ThreadHandle() ); +#else + OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output"); +#endif + } + + std::string backupfilename = param.getDefault("backupfile", std::string("") ); + if( ! backupfilename.empty() ) + { + backupfile_.open( backupfilename.c_str() ); + } } } } From 8632c71cefe039a9ec3569d391c4c9baa24056fa Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 10 Nov 2016 17:46:49 +0100 Subject: [PATCH 10/11] Do not populate cellData but issue a warning in parallel. This will lead to some data missing in the parallel runs but will allow successful runs. --- .../SimulatorFullyImplicitBlackoilOutput.hpp | 48 +++++++++++++++++-- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp index ef879d17f..d11b0c7fb 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilOutput.hpp @@ -785,16 +785,56 @@ namespace Opm const Model& physicalModel, bool substep) { + data::Solution cellData{}; const RestartConfig& restartConfig = eclipseState_.getRestartConfig(); const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig(); const int reportStepNum = timer.reportStepNum(); bool logMessages = output_ && parallelOutput_->isIORank(); + + if( output_ && !parallelOutput_->isParallel() ) + { - data::Solution cellData; - detail::getRestartData( cellData, phaseUsage_, physicalModel, - restartConfig, reportStepNum, logMessages ); - detail::getSummaryData( cellData, phaseUsage_, physicalModel, summaryConfig ); + detail::getRestartData( cellData, phaseUsage_, physicalModel, + restartConfig, reportStepNum, logMessages ); + detail::getSummaryData( cellData, phaseUsage_, physicalModel, summaryConfig ); + } + else + { + if ( logMessages ) + { + std::map rstKeywords = restartConfig.getRestartKeywords(reportStepNum); + std::vector keywords = + { "WIP", "OIPL", "OIPG", "OIP", "GIPG", "GIPL", "GIP", + "RPV", "FRPH", "RPRH"}; + + std::ostringstream str; + str << "Output of restart/summary config not supported in parallel. Requested keywords were "; + std::size_t no_kw = 0; + + auto func = [&] (const char* kw) + { + if ( detail::hasFRBKeyword(summaryConfig, kw) ) + { + str << kw << " "; + ++ no_kw; + } + }; + std::for_each(keywords.begin(), keywords.end(), func); + + for (auto& keyValue : rstKeywords) + { + str << keyValue.first << " "; + ++ no_kw; + } + + if ( no_kw ) + { + Opm::OpmLog::warning("Unhandled ouput request", str.str()); + } + } + } + writeTimeStepWithCellProperties(timer, localState, localWellState, cellData, substep); } } From 1882d3315ad36d88786d2e26d7f8004379a6b49f Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 11 Nov 2016 11:55:54 +0100 Subject: [PATCH 11/11] Do not throw for unrecognized file when merging log files. The regex we are using might also consider a file named bla.2.blub. In that case it is not nice to throw an exception. Instead we print a message to std::cerr. --- opm/simulators/ParallelFileMerger.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/simulators/ParallelFileMerger.hpp b/opm/simulators/ParallelFileMerger.hpp index 58ddd0d6e..bceb2fe00 100644 --- a/opm/simulators/ParallelFileMerger.hpp +++ b/opm/simulators/ParallelFileMerger.hpp @@ -83,10 +83,10 @@ public: } else { - OPM_THROW(std::runtime_error, - "Unrecognized file with name " + std::cerr << "WARNING: Unrecognized file with name " << filename - << " from parallel run."); + << " that might stem from a parallel run." + << std::endl; } } }