diff --git a/opm/input/eclipse/EclipseState/Runspec.hpp b/opm/input/eclipse/EclipseState/Runspec.hpp index b524a9a5e..963fb6ca6 100644 --- a/opm/input/eclipse/EclipseState/Runspec.hpp +++ b/opm/input/eclipse/EclipseState/Runspec.hpp @@ -472,6 +472,7 @@ public: bool co2Storage() const noexcept; bool h2Storage() const noexcept; bool micp() const noexcept; + bool mech() const noexcept; bool operator==(const Runspec& data) const; static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state); @@ -496,6 +497,7 @@ public: serializer(m_co2storage); serializer(m_h2storage); serializer(m_micp); + serializer(m_mech); } private: @@ -517,6 +519,7 @@ private: bool m_co2storage; bool m_h2storage; bool m_micp; + bool m_mech; }; diff --git a/src/opm/input/eclipse/EclipseState/Runspec.cpp b/src/opm/input/eclipse/EclipseState/Runspec.cpp index 80d5e9392..f7455b844 100644 --- a/src/opm/input/eclipse/EclipseState/Runspec.cpp +++ b/src/opm/input/eclipse/EclipseState/Runspec.cpp @@ -624,6 +624,7 @@ Runspec::Runspec( const Deck& deck ) , m_co2storage (false) , m_h2storage (false) , m_micp (false) + , m_mech (false) { if (DeckSection::hasRUNSPEC(deck)) { const RUNSPECSection runspecSection{deck}; @@ -671,6 +672,12 @@ Runspec::Runspec( const Deck& deck ) "for details on the used model."; OpmLog::note(msg); } + + if (runspecSection.hasKeyword()) { + m_mech = true; + const std::string msg = "Simulation will solve for mechanical quantities"; + OpmLog::note(msg); + } } } @@ -692,6 +699,7 @@ Runspec Runspec::serializationTestObject() result.m_co2storage = true; result.m_h2storage = true; result.m_micp = true; + result.m_mech = true; return result; } @@ -766,6 +774,11 @@ bool Runspec::micp() const noexcept return this->m_micp; } +bool Runspec::mech() const noexcept +{ + return this->m_mech; +} + std::time_t Runspec::start_time() const noexcept { return this->m_start_time; @@ -805,6 +818,7 @@ bool Runspec::rst_cmp(const Runspec& full_spec, const Runspec& rst_spec) { full_spec.m_co2storage == rst_spec.m_co2storage && full_spec.m_h2storage == rst_spec.m_h2storage && full_spec.m_micp == rst_spec.m_micp && + full_spec.m_mech == rst_spec.m_mech && Welldims::rst_cmp(full_spec.wellDimensions(), rst_spec.wellDimensions()); } @@ -822,7 +836,8 @@ bool Runspec::operator==(const Runspec& data) const { this->m_nupcol == data.m_nupcol && this->m_co2storage == data.m_co2storage && this->m_h2storage == data.m_h2storage && - this->m_micp == data.m_micp; + this->m_micp == data.m_micp && + this->m_mech == data.m_mech; } diff --git a/src/opm/input/eclipse/share/keywords/900_OPM/M/MECH b/src/opm/input/eclipse/share/keywords/900_OPM/M/MECH new file mode 100644 index 000000000..5aefd943a --- /dev/null +++ b/src/opm/input/eclipse/share/keywords/900_OPM/M/MECH @@ -0,0 +1,6 @@ +{ + "name": "MECH", + "sections": [ + "RUNSPEC" + ] +} diff --git a/src/opm/input/eclipse/share/keywords/keyword_list.cmake b/src/opm/input/eclipse/share/keywords/keyword_list.cmake index de5a8508d..27de33947 100644 --- a/src/opm/input/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/input/eclipse/share/keywords/keyword_list.cmake @@ -1113,6 +1113,7 @@ set( keywords 900_OPM/G/GCOMPIDX 900_OPM/G/GASDENT 900_OPM/G/GASJT + 900_OPM/M/MECH 900_OPM/M/MICP 900_OPM/M/MICPPARA 900_OPM/M/MINNPCOL diff --git a/tests/parser/RunspecTests.cpp b/tests/parser/RunspecTests.cpp index 3398853d6..815d92ae0 100644 --- a/tests/parser/RunspecTests.cpp +++ b/tests/parser/RunspecTests.cpp @@ -1112,3 +1112,25 @@ BOOST_AUTO_TEST_CASE(NUPCOL) { BOOST_CHECK_EQUAL(np.value(), min_value); } +BOOST_AUTO_TEST_CASE(Mech) { + const std::string input = R"( + RUNSPEC + OIL + GAS + WATER + MECH + )"; + + Parser parser; + + auto deck = parser.parseString(input); + + Runspec runspec( deck ); + const auto& phases = runspec.phases(); + BOOST_CHECK_EQUAL( 3U, phases.size() ); + BOOST_CHECK( phases.active( Phase::OIL ) ); + BOOST_CHECK( phases.active( Phase::GAS ) ); + BOOST_CHECK( phases.active( Phase::WATER ) ); + BOOST_CHECK( runspec.mech() ); +} +