split close wells from close connection

This commit is contained in:
Tor Harald Sandve 2018-07-03 15:13:30 +02:00
parent a5f5581441
commit 4a2780d161
3 changed files with 20 additions and 16 deletions

View File

@ -163,7 +163,7 @@ namespace Opm {
// Close wells and completions due to economical reasons
for (auto& well : well_container_) {
well->closeWellsAndCompletions(wellTestState_);
well->closeCompletions(wellTestState_);
}
}
@ -248,12 +248,12 @@ namespace Opm {
const size_t numberOfClosedCompletions = wellTestStateForTheWellTest.sizeCompletions();
well->solveWellForTesting(ebosSimulator_, wellStateCopy, B_avg, terminal_output_);
well->updateWellTestState(wellStateCopy, simulationTime, wellTestStateForTheWellTest, /*writeMessageToOPMLog=*/ false);
well->closeWellsAndCompletions(wellTestStateForTheWellTest);
well->closeCompletions(wellTestStateForTheWellTest);
// Stop testing if the well is closed or shut due to all completions shut
// Also check if number of completions has increased. If the number of closed completions do not increased
// we stop the testing.
if (wellTestStateForTheWellTest.sizeWells() > 0 && numberOfClosedCompletions == wellTestStateForTheWellTest.sizeCompletions())
if (wellTestStateForTheWellTest.sizeWells() > 0 || numberOfClosedCompletions == wellTestStateForTheWellTest.sizeCompletions())
testWell = false;
}
@ -338,14 +338,22 @@ namespace Opm {
const Well* well_ecl = wells_ecl_[index_well];
// well is shut due to economical reasons
if (wellTestState_.hasWell(well_name, WellTestConfig::Reason::ECONOMIC) && well_ecl->getAutomaticShutIn() ) {
well_state_.bhp()[w] = 0;
const int np = numPhases();
for (int p = 0; p < np; ++p) {
well_state_.wellRates()[np * w + p] = 0;
// well is closed due to economical reasons
if (wellTestState_.hasWell(well_name, WellTestConfig::Reason::ECONOMIC)) {
if( well_ecl->getAutomaticShutIn() ) {
// shut wells are not added to the well container
well_state_.bhp()[w] = 0;
const int np = numPhases();
for (int p = 0; p < np; ++p) {
well_state_.wellRates()[np * w + p] = 0;
}
continue;
}
else {
// close wells are added to the container but marked as closed
struct WellControls* well_controls = wells()->ctrls[w];
well_controls_stop_well(well_controls);
}
continue;
}
// Use the pvtRegionIdx from the top cell

View File

@ -227,7 +227,7 @@ namespace Opm
void solveWellForTesting(Simulator& ebosSimulator, WellState& well_state, const std::vector<double>& B_avg, bool terminal_output);
void closeWellsAndCompletions(WellTestState& wellTestState);
void closeCompletions(WellTestState& wellTestState);
const Well* wellEcl() const;

View File

@ -913,12 +913,8 @@ namespace Opm
template<typename TypeTag>
void
WellInterface<TypeTag>::closeWellsAndCompletions(WellTestState& wellTestState)
WellInterface<TypeTag>::closeCompletions(WellTestState& wellTestState)
{
if (wellTestState.hasWell(name(), WellTestConfig::Reason::ECONOMIC)) {
well_controls_stop_well(wellControls());
}
const auto& connections = well_ecl_->getConnections(current_step_);
int perfIdx = 0;
for (const auto& connection : connections) {