From 4567bdee6cc62437053bd688aa95d6f4e4ce0c7d Mon Sep 17 00:00:00 2001 From: Vegard Kippe Date: Tue, 30 Apr 2024 12:59:38 +0200 Subject: [PATCH] Use 0 degC instead of STDCOND for default WTEMP in TEMP option --- opm/input/eclipse/EclipseState/Runspec.cpp | 18 ++++++++++++++++++ opm/input/eclipse/EclipseState/Runspec.hpp | 3 +++ opm/input/eclipse/Schedule/Schedule.cpp | 3 ++- opm/input/eclipse/Schedule/Well/Well.cpp | 15 ++++++--------- opm/input/eclipse/Schedule/Well/Well.hpp | 3 ++- 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/opm/input/eclipse/EclipseState/Runspec.cpp b/opm/input/eclipse/EclipseState/Runspec.cpp index d482891a75b..910d8c71c2b 100644 --- a/opm/input/eclipse/EclipseState/Runspec.cpp +++ b/opm/input/eclipse/EclipseState/Runspec.cpp @@ -648,6 +648,7 @@ Runspec::Runspec(const Deck& deck) , m_h2storage (false) , m_micp (false) , m_mech (false) + , m_temp (false) { if (DeckSection::hasRUNSPEC(deck)) { const RUNSPECSection runspecSection{deck}; @@ -762,6 +763,15 @@ Runspec::Runspec(const Deck& deck) OpmLog::note(msg); } + + if (runspecSection.hasKeyword()) { + m_temp = true; + + const std::string msg = "Simulation will include energy, but not enthalpy (no work terms)."; + + OpmLog::note(msg); + + } } } @@ -787,6 +797,7 @@ Runspec Runspec::serializationTestObject() result.m_h2storage = true; result.m_micp = true; result.m_mech = true; + result.m_temp = true; return result; } @@ -886,6 +897,11 @@ bool Runspec::mech() const noexcept return this->m_mech; } +bool Runspec::temp() const noexcept +{ + return this->m_temp; +} + std::time_t Runspec::start_time() const noexcept { return this->m_start_time; @@ -928,6 +944,7 @@ bool Runspec::rst_cmp(const Runspec& full_spec, const Runspec& rst_spec) full_spec.m_h2storage == rst_spec.m_h2storage && full_spec.m_micp == rst_spec.m_micp && full_spec.m_mech == rst_spec.m_mech && + full_spec.m_temp == rst_spec.m_temp && Welldims::rst_cmp(full_spec.wellDimensions(), rst_spec.wellDimensions()); } @@ -951,6 +968,7 @@ bool Runspec::operator==(const Runspec& data) const && (this->m_h2storage == data.m_h2storage) && (this->m_micp == data.m_micp) && (this->m_mech == data.m_mech) + && (this->m_temp == data.m_temp) ; } diff --git a/opm/input/eclipse/EclipseState/Runspec.hpp b/opm/input/eclipse/EclipseState/Runspec.hpp index 284ef6f2164..e406ad91383 100644 --- a/opm/input/eclipse/EclipseState/Runspec.hpp +++ b/opm/input/eclipse/EclipseState/Runspec.hpp @@ -509,6 +509,7 @@ class Runspec { bool h2Storage() const noexcept; bool micp() const noexcept; bool mech() const noexcept; + bool temp() const noexcept; bool operator==(const Runspec& data) const; static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state); @@ -537,6 +538,7 @@ class Runspec { serializer(m_h2storage); serializer(m_micp); serializer(m_mech); + serializer(m_temp); } private: @@ -562,6 +564,7 @@ class Runspec { bool m_h2storage; bool m_micp; bool m_mech; + bool m_temp; }; std::size_t declaredMaxRegionID(const Runspec& rspec); diff --git a/opm/input/eclipse/Schedule/Schedule.cpp b/opm/input/eclipse/Schedule/Schedule.cpp index fe1c9414129..53a3187ea63 100644 --- a/opm/input/eclipse/Schedule/Schedule.cpp +++ b/opm/input/eclipse/Schedule/Schedule.cpp @@ -944,7 +944,8 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e allowCrossFlow, automaticShutIn, pvt_table, - gas_inflow); + gas_inflow, + this->m_static.m_runspec.temp()); this->addWell( std::move(well) ); diff --git a/opm/input/eclipse/Schedule/Well/Well.cpp b/opm/input/eclipse/Schedule/Well/Well.cpp index 7497b75f62e..9b37f8ba1be 100644 --- a/opm/input/eclipse/Schedule/Well/Well.cpp +++ b/opm/input/eclipse/Schedule/Well/Well.cpp @@ -468,7 +468,8 @@ Well::Well(const std::string& wname_arg, bool allow_xflow, bool auto_shutin, int pvt_table_, - GasInflowEquation inflow_eq): + GasInflowEquation inflow_eq, + bool temp_option): wname(wname_arg), group_name(gname), init_step(init_step_arg), @@ -504,6 +505,10 @@ Well::Well(const std::string& wname_arg, well_temperature(Metric::TemperatureOffset + ParserKeywords::STCOND::TEMPERATURE::defaultValue), well_inj_mult(std::nullopt) { + if (temp_option) { + well_temperature = Metric::TemperatureOffset + 0.0; + } + auto p = std::make_shared(this->unit_system, this->wname); p->whistctl_cmode = whistctl_cmode; this->updateProduction(p); @@ -918,14 +923,6 @@ bool Well::handleCOMPSEGS(const DeckKeyword& keyword, const ScheduleGrid& grid, const ParseContext& parseContext, ErrorGuard& errors) { - if (!this->segments) { - throw OpmInputError{ - fmt::format("WELSEGS must be specified for well {} " - "before COMPSEGS being input.", - this->name()), - keyword.location() - }; - } auto [new_connections, new_segments] = Compsegs::processCOMPSEGS( keyword, *this->connections, diff --git a/opm/input/eclipse/Schedule/Well/Well.hpp b/opm/input/eclipse/Schedule/Well/Well.hpp index 169356d24ae..3ba308f3b1e 100644 --- a/opm/input/eclipse/Schedule/Well/Well.hpp +++ b/opm/input/eclipse/Schedule/Well/Well.hpp @@ -395,7 +395,8 @@ class Well { bool allow_xflow, bool auto_shutin, int pvt_table, - GasInflowEquation inflow_eq); + GasInflowEquation inflow_eq, + bool temp_option = false); Well(const RestartIO::RstWell& rst_well, int report_step,