mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge remote-tracking branch 'origin/master' into frankenstein
* origin/master: Do not throw for unrecognized file when merging log files. Do not populate cellData but issue a warning in parallel. Removed ternary operator in inline initialization. Correctly mark transfer of ownership for ouptut writer Indent nested #if Remove Solution.sdc assignment Cater variable name change in BCRSMatrix of DUNE 2.5 Fix using local active cells for writing eclipse files in parallel. add restart test for SPE1CASE2_ACTNUM rename the 'flow' binary to 'flow_legacy' and set a symbolic link Added ctest for restart files
This commit is contained in:
commit
d989c1e2fc
@ -128,7 +128,7 @@ endif (NOT EIGEN3_FOUND)
|
|||||||
|
|
||||||
|
|
||||||
if (HAVE_OPM_DATA)
|
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_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)
|
add_test( NAME flow_MSW2DH__ COMMAND flow_multisegment ${OPM_DATA_ROOT}/wells_test_suite/MSW/2D_H__/2D_H__.DATA)
|
||||||
@ -136,14 +136,23 @@ if (HAVE_OPM_DATA)
|
|||||||
if (ERT_PYTHON_PATH)
|
if (ERT_PYTHON_PATH)
|
||||||
include(OpmPythonTest)
|
include(OpmPythonTest)
|
||||||
|
|
||||||
opm_add_python_test( check_INIT_SPE1 ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $<TARGET_FILE:flow> ${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 $<TARGET_FILE:flow_legacy> ${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 )
|
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 $<TARGET_FILE:flow> ${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 $<TARGET_FILE:flow_legacy> ${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
|
opm_add_python_test( check_RESTART_SPE1CASE2
|
||||||
${PROJECT_SOURCE_DIR}/tests/check_RESTART.py
|
${PROJECT_SOURCE_DIR}/tests/check_RESTART.py
|
||||||
$<TARGET_FILE:flow> ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ${OPM_DATA_ROOT}/spe1/SPE1CASE2_RESTART.DATA )
|
$<TARGET_FILE:flow_legacy> ${OPM_DATA_ROOT}/spe1/SPE1CASE2.DATA ${OPM_DATA_ROOT}/spe1/SPE1CASE2_RESTART.DATA )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include (${CMAKE_CURRENT_SOURCE_DIR}/compareECLFiles.cmake)
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ list (APPEND TEST_DATA_FILES
|
|||||||
# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort
|
# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort
|
||||||
list (APPEND EXAMPLE_SOURCE_FILES
|
list (APPEND EXAMPLE_SOURCE_FILES
|
||||||
examples/find_zero.cpp
|
examples/find_zero.cpp
|
||||||
examples/flow.cpp
|
examples/flow_legacy.cpp
|
||||||
examples/flow_sequential.cpp
|
examples/flow_sequential.cpp
|
||||||
examples/flow_ebos.cpp
|
examples/flow_ebos.cpp
|
||||||
examples/flow_multisegment.cpp
|
examples/flow_multisegment.cpp
|
||||||
@ -126,7 +126,7 @@ list (APPEND PROGRAM_SOURCE_FILES
|
|||||||
examples/sim_2p_incomp.cpp
|
examples/sim_2p_incomp.cpp
|
||||||
examples/sim_2p_incomp_ad.cpp
|
examples/sim_2p_incomp_ad.cpp
|
||||||
examples/sim_2p_comp_reorder.cpp
|
examples/sim_2p_comp_reorder.cpp
|
||||||
examples/flow.cpp
|
examples/flow_legacy.cpp
|
||||||
examples/flow_sequential.cpp
|
examples/flow_sequential.cpp
|
||||||
examples/flow_solvent.cpp
|
examples/flow_solvent.cpp
|
||||||
examples/opm_init_check.cpp
|
examples/opm_init_check.cpp
|
||||||
|
@ -27,6 +27,28 @@ macro (add_test_compareECLFiles casename filename)
|
|||||||
TEST_ARGS ${OPM_DATA_ROOT}/${casename}/${filename}.DATA )
|
TEST_ARGS ${OPM_DATA_ROOT}/${casename}/${filename}.DATA )
|
||||||
endmacro (add_test_compareECLFiles)
|
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)
|
if(NOT TARGET test-suite)
|
||||||
add_custom_target(test-suite)
|
add_custom_target(test-suite)
|
||||||
@ -37,3 +59,9 @@ opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-regressionTest.sh "")
|
|||||||
add_test_compareECLFiles(spe1 SPE1CASE2)
|
add_test_compareECLFiles(spe1 SPE1CASE2)
|
||||||
add_test_compareECLFiles(spe3 SPE3CASE1)
|
add_test_compareECLFiles(spe3 SPE3CASE1)
|
||||||
add_test_compareECLFiles(spe9 SPE9_CP_SHORT)
|
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)
|
||||||
|
add_test_compareECLRestartFiles(spe1 SPE1CASE2_ACTNUM)
|
||||||
|
@ -239,8 +239,13 @@ try
|
|||||||
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
std::cout << "\n\n================ Starting main simulation loop ===============\n"
|
||||||
<< std::flush;
|
<< std::flush;
|
||||||
|
|
||||||
|
std::unique_ptr<Opm::EclipseWriter>
|
||||||
|
eclipseWriter(new Opm::EclipseWriter(*eclipseState,
|
||||||
|
UgGridHelpers
|
||||||
|
::createEclipseGrid( cGrid ,
|
||||||
|
eclipseState->getInputGrid())));
|
||||||
Opm::BlackoilOutputWriter
|
Opm::BlackoilOutputWriter
|
||||||
outputWriter(cGrid, param, *eclipseState, pu,
|
outputWriter(cGrid, param, *eclipseState, std::move(eclipseWriter), pu,
|
||||||
new_props->permeability() );
|
new_props->permeability() );
|
||||||
|
|
||||||
SimulatorReport fullReport;
|
SimulatorReport fullReport;
|
||||||
|
@ -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.insert( "SSOL", UnitSystem::measure::identity, reservoir.getCellData( BlackoilSolventState::SSOL ) , data::TargetType::RESTART_SOLUTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
sol.sdc = &reservoir;
|
|
||||||
|
|
||||||
return sol;
|
return sol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,11 @@ namespace Opm
|
|||||||
nnz = ia[rows];
|
nnz = ia[rows];
|
||||||
|
|
||||||
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 3)
|
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 3)
|
||||||
|
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 5)
|
||||||
|
this->allocationSize_ = nnz;
|
||||||
|
#else
|
||||||
this->allocationSize = nnz;
|
this->allocationSize = nnz;
|
||||||
|
#endif
|
||||||
this->avg = 0;
|
this->avg = 0;
|
||||||
this->overflowsize = -1.0;
|
this->overflowsize = -1.0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -229,6 +229,7 @@ namespace Opm
|
|||||||
// distributeData()
|
// distributeData()
|
||||||
boost::any parallel_information_;
|
boost::any parallel_information_;
|
||||||
// setupOutputWriter()
|
// setupOutputWriter()
|
||||||
|
std::unique_ptr<EclipseWriter> eclipse_writer_;
|
||||||
std::unique_ptr<OutputWriter> output_writer_;
|
std::unique_ptr<OutputWriter> output_writer_;
|
||||||
// setupLinearSolver
|
// setupLinearSolver
|
||||||
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
std::unique_ptr<NewtonIterationBlackoilInterface> fis_solver_;
|
||||||
@ -755,9 +756,9 @@ namespace Opm
|
|||||||
if( output && output_ecl && output_cout_)
|
if( output && output_ecl && output_cout_)
|
||||||
{
|
{
|
||||||
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
|
const EclipseGrid& inputGrid = eclipse_state_->getInputGrid();
|
||||||
EclipseWriter writer(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid ));
|
eclipse_writer_.reset(new EclipseWriter(*eclipse_state_, UgGridHelpers::createEclipseGrid( grid , inputGrid )));
|
||||||
writer.writeInitAndEgrid(geoprops_->simProps(grid),
|
eclipse_writer_->writeInitAndEgrid(geoprops_->simProps(grid),
|
||||||
geoprops_->nonCartesianConnections());
|
geoprops_->nonCartesianConnections());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,6 +774,7 @@ namespace Opm
|
|||||||
output_writer_.reset(new OutputWriter(grid_init_->grid(),
|
output_writer_.reset(new OutputWriter(grid_init_->grid(),
|
||||||
param_,
|
param_,
|
||||||
*eclipse_state_,
|
*eclipse_state_,
|
||||||
|
std::move(eclipse_writer_),
|
||||||
Opm::phaseUsageFromDeck(*deck_),
|
Opm::phaseUsageFromDeck(*deck_),
|
||||||
fluidprops_->permeability()));
|
fluidprops_->permeability()));
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriter(const Grid& grid,
|
BlackoilOutputWriter(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
|
std::unique_ptr<EclipseWriter>&& eclWriter,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability );
|
const double* permeability );
|
||||||
|
|
||||||
@ -328,6 +329,7 @@ namespace Opm
|
|||||||
BlackoilOutputWriter(const Grid& grid,
|
BlackoilOutputWriter(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
|
std::unique_ptr<EclipseWriter>&& eclWriter,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability )
|
const double* permeability )
|
||||||
: output_( param.getDefault("output", true) ),
|
: output_( param.getDefault("output", true) ),
|
||||||
@ -336,49 +338,58 @@ namespace Opm
|
|||||||
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
||||||
lastBackupReportStep_( -1 ),
|
lastBackupReportStep_( -1 ),
|
||||||
phaseUsage_( phaseUsage ),
|
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) ?
|
|
||||||
new EclipseWriter(eclipseState,UgGridHelpers::createEclipseGrid( grid , eclipseState.getInputGrid()))
|
|
||||||
: 0 ),
|
|
||||||
eclipseState_(eclipseState),
|
eclipseState_(eclipseState),
|
||||||
asyncOutput_()
|
asyncOutput_()
|
||||||
{
|
{
|
||||||
// For output.
|
// For output.
|
||||||
if (output_ && parallelOutput_->isIORank() ) {
|
if ( output_ )
|
||||||
// Ensure that output dir exists
|
{
|
||||||
boost::filesystem::path fpath(outputDir_);
|
if ( param.getDefault("output_vtk",false) )
|
||||||
try {
|
{
|
||||||
create_directories(fpath);
|
vtkWriter_
|
||||||
}
|
.reset(new BlackoilVTKWriter< Grid >( grid, outputDir_ ));
|
||||||
catch (...) {
|
|
||||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create output thread if enabled and rank is I/O rank
|
if( parallelOutput_->isIORank() ) {
|
||||||
// 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 ( param.getDefault("output_matlab", false ) )
|
||||||
if( ! backupfilename.empty() )
|
{
|
||||||
{
|
matlabWriter_
|
||||||
backupfile_.open( backupfilename.c_str() );
|
.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() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -774,15 +785,55 @@ namespace Opm
|
|||||||
const Model& physicalModel,
|
const Model& physicalModel,
|
||||||
bool substep)
|
bool substep)
|
||||||
{
|
{
|
||||||
|
data::Solution cellData{};
|
||||||
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
||||||
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
||||||
const int reportStepNum = timer.reportStepNum();
|
const int reportStepNum = timer.reportStepNum();
|
||||||
bool logMessages = output_ && parallelOutput_->isIORank();
|
bool logMessages = output_ && parallelOutput_->isIORank();
|
||||||
|
|
||||||
data::Solution cellData;
|
if( output_ && !parallelOutput_->isParallel() )
|
||||||
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<std::string, int> rstKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
||||||
|
std::vector<const char*> 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);
|
writeTimeStepWithCellProperties(timer, localState, localWellState, cellData, substep);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
@ -68,7 +69,8 @@ namespace Opm
|
|||||||
template <class Grid>
|
template <class Grid>
|
||||||
BlackoilOutputWriterEbos(const Grid& grid,
|
BlackoilOutputWriterEbos(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const EclipseState& eclipseState,
|
||||||
|
std::unique_ptr<EclipseWriter>&& eclWriter,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
const double* permeability );
|
const double* permeability );
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ namespace Opm
|
|||||||
|
|
||||||
std::ofstream backupfile_;
|
std::ofstream backupfile_;
|
||||||
Opm::PhaseUsage phaseUsage_;
|
Opm::PhaseUsage phaseUsage_;
|
||||||
std::unique_ptr< EclipseWriter > eclWriter_;
|
std::unique_ptr<EclipseWriter> eclWriter_;
|
||||||
const EclipseState& eclipseState_;
|
const EclipseState& eclipseState_;
|
||||||
|
|
||||||
std::unique_ptr< ThreadHandle > asyncOutput_;
|
std::unique_ptr< ThreadHandle > asyncOutput_;
|
||||||
@ -170,25 +172,24 @@ namespace Opm
|
|||||||
inline
|
inline
|
||||||
BlackoilOutputWriterEbos::
|
BlackoilOutputWriterEbos::
|
||||||
BlackoilOutputWriterEbos(const Grid& grid,
|
BlackoilOutputWriterEbos(const Grid& grid,
|
||||||
const parameter::ParameterGroup& param,
|
const parameter::ParameterGroup& param,
|
||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const Opm::PhaseUsage &phaseUsage,
|
std::unique_ptr<EclipseWriter>&& eclWriter,
|
||||||
const double* permeability )
|
const Opm::PhaseUsage &phaseUsage,
|
||||||
|
const double* permeability )
|
||||||
: output_( param.getDefault("output", true) ),
|
: output_( param.getDefault("output", true) ),
|
||||||
parallelOutput_( output_ ? new ParallelDebugOutput< Grid >( grid, eclipseState, phaseUsage.num_phases, permeability ) : 0 ),
|
parallelOutput_( output_ ? new ParallelDebugOutput< Grid >( grid, eclipseState, phaseUsage.num_phases, permeability ) : 0 ),
|
||||||
outputDir_( output_ ? param.getDefault("output_dir", std::string("output")) : "." ),
|
outputDir_( output_ ? param.getDefault("output_dir", std::string("output")) : "." ),
|
||||||
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
||||||
lastBackupReportStep_( -1 ),
|
lastBackupReportStep_( -1 ),
|
||||||
phaseUsage_( phaseUsage ),
|
phaseUsage_( phaseUsage ),
|
||||||
eclWriter_( output_ && parallelOutput_->isIORank() &&
|
|
||||||
param.getDefault("output_ecl", true) ?
|
|
||||||
new EclipseWriter(eclipseState,UgGridHelpers::createEclipseGrid( grid , eclipseState.getInputGrid()))
|
|
||||||
: 0 ),
|
|
||||||
eclipseState_(eclipseState),
|
eclipseState_(eclipseState),
|
||||||
asyncOutput_()
|
asyncOutput_()
|
||||||
{
|
{
|
||||||
// For output.
|
// For output.
|
||||||
if (output_ && parallelOutput_->isIORank() ) {
|
if (output_ && parallelOutput_->isIORank() ) {
|
||||||
|
eclWriter_ = std::move(eclWriter);
|
||||||
|
|
||||||
// Ensure that output dir exists
|
// Ensure that output dir exists
|
||||||
boost::filesystem::path fpath(outputDir_);
|
boost::filesystem::path fpath(outputDir_);
|
||||||
try {
|
try {
|
||||||
@ -524,11 +525,126 @@ namespace Opm
|
|||||||
|
|
||||||
return sol;
|
return sol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the summaryConfig has a keyword with the standardized field, region, or block prefixes.
|
||||||
|
*/
|
||||||
|
inline bool hasFRBKeyword(const SummaryConfig& summaryConfig, const std::string keyword) {
|
||||||
|
std::string field_kw = "F" + keyword;
|
||||||
|
std::string region_kw = "R" + keyword;
|
||||||
|
std::string block_kw = "B" + keyword;
|
||||||
|
return summaryConfig.hasKeyword(field_kw)
|
||||||
|
|| summaryConfig.hasKeyword(region_kw)
|
||||||
|
|| summaryConfig.hasKeyword(block_kw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the data as asked for in the summaryConfig
|
||||||
|
*/
|
||||||
|
template<class Model>
|
||||||
|
void getSummaryData(data::Solution& output,
|
||||||
|
const Opm::PhaseUsage& phaseUsage,
|
||||||
|
const Model& physicalModel,
|
||||||
|
const SummaryConfig& summaryConfig)
|
||||||
|
{
|
||||||
|
//Get shorthands for water, oil, gas
|
||||||
|
const int aqua_active = phaseUsage.phase_used[Opm::PhaseUsage::Aqua];
|
||||||
|
const int liquid_active = phaseUsage.phase_used[Opm::PhaseUsage::Liquid];
|
||||||
|
const int vapour_active = phaseUsage.phase_used[Opm::PhaseUsage::Vapour];
|
||||||
|
|
||||||
|
#warning "TODO: fluid in place"
|
||||||
|
#if 0
|
||||||
|
#warning "TODO"
|
||||||
|
const int numFip = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now process all of the summary config files
|
||||||
|
*/
|
||||||
|
// Water in place
|
||||||
|
if (aqua_active && hasFRBKeyword(summaryConfig, "WIP")) {
|
||||||
|
#warning "TODO"
|
||||||
|
const std::vector<double> wip(numFip, 0.0);
|
||||||
|
output.insert("WIP",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
wip,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
if (liquid_active) {
|
||||||
|
#warning "TODO"
|
||||||
|
const std::vector<double> oipl(numFip, 0.0);
|
||||||
|
const std::vector<double> oipg(numFip, 0.0);
|
||||||
|
const std::vector<double> oip(numFip, 0.0);
|
||||||
|
|
||||||
|
//Oil in place (liquid phase only)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "OIPL")) {
|
||||||
|
output.insert("OIPL",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
oipl,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
//Oil in place (gas phase only)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "OIPG")) {
|
||||||
|
output.insert("OIPG",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
oipg,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
// Oil in place (in liquid and gas phases)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "OIP")) {
|
||||||
|
output.insert("OIP",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
oip,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vapour_active) {
|
||||||
|
#warning "TODO"
|
||||||
|
const std::vector<double> gipl(numFip, 0.0);
|
||||||
|
const std::vector<double> gipg(numFip, 0.0);
|
||||||
|
const std::vector<double> gip(numFip, 0.0);
|
||||||
|
|
||||||
|
// Gas in place (gas phase only)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "GIPG")) {
|
||||||
|
output.insert("GIPG",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
gipg,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
// Gas in place (liquid phase only)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "GIPL")) {
|
||||||
|
output.insert("GIPL",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
gipl,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
// Gas in place (in both liquid and gas phases)
|
||||||
|
if (hasFRBKeyword(summaryConfig, "GIP")) {
|
||||||
|
output.insert("GIP",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
gip,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Cell pore volume in reservoir conditions
|
||||||
|
if (hasFRBKeyword(summaryConfig, "RPV")) {
|
||||||
|
const std::vector<double> pv(numFip, 0.0);
|
||||||
|
output.insert("RPV",
|
||||||
|
Opm::UnitSystem::measure::volume,
|
||||||
|
pv,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
// Pressure averaged value (hydrocarbon pore volume weighted)
|
||||||
|
if (summaryConfig.hasKeyword("FPRH") || summaryConfig.hasKeyword("RPRH")) {
|
||||||
|
const std::vector<double> prh(numFip, 0.0);
|
||||||
|
output.insert("PRH",
|
||||||
|
Opm::UnitSystem::measure::pressure,
|
||||||
|
prh,
|
||||||
|
data::TargetType::SUMMARY );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class Model>
|
template<class Model>
|
||||||
inline void
|
inline void
|
||||||
BlackoilOutputWriterEbos::
|
BlackoilOutputWriterEbos::
|
||||||
@ -538,10 +654,56 @@ namespace Opm
|
|||||||
const Model& physicalModel,
|
const Model& physicalModel,
|
||||||
bool substep)
|
bool substep)
|
||||||
{
|
{
|
||||||
|
data::Solution cellData{};
|
||||||
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
||||||
|
const SummaryConfig& summaryConfig = eclipseState_.getSummaryConfig();
|
||||||
const int reportStepNum = timer.reportStepNum();
|
const int reportStepNum = timer.reportStepNum();
|
||||||
Opm::data::Solution sol = detail::getOutputDataEbos( phaseUsage_, physicalModel, restartConfig, reportStepNum );
|
bool logMessages = output_ && parallelOutput_->isIORank();
|
||||||
writeTimeStepWithCellProperties(timer, localState, localWellState, sol, substep);
|
|
||||||
|
if( output_ && !parallelOutput_->isParallel() )
|
||||||
|
{
|
||||||
|
//detail::getRestartData( cellData, phaseUsage_, physicalModel,
|
||||||
|
// restartConfig, reportStepNum, logMessages );
|
||||||
|
detail::getSummaryData( cellData, phaseUsage_, physicalModel, summaryConfig );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( logMessages )
|
||||||
|
{
|
||||||
|
std::map<std::string, int> rstKeywords = restartConfig.getRestartKeywords(reportStepNum);
|
||||||
|
std::vector<const char*> 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,10 +83,10 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OPM_THROW(std::runtime_error,
|
std::cerr << "WARNING: Unrecognized file with name "
|
||||||
"Unrecognized file with name "
|
|
||||||
<< filename
|
<< filename
|
||||||
<< " from parallel run.");
|
<< " that might stem from a parallel run."
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
tests/run-restart-regressionTest.sh
Executable file
24
tests/run-restart-regressionTest.sh
Executable file
@ -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}
|
Loading…
Reference in New Issue
Block a user