Fixes perf rate initialization for distributed wells.

This commit is contained in:
Markus Blatt
2020-12-07 16:04:57 +01:00
parent 6e87ec6266
commit 3c66b729e1
2 changed files with 26 additions and 8 deletions

View File

@@ -27,6 +27,8 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <memory>
#include <iterator>
#include <numeric>
namespace Opm
{
@@ -197,6 +199,16 @@ public:
/// \brief Inidicate completion of reset of the ecl index information
void endReset();
/// \brief Sum all the values of the perforations
template<typename It>
typename std::iterator_traits<It>::value_type sumPerfValues(It begin, It end)
{
using V = typename std::iterator_traits<It>::value_type;
/// \todo cater for overlap later. Currently only owner
auto local = std::accumulate(begin, end, V());
return communication().sum(local);
}
/// \brief Free data of communication data structures.
void clearCommunicateAbove();
private: