From 9b22cab024e1aa6d9c2aeb40defce27135d0ab14 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 10 Mar 2020 10:38:43 +0100 Subject: [PATCH] changed: relocate and rename StoneType enum unfortunate naming, unfortunate location --- opm/parser/eclipse/EclipseState/Runspec.hpp | 26 ++++++++------ .../parser/eclipse/EclipseState/Runspec.cpp | 35 ++++++++----------- tests/parser/RunspecTests.cpp | 2 +- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Runspec.hpp b/opm/parser/eclipse/EclipseState/Runspec.hpp index 0552b0ff9..bb65deba5 100644 --- a/opm/parser/eclipse/EclipseState/Runspec.hpp +++ b/opm/parser/eclipse/EclipseState/Runspec.hpp @@ -185,29 +185,36 @@ private: class SatFuncControls { public: + enum class ThreePhaseOilKrModel { + Default, + Stone1, + Stone2 + }; + SatFuncControls(); explicit SatFuncControls(const Deck& deck); - explicit SatFuncControls(const double tolcritArg); + SatFuncControls(const double tolcritArg, + ThreePhaseOilKrModel model); double minimumRelpermMobilityThreshold() const { return this->tolcrit; } + ThreePhaseOilKrModel krModel() const + { + return this->krmodel; + } + bool operator==(const SatFuncControls& rhs) const; private: double tolcrit; + ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default; }; class Runspec { public: - enum class StoneType { - DEFAULT, - STONE1, - STONE2 - }; - Runspec() = default; explicit Runspec( const Deck& ); Runspec(const Phases& act_phases, @@ -218,8 +225,7 @@ public: const UDQParams& udqparams, const EclHysterConfig& hystPar, const Actdims& actDims, - const SatFuncControls& sfuncctrl, - StoneType stonetype); + const SatFuncControls& sfuncctrl); const UDQParams& udqParams() const noexcept; const Phases& phases() const noexcept; @@ -231,7 +237,6 @@ public: const EclHysterConfig& hysterPar() const noexcept; const Actdims& actdims() const noexcept; const SatFuncControls& saturationFunctionControls() const noexcept; - StoneType stoneType() const noexcept; bool operator==(const Runspec& data) const; @@ -245,7 +250,6 @@ private: EclHysterConfig hystpar; Actdims m_actdims; SatFuncControls m_sfuncctrl; - StoneType stonetype = StoneType::DEFAULT; }; diff --git a/src/opm/parser/eclipse/EclipseState/Runspec.cpp b/src/opm/parser/eclipse/EclipseState/Runspec.cpp index 16200f262..80fe0a785 100644 --- a/src/opm/parser/eclipse/EclipseState/Runspec.cpp +++ b/src/opm/parser/eclipse/EclipseState/Runspec.cpp @@ -251,15 +251,24 @@ SatFuncControls::SatFuncControls(const Deck& deck) this->tolcrit = deck.getKeyword(0).getRecord(0) .getItem().getSIDouble(0); } + + if (deck.hasKeyword()) + krmodel = ThreePhaseOilKrModel::Stone1; + else if (deck.hasKeyword() || + deck.hasKeyword()) + krmodel = ThreePhaseOilKrModel::Stone2; } -SatFuncControls::SatFuncControls(const double tolcritArg) +SatFuncControls::SatFuncControls(const double tolcritArg, + ThreePhaseOilKrModel model) : tolcrit(tolcritArg) + , krmodel(model) {} bool SatFuncControls::operator==(const SatFuncControls& rhs) const { - return this->minimumRelpermMobilityThreshold() == rhs.minimumRelpermMobilityThreshold(); + return this->minimumRelpermMobilityThreshold() == rhs.minimumRelpermMobilityThreshold() && + this->krModel() == rhs.krModel(); } Runspec::Runspec( const Deck& deck ) : @@ -280,13 +289,7 @@ Runspec::Runspec( const Deck& deck ) : hystpar( deck ), m_actdims( deck ), m_sfuncctrl( deck ) -{ - if (deck.hasKeyword()) - stonetype = StoneType::STONE1; - else if (deck.hasKeyword() || - deck.hasKeyword()) - stonetype = StoneType::STONE2; -} +{} Runspec::Runspec(const Phases& act_phases, const Tabdims& tabdims, @@ -296,8 +299,7 @@ Runspec::Runspec(const Phases& act_phases, const UDQParams& udqparams, const EclHysterConfig& hystPar, const Actdims& actDims, - const SatFuncControls& sfuncctrl, - StoneType stone) : + const SatFuncControls& sfuncctrl) : active_phases(act_phases), m_tabdims(tabdims), endscale(endScale), @@ -306,8 +308,7 @@ Runspec::Runspec(const Phases& act_phases, udq_params(udqparams), hystpar(hystPar), m_actdims(actDims), - m_sfuncctrl(sfuncctrl), - stonetype(stone) + m_sfuncctrl(sfuncctrl) {} const Phases& Runspec::phases() const noexcept { @@ -365,11 +366,6 @@ const UDQParams& Runspec::udqParams() const noexcept { return this->udq_params; } -Runspec::StoneType Runspec::stoneType() const noexcept { - return this->stonetype; -} - - bool Runspec::operator==(const Runspec& data) const { return this->phases() == data.phases() && this->tabdims() == data.tabdims() && @@ -378,8 +374,7 @@ bool Runspec::operator==(const Runspec& data) const { this->wellSegmentDimensions() == data.wellSegmentDimensions() && this->hysterPar() == data.hysterPar() && this->actdims() == data.actdims() && - this->saturationFunctionControls() == data.saturationFunctionControls() && - this->stoneType() == data.stoneType(); + this->saturationFunctionControls() == data.saturationFunctionControls(); } } diff --git a/tests/parser/RunspecTests.cpp b/tests/parser/RunspecTests.cpp index 074cca033..bd69bcb55 100644 --- a/tests/parser/RunspecTests.cpp +++ b/tests/parser/RunspecTests.cpp @@ -487,7 +487,7 @@ BOOST_AUTO_TEST_CASE(TolCrit) } { - const auto sfctrl = ::Opm::SatFuncControls{ 5.0e-7 }; + const auto sfctrl = ::Opm::SatFuncControls{ 5.0e-7, ::Opm::SatFuncControls::ThreePhaseOilKrModel::Default }; BOOST_CHECK_CLOSE(sfctrl.minimumRelpermMobilityThreshold(), 5.0e-7, 1.0e-10); BOOST_CHECK_MESSAGE(!(sfctrl == ::Opm::SatFuncControls{}), "Default-constructed SatFuncControl must NOT equal non-default");