Removed WELOPEN from constructor, added throwing on non OPEN/SHUT statuses
This commit is contained in:
parent
e1f104ccdd
commit
8cdaf7d05d
@ -183,6 +183,7 @@ list (APPEND TEST_DATA_FILES
|
||||
tests/testBlackoilState2.DATA
|
||||
tests/wells_manager_data.data
|
||||
tests/wells_manager_data_expanded.data
|
||||
tests/wells_manager_data_wellSTOP.data
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
|
@ -312,34 +312,6 @@ namespace Opm
|
||||
|
||||
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.
|
||||
if (deck.hasField("GRUPTREE")) {
|
||||
std::cout << "Found gruptree" << std::endl;
|
||||
@ -1200,6 +1172,10 @@ namespace Opm
|
||||
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++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)) {
|
||||
clear_well_controls(well_index, w_);
|
||||
int ok = 1;
|
||||
|
@ -262,6 +262,14 @@ BOOST_AUTO_TEST_CASE(New_Constructor_Works_ExpandedData) {
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -72,7 +72,15 @@ WCONINJE
|
||||
|
||||
|
||||
TSTEP
|
||||
14.0
|
||||
/
|
||||
14.0 /
|
||||
/
|
||||
|
||||
WELOPEN
|
||||
'INJ1' 'SHUT' 5* /
|
||||
/
|
||||
|
||||
TSTEP
|
||||
14.0 /
|
||||
/
|
||||
|
||||
END
|
||||
|
42
tests/wells_manager_data_wellSTOP.data
Executable file
42
tests/wells_manager_data_wellSTOP.data
Executable 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
|
Loading…
Reference in New Issue
Block a user