Merge remote-tracking branch 'upstream/opm-parser-integrate' into opm-parser-integrate

This commit is contained in:
Joakim Hove 2014-02-07 09:23:39 +01:00
commit 0b44f76333
8 changed files with 90 additions and 36 deletions

View File

@ -183,6 +183,7 @@ list (APPEND TEST_DATA_FILES
tests/testBlackoilState2.DATA tests/testBlackoilState2.DATA
tests/wells_manager_data.data tests/wells_manager_data.data
tests/wells_manager_data_expanded.data tests/wells_manager_data_expanded.data
tests/wells_manager_data_wellSTOP.data
) )
# originally generated with the command: # originally generated with the command:

View File

@ -31,13 +31,14 @@ if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P) endif (CMAKE_SIZEOF_VOID_P)
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
find_library (CJSON_LIBRARY find_library (CJSON_LIBRARY
NAMES "cjson" NAMES "cjson"
HINTS "${CJSON_ROOT}" HINTS "${CJSON_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../opm-parser" PATHS "${PROJECT_BINARY_DIR}/../opm-parser"
"${PROJECT_BINARY_DIR}/../opm-parser-build" "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/build" "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/cmake-build"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
"opm/json" "opm/json"
DOC "Path to cjson library archive/shared object files" DOC "Path to cjson library archive/shared object files"

View File

@ -31,6 +31,9 @@ if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT)
set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser") set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser")
endif () endif ()
# Detect the build dir suffix or subdirectory
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
# if a root is specified, then don't search in system directories # if a root is specified, then don't search in system directories
# or in relative directories to this one # or in relative directories to this one
if (OPM_PARSER_ROOT) if (OPM_PARSER_ROOT)
@ -43,9 +46,8 @@ else ()
"${PROJECT_SOURCE_DIR}/../opm-parser") "${PROJECT_SOURCE_DIR}/../opm-parser")
set (_opm_parser_build set (_opm_parser_build
"${PROJECT_BINARY_DIR}/../opm-parser" "${PROJECT_BINARY_DIR}/../opm-parser"
"${PROJECT_BINARY_DIR}/../opm-parser-build" "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/build" "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}")
"${PROJECT_BINARY_DIR}/../../opm-parser/cmake-build")
endif () endif ()
# use this header as signature # use this header as signature

View File

@ -59,6 +59,7 @@ set (_opm_proj_exemptions
dune-istl dune-istl
dune-grid dune-grid
dune-geometry dune-geometry
opm-parser
) )
# although a DUNE module, it is delivered in the OPM suite # although a DUNE module, it is delivered in the OPM suite

View File

@ -312,34 +312,6 @@ namespace Opm
setupWellControls(wells, timeStep, well_names, pu); setupWellControls(wells, timeStep, well_names, pu);
if (deck.hasField("WELOPEN")) {
const WELOPEN& welopen = deck.getWELOPEN();
for (size_t i = 0; i < welopen.welopen.size(); ++i) {
WelopenLine line = welopen.welopen[i];
std::string wellname = line.well_;
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
if (it == well_names_to_index.end()) {
OPM_THROW(std::runtime_error, "Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS.");
}
const int index = it->second;
if (line.openshutflag_ == "SHUT") {
int cur_ctrl = well_controls_get_current(w_->ctrls[index]);
if (cur_ctrl >= 0) {
well_controls_invert_current(w_->ctrls[index]);
}
assert(well_controls_get_current(w_->ctrls[index]) < 0);
} else if (line.openshutflag_ == "OPEN") {
int cur_ctrl = well_controls_get_current(w_->ctrls[index]);
if (cur_ctrl < 0) {
well_controls_invert_current(w_->ctrls[index]);
}
assert(well_controls_get_current(w_->ctrls[index]) >= 0);
} else {
OPM_THROW(std::runtime_error, "Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
}
}
}
// Build the well_collection_ well group hierarchy. // Build the well_collection_ well group hierarchy.
if (deck.hasField("GRUPTREE")) { if (deck.hasField("GRUPTREE")) {
std::cout << "Found gruptree" << std::endl; std::cout << "Found gruptree" << std::endl;
@ -1200,6 +1172,10 @@ namespace Opm
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) { for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) {
WellConstPtr well = (*wellIter); WellConstPtr well = (*wellIter);
if ( !( well->getStatus( timeStep ) == WellCommon::SHUT || well->getStatus( timeStep ) == WellCommon::OPEN) ) {
OPM_THROW(std::runtime_error, "Currently we do not support well status " << WellCommon::Status2String(well->getStatus( timeStep )));
}
if (well->isInjector(timeStep)) { if (well->isInjector(timeStep)) {
clear_well_controls(well_index, w_); clear_well_controls(well_index, w_);
int ok = 1; int ok = 1;

View File

@ -262,6 +262,14 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works_ExpandedData) {
BOOST_CHECK(wells_equal( wellsManager.c_wells(), oldWellsManager.c_wells(), true)); BOOST_CHECK(wells_equal( wellsManager.c_wells(), oldWellsManager.c_wells(), true));
} }
Deck.setCurrentEpoch(2);
{
Opm::WellsManager wellsManager(eclipseState, 2,Deck, *gridManager.c_grid(), NULL);
Opm::WellsManager oldWellsManager(Deck, *gridManager.c_grid(), NULL);
BOOST_CHECK(wells_equal( wellsManager.c_wells(), oldWellsManager.c_wells(), true));
}
} }
@ -303,3 +311,18 @@ BOOST_AUTO_TEST_CASE(ControlsEqual) {
} }
BOOST_AUTO_TEST_CASE(WellHasSTOP_ExceptionIsThrown) {
Opm::EclipseGridParser Deck("wells_manager_data_wellSTOP.data");
Opm::GridManager gridManager(Deck);
Opm::ParserPtr parser(new Opm::Parser());
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(parser->parseFile("wells_manager_data_wellSTOP.data")));
Deck.setCurrentEpoch(0);
BOOST_CHECK_THROW( new Opm::WellsManager(eclipseState, 0, Deck, *gridManager.c_grid(), NULL), std::runtime_error );
}

View File

@ -72,7 +72,15 @@ WCONINJE
TSTEP TSTEP
14.0 14.0 /
/ /
WELOPEN
'INJ1' 'SHUT' 5* /
/
TSTEP
14.0 /
/
END END

View File

@ -0,0 +1,42 @@
OIL
GAS
WATER
DIMENS
10 10 5 /
GRID
DXV
10*1000.0 /
DYV
10*1000.0 /
DZV
10.0 20.0 30.0 10.0 5.0 /
DEPTHZ
121*2000
/
SCHEDULE
WELSPECS
'INJ1' 'G' 1 1 8335 'GAS' /
'PROD1' 'G' 10 10 8400 'OIL' /
/
COMPDAT
'INJ1' 1 1 1 1 'OPEN' 1 10.6092 0.5 /
'PROD1' 10 3 3 3 'OPEN' 0 10.6092 0.5 /
/
WELOPEN
'INJ1' 'STOP' 5* /
/
TSTEP
10 /
END