From 5d457ff70816792ad384262c6d8358bd869ece8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Sun, 2 Jun 2013 23:30:43 +0200 Subject: [PATCH] Ensures well rate initialization actually happens. Do not use the well's comp_frac member, only rely on the control's distr member for initialization. This forced a change to WellsManager's initialization of the distr member. --- opm/core/simulator/WellState.hpp | 5 ++--- opm/core/wells/WellsManager.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index eb4e583df..9849bd680 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -60,11 +60,10 @@ namespace Opm } // Initialize well rates to match controls if type is SURFACE_RATE if ((ctrl->current >= 0) && // open well - (ctrl->type[ctrl->current] != SURFACE_RATE)) { + (ctrl->type[ctrl->current] == SURFACE_RATE)) { const double rate_target = ctrl->target[ctrl->current]; for (int p = 0; p < np; ++p) { - const double phase_distr = ctrl->distr[np * ctrl->current + p] - * wells->comp_frac[np * w + p]; + const double phase_distr = ctrl->distr[np * ctrl->current + p]; wellrates_[np*w + p] = rate_target * phase_distr; } } diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 328abd495..a32545595 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -505,13 +505,33 @@ namespace Opm int control_pos[5] = { -1, -1, -1, -1, -1 }; if (ok && wci_line.surface_flow_max_rate_ >= 0.0) { control_pos[InjectionControl::RATE] = w_->ctrls[wix]->num; - const double distr[3] = { 1.0, 1.0, 1.0 }; + double distr[3] = { 0.0, 0.0, 0.0 }; + if (wci_line.injector_type_ == "WATER") { + distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; + } else if (wci_line.injector_type_ == "OIL") { + distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; + } else if (wci_line.injector_type_ == "GAS") { + distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0; + } else { + THROW("Injector type " << wci_line.injector_type_ << " not supported." + "WellsManager only supports WATER, OIL and GAS injector types."); + } ok = append_well_controls(SURFACE_RATE, wci_line.surface_flow_max_rate_, distr, wix, w_); } if (ok && wci_line.reservoir_flow_max_rate_ >= 0.0) { control_pos[InjectionControl::RESV] = w_->ctrls[wix]->num; - const double distr[3] = { 1.0, 1.0, 1.0 }; + double distr[3] = { 0.0, 0.0, 0.0 }; + if (wci_line.injector_type_ == "WATER") { + distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; + } else if (wci_line.injector_type_ == "OIL") { + distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; + } else if (wci_line.injector_type_ == "GAS") { + distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0; + } else { + THROW("Injector type " << wci_line.injector_type_ << " not supported." + "WellsManager only supports WATER, OIL and GAS injector types."); + } ok = append_well_controls(RESERVOIR_RATE, wci_line.reservoir_flow_max_rate_, distr, wix, w_); }