From 2ac7b5e4bfde01a3ab143aba2d771b4b064c8f6a Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sat, 15 May 2021 08:49:14 +0200 Subject: [PATCH] Reorder variables and remove .reserve() calls --- opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp | 9 +++------ opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp | 9 +++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp index f0ad4cadf..52bf2f24e 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.cpp @@ -537,21 +537,18 @@ void WellStateFullyImplicitBlackoil::initWellStateMSWell(const std::vector { // still using the order in wells const int nw = wells_ecl.size(); - const auto& pu = this->phaseUsage(); - const int np = pu.num_phases; if (nw == 0) { return; } + const auto& pu = this->phaseUsage(); + const int np = pu.num_phases; top_segment_index_.clear(); - top_segment_index_.reserve(nw); seg_press_.clear(); - seg_press_.reserve(nw); seg_rates_.clear(); - seg_rates_.reserve(nw * numPhases()); seg_number_.clear(); - nseg_ = 0; + // in the init function, the well rates and perforation rates have been initialized or copied from prevState // what we do here, is to set the segment rates and perforation rates for (int w = 0; w < nw; ++w) { diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index ffc9d6a3b..da67f0661 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -424,6 +424,11 @@ private: // for StandardWell, the number of segments will be one std::vector seg_rates_; std::vector seg_press_; + // the index of the top segments, which is used to locate the + // multisegment well related information in WellState + std::vector top_segment_index_; + int nseg_; // total number of the segments + // The following data are only recorded for output // pressure drop std::vector seg_pressdrop_; @@ -433,10 +438,6 @@ private: std::vector seg_pressdrop_hydorstatic_; // accelerational pressure drop std::vector seg_pressdrop_acceleration_; - // the index of the top segments, which is used to locate the - // multisegment well related information in WellState - std::vector top_segment_index_; - int nseg_; // total number of the segments // Productivity Index std::vector productivity_index_;