From 80dd2c33a14e562ec85c8e2be9cf2dc991f540e0 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 18 Aug 2023 08:53:44 +0200 Subject: [PATCH] Implement support for keyword WDFAC and WDFACCOR Implement support for DFactor in COMPDAT Add output of CDFAC --- CMakeLists_files.cmake | 2 + opm/input/eclipse/Schedule/Schedule.hpp | 2 + .../eclipse/Schedule/Well/Connection.hpp | 10 ++ opm/input/eclipse/Schedule/Well/WDFAC.hpp | 80 +++++++++++ opm/input/eclipse/Schedule/Well/Well.hpp | 9 ++ .../eclipse/Schedule/Well/WellConnections.hpp | 4 + opm/input/eclipse/Units/UnitSystem.hpp | 1 + opm/output/data/Wells.hpp | 8 +- .../eclipse/Schedule/KeywordHandlers.cpp | 45 +++++++ .../eclipse/Schedule/Well/Connection.cpp | 30 ++++- src/opm/input/eclipse/Schedule/Well/WDFAC.cpp | 117 ++++++++++++++++ src/opm/input/eclipse/Schedule/Well/Well.cpp | 21 ++- .../eclipse/Schedule/Well/WellConnections.cpp | 45 +++++-- src/opm/input/eclipse/Units/UnitSystem.cpp | 22 ++- .../share/keywords/000_Eclipse100/C/COMPDAT | 4 +- .../share/keywords/000_Eclipse100/W/WDFACCOR | 10 +- src/opm/output/eclipse/Summary.cpp | 30 +++++ tests/parser/ConnectionTests.cpp | 24 ++-- tests/parser/MultisegmentWellTests.cpp | 70 +++++----- tests/parser/ScheduleTests.cpp | 126 ++++++++++++++++++ tests/test_PAvgCalculator.cpp | 6 +- tests/test_RFT.cpp | 8 +- tests/test_Restart.cpp | 6 +- tests/test_Serialization.cpp | 2 + tests/test_Summary.cpp | 10 +- tests/test_Summary_Group.cpp | 2 +- tests/test_Wells.cpp | 6 +- 27 files changed, 614 insertions(+), 86 deletions(-) create mode 100644 opm/input/eclipse/Schedule/Well/WDFAC.hpp create mode 100644 src/opm/input/eclipse/Schedule/Well/WDFAC.cpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 3843e3ea5..3b2675ab6 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -228,6 +228,7 @@ if(ENABLE_ECL_INPUT) src/opm/input/eclipse/Schedule/Well/WINJMULT.cpp src/opm/input/eclipse/Schedule/Well/WList.cpp src/opm/input/eclipse/Schedule/Well/WListManager.cpp + src/opm/input/eclipse/Schedule/Well/WDFAC.cpp src/opm/input/eclipse/Schedule/Well/WVFPDP.cpp src/opm/input/eclipse/Schedule/Well/WVFPEXP.cpp src/opm/input/eclipse/Schedule/WellTraj/RigEclipseWellLogExtractor.cpp @@ -1259,6 +1260,7 @@ if(ENABLE_ECL_INPUT) opm/input/eclipse/Schedule/Well/WellPolymerProperties.hpp opm/input/eclipse/Schedule/Well/WellTracerProperties.hpp opm/input/eclipse/Schedule/Well/WINJMULT.hpp + opm/input/eclipse/Schedule/Well/WDFAC.hpp opm/input/eclipse/Schedule/Well/WVFPDP.hpp opm/input/eclipse/Schedule/Well/WVFPEXP.hpp opm/input/eclipse/Schedule/Well/WellTestConfig.hpp diff --git a/opm/input/eclipse/Schedule/Schedule.hpp b/opm/input/eclipse/Schedule/Schedule.hpp index 10142545f..df3dae2fd 100644 --- a/opm/input/eclipse/Schedule/Schedule.hpp +++ b/opm/input/eclipse/Schedule/Schedule.hpp @@ -749,6 +749,8 @@ namespace Opm void handleWCONINJH (HandlerContext&); void handleWCONPROD (HandlerContext&); void handleWECON (HandlerContext&); + void handleWDFACCOR (HandlerContext&); + void handleWDFAC (HandlerContext&); void handleWEFAC (HandlerContext&); void handleWELOPEN (HandlerContext&); void handleWELPI (HandlerContext&); diff --git a/opm/input/eclipse/Schedule/Well/Connection.hpp b/opm/input/eclipse/Schedule/Well/Connection.hpp index ff73ae5b4..de47c2c89 100644 --- a/opm/input/eclipse/Schedule/Well/Connection.hpp +++ b/opm/input/eclipse/Schedule/Well/Connection.hpp @@ -93,6 +93,8 @@ namespace RestartIO { double re, double connection_length, double skin_factor, + double d_factor, + double Ke, const int satTableId, const Direction direction, const CTFKind ctf_kind, @@ -123,6 +125,8 @@ namespace RestartIO { double re() const; double connectionLength() const; double skinFactor() const; + double dFactor() const; + double Ke() const; CTFKind kind() const; const InjMult& injmult() const; bool activeInjMult() const; @@ -136,6 +140,8 @@ namespace RestartIO { void setState(State state); void setComplnum(int compnum); void setSkinFactor(double skin_factor); + void setDFactor(double d_factor); + void setKe(double Ke); void setCF(double CF); void scaleWellPi(double wellPi); bool prepareWellPIScaling(); @@ -174,6 +180,8 @@ namespace RestartIO { serializer(m_re); serializer(m_connection_length); serializer(m_skin_factor); + serializer(m_d_factor); + serializer(m_Ke); serializer(ijk); serializer(m_global_index); serializer(m_ctfkind); @@ -199,6 +207,8 @@ namespace RestartIO { double m_re; double m_connection_length; double m_skin_factor; + double m_d_factor; + double m_Ke; std::array ijk; CTFKind m_ctfkind; diff --git a/opm/input/eclipse/Schedule/Well/WDFAC.hpp b/opm/input/eclipse/Schedule/Well/WDFAC.hpp new file mode 100644 index 000000000..2719b9e2f --- /dev/null +++ b/opm/input/eclipse/Schedule/Well/WDFAC.hpp @@ -0,0 +1,80 @@ +/* + Copyright 2023 Equinor. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#ifndef WDFAC_HPP_HEADER_INCLUDED +#define WDFAC_HPP_HEADER_INCLUDED + +namespace Opm { + class DeckRecord; + class WellConnections; +} // namespace Opm + +namespace Opm { namespace RestartIO { + struct RstWell; +}} // namespace Opm::RestartIO + +namespace Opm { + + enum class WDFACTYPE { + NONE = 1, + DFACTOR = 2, + DAKEMODEL = 3, + CON_DFACTOR = 4 + }; + + class WDFAC + { + public: + static WDFAC serializationTestObject(); + + double getDFactor(double rho, double mu, double k, double phi, double rw, double h) const; + void updateWDFAC(const DeckRecord& record); + //void updateWDFAC(const RestartIO::RstWell& rst_well); + void updateWDFACCOR(const DeckRecord& record); + //void updateWDFACOR(const RestartIO::RstWell& rst_well); + + void updateWDFACType(const WellConnections& connections); + + bool useDFactor() const; + bool useConnectionDFactor() const; + + bool operator==(const WDFAC& other) const; + bool operator!=(const WDFAC& other) const; + + template + void serializeOp(Serializer& serializer) + { + serializer(m_a); + serializer(m_b); + serializer(m_c); + serializer(m_d); + serializer(m_type); + } + + private: + double m_a{0.0}; + double m_b{0.0}; + double m_c{0.0}; + double m_d{0.0}; + WDFACTYPE m_type = WDFACTYPE::NONE; + }; + +} // namespace Opm + +#endif // WDFAC_HPP_HEADER_INCLUDED diff --git a/opm/input/eclipse/Schedule/Well/Well.hpp b/opm/input/eclipse/Schedule/Well/Well.hpp index 2fa5b4ca4..d20b51376 100644 --- a/opm/input/eclipse/Schedule/Well/Well.hpp +++ b/opm/input/eclipse/Schedule/Well/Well.hpp @@ -68,6 +68,7 @@ class WellSegments; class WellTracerProperties; class WVFPEXP; class WVFPDP; +class WDFAC; namespace RestartIO { struct RstWell; @@ -410,6 +411,8 @@ public: const WellTracerProperties& getTracerProperties() const; const WVFPDP& getWVFPDP() const; const WVFPEXP& getWVFPEXP() const; + const WDFAC& getWDFAC() const; + /* The rate of a given phase under the following assumptions: * * Returns zero if production is requested for an injector (and vice * versa) @@ -458,6 +461,7 @@ public: bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor); bool updateWellGuideRate(double guide_rate); bool updateEfficiencyFactor(double efficiency_factor); + bool updateSolventFraction(double solvent_fraction); bool updateTracer(std::shared_ptr tracer_properties); bool updateFoamProperties(std::shared_ptr foam_properties); @@ -475,6 +479,8 @@ public: void updateWPaveRefDepth(double ref_depth); bool updateWVFPDP(std::shared_ptr wvfpdp); bool updateWVFPEXP(std::shared_ptr wvfpexp); + bool updateWDFAC(std::shared_ptr wdfac); + bool handleWELSEGS(const DeckKeyword& keyword); bool handleCOMPSEGS(const DeckKeyword& keyword, const ScheduleGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); @@ -551,6 +557,7 @@ public: serializer(injection); serializer(segments); serializer(wvfpdp); + serializer(wdfac); serializer(wvfpexp); serializer(m_pavg); serializer(well_temperature); @@ -601,6 +608,8 @@ private: std::shared_ptr segments; std::shared_ptr wvfpdp; std::shared_ptr wvfpexp; + std::shared_ptr wdfac; + Status status; PAvg m_pavg; double well_temperature; diff --git a/opm/input/eclipse/Schedule/Well/WellConnections.hpp b/opm/input/eclipse/Schedule/Well/WellConnections.hpp index 62fc1a63d..3ed188439 100644 --- a/opm/input/eclipse/Schedule/Well/WellConnections.hpp +++ b/opm/input/eclipse/Schedule/Well/WellConnections.hpp @@ -78,6 +78,8 @@ namespace Opm { const double re, const double connection_length, const double skin_factor, + const double d_factor, + const double Ke, const int satTableId, const Connection::Direction direction = Connection::Direction::Z, const Connection::CTFKind ctf_kind = Connection::CTFKind::DeckValue, @@ -183,6 +185,8 @@ namespace Opm { const double re, const double connection_length, const double skin_factor, + const double d_factor, + const double Ke, const int satTableId, const Connection::Direction direction = Connection::Direction::Z, const Connection::CTFKind ctf_kind = Connection::CTFKind::DeckValue, diff --git a/opm/input/eclipse/Units/UnitSystem.hpp b/opm/input/eclipse/Units/UnitSystem.hpp index 4b50ce2ea..5bd5f2b0d 100644 --- a/opm/input/eclipse/Units/UnitSystem.hpp +++ b/opm/input/eclipse/Units/UnitSystem.hpp @@ -86,6 +86,7 @@ namespace Opm { moles, ppm, ymodule, + dfactor, _count // New entries must be added *before* this }; diff --git a/opm/output/data/Wells.hpp b/opm/output/data/Wells.hpp index ac75faf55..917535c28 100644 --- a/opm/output/data/Wells.hpp +++ b/opm/output/data/Wells.hpp @@ -256,6 +256,7 @@ namespace Opm { double cell_saturation_gas; double effective_Kh; double trans_factor; + double d_factor; ConnectionFiltrate filtrate; @@ -270,6 +271,7 @@ namespace Opm { cell_saturation_gas == conn2.cell_saturation_gas && effective_Kh == conn2.effective_Kh && trans_factor == conn2.trans_factor && + d_factor == conn2.d_factor && filtrate == conn2.filtrate; } @@ -292,6 +294,7 @@ namespace Opm { serializer(cell_saturation_gas); serializer(effective_Kh); serializer(trans_factor); + serializer(d_factor); serializer(filtrate); } @@ -299,7 +302,7 @@ namespace Opm { { return Connection{1, Rates::serializationTestObject(), 2.0, 3.0, 4.0, 5.0, - 6.0, 7.0, 8.0, + 6.0, 7.0, 8.0, 9.0, ConnectionFiltrate::serializationTestObject() }; } }; @@ -1183,6 +1186,7 @@ namespace Opm { buffer.write(this->cell_saturation_gas); buffer.write(this->effective_Kh); buffer.write(this->trans_factor); + buffer.write(this->d_factor); this->filtrate.write(buffer); } @@ -1198,6 +1202,7 @@ namespace Opm { json_data.add_item("sgas", this->cell_saturation_gas); json_data.add_item("Kh", this->effective_Kh); json_data.add_item("trans_factor", this->trans_factor); + json_data.add_item("d_factor", this->d_factor); } template @@ -1343,6 +1348,7 @@ namespace Opm { buffer.read(this->cell_saturation_gas); buffer.read(this->effective_Kh); buffer.read(this->trans_factor); + buffer.read(this->d_factor); this->filtrate.read(buffer); } diff --git a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp index 74d8216f9..5d48b9632 100644 --- a/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp +++ b/src/opm/input/eclipse/Schedule/KeywordHandlers.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,10 @@ #include #include +#include + +#include +#include #include #include #include @@ -195,7 +200,11 @@ namespace { auto well2 = this->snapshots.back().wells.get(name); auto connections = std::shared_ptr( new WellConnections( well2.getConnections())); connections->loadCOMPDAT(record, handlerContext.grid, name, handlerContext.keyword.location()); + if (well2.updateConnections(connections, handlerContext.grid)) { + auto wdfac = std::make_shared(well2.getWDFAC()); + wdfac->updateWDFACType(*connections); + well2.updateWDFAC(std::move(wdfac)); this->snapshots.back().wells.update( well2 ); wells.insert( name ); } @@ -1530,6 +1539,40 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno) } } + void Schedule::handleWDFAC(HandlerContext& handlerContext) { + for (const auto& record : handlerContext.keyword) { + const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0); + const auto well_names = wellNames(wellNamePattern, handlerContext.currentStep); + if (well_names.empty()) + this->invalidNamePattern(wellNamePattern, handlerContext); + + for (const auto& well_name : well_names) { + auto well = this->snapshots.back().wells.get(well_name); + auto wdfac = std::make_shared(well.getWDFAC()); + wdfac->updateWDFAC( record ); + if (well.updateWDFAC(std::move(wdfac))) + this->snapshots.back().wells.update( std::move(well) ); + } + } + } + + void Schedule::handleWDFACCOR(HandlerContext& handlerContext) { + for (const auto& record : handlerContext.keyword) { + const std::string& wellNamePattern = record.getItem("WELLNAME").getTrimmedString(0); + const auto well_names = wellNames(wellNamePattern, handlerContext.currentStep); + if (well_names.empty()) + this->invalidNamePattern(wellNamePattern, handlerContext); + + for (const auto& well_name : well_names) { + auto well = this->snapshots.back().wells.get(well_name); + auto wdfac = std::make_shared(well.getWDFAC()); + wdfac->updateWDFACCOR( record ); + if (well.updateWDFAC(std::move(wdfac))) + this->snapshots.back().wells.update( std::move(well) ); + } + } + } + void Schedule::handleWEFAC(HandlerContext& handlerContext) { for (const auto& record : handlerContext.keyword) { const std::string& wellNamePattern = record.getItem("WELLNAME").getTrimmedString(0); @@ -2774,6 +2817,8 @@ Well{0} entered with 'FIELD' parent group: { "WCONINJH", &Schedule::handleWCONINJH }, { "WCONPROD", &Schedule::handleWCONPROD }, { "WECON" , &Schedule::handleWECON }, + { "WDFAC" , &Schedule::handleWDFAC }, + { "WDFACCOR", &Schedule::handleWDFACCOR }, { "WEFAC" , &Schedule::handleWEFAC }, { "WELOPEN" , &Schedule::handleWELOPEN }, { "WELPI" , &Schedule::handleWELPI }, diff --git a/src/opm/input/eclipse/Schedule/Well/Connection.cpp b/src/opm/input/eclipse/Schedule/Well/Connection.cpp index 82b2bee5b..f3080936b 100644 --- a/src/opm/input/eclipse/Schedule/Well/Connection.cpp +++ b/src/opm/input/eclipse/Schedule/Well/Connection.cpp @@ -48,6 +48,8 @@ namespace Opm { double re, double connection_length, double skin_factor, + double d_factor, + double Ke, const int satTableId, const Direction directionArg, const CTFKind ctf_kind, @@ -65,6 +67,8 @@ namespace Opm { m_re(re), m_connection_length(connection_length), m_skin_factor(skin_factor), + m_d_factor(d_factor), + m_Ke(Ke), ijk({i,j,k}), m_ctfkind(ctf_kind), m_global_index(global_index), @@ -90,6 +94,8 @@ Connection::Connection(const RestartIO::RstConnection& rst_connection, const Sch m_re(0.0), m_connection_length(0.0), m_skin_factor(rst_connection.skin_factor), + m_d_factor(0.0), + m_Ke(0.0), ijk(rst_connection.ijk), m_ctfkind(rst_connection.cf_kind), m_global_index(grid.get_cell(this->ijk[0], this->ijk[1], this->ijk[2]).global_index), @@ -109,7 +115,7 @@ Connection::Connection(const RestartIO::RstConnection& rst_connection, const Sch } Connection::Connection() - : Connection(0, 0, 0, 0, 0, 0.0, State::SHUT, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, + : Connection(0, 0, 0, 0, 0, 0.0, State::SHUT, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Direction::X, CTFKind::DeckValue, 0, false) {} @@ -128,6 +134,8 @@ Connection::Connection(const RestartIO::RstConnection& rst_connection, const Sch result.m_re = 7.1; result.m_connection_length = 7.2; result.m_skin_factor = 8.0; + result.m_d_factor = 8.5; + result.m_Ke = 8.9; result.ijk = {9, 10, 11}; result.m_ctfkind = CTFKind::Defaulted; result.m_global_index = 12; @@ -214,6 +222,14 @@ const std::optional>& Connection::perf_range() const { this->m_skin_factor = skin_factor; } + void Connection::setDFactor(double d_factor) { + this->m_d_factor = d_factor; + } + + void Connection::setKe(double Ke) { + this->m_Ke = Ke; + } + void Connection::setCF(double CF) { this->m_CF = CF; } @@ -250,6 +266,14 @@ const std::optional>& Connection::perf_range() const { return this->m_skin_factor; } + double Connection::dFactor() const { + return this->m_d_factor; + } + + double Connection::Ke() const { + return this->m_Ke; + } + void Connection::setState(State state) { this->open_state = state; } @@ -306,6 +330,8 @@ const std::optional>& Connection::perf_range() const { ss << "Re " << this->m_re << std::endl; ss << "connection length " << this->m_connection_length << std::endl; ss << "skinf " << this->m_skin_factor << std::endl; + ss << "dfactor " << this->m_d_factor << std::endl; + ss << "Ke " << this->m_Ke << std::endl; ss << "kh " << this->m_Kh << std::endl; ss << "sat_tableId " << this->sat_tableId << std::endl; ss << "open_state " << Connection::State2String(this->open_state) << std::endl; @@ -334,6 +360,8 @@ const std::optional>& Connection::perf_range() const { && this->m_re == rhs.m_re && this->m_connection_length == rhs.m_connection_length && this->m_skin_factor == rhs.m_skin_factor + && this->m_d_factor == rhs.m_d_factor + && this->m_Ke == rhs.m_Ke && this->m_injmult == rhs.m_injmult && this->m_Kh == rhs.m_Kh && this->sat_tableId == rhs.sat_tableId diff --git a/src/opm/input/eclipse/Schedule/Well/WDFAC.cpp b/src/opm/input/eclipse/Schedule/Well/WDFAC.cpp new file mode 100644 index 000000000..45adea47c --- /dev/null +++ b/src/opm/input/eclipse/Schedule/Well/WDFAC.cpp @@ -0,0 +1,117 @@ +/* + Copyright 2023 Equinor. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +namespace Opm { + + WDFAC WDFAC::serializationTestObject() + { + WDFAC result; + result.m_a = 1.23; + result.m_b = 0.456; + result.m_c = 0.457; + result.m_d = 0.458; + result.m_type = WDFACTYPE::NONE; + + return result; + } + + bool WDFAC::operator==(const WDFAC& other) const { + return (m_a == other.m_a) + && (m_b == other.m_b) + && (m_c == other.m_c) + && (m_d == other.m_d) + && (m_type == other.m_type); + } + + void WDFAC::updateWDFAC(const DeckRecord& record) { + m_d = record.getItem().getSIDouble(0); + m_type = WDFACTYPE::DFACTOR; + } + + void WDFAC::updateWDFACCOR(const DeckRecord& record) { + m_a = record.getItem().getSIDouble(0); + m_b = record.getItem().getSIDouble(0); + m_c = record.getItem().getSIDouble(0); + m_type = WDFACTYPE::DAKEMODEL; + } + + void WDFAC::updateWDFACType(const WellConnections& connections) { + + const auto non_trivial_dfactor = + std::any_of(connections.begin(), connections.end(), + [](const auto& conn) { return conn.dFactor() > 0.0; }); + + if (non_trivial_dfactor) + m_type = WDFACTYPE::CON_DFACTOR; + } + + + double WDFAC::getDFactor(double rho, double mu, double k, double phi, double rw, double h) const { + + switch (m_type) + { + case WDFACTYPE::NONE: + return 0.0; + case WDFACTYPE::DFACTOR: + return m_d; + case WDFACTYPE::DAKEMODEL: + { + const auto k_md = unit::convert::to(k, prefix::milli*unit::darcy); + double beta = m_a * (std::pow(k_md, m_b) * std::pow(phi, m_c)); + double specific_gravity = rho / 1.225; // divide by density of air at standard conditions. + return beta * specific_gravity * k / (h * mu * rw ); + } + case WDFACTYPE::CON_DFACTOR: + throw std::invalid_argument { "getDFactor should not be called if D factor is given by COMPDAT item 12." }; + default: + break; + } + return 0.0; + } + + bool WDFAC::useDFactor() const { + return m_type != WDFACTYPE::NONE; + } + + bool WDFAC::useConnectionDFactor() const { + return m_type == WDFACTYPE::CON_DFACTOR; + } + + bool WDFAC::operator!=(const WDFAC& other) const { + return !(*this == other); + } +} diff --git a/src/opm/input/eclipse/Schedule/Well/Well.cpp b/src/opm/input/eclipse/Schedule/Well/Well.cpp index 652162891..d76c7e42f 100644 --- a/src/opm/input/eclipse/Schedule/Well/Well.cpp +++ b/src/opm/input/eclipse/Schedule/Well/Well.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,8 @@ #include #include + + #include #include @@ -311,6 +314,7 @@ Well::Well(const RestartIO::RstWell& rst_well, injection(std::make_shared(unit_system_arg, wname)), wvfpdp(std::make_shared()), wvfpexp(explicitTHPOptions(rst_well)), + wdfac(std::make_shared()), status(status_from_int(rst_well.well_status)), well_temperature(Metric::TemperatureOffset + ParserKeywords::STCOND::TEMPERATURE::defaultValue), well_inj_mult(std::nullopt) @@ -492,6 +496,7 @@ Well::Well(const std::string& wname_arg, injection(std::make_shared(unit_system, wname)), wvfpdp(std::make_shared()), wvfpexp(std::make_shared()), + wdfac(std::make_shared()), status(Status::SHUT), well_temperature(Metric::TemperatureOffset + ParserKeywords::STCOND::TEMPERATURE::defaultValue), well_inj_mult(std::nullopt) @@ -536,6 +541,7 @@ Well Well::serializationTestObject() result.injection = std::make_shared(Well::WellInjectionProperties::serializationTestObject()); result.segments = std::make_shared(WellSegments::serializationTestObject()); result.wvfpexp = std::make_shared(WVFPEXP::serializationTestObject()); + result.wdfac = std::make_shared(WDFAC::serializationTestObject()); result.m_pavg = PAvg(); result.well_temperature = 10.0; result.well_inj_mult = InjMult::serializationTestObject(); @@ -553,7 +559,6 @@ bool Well::updateWPAVE(const PAvg& pavg) { return true; } - bool Well::updateEfficiencyFactor(double efficiency_factor_arg) { if (this->efficiency_factor != efficiency_factor_arg) { this->efficiency_factor = efficiency_factor_arg; @@ -654,6 +659,15 @@ bool Well::updateWVFPEXP(std::shared_ptr wvfpexp_arg) { return false; } +bool Well::updateWDFAC(std::shared_ptr wdfac_arg) { + if (*this->wdfac != *wdfac_arg) { + this->wdfac = std::move(wdfac_arg); + return true; + } + + return false; +} + void Well::switchToProducer() { auto p = std::make_shared(this->getInjectionProperties()); @@ -1160,6 +1174,10 @@ const WVFPEXP& Well::getWVFPEXP() const { return *this->wvfpexp; } +const WDFAC& Well::getWDFAC() const { + return *this->wdfac; +} + const WellEconProductionLimits& Well::getEconLimits() const { return *this->econ_limits; } @@ -1734,6 +1752,7 @@ bool Well::operator==(const Well& data) const { && (this->derive_refdepth_from_conns_ == data.derive_refdepth_from_conns_) && (this->getTracerProperties() == data.getTracerProperties()) && (this->getWVFPEXP() == data.getWVFPEXP()) + && (this->getWDFAC() == data.getWDFAC()) && (this->getProductionProperties() == data.getProductionProperties()) && (this->m_pavg == data.m_pavg) && (this->getInjectionProperties() == data.getInjectionProperties()) diff --git a/src/opm/input/eclipse/Schedule/Well/WellConnections.cpp b/src/opm/input/eclipse/Schedule/Well/WellConnections.cpp index 256db8325..965c9a44d 100644 --- a/src/opm/input/eclipse/Schedule/Well/WellConnections.cpp +++ b/src/opm/input/eclipse/Schedule/Well/WellConnections.cpp @@ -296,6 +296,8 @@ namespace Opm { const double re, const double connection_length, const double skin_factor, + const double d_factor, + const double Ke, const int satTableId, const Connection::Direction direction, const Connection::CTFKind ctf_kind, @@ -308,7 +310,7 @@ namespace Opm { Connection conn(conn_i, conn_j, k, global_index, complnum, depth, state, CF, Kh, rw, r0, re, connection_length, - skin_factor, satTableId, direction, ctf_kind, + skin_factor, d_factor, Ke, satTableId, direction, ctf_kind, seqIndex, defaultSatTabId); this->add(conn); @@ -325,6 +327,8 @@ namespace Opm { const double re, const double connection_length, const double skin_factor, + const double d_factor, + const double Ke, const int satTableId, const Connection::Direction direction, const Connection::CTFKind ctf_kind, @@ -335,7 +339,7 @@ namespace Opm { this->addConnection(i, j, k, global_index, complnum, depth, state, CF, Kh, rw, r0, re, - connection_length, skin_factor, + connection_length, skin_factor, d_factor, Ke, satTableId, direction, ctf_kind, seqIndex, defaultSatTabId); } @@ -367,6 +371,9 @@ namespace Opm { const auto& satTableIdItem = record.getItem("SAT_TABLE"); const auto direction = Connection::DirectionFromString(record.getItem("DIR").getTrimmedString(0)); double skin_factor = record.getItem("SKIN").getSIDouble(0); + + double d_factor = record.getItem("D_FACTOR").getSIDouble(0); + double rw; if (satTableIdItem.hasValue(0) && satTableIdItem.get < int > (0) > 0) @@ -420,23 +427,23 @@ namespace Opm { std::array cell_size = cell.dimensions; const auto& D = effectiveExtent(direction, props->ntg, cell_size); + std::array cell_perm = {{ props->permx, + props->permy, + props->permz}}; + const auto& K = permComponents(direction, cell_perm); + double Ke = std::sqrt(K[0] * K[1]); + /* We start with the absolute happy path; both CF and Kh are explicitly given in the deck. */ if (CF > 0 && Kh > 0) goto CF_done; /* We must calculate CF and Kh from the items in the COMPDAT record and cell properties. */ { - std::array cell_perm = {{ props->permx, - props->permy, - props->permz}}; - const auto& K = permComponents(direction, cell_perm); - if (r0 < 0) r0 = effectiveRadius(K,D); - if (CF < 0) { if (Kh < 0) - Kh = std::sqrt(K[0] * K[1]) * D[2]; + Kh = Ke * D[2]; CF = angle * Kh / (std::log(r0 / std::min(rw, r0)) + skin_factor); ctf_kind = ::Opm::Connection::CTFKind::Defaulted; } else { @@ -444,7 +451,7 @@ namespace Opm { Kh = CF * (std::log(r0 / std::min(r0, rw)) + skin_factor) / angle; } else { if (Kh < 0) { - Kh = std::sqrt(K[0] * K[1]) * D[2]; + Kh = Ke * D[2]; // Compute r0 to be consistent with other parameters r0 = RestartIO::RstConnection::inverse_peaceman(CF, Kh, rw, skin_factor); @@ -477,6 +484,8 @@ namespace Opm { re, connection_length, skin_factor, + d_factor, + Ke, satTableId, direction, ctf_kind, @@ -499,6 +508,8 @@ namespace Opm { re, connection_length, skin_factor, + d_factor, + Ke, satTableId, direction, ctf_kind, @@ -527,6 +538,7 @@ namespace Opm { const auto& diameterItem = record.getItem("DIAMETER"); const auto& KhItem = record.getItem("Kh"); double skin_factor = record.getItem("SKIN").getSIDouble(0); + double d_factor = record.getItem("D_FACTOR").getSIDouble(0); const auto& satTableIdItem = record.getItem("SAT_TABLE"); Connection::State state = Connection::StateFromString(record.getItem("STATE").getTrimmedString(0)); @@ -624,13 +636,14 @@ namespace Opm { std::array cell_size = cell.dimensions; + std::array cell_perm = {{ props->permx, + props->permy, + props->permz}}; + if (CF < 0 && Kh < 0) { /* We must calculate CF and Kh from the items in the COMPTRAJ record and cell properties. */ ctf_kind = ::Opm::Connection::CTFKind::Defaulted; - std::array cell_perm = {{ props->permx, - props->permy, - props->permz}}; const auto& perm_thickness = permThickness(connection_vector, cell_perm, @@ -668,6 +681,8 @@ namespace Opm { const auto direction = Connection::DirectionFromString("Z"); double re = -1; double connection_length = connection_vector.length(); + const auto& K = permComponents(direction, cell_perm); + double Ke = std::sqrt(K[0] * K[1]); auto prev = std::find_if( this->m_connections.begin(), this->m_connections.end(), @@ -685,6 +700,8 @@ namespace Opm { re, connection_length, skin_factor, + d_factor, + Ke, satTableId, direction, ctf_kind, @@ -707,6 +724,8 @@ namespace Opm { re, connection_length, skin_factor, + d_factor, + Ke, satTableId, direction, ctf_kind, diff --git a/src/opm/input/eclipse/Units/UnitSystem.cpp b/src/opm/input/eclipse/Units/UnitSystem.cpp index 27c2574c9..a1b84b2f2 100644 --- a/src/opm/input/eclipse/Units/UnitSystem.cpp +++ b/src/opm/input/eclipse/Units/UnitSystem.cpp @@ -95,6 +95,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_metric[] = { @@ -143,6 +144,7 @@ namespace { 1 / Metric::Moles, 1 / Metric::PPM, 1 / Metric::Ymodule, + 1 / (Metric::Time / Metric::GasSurfaceVolume), }; static const double from_metric[] = { @@ -191,6 +193,7 @@ namespace { Metric::Moles, Metric::PPM, Metric::Ymodule, + Metric::Time / Metric::GasSurfaceVolume, }; static constexpr const char* metric_names[static_cast(UnitSystem::measure::_count)] = { @@ -239,6 +242,7 @@ namespace { "KG-M", "PPM", /*Parts per million */ "GPa", + "DAY/SM3" }; static_assert(numElems(from_metric_offset) == static_cast(UnitSystem::measure::_count), @@ -307,6 +311,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_field[] = { @@ -355,6 +360,7 @@ namespace { 1 / Field::Moles, 1 / Field::PPM, 1 / Field::Ymodule, + 1 / (Field::Time / Field::GasSurfaceVolume) }; static const double from_field[] = { @@ -403,6 +409,7 @@ namespace { Field::Moles, Field::PPM, Field::Ymodule, + Field::Time / Field::GasSurfaceVolume, }; static constexpr const char* field_names[static_cast(UnitSystem::measure::_count)] = { @@ -451,6 +458,7 @@ namespace { "LB-M", "PPM", "GPa", + "DAY/MSCF", }; static_assert(numElems(from_field_offset) == static_cast(UnitSystem::measure::_count), @@ -519,6 +527,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_lab[] = { @@ -567,6 +576,7 @@ namespace { 1 / Lab::Moles, 1 / Lab::PPM, 1 / Lab::Ymodule, + 1 / (Lab::Time / Lab::GasSurfaceVolume) }; static const double from_lab[] = { @@ -615,6 +625,7 @@ namespace { Lab::Moles, Lab::PPM, Lab::Ymodule, + Lab::Time / Lab::GasSurfaceVolume }; static constexpr const char* lab_names[static_cast(UnitSystem::measure::_count)] = { @@ -663,6 +674,7 @@ namespace { "g-M", "PPM", "GPa", + "HR/SCC", }; static_assert(numElems(from_lab_offset) == static_cast(UnitSystem::measure::_count), @@ -731,6 +743,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_pvt_m[] = { @@ -779,6 +792,7 @@ namespace { 1 / PVT_M::Moles, 1 / PVT_M::PPM, 1 / PVT_M::Ymodule, + 1 / (PVT_M::Time / PVT_M::GasSurfaceVolume), }; static const double from_pvt_m[] = { @@ -827,6 +841,7 @@ namespace { PVT_M::Moles, PVT_M::PPM, PVT_M::Ymodule, + PVT_M::Time / PVT_M::GasSurfaceVolume, }; static constexpr const char* pvt_m_names[static_cast(UnitSystem::measure::_count)] = { @@ -874,7 +889,8 @@ namespace { "SM3/SM3/DAY", "KG-M", "PPM", - "GPa" + "GPa", + "DAY/SM3", }; static_assert(numElems(from_pvt_m_offset) == static_cast(UnitSystem::measure::_count), @@ -943,6 +959,7 @@ namespace { 0.0, 0.0, 0.0, + 0.0, }; static const double to_input[] = { @@ -991,6 +1008,7 @@ namespace { 1, 1, 1, + 1, }; static const double from_input[] = { @@ -1039,6 +1057,7 @@ namespace { 1, 1, 1, + 1, }; static constexpr const char* input_names[static_cast(UnitSystem::measure::_count)] = { @@ -1087,6 +1106,7 @@ namespace { "g-M", "PPM", "GPa", + "DAY/SM3", }; static_assert(numElems(from_input_offset) == static_cast(UnitSystem::measure::_count), diff --git a/src/opm/input/eclipse/share/keywords/000_Eclipse100/C/COMPDAT b/src/opm/input/eclipse/share/keywords/000_Eclipse100/C/COMPDAT index b1a33d1df..40f492ca5 100644 --- a/src/opm/input/eclipse/share/keywords/000_Eclipse100/C/COMPDAT +++ b/src/opm/input/eclipse/share/keywords/000_Eclipse100/C/COMPDAT @@ -73,8 +73,8 @@ "item": 12, "name": "D_FACTOR", "value_type": "DOUBLE", - "dimension": "1", - "comment": "Not used" + "dimension": "Time/GasSurfaceVolume", + "default": 0 }, { diff --git a/src/opm/input/eclipse/share/keywords/000_Eclipse100/W/WDFACCOR b/src/opm/input/eclipse/share/keywords/000_Eclipse100/W/WDFACCOR index e4e8b822b..4f63ca107 100644 --- a/src/opm/input/eclipse/share/keywords/000_Eclipse100/W/WDFACCOR +++ b/src/opm/input/eclipse/share/keywords/000_Eclipse100/W/WDFACCOR @@ -11,17 +11,21 @@ { "name": "A", "value_type": "DOUBLE", - "default": 0 + "default": 0, + "dimension": "Viscosity*Time/Permeability*GasSurfaceVolume" }, { "name": "B", "value_type": "DOUBLE", - "default": 0 + "default": 0, + "dimension": "1" + }, { "name": "C", "value_type": "DOUBLE", - "default": 0 + "default": 0, + "dimension": "1" } ] } diff --git a/src/opm/output/eclipse/Summary.cpp b/src/opm/output/eclipse/Summary.cpp index 6fa36d54d..d9a8ecdf0 100644 --- a/src/opm/output/eclipse/Summary.cpp +++ b/src/opm/output/eclipse/Summary.cpp @@ -1238,6 +1238,35 @@ inline quantity trans_factors ( const fn_args& args ) { return { connPos->trans_factor, measure::transmissibility }; } +inline quantity d_factors ( const fn_args& args ) { + const quantity zero = { 0.0, measure::dfactor }; + + if (args.schedule_wells.empty()) + // No wells. Before simulation starts? + return zero; + + auto xwPos = args.wells.find(args.schedule_wells.front()->name()); + if (xwPos == args.wells.end()) + // No dynamic results for this well. Not open? + return zero; + + // Like connection rate we need to look up a connection with offset 0. + const size_t global_index = args.num - 1; + const auto& connections = xwPos->second.connections; + auto connPos = std::find_if(connections.begin(), connections.end(), + [global_index](const Opm::data::Connection& c) + { + return c.index == global_index; + }); + + if (connPos == connections.end()) + // No dynamic results for this connection. + return zero; + + // Connection "d_factor". + return { connPos->d_factor, measure::dfactor }; +} + inline quantity wstat( const fn_args& args ) { const quantity zero = { Opm::WStat::numeric::UNKNOWN, measure::identity}; if (args.schedule_wells.empty()) @@ -2250,6 +2279,7 @@ static const auto funs = std::unordered_map { { "CSIT", mul( crate< rt::brine, injector >, duration ) }, { "CSPT", mul( crate< rt::brine, producer >, duration ) }, { "CTFAC", trans_factors }, + { "CDFAC", d_factors }, { "CPI", connection_productivity_index }, { "FWPR", rate< rt::wat, producer > }, diff --git a/tests/parser/ConnectionTests.cpp b/tests/parser/ConnectionTests.cpp index 8bdc34853..0f261a337 100644 --- a/tests/parser/ConnectionTests.cpp +++ b/tests/parser/ConnectionTests.cpp @@ -98,8 +98,8 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) { auto dir = Opm::Connection::Direction::Z; const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections completionSet(Opm::Connection::Order::TRACK, 1,1); - Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); - Opm::Connection completion2( 10,10,11, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion2( 10,10,11, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); completionSet.add( completion1 ); BOOST_CHECK_EQUAL( 1U , completionSet.size() ); BOOST_CHECK_MESSAGE( !completionSet.empty(), "Non-empty completion set must not be empty" ); @@ -114,8 +114,8 @@ BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) { BOOST_AUTO_TEST_CASE(WellConnectionsGetOutOfRangeThrows) { auto dir = Opm::Connection::Direction::Z; const auto kind = Opm::Connection::CTFKind::DeckValue; - Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0,true); - Opm::Connection completion2( 10,10,11, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0,true); + Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0,true); + Opm::Connection completion2( 10,10,11, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0,true); Opm::WellConnections completionSet(Opm::Connection::Order::TRACK, 1,1); completionSet.add( completion1 ); BOOST_CHECK_EQUAL( 1U , completionSet.size() ); @@ -153,9 +153,9 @@ BOOST_AUTO_TEST_CASE(AddCompletionCopy) { auto dir = Opm::Connection::Direction::Z; const auto kind = Opm::Connection::CTFKind::DeckValue; - Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); - Opm::Connection completion2( 10,10,11, 101, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); - Opm::Connection completion3( 10,10,12, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion1( 10,10,10, 100, 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion2( 10,10,11, 101, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion3( 10,10,12, 102, 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); completionSet.add( completion1 ); completionSet.add( completion2 ); @@ -176,9 +176,9 @@ BOOST_AUTO_TEST_CASE(ActiveCompletions) { auto dir = Opm::Connection::Direction::Z; const auto kind = Opm::Connection::CTFKind::Defaulted; Opm::WellConnections completions(Opm::Connection::Order::TRACK, 10,10); - Opm::Connection completion1( 0,0,0, grid.getGlobalIndex(0,0,0), 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); - Opm::Connection completion2( 0,0,1, grid.getGlobalIndex(0,0,1), 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); - Opm::Connection completion3( 0,0,2, grid.getGlobalIndex(0,0,2), 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion1( 0,0,0, grid.getGlobalIndex(0,0,0), 1, 0.0, Opm::Connection::State::OPEN , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion2( 0,0,1, grid.getGlobalIndex(0,0,1), 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); + Opm::Connection completion3( 0,0,2, grid.getGlobalIndex(0,0,2), 1, 0.0, Opm::Connection::State::SHUT , 99.88, 355.113, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true); completions.add( completion1 ); completions.add( completion2 ); @@ -469,6 +469,8 @@ END 0.234, 0.157, 0.0, + 0.0, + 0.0, 0.0, 0.0, 1); @@ -514,6 +516,8 @@ END 0.0, 0.0, 0.0, + 0.0, + 0.0, 1); BOOST_REQUIRE_EQUAL(connP.size(), std::size_t{4}); diff --git a/tests/parser/MultisegmentWellTests.cpp b/tests/parser/MultisegmentWellTests.cpp index 150b450ef..16d8050e9 100644 --- a/tests/parser/MultisegmentWellTests.cpp +++ b/tests/parser/MultisegmentWellTests.cpp @@ -61,14 +61,14 @@ BOOST_AUTO_TEST_CASE(AICDWellTest) { const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10); Opm::EclipseGrid grid(20,20,20, 1., 1., 25.0, 2500.0); - connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 18, 0, 1,grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 17, 0, 1,grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 16, 0, 1,grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 15, 0, 1,grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 18, 0, 1,grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 17, 0, 1,grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 16, 0, 1,grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 15, 0, 1,grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -221,14 +221,14 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) { const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10); Opm::EclipseGrid grid(20,20,20, 1., 1., 25.0, 2500.0); - connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 0,grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 1,grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 2,grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 18, 0, 1,grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 17, 0, 1,grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 16, 0, 1,grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 15, 0, 1,grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 18, 0, 1,grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 17, 0, 1,grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 16, 0, 1,grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 15, 0, 1,grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -388,14 +388,14 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) { const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10); Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.); - connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -457,14 +457,14 @@ BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) { const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10); Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.); - connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1),1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); @@ -526,14 +526,14 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) { const auto kind = Opm::Connection::CTFKind::DeckValue; Opm::WellConnections connection_set(Opm::Connection::Order::TRACK, 10,10); Opm::EclipseGrid grid(20,20,20, 1., 1., 25., 2500.); - connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 0, grid.getGlobalIndex(19,0,0), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 1, grid.getGlobalIndex(19,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); + connection_set.add(Opm::Connection( 19, 0, 2, grid.getGlobalIndex(19,0,2), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, dir, kind, 0, true) ); - connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); - connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 18, 0, 1, grid.getGlobalIndex(18,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 17, 0, 1, grid.getGlobalIndex(17,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 16, 0, 1, grid.getGlobalIndex(16,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); + connection_set.add(Opm::Connection( 15, 0, 1, grid.getGlobalIndex(15,0,1), 1, 0.0, Opm::Connection::State::OPEN , 200, 17.29, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, kind, 0, true) ); BOOST_CHECK_EQUAL( 7U , connection_set.size() ); diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index e422f4e09..c3ccc61d4 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -3887,6 +3888,8 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) { 10, 10, 10, + 10, + 10, 100); BOOST_CHECK( ws.updateConnections(c2, false) ); @@ -5681,6 +5684,129 @@ END BOOST_CHECK(wvfpexp2.prevent()); } + +BOOST_AUTO_TEST_CASE(Test_wdfac) { + std::string input = R"( +DIMENS + 10 10 10 / + +START -- 0 + 19 JUN 2007 / + +GRID + +DXV + 10*100.0 / +DYV + 10*100.0 / +DZV + 10*10.0 / +DEPTHZ +121*2000.0 / + +PORO + 1000*0.1 / +PERMX + 1000*1 / +PERMY + 1000*0.1 / +PERMZ + 1000*0.01 / + +SCHEDULE + +DATES -- 1 + 10 OKT 2008 / +/ +WELSPECS + 'W1' 'G1' 3 3 2873.94 'WATER' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' / + 'W2' 'G2' 5 5 1 'OIL' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' / +/ + +COMPDAT + 'W1' 3 3 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / + 'W1' 3 3 2 2 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / + 'W1' 3 3 3 3 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / +/ + +WDFAC + 'W1' 1 / + 'W2' 2 / +/ + +DATES -- 2 + 10 NOV 2008 / +/ + +WDFACCOR +-- 'W1' 8.957e10 1.1045 0.0 / + 'W1' 1.984e-7 -1.1045 0.0 / +/ + +DATES -- 3 + 12 NOV 2008 / +/ + +COMPDAT + 'W1' 3 3 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / + 'W1' 3 3 2 2 'OPEN' 1* 32.948 0.311 3047.839 1* 0 'X' 22.100 / + 'W1' 3 3 3 3 'OPEN' 1* 46.825 0.311 4332.346 1* 11 'X' 22.123 / +/ + + +END + +)"; + Deck deck = Parser{}.parseString(input); + const auto es = EclipseState { deck }; + const auto sched = Schedule { deck, es, std::make_shared() }; + + const auto& well11 = sched.getWell("W1", 1); + const auto& well21 = sched.getWell("W2", 1); + const auto& wdfac11 = well11.getWDFAC(); + const auto& wdfac21 = well21.getWDFAC(); + + double rho = 1.0; + double mu = 0.01*Opm::prefix::centi * Opm::unit::Poise; + double k = 10.0 * Opm::prefix::milli * Opm::unit::darcy; + double h = 20; + double rw = 0.108; + double phi = 0.3; + + // WDFAC overwrites D factor in COMDAT + BOOST_CHECK(!wdfac11.useConnectionDFactor()); + BOOST_CHECK(wdfac11.useDFactor()); + BOOST_CHECK(!wdfac21.useConnectionDFactor()); + + BOOST_CHECK_CLOSE(wdfac11.getDFactor(rho, mu, k, phi, rw, h), 1*Opm::unit::day, 1e-12); + BOOST_CHECK_CLOSE(wdfac21.getDFactor(rho, mu, k, phi, rw, h), 2*Opm::unit::day, 1e-12); + + const auto& well12 = sched.getWell("W1", 2); + const auto& well22 = sched.getWell("W2", 2); + const auto& wdfac12 = well12.getWDFAC(); + const auto& wdfac22 = well22.getWDFAC(); + + BOOST_CHECK_CLOSE(wdfac12.getDFactor(rho, mu, k, phi, rw, h), 5.19e-1, 3); + BOOST_CHECK_CLOSE(wdfac22.getDFactor(rho, mu, k, phi, rw, h), 2*Opm::unit::day, 1e-12); + + + const auto& well13 = sched.getWell("W1", 3); + const auto& well23 = sched.getWell("W2", 3); + const auto& wdfac13 = well13.getWDFAC(); + const auto& wdfac23 = well23.getWDFAC(); + BOOST_CHECK(wdfac13.useConnectionDFactor()); + BOOST_CHECK(wdfac13.useDFactor()); + BOOST_CHECK(!wdfac23.useConnectionDFactor()); + + + BOOST_CHECK_CLOSE(well13.getConnections()[0].dFactor(), 0*Opm::unit::day, 1e-12); + BOOST_CHECK_CLOSE(well13.getConnections()[1].dFactor(), 0*Opm::unit::day, 1e-12); + BOOST_CHECK_CLOSE(well13.getConnections()[2].dFactor(), 11*Opm::unit::day, 1e-12); + + BOOST_CHECK_CLOSE(wdfac23.getDFactor(rho, mu, k, phi, rw, h), 2*Opm::unit::day, 1e-12); + BOOST_CHECK_THROW(wdfac13.getDFactor(rho, mu, k, phi, rw, h ), std::exception); +} + BOOST_AUTO_TEST_CASE(createDeckWithBC) { std::string input = R"( START -- 0 diff --git a/tests/test_PAvgCalculator.cpp b/tests/test_PAvgCalculator.cpp index 80b6c89f7..9369ce6ec 100644 --- a/tests/test_PAvgCalculator.cpp +++ b/tests/test_PAvgCalculator.cpp @@ -60,7 +60,7 @@ namespace { conns.emplace_back(i, j, k, globIndex({i, j, k}, dims), k, 2000 + (2*k + 1) / static_cast(2), Opm::Connection::State::OPEN, - k / 100.0, 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0, + k / 100.0, 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::Z, Opm::Connection::CTFKind::DeckValue, k, false); } @@ -96,7 +96,7 @@ namespace { // 0.03, 0.0, 0.01, 0.02, 0.03, ... ((k + 3 - topConn) % 4) / 100.0, - 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0, + 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::Z, Opm::Connection::CTFKind::DeckValue, k - topConn, false); } @@ -118,7 +118,7 @@ namespace { conns.emplace_back(i, j, k, globIndex({i, j, k}, dims), i - left, 2000 + (2*k + 1) / static_cast(2), Opm::Connection::State::OPEN, - i / 100.0, 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0, + i / 100.0, 1.0, 1.0, 0.5, 0.5, 1.0, 0.0, 0.0, 0.0, 0, Opm::Connection::Direction::X, Opm::Connection::CTFKind::DeckValue, i - left, false); } diff --git a/tests/test_RFT.cpp b/tests/test_RFT.cpp index cc73c3350..4991bf09e 100644 --- a/tests/test_RFT.cpp +++ b/tests/test_RFT.cpp @@ -732,12 +732,12 @@ BOOST_AUTO_TEST_CASE(test_RFT) std::vector well1_comps(9); Opm::data::ConnectionFiltrate con_filtrate {0.1, 1, 3, 0.4, 1.e-9, 0.2, 0.05, 10.}; // values are not used in this test for (size_t i = 0; i < 9; ++i) { - Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i, 1.2e3, 4.321, con_filtrate}; + Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i, 1.2e3, 4.321, 0.0, con_filtrate}; well1_comps[i] = std::move(well_comp); } std::vector well2_comps(6); for (size_t i = 0; i < 6; ++i) { - Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2, 0.15, 0.54321, con_filtrate}; + Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2, 0.15, 0.54321, 0.0, con_filtrate}; well2_comps[i] = std::move(well_comp); } @@ -871,12 +871,12 @@ BOOST_AUTO_TEST_CASE(test_RFT2) std::vector well1_comps(9); Opm::data::ConnectionFiltrate con_filtrate {0.1, 1, 3, 0.4, 1.e-9, 0.2, 0.05, 10.}; // values are not used in this test for (size_t i = 0; i < 9; ++i) { - Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i, 3.14e5, 0.1234, con_filtrate}; + Opm::data::Connection well_comp { grid.getGlobalIndex(8,8,i) ,r1, 0.0 , 0.0, (double)i, 0.1*i,0.2*i, 3.14e5, 0.1234, 0.0, con_filtrate}; well1_comps[i] = std::move(well_comp); } std::vector well2_comps(6); for (size_t i = 0; i < 6; ++i) { - Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2, 355.113, 0.9876, con_filtrate}; + Opm::data::Connection well_comp { grid.getGlobalIndex(3,3,i+3) ,r2, 0.0 , 0.0, (double)i, i*0.1,i*0.2, 355.113, 0.9876, 0.0, con_filtrate}; well2_comps[i] = std::move(well_comp); } diff --git a/tests/test_Restart.cpp b/tests/test_Restart.cpp index 39b367340..400608f68 100644 --- a/tests/test_Restart.cpp +++ b/tests/test_Restart.cpp @@ -187,15 +187,15 @@ data::Wells mkWells() { * input deck. All other entries in the well structures are arbitrary. */ Opm::data::ConnectionFiltrate con_filtrate {0.1, 1, 3, 0.4, 1.e-9, 0.2, 0.05, 10.}; // values are not used in this test - w1.connections.push_back( { 88, rc1, 30.45, 123.4, 543.21, 0.62, 0.15, 1.0e3, 1.234, con_filtrate } ); - w1.connections.push_back( { 288, rc2, 33.19, 123.4, 432.1, 0.26, 0.45, 2.56, 2.345, con_filtrate } ); + w1.connections.push_back( { 88, rc1, 30.45, 123.4, 543.21, 0.62, 0.15, 1.0e3, 1.234, 0.0, con_filtrate } ); + w1.connections.push_back( { 288, rc2, 33.19, 123.4, 432.1, 0.26, 0.45, 2.56, 2.345, 0.0, con_filtrate } ); w2.rates = r2; w2.thp = 2.0; w2.bhp = 2.34; w2.temperature = 4.56; w2.control = 2; - w2.connections.push_back( { 188, rc3, 36.22, 123.4, 256.1, 0.55, 0.0125, 314.15, 3.456, con_filtrate } ); + w2.connections.push_back( { 188, rc3, 36.22, 123.4, 256.1, 0.55, 0.0125, 314.15, 3.456, 0.0, con_filtrate } ); { data::Wells wellRates; diff --git a/tests/test_Serialization.cpp b/tests/test_Serialization.cpp index 50b4a779f..c9d3710e6 100644 --- a/tests/test_Serialization.cpp +++ b/tests/test_Serialization.cpp @@ -98,6 +98,7 @@ #include #include #include +#include #include #include #include @@ -111,6 +112,7 @@ #include #include #include + #include #include #include diff --git a/tests/test_Summary.cpp b/tests/test_Summary.cpp index 79926fe7b..d822c400d 100644 --- a/tests/test_Summary.cpp +++ b/tests/test_Summary.cpp @@ -319,11 +319,11 @@ data::Wells result_wells(const bool w3_injector = true) data::ConnectionFiltrate zero_filtrate {}; // only injecting connections are counted for filtration related data::ConnectionFiltrate con_filtrate = {0.1*sm3_pr_day(), 1*sm3(), 3, 0.01*unit::meter, 1.e-3*unit::darcy, 0.2, 0.05*unit::meter, 10.*unit::square(unit::meter)}; data::ConnectionFiltrate w3_con_filtrate = w3_injector ? con_filtrate : zero_filtrate; - data::Connection well1_comp1 { 0 , crates1, 1.9 *unit::barsa, -123.4 *rm3_pr_day(), 314.15, 0.35 , 0.25, 2.718e2, 111.222*cp_rm3_per_db(), zero_filtrate}; - data::Connection well2_comp1 { 1 , crates2, 1.10*unit::barsa, - 23.4 *rm3_pr_day(), 212.1 , 0.78 , 0.0 , 12.34 , 222.333*cp_rm3_per_db(), zero_filtrate}; - data::Connection well2_comp2 { 101, crates3, 1.11*unit::barsa, -234.5 *rm3_pr_day(), 150.6 , 0.001, 0.89, 100.0 , 333.444*cp_rm3_per_db(), con_filtrate /* output should be zero since it is a producer */}; - data::Connection well3_comp1 { 2 , crates3, 1.11*unit::barsa, 432.1 *rm3_pr_day(), 456.78, 0.0 , 0.15, 432.1 , 444.555*cp_rm3_per_db(), w3_con_filtrate}; - data::Connection well6_comp1 { 77 , crates6, 6.11*unit::barsa, 321.09*rm3_pr_day(), 656.78, 0.0 , 0.65, 632.1 , 555.666*cp_rm3_per_db(), zero_filtrate}; + data::Connection well1_comp1 { 0 , crates1, 1.9 *unit::barsa, -123.4 *rm3_pr_day(), 314.15, 0.35 , 0.25, 2.718e2, 111.222*cp_rm3_per_db(), 0.0, zero_filtrate}; + data::Connection well2_comp1 { 1 , crates2, 1.10*unit::barsa, - 23.4 *rm3_pr_day(), 212.1 , 0.78 , 0.0 , 12.34 , 222.333*cp_rm3_per_db(), 0.0, zero_filtrate}; + data::Connection well2_comp2 { 101, crates3, 1.11*unit::barsa, -234.5 *rm3_pr_day(), 150.6 , 0.001, 0.89, 100.0 , 333.444*cp_rm3_per_db(), 0.0, con_filtrate /* output should be zero since it is a producer */}; + data::Connection well3_comp1 { 2 , crates3, 1.11*unit::barsa, 432.1 *rm3_pr_day(), 456.78, 0.0 , 0.15, 432.1 , 444.555*cp_rm3_per_db(), 0.0, w3_con_filtrate}; + data::Connection well6_comp1 { 77 , crates6, 6.11*unit::barsa, 321.09*rm3_pr_day(), 656.78, 0.0 , 0.65, 632.1 , 555.666*cp_rm3_per_db(), 0.0, zero_filtrate}; /* The completions diff --git a/tests/test_Summary_Group.cpp b/tests/test_Summary_Group.cpp index 077a928d5..9e66a0de9 100644 --- a/tests/test_Summary_Group.cpp +++ b/tests/test_Summary_Group.cpp @@ -172,7 +172,7 @@ static data::Wells result_wells() { input deck. */ data::ConnectionFiltrate con_filtrate {0.1, 1, 3, 0.4, 1.e-9, 0.2, 0.05, 10.}; // values are not tested in this test - data::Connection well1_comp1 { 0 , crates1, 1.9 , 123.4, 314.15, 0.35, 0.25, 2.718e2, 0.12345, con_filtrate }; + data::Connection well1_comp1 { 0 , crates1, 1.9 , 123.4, 314.15, 0.35, 0.25, 2.718e2, 0.12345, 0.0, con_filtrate }; /* The completions diff --git a/tests/test_Wells.cpp b/tests/test_Wells.cpp index 7a89284a7..a4852e164 100644 --- a/tests/test_Wells.cpp +++ b/tests/test_Wells.cpp @@ -116,8 +116,8 @@ BOOST_AUTO_TEST_CASE(get_connections) { * the completion keys (active indices) and well names correspond to the * input deck. All other entries in the well structures are arbitrary. */ - w1.connections.push_back( { 88, rc1, 30.45, 123.45, 543.21, 0.123, 0.5, 17.29, 0.1729,{}} ); - w1.connections.push_back( { 288, rc2, 33.19, 67.89, 98.76, 0.5, 0.125, 355.113, 0.355113, {}} ); + w1.connections.push_back( { 88, rc1, 30.45, 123.45, 543.21, 0.123, 0.5, 17.29, 0.1729,0.0,{}} ); + w1.connections.push_back( { 288, rc2, 33.19, 67.89, 98.76, 0.5, 0.125, 355.113, 0.355113,0.0, {}} ); { Json::JsonObject json_data; @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(get_connections) { w2.temperature = 4.56; w2.control = 2; w2.filtrate = {0.3, 3, 0.4}; // values are not tested in this test - w2.connections.push_back( { 188, rc3, 36.22, 19.28, 28.91, 0.125, 0.125, 3.141, 0.31415, {}} ); + w2.connections.push_back( { 188, rc3, 36.22, 19.28, 28.91, 0.125, 0.125, 3.141, 0.31415, 0.0, {}} ); data::Wells wellRates; wellRates["OP_1"] = w1;