From 0ab04b04cd4156ac028cf6e7eb9aaa5242b84f68 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 17 Nov 2016 14:21:46 +0100 Subject: [PATCH] checking whethter group control is active When applying group control related functions. --- opm/autodiff/BlackoilModelBase_impl.hpp | 17 +++++++++++------ opm/autodiff/MultisegmentWells.cpp | 1 + opm/autodiff/MultisegmentWells_impl.hpp | 20 +++++++++++--------- opm/autodiff/StandardWells_impl.hpp | 24 ++++++++++++++---------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index f56ccb89f..dbbcc7322 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -790,10 +790,12 @@ namespace detail { // get reasonable initial conditions for the wells asImpl().wellModel().updateWellControls(well_state); - // enforce VREP control when necessary. - applyVREPGroupControl(reservoir_state, well_state); + if (asImpl().wellModel().wellCollection()->groupControlActive()) { + // enforce VREP control when necessary. + applyVREPGroupControl(reservoir_state, well_state); - asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates()); + asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates()); + } // Create the primary variables. SolutionState state = asImpl().variableState(reservoir_state, well_state); @@ -1097,9 +1099,12 @@ namespace detail { // wells active or not as parallel logging will take place that needs to // communicate with all processes. asImpl().wellModel().updateWellControls(well_state); - // Enforce the VREP control - applyVREPGroupControl(reservoir_state, well_state); - asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates()); + + if (asImpl().wellModel().wellCollection()->groupControlActive()) { + // Enforce the VREP control + applyVREPGroupControl(reservoir_state, well_state); + asImpl().wellModel().wellCollection()->updateWellTargets(well_state.wellRates()); + } } while (it < 15); if (converged) { diff --git a/opm/autodiff/MultisegmentWells.cpp b/opm/autodiff/MultisegmentWells.cpp index 35730f41f..ef8403d98 100644 --- a/opm/autodiff/MultisegmentWells.cpp +++ b/opm/autodiff/MultisegmentWells.cpp @@ -147,6 +147,7 @@ namespace Opm { : wells_multisegment_( createMSWellVector(wells_arg, wells_ecl, time_step) ) , wops_ms_(wells_multisegment_) , well_collection_(well_collection) + , well_perforation_efficiency_factors_(Vector::Ones(numWells())) , num_phases_(wells_arg ? wells_arg->number_of_phases : 0) , wells_(wells_arg) , fluid_(nullptr) diff --git a/opm/autodiff/MultisegmentWells_impl.hpp b/opm/autodiff/MultisegmentWells_impl.hpp index e4e0392a3..6c2863296 100644 --- a/opm/autodiff/MultisegmentWells_impl.hpp +++ b/opm/autodiff/MultisegmentWells_impl.hpp @@ -904,16 +904,18 @@ namespace Opm break; } - // get the well node in the well collection - WellNode& well_node = well_collection_->findWellNode(std::string(wells().name[w])); + if (wellCollection()->groupControlActive()) { + // get the well node in the well collection + WellNode& well_node = well_collection_->findWellNode(std::string(wells().name[w])); - // update whehter the well is under group control or individual control - if (well_node.groupControlIndex() >= 0 && current == well_node.groupControlIndex()) { - // under group control - well_node.setIndividualControl(false); - } else { - // individual control - well_node.setIndividualControl(true); + // update whehter the well is under group control or individual control + if (well_node.groupControlIndex() >= 0 && current == well_node.groupControlIndex()) { + // under group control + well_node.setIndividualControl(false); + } else { + // individual control + well_node.setIndividualControl(true); + } } } diff --git a/opm/autodiff/StandardWells_impl.hpp b/opm/autodiff/StandardWells_impl.hpp index cdd506acc..983ecce7d 100644 --- a/opm/autodiff/StandardWells_impl.hpp +++ b/opm/autodiff/StandardWells_impl.hpp @@ -76,7 +76,7 @@ namespace Opm , wells_(wells_arg) , wops_(wells_arg) , well_collection_(well_collection) - , well_perforation_efficiency_factors_(Vector()) + , well_perforation_efficiency_factors_(Vector::Ones(wells_!=nullptr ? wells_->well_connpos[wells_->number_of_wells] : 0)) , fluid_(nullptr) , active_(nullptr) , phase_condition_(nullptr) @@ -852,16 +852,20 @@ namespace Opm break; } - // get well node in the well collection - WellNode& well_node = well_collection_->findWellNode(std::string(wells().name[w])); - // update whehter the well is under group control or individual control - if (well_node.groupControlIndex() >= 0 && current == well_node.groupControlIndex()) { - // under group control - well_node.setIndividualControl(false); - } else { - // individual control - well_node.setIndividualControl(true); + if (wellCollection()->groupControlActive()) { + + // get well node in the well collection + WellNode& well_node = well_collection_->findWellNode(std::string(wells().name[w])); + + // update whehter the well is under group control or individual control + if (well_node.groupControlIndex() >= 0 && current == well_node.groupControlIndex()) { + // under group control + well_node.setIndividualControl(false); + } else { + // individual control + well_node.setIndividualControl(true); + } } }