diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index ff3150782..a8f20886c 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -143,18 +143,16 @@ namespace Opm assert((wells->type[w] == INJECTOR) || (wells->type[w] == PRODUCER)); const WellControls* ctrl = wells->ctrls[w]; - if (well_controls_well_is_stopped(ctrl)) { - // Shut well: perfphaserates_ are all zero. - } else { - const int num_perf_this_well = wells->well_connpos[w + 1] - wells->well_connpos[w]; - // Open well: Initialize perfphaserates_ to well - // rates divided by the number of perforations. - for (int perf = wells->well_connpos[w]; perf < wells->well_connpos[w + 1]; ++perf) { + const int num_perf_this_well = wells->well_connpos[w + 1] - wells->well_connpos[w]; + // Open well: Initialize perfphaserates_ to well + // rates divided by the number of perforations. + for (int perf = wells->well_connpos[w]; perf < wells->well_connpos[w + 1]; ++perf) { + if (well_controls_well_is_open(ctrl)) { for (int p = 0; p < np; ++p) { perfphaserates_[np*perf + p] = wellRates()[np*w + p] / double(num_perf_this_well); } - perfPress()[perf] = cellPressures[wells->well_cells[perf]]; } + perfPress()[perf] = cellPressures[wells->well_cells[perf]]; } } diff --git a/tests/test_wellstatefullyimplicitblackoil.cpp b/tests/test_wellstatefullyimplicitblackoil.cpp index 464370f5f..69ad020ec 100644 --- a/tests/test_wellstatefullyimplicitblackoil.cpp +++ b/tests/test_wellstatefullyimplicitblackoil.cpp @@ -303,4 +303,18 @@ BOOST_AUTO_TEST_CASE(Rates) } } +// --------------------------------------------------------------------- + +BOOST_AUTO_TEST_CASE(STOP_well) +{ + /* + This test verifies that the perforation pressures is correctly initialized + also for wells in the STOP state. + */ + const Setup setup{ "wells_manager_data_wellSTOP.data" }; + auto wstate = buildWellState(setup, 0); + for (const auto& p : wstate.perfPress()) + BOOST_CHECK(p > 0); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/wells_manager_data_wellSTOP.data b/tests/wells_manager_data_wellSTOP.data index 54eea039e..351f3f7c1 100644 --- a/tests/wells_manager_data_wellSTOP.data +++ b/tests/wells_manager_data_wellSTOP.data @@ -35,11 +35,17 @@ SCHEDULE WELSPECS 'INJ1' 'G' 1 1 8335 'GAS' / 'PROD1' 'G' 10 10 8400 'OIL' / + 'STOP' 'G' 5 5 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 / + 'STOP' 5 3 1 3 'OPEN' 0 10.6092 0.5 / +/ + +WCONHIST + 'STOP' 'STOP' 'GRAT' 0 0 0 / / WCONPROD