From 254cee34bd0783943240ffb86f305fad555fe8d1 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 5 Dec 2019 11:48:28 +0100 Subject: [PATCH] addingress reviewing comments for PR#1251 --- .../EclipseState/Schedule/MSW/SpiralICD.hpp | 2 +- .../Schedule/MSW/WellSegments.hpp | 1 + .../EclipseState/Schedule/Schedule.hpp | 2 +- .../EclipseState/Schedule/MSW/SpiralICD.cpp | 19 +++++++++---------- .../Schedule/MSW/WellSegments.cpp | 2 +- .../EclipseState/Schedule/Schedule.cpp | 5 ++--- tests/parser/WellTests.cpp | 1 - 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp index 1e37647d0..a83174195 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp @@ -75,7 +75,7 @@ namespace Opm { Status m_status; // scaling factor is the only one can not be gotten from deck directly, needs to be // updated afterwards - double m_scaling_fractor; + double m_scaling_factor; }; } diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp index 01b503c8b..2f2568012 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp @@ -85,6 +85,7 @@ namespace Opm { double segmentLength(const int segment_number) const; + // it returns true if there is no error encountered during the update bool updateWSEGSICD(const std::vector >& sicd_pairs); private: diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index ea57fcb96..ad6fef763 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -277,7 +277,7 @@ namespace Opm void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep ); void handleWELSEGS( const DeckKeyword& keyword, size_t currentStep); void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); - void handleWSEGSICD( const DeckKeyword& keyword, size_t currentStep); + void handleWSEGSICD( const DeckKeyword& keyword, size_t currentStep); void handleWCONINJE( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors); void handleWFOAM( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors); void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp index c88fc63ca..9f552eaff 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp @@ -39,8 +39,7 @@ namespace Opm { m_method_flow_scaling(record.getItem("METHOD_SCALING_FACTOR").get(0)), m_max_absolute_rate(record.getItem("MAX_ABS_RATE").hasValue(0) ? record.getItem("MAX_ABS_RATE").getSIDouble(0) - : std::numeric_limits::max()), - m_scaling_fractor(std::numeric_limits::lowest()) + : std::numeric_limits::max()), m_scaling_factor(std::numeric_limits::lowest()) { if (record.getItem("STATUS").getTrimmedString(0) == "OPEN") { m_status = Status::OPEN; @@ -123,19 +122,19 @@ namespace Opm { double SpiralICD::scalingFactor() const { - if (m_scaling_fractor <= 0.) - throw std::runtime_error("the scaling factor has invalid value " + std::to_string(m_scaling_fractor)); + if (m_scaling_factor <= 0.) + throw std::runtime_error("the scaling factor has invalid value " + std::to_string(m_scaling_factor)); - return m_scaling_fractor; + return m_scaling_factor; } void SpiralICD::updateScalingFactor(const double outlet_segment_length, const double completion_length) { if (m_method_flow_scaling < 0) { if (m_length > 0.) { // icd length / outlet segment length - m_scaling_fractor = m_length / outlet_segment_length; + m_scaling_factor = m_length / outlet_segment_length; } else if (m_length < 0.) { - m_scaling_fractor = std::abs(m_length); + m_scaling_factor = std::abs(m_length); } else { // icd length is zero, not sure the proper way to handle this yet throw std::logic_error("Zero-value length of SICD is found when calcuating scaling factor"); } @@ -143,14 +142,14 @@ namespace Opm { if (m_length <= 0.) throw std::logic_error("Non positive length of SICD if found when method of scaling is zero"); - m_scaling_fractor = m_length / outlet_segment_length; + m_scaling_factor = m_length / outlet_segment_length; } else if (m_method_flow_scaling == 1) { - m_scaling_fractor = std::abs(m_length); + m_scaling_factor = std::abs(m_length); } else if (m_method_flow_scaling == 2) { if (completion_length == 0.) { throw std::logic_error("Zero connection length is found. No way to update scaling factor for this SICD segment"); } - m_scaling_fractor = m_length / completion_length; + m_scaling_factor = m_length / completion_length; } else { throw std::logic_error(" invalid method specified to calculate flow scaling factor for SICD"); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp index 87786e444..a72866be9 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp @@ -432,7 +432,7 @@ namespace Opm { } if (segment_length <= 0.) - throw std::runtime_error(" non positive segemnt length is obtained for segment " + throw std::runtime_error(" non positive segment length is obtained for segment " + std::to_string(segment_number)); return segment_length; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index a2a1227e5..1692099ae 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -325,8 +325,8 @@ namespace { else if (keyword.name() == "COMPSEGS") handleCOMPSEGS(keyword, currentStep, grid, parseContext, errors); - else if (keyword.name() == "WSEGSICD") - handleWSEGSICD(keyword, currentStep); + else if (keyword.name() == "WSEGSICD") + handleWSEGSICD(keyword, currentStep); else if (keyword.name() == "WELOPEN") handleWELOPEN(keyword, currentStep, parseContext, errors); @@ -420,7 +420,6 @@ namespace { } else { std::string msg = "OPM does not support grid property modifier " + keyword.name() + " in the Schedule section. Error at report: " + std::to_string( currentStep ); parseContext.handleError( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , msg, errors ); - } } } diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index 8cbf58ede..e3d5662ce 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -219,7 +219,6 @@ BOOST_AUTO_TEST_CASE(isProducerCorrectlySet) { } - { Opm::Well well("WELL1" , "GROUP", 0, 1, 0, 0, 0.0, Opm::Phase::OIL, Opm::Well::ProducerCMode::CMODE_UNDEFINED, Connection::Order::DEPTH, UnitSystem::newMETRIC(), 0);