From af849bf9e99c3f7c61ae342ee6c6ffd13686162f Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Fri, 13 Apr 2012 14:22:44 +0200 Subject: [PATCH] Added computations for total flow for each well --- opm/core/utility/miscUtilities.cpp | 14 ++++++++++++++ opm/core/utility/miscUtilities.hpp | 3 +++ 2 files changed, 17 insertions(+) diff --git a/opm/core/utility/miscUtilities.cpp b/opm/core/utility/miscUtilities.cpp index 52a1457c7..5dfbbdad4 100644 --- a/opm/core/utility/miscUtilities.cpp +++ b/opm/core/utility/miscUtilities.cpp @@ -437,6 +437,20 @@ namespace Opm } } } + + void computeFlowRatePerWell(const Wells& wells, const std::vector& flow_rates_per_cell, + std::vector& flow_rates_per_well) + { + int index_in_flow_rates = 0; + for(int w = 0; w < wells.number_of_wells; w++) { + int number_of_cells = wells.well_connpos[w+1]-wells.well_connpos[w]; + double flow_sum = 0.0; + for(int i = 0; i < number_of_cells; i++) { + flow_sum += flow_rates_per_cell[index_in_flow_rates++]; + } + flow_rates_per_well.push_back(flow_sum); + } + } } // namespace Opm diff --git a/opm/core/utility/miscUtilities.hpp b/opm/core/utility/miscUtilities.hpp index 72edea5ae..6ef992f60 100644 --- a/opm/core/utility/miscUtilities.hpp +++ b/opm/core/utility/miscUtilities.hpp @@ -180,6 +180,9 @@ namespace Opm void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector& saturations, const std::vector& densities, std::vector& wdp); + void computeFlowRatePerWell(const Wells& wells, const std::vector& flow_rates_per_cell, + std::vector& flow_rates_per_well); + /// Encapsulates the watercut curves. class Watercut {