Compare commits

...

3 Commits

Author SHA1 Message Date
Joakim Hove
63b663228a Bumped version to 2020.04-rc2 2020-04-23 10:33:41 +02:00
Joakim Hove
bf475b73b4 Segment sorting - check if already in order 2020-04-23 10:27:29 +02:00
Joakim Hove
1e734020f1 Update connections should hanlde empty list 2020-04-23 10:27:12 +02:00
6 changed files with 21 additions and 13 deletions

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
opm-common (2019.04-pre~xenial) xenial; urgency=medium
opm-common (2020.04-rc2-1~xenial) xenial; urgency=medium
* New release

View File

@@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2020.04-pre
Label: 2020.04-pre
Version: 2020.04-rc2
Label: 2020.04-rc2
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@@ -2,10 +2,10 @@
# spec file for package opm-common
#
%define tag final
%define tag rc2
Name: opm-common
Version: 2018.10
Version: 2020.04
Release: 0
Summary: Open Porous Media - common helpers and buildsystem
License: GPL-3.0

View File

@@ -20,6 +20,7 @@
#include <cmath>
#include <iostream>
#include <map>
#include <iterator>
#include <unordered_set>
#ifdef _WIN32
@@ -479,16 +480,19 @@ namespace Opm {
}
}
std::size_t head_index = 0;
while (head_index < segments.size()) {
auto head_iter = std::find_if(segments.begin() + head_index, segments.end(),
[&segment_set] (const Segment& segment) { return (segment_set.count(segment.outletSegment()) == 0); });
const auto& head_segment = segments[head_index];
if (segment_set.count(head_segment.outletSegment()) != 0) {
auto head_iter = std::find_if(std::next(segments.begin(), head_index), segments.end(),
[&segment_set] (const Segment& segment) { return (segment_set.count(segment.outletSegment()) == 0); });
if (head_iter == segments.end())
throw std::logic_error("Loop detected in branch/segment structure");
segment_set.erase( head_iter->segmentNumber() );
std::swap( segments[head_index], *head_iter);
if (head_iter == segments.end())
throw std::logic_error("Loop detected in branch/segment structure");
std::swap( segments[head_index], *head_iter);
}
segment_set.erase( segments[head_index].segmentNumber() );
head_index++;
}

View File

@@ -628,7 +628,7 @@ bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg) {
bool Well::updateConnections(std::shared_ptr<WellConnections> connections_arg, const EclipseGrid& grid, const std::vector<int>& pvtnum) {
bool update = this->updateConnections(connections_arg);
if (this->pvt_table == 0) {
if (this->pvt_table == 0 && this->connections->size() > 0) {
const auto& lowest = this->connections->lowest();
auto active_index = grid.activeIndex(lowest.global_index());
this->pvt_table = pvtnum[active_index];

View File

@@ -431,12 +431,16 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction
const Connection& WellConnections::lowest() const {
if (this->m_connections.empty())
throw std::logic_error("Tried to get lowest connection from empty set");
const auto max_iter = std::max_element(this->m_connections.begin(),
this->m_connections.end(),
[](const Connection& c1, const Connection& c2)
{
return c1.depth() < c2.depth();
});
return *max_iter;
}