From 828cd2ee9a5b4248b9ce673a9900fbb48da0bafb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 8 Jan 2020 15:12:23 +0100 Subject: [PATCH 1/6] fixed: add missing initializer --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index ddb3acde3..8bffdef17 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -202,8 +202,8 @@ public: UDAValue BHPTarget; UDAValue THPTarget; - double bhp_hist_limit; - double thp_hist_limit = 0; + double bhp_hist_limit = 0.0; + double thp_hist_limit = 0.0; double temperature; double BHPH; @@ -308,8 +308,8 @@ public: UDAValue THPTarget; // BHP and THP limit - double bhp_hist_limit; - double thp_hist_limit = 0; + double bhp_hist_limit = 0.0; + double thp_hist_limit = 0.0; // historical BHP and THP under historical mode double BHPH = 0.0; From 7ac2febae229de227888eb47c03e0c8393c54236 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 9 Jan 2020 09:45:11 +0100 Subject: [PATCH 2/6] changed: allow disabling sanity check in Dimension constructor while this makes sense to do in general, it causes issues when reconstructing after deserialization. we have dimensions with '/' and '*' in the name that was constructed through newComposite. --- opm/parser/eclipse/Units/Dimension.hpp | 3 ++- src/opm/parser/eclipse/Units/Dimension.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/Units/Dimension.hpp b/opm/parser/eclipse/Units/Dimension.hpp index 2e8f9fe24..daea8c0cc 100644 --- a/opm/parser/eclipse/Units/Dimension.hpp +++ b/opm/parser/eclipse/Units/Dimension.hpp @@ -27,7 +27,8 @@ namespace Opm { class Dimension { public: Dimension(); - Dimension(const std::string& name, double SIfactor, double SIoffset = 0.0); + Dimension(const std::string& name, double SIfactor, + double SIoffset = 0.0, bool sanityCheck = true); double getSIScaling() const; double getSIScalingRaw() const; diff --git a/src/opm/parser/eclipse/Units/Dimension.cpp b/src/opm/parser/eclipse/Units/Dimension.cpp index 1a4b928bf..8011190a1 100644 --- a/src/opm/parser/eclipse/Units/Dimension.cpp +++ b/src/opm/parser/eclipse/Units/Dimension.cpp @@ -33,9 +33,10 @@ namespace Opm { } - Dimension::Dimension(const std::string& name, double SIfactor, double SIoffset) + Dimension::Dimension(const std::string& name, double SIfactor, + double SIoffset, bool sanityCheck) { - for (auto iter = name.begin(); iter != name.end(); ++iter) { + for (auto iter = name.begin(); iter != name.end() && sanityCheck; ++iter) { if (!isalpha(*iter) && (*iter) != '1') throw std::invalid_argument("Invalid dimension name"); } From c4936d55e1739af1af2dc49112b86dbace4280bb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:49:17 +0100 Subject: [PATCH 3/6] fixed: update UDAValue constructors for new dim member --- opm/parser/eclipse/Deck/UDAValue.hpp | 2 ++ src/opm/parser/eclipse/Deck/UDAValue.cpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/opm/parser/eclipse/Deck/UDAValue.hpp b/opm/parser/eclipse/Deck/UDAValue.hpp index dbc92c296..b94e984b5 100644 --- a/opm/parser/eclipse/Deck/UDAValue.hpp +++ b/opm/parser/eclipse/Deck/UDAValue.hpp @@ -35,6 +35,8 @@ public: explicit UDAValue(double); explicit UDAValue(const std::string&); UDAValue(const UDAValue& src, const Dimension& dim); + UDAValue(double data, const Dimension& dim); + UDAValue(const std::string& data, const Dimension& dim); /* The get() and get() methods will throw an diff --git a/src/opm/parser/eclipse/Deck/UDAValue.cpp b/src/opm/parser/eclipse/Deck/UDAValue.cpp index ed7244c46..7a903c74b 100644 --- a/src/opm/parser/eclipse/Deck/UDAValue.cpp +++ b/src/opm/parser/eclipse/Deck/UDAValue.cpp @@ -29,6 +29,13 @@ UDAValue::UDAValue(double value): { } +UDAValue::UDAValue(double value, const Dimension& dim_): + numeric_value(true), + double_value(value), + dim(dim_) +{ +} + UDAValue::UDAValue() : UDAValue(0) @@ -40,6 +47,13 @@ UDAValue::UDAValue(const std::string& value): { } +UDAValue::UDAValue(const std::string& value, const Dimension& dim_): + numeric_value(false), + string_value(value), + dim(dim_) +{ +} + UDAValue::UDAValue(const UDAValue& src, const Dimension& new_dim): UDAValue(src) { From 13db196c5c9ffd3e0a3e3d1de9f121ef71aca906 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:49:54 +0100 Subject: [PATCH 4/6] fixed: missing CTFKind parameter in Connection --- .../eclipse/EclipseState/Schedule/Well/Connection.hpp | 2 ++ .../eclipse/EclipseState/Schedule/Well/Connection.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp index d038f056f..2e5ea7095 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp @@ -102,6 +102,7 @@ namespace Opm { double r0, double skinFactor, const std::array& IJK, + CTFKind kind, std::size_t seqIndex, double segDistStart, double segDistEnd, @@ -128,6 +129,7 @@ namespace Opm { double r0() const; double skinFactor() const; double wellPi() const; + CTFKind kind() const; void setState(State state); void setComplnum(int compnum); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp index 15345e16e..57ee39873 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp @@ -75,7 +75,8 @@ namespace Opm { Connection::Connection(Direction dir, double depth, State state, int satTableId, int complnum, double CF, double Kh, double rw, double r0, double skinFactor, - const std::array& IJK, std::size_t seqIndex, + const std::array& IJK, + CTFKind kind, std::size_t seqIndex, double segDistStart, double segDistEnd, bool defaultSatTabId, std::size_t compSegSeqIndex, int segment, double wellPi) @@ -90,6 +91,7 @@ namespace Opm { , m_r0(r0) , m_skin_factor(skinFactor) , ijk(IJK) + , m_ctfkind(kind) , m_seqIndex(seqIndex) , m_segDistStart(segDistStart) , m_segDistEnd(segDistEnd) @@ -102,7 +104,7 @@ namespace Opm { Connection::Connection() : Connection(Direction::X, 1.0, State::SHUT, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, - {0,0,0}, 0, 0.0, 0.0, false, 0, 0, 0.0) + {0,0,0}, CTFKind::Defaulted, 0, 0.0, 0.0, false, 0, 0, 0.0) {} bool Connection::sameCoordinate(const int i, const int j, const int k) const { @@ -389,4 +391,8 @@ std::string Connection::CTFKindToString(const CTFKind ctf_kind) }; } +Connection::CTFKind Connection::kind() const { + return m_ctfkind; +} + } From df5baad2337cad32b29d79bde2b91a3bb7ee3bc1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:50:28 +0100 Subject: [PATCH 5/6] fixed: return by const ref --- opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp b/opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp index 35f3a75b7..a7f527699 100644 --- a/opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp +++ b/opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp @@ -50,9 +50,9 @@ public: { } - const index_type getIndex() const { return m_map; } + const index_type& getIndex() const { return m_map; } - const storage_type getStorage() const { return m_vector; } + const storage_type& getStorage() const { return m_vector; } std::size_t count(const K& key) const { return this->m_map.count(key); From 69864360737165822f9607a22b064455ba7c7a4a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 17 Jan 2020 10:08:14 +0100 Subject: [PATCH 6/6] make TimeStampUTC constructible from variables also add accessor --- opm/common/utility/TimeService.hpp | 6 ++++++ src/opm/common/utility/TimeService.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/opm/common/utility/TimeService.hpp b/opm/common/utility/TimeService.hpp index 4b97c1175..952a681e4 100644 --- a/opm/common/utility/TimeService.hpp +++ b/opm/common/utility/TimeService.hpp @@ -45,6 +45,11 @@ namespace Opm { explicit TimeStampUTC(const std::time_t tp); explicit TimeStampUTC(const YMD& ymd); + TimeStampUTC(const YMD& ymd, + int hour, + int minutes, + int seconds, + int usec); TimeStampUTC& operator=(const std::time_t tp); bool operator==(const TimeStampUTC& data) const; @@ -54,6 +59,7 @@ namespace Opm { TimeStampUTC& seconds(const int s); TimeStampUTC& microseconds(const int us); + const YMD& ymd() const { return ymd_; } int year() const { return this->ymd_.year; } int month() const { return this->ymd_.month; } int day() const { return this->ymd_.day; } diff --git a/src/opm/common/utility/TimeService.cpp b/src/opm/common/utility/TimeService.cpp index 024acb671..253b82850 100644 --- a/src/opm/common/utility/TimeService.cpp +++ b/src/opm/common/utility/TimeService.cpp @@ -63,6 +63,15 @@ Opm::TimeStampUTC::TimeStampUTC(const std::time_t tp) this->hour(tm.tm_hour).minutes(tm.tm_min).seconds(tm.tm_sec); } +Opm::TimeStampUTC::TimeStampUTC(const Opm::TimeStampUTC::YMD& ymd, + int hour, int minutes, int seconds, int usec) + : ymd_(ymd) + , hour_(hour) + , minutes_(minutes) + , seconds_(seconds) + , usec_(usec) +{} + Opm::TimeStampUTC& Opm::TimeStampUTC::operator=(const std::time_t tp) { auto t = tp;