From fffe2596219700fbcc2f3fa377da6ff8b0af21a2 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 23 Apr 2019 07:25:05 +0200 Subject: [PATCH] Misc minor changes: whitespace++ --- .../Schedule/MSW/WellSegments.hpp | 2 +- .../EclipseState/Schedule/Well/Connection.hpp | 38 +++---- .../EclipseState/Schedule/Well/Well.hpp | 1 + .../Schedule/MSW/WellSegments.cpp | 2 +- .../EclipseState/Schedule/Well/Well.cpp | 10 +- .../Schedule/Well/WellConnections.cpp | 107 +++++++++--------- .../Well/WellProductionProperties.cpp | 1 + tests/test_Summary.cpp | 10 +- 8 files changed, 88 insertions(+), 83 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp index f996e3388..c4a23eeda 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp @@ -34,7 +34,7 @@ namespace Opm { public: WellSegments() = default; - std::string wellName() const; + const std::string& wellName() const; int size() const; double depthTopSegment() const; double lengthTopSegment() const; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp index a90df46a4..2a0c12e2b 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp @@ -50,11 +50,10 @@ namespace Opm { double skin_factor, const int satTableId, const WellCompletion::DirectionEnum direction, - const std::size_t seqIndex, - const double segDistStart, - const double segDistEnd, - const bool defaultSatTabId - ); + const std::size_t seqIndex, + const double segDistStart, + const double segDistEnd, + const bool defaultSatTabId); bool attachedToSegment() const; @@ -79,15 +78,16 @@ namespace Opm { void setComplnum(int compnum); void scaleWellPi(double wellPi); void updateSegment(int segment_number, double center_depth, std::size_t seqIndex); - const std::size_t& getSeqIndex() const; - const bool& getDefaultSatTabId() const; - const std::size_t& getCompSegSeqIndex() const; - void setCompSegSeqIndex(std::size_t index); - void setDefaultSatTabId(bool id); - const double& getSegDistStart() const; - const double& getSegDistEnd() const; - void setSegDistStart(const double& distStart); - void setSegDistEnd(const double& distEnd); + const std::size_t& getSeqIndex() const; + const bool& getDefaultSatTabId() const; + const std::size_t& getCompSegSeqIndex() const; + void setCompSegSeqIndex(std::size_t index); + void setDefaultSatTabId(bool id); + const double& getSegDistStart() const; + const double& getSegDistEnd() const; + void setSegDistStart(const double& distStart); + void setSegDistEnd(const double& distEnd); + std::string str() const; bool operator==( const Connection& ) const; bool operator!=( const Connection& ) const; @@ -104,11 +104,11 @@ namespace Opm { double m_skin_factor; std::array ijk; - std::size_t m_seqIndex; - double m_segDistStart; - double m_segDistEnd; - bool m_defaultSatTabId; - std::size_t m_compSeg_seqIndex=0; + std::size_t m_seqIndex; + double m_segDistStart; + double m_segDistEnd; + bool m_defaultSatTabId; + std::size_t m_compSeg_seqIndex=0; // related segment number // -1 means the completion is not related to segment diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 9ff655c0a..49fbddcb2 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -95,6 +95,7 @@ namespace Opm { void switchToInjector( size_t timeStep); void switchToProducer( size_t timeStep); + bool setProducer(size_t timeStep, bool producer); bool isProducer(size_t timeStep) const; bool isInjector(size_t timeStep) const; void addWELSPECS(const DeckRecord& deckRecord); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp index 87866cbe5..49c2dbb65 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp @@ -35,7 +35,7 @@ namespace Opm { - std::string WellSegments::wellName() const { + const std::string& WellSegments::wellName() const { return m_well_name; } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 585afbe9b..6a6e4aafc 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -147,7 +147,7 @@ namespace Opm { if (isInjector(timeStep)) switchToProducer( timeStep ); - m_isProducer.update(timeStep , true); + this->setProducer(timeStep, true); return m_productionProperties.update(timeStep, newProperties); } @@ -163,7 +163,7 @@ namespace Opm { if (isProducer(timeStep)) switchToInjector( timeStep ); - m_isProducer.update(timeStep , false); + this->setProducer(timeStep, false); return m_injectionProperties.update(timeStep, newProperties); } @@ -176,8 +176,8 @@ namespace Opm { } bool Well::setPolymerProperties(size_t timeStep , const WellPolymerProperties& newProperties) { - m_isProducer.update(timeStep , false); bool update = m_polymerProperties.update(timeStep, newProperties); + this->setProducer(timeStep, false); return update; } @@ -240,6 +240,10 @@ namespace Opm { return m_status.update( timeStep , status ); } + bool Well::setProducer(size_t timeStep, bool producer) { + this->m_isProducer.update(timeStep, producer); + } + bool Well::isProducer(size_t timeStep) const { return bool( m_isProducer.get(timeStep) ); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp index da4460004..8143e1e97 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp @@ -144,10 +144,10 @@ namespace { double skin_factor, const int satTableId, const WellCompletion::DirectionEnum direction, - const std::size_t seqIndex, - const double segDistStart, - const double segDistEnd, - const bool defaultSatTabId) + const std::size_t seqIndex, + const double segDistStart, + const double segDistEnd, + const bool defaultSatTabId) { int conn_i = (i < 0) ? this->headI : i; int conn_j = (j < 0) ? this->headJ : j; @@ -167,10 +167,10 @@ namespace { double skin_factor, const int satTableId, const WellCompletion::DirectionEnum direction, - const std::size_t seqIndex, - const double segDistStart, - const double segDistEnd, - const bool defaultSatTabId) + const std::size_t seqIndex, + const double segDistStart, + const double segDistEnd, + const bool defaultSatTabId) { int complnum = (this->m_connections.size() + 1); this->addConnection(i, @@ -186,10 +186,10 @@ namespace { skin_factor, satTableId, direction, - seqIndex, - segDistStart, - segDistEnd, - defaultSatTabId); + seqIndex, + segDistStart, + segDistEnd, + defaultSatTabId); } void WellConnections::loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties) { @@ -296,48 +296,47 @@ namespace { same_ijk ); // Only add connection for active grid cells if (grid.cellActive(I, J, k)) { - if (prev == this->m_connections.end()) { - std::size_t noConn = this->m_connections.size(); - this->addConnection(I,J,k, - grid.getCellDepth( I,J,k ), - state, - CF, - Kh, - rw, - r0, - skin_factor, - satTableId, - direction, - noConn, 0., 0., defaultSatTable); - } - else { - std::size_t noConn = prev->getSeqIndex(); - // The complnum value carries over; the rest of the state is fully specified by - // the current COMPDAT keyword. - int complnum = prev->complnum(); - std::size_t css_ind = prev->getCompSegSeqIndex(); - int conSegNo = prev->segment(); - std::size_t con_SIndex = prev->getSeqIndex(); - double conCDepth = prev->depth(); - double conSDStart = prev->getSegDistStart(); - double conSDEnd = prev->getSegDistEnd(); - *prev = Connection(I,J,k, - complnum, - grid.getCellDepth(I,J,k), - state, - CF, - Kh, - rw, - r0, - skin_factor, - satTableId, - direction, - noConn, conSDStart, conSDEnd, defaultSatTable); - prev->setCompSegSeqIndex(css_ind); - prev->updateSegment(conSegNo, conCDepth, con_SIndex); - } - } - } + if (prev == this->m_connections.end()) { + std::size_t noConn = this->m_connections.size(); + this->addConnection(I,J,k, + grid.getCellDepth( I,J,k ), + state, + CF, + Kh, + rw, + r0, + skin_factor, + satTableId, + direction, + noConn, 0., 0., defaultSatTable); + } else { + std::size_t noConn = prev->getSeqIndex(); + // The complnum value carries over; the rest of the state is fully specified by + // the current COMPDAT keyword. + int complnum = prev->complnum(); + std::size_t css_ind = prev->getCompSegSeqIndex(); + int conSegNo = prev->segment(); + std::size_t con_SIndex = prev->getSeqIndex(); + double conCDepth = prev->depth(); + double conSDStart = prev->getSegDistStart(); + double conSDEnd = prev->getSegDistEnd(); + *prev = Connection(I,J,k, + complnum, + grid.getCellDepth(I,J,k), + state, + CF, + Kh, + rw, + r0, + skin_factor, + satTableId, + direction, + noConn, conSDStart, conSDEnd, defaultSatTable); + prev->setCompSegSeqIndex(css_ind); + prev->updateSegment(conSegNo, conCDepth, con_SIndex); + } + } + } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp index b129a51b2..30f3eb7d2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp @@ -236,6 +236,7 @@ namespace Opm { << "THPH: " << wp.THPH << ", " << "VFP table: " << wp.VFPTableNumber << ", " << "ALQ: " << wp.ALQValue << ", " + << "WHISTCTL: " << wp.whistctl_cmode << ", " << "prediction: " << wp.predictionMode << " }"; } diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 8641521cd..34e925ff4 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -140,7 +140,7 @@ static data::Wells result_wells() { rates3.set( rt::well_potential_oil, 30.14 / day ); rates3.set( rt::well_potential_gas, 30.15 / day ); - + data::Rates rates6; rates6.set( rt::wat, 60.0 / day ); rates6.set( rt::oil, 60.1 / day ); @@ -201,7 +201,7 @@ static data::Wells result_wells() { crates6.set( rt::reservoir_water, 600.6 / day ); crates6.set( rt::reservoir_oil, 600.7 / day ); crates6.set( rt::reservoir_gas, 600.8 / day ); - + // Segment vectors auto segment = ::Opm::data::Segment{}; segment.rates.set(rt::wat, 123.45*sm3_pr_day()); @@ -347,7 +347,7 @@ BOOST_AUTO_TEST_CASE(well_keywords) { BOOST_CHECK_CLOSE( -20.15, ecl_sum_get_well_var( resp, 1, "W_2", "WGPP" ), 1e-5 ); BOOST_CHECK_CLOSE( 30.13, ecl_sum_get_well_var( resp, 1, "W_3", "WWPI" ), 1e-5 ); BOOST_CHECK_CLOSE( 60.15, ecl_sum_get_well_var( resp, 1, "W_6", "WGPI" ), 1e-5 ); - + /* Production totals */ BOOST_CHECK_CLOSE( 10.0, ecl_sum_get_well_var( resp, 1, "W_1", "WWPT" ), 1e-5 ); BOOST_CHECK_CLOSE( 20.0, ecl_sum_get_well_var( resp, 1, "W_2", "WWPT" ), 1e-5 ); @@ -550,7 +550,7 @@ BOOST_AUTO_TEST_CASE(group_keywords) { BOOST_CHECK_CLOSE( -10.15 - 20.15, ecl_sum_get_group_var( resp, 1, "G_1", "GGPP" ), 1e-5 ); BOOST_CHECK_CLOSE( 30.13 + 60.13, ecl_sum_get_group_var( resp, 1, "G_2", "GWPI" ), 1e-5 ); BOOST_CHECK_CLOSE( 30.15 + 60.15, ecl_sum_get_group_var( resp, 1, "G_2", "GGPI" ), 1e-5 ); - + /* Production totals */ BOOST_CHECK_CLOSE( 10.0 + 20.0, ecl_sum_get_group_var( resp, 1, "G_1", "GWPT" ), 1e-5 ); BOOST_CHECK_CLOSE( 10.1 + 20.1, ecl_sum_get_group_var( resp, 1, "G_1", "GOPT" ), 1e-5 ); @@ -800,7 +800,7 @@ BOOST_AUTO_TEST_CASE(field_keywords) { BOOST_CHECK_CLOSE( -10.15 - 20.15, ecl_sum_get_field_var( resp, 1, "FGPP" ), 1e-5 ); BOOST_CHECK_CLOSE( 30.15 + 60.15, ecl_sum_get_field_var( resp, 1, "FGPI" ), 1e-5 ); BOOST_CHECK_CLOSE( 30.13 + 60.13, ecl_sum_get_field_var( resp, 1, "FWPI" ), 1e-5 ); - + /* Production totals */ BOOST_CHECK_CLOSE( 10.0 + 20.0, ecl_sum_get_field_var( resp, 1, "FWPT" ), 1e-5 ); BOOST_CHECK_CLOSE( 10.1 + 20.1, ecl_sum_get_field_var( resp, 1, "FOPT" ), 1e-5 );