Merge pull request #1550 from akva2/followup_stonetype

changed: relocate and rename StoneType enum
This commit is contained in:
Bård Skaflestad 2020-03-10 07:57:26 -05:00 committed by GitHub
commit cb7e40345f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 32 deletions

View File

@ -185,29 +185,36 @@ private:
class SatFuncControls { class SatFuncControls {
public: public:
enum class ThreePhaseOilKrModel {
Default,
Stone1,
Stone2
};
SatFuncControls(); SatFuncControls();
explicit SatFuncControls(const Deck& deck); explicit SatFuncControls(const Deck& deck);
explicit SatFuncControls(const double tolcritArg); SatFuncControls(const double tolcritArg,
ThreePhaseOilKrModel model);
double minimumRelpermMobilityThreshold() const double minimumRelpermMobilityThreshold() const
{ {
return this->tolcrit; return this->tolcrit;
} }
ThreePhaseOilKrModel krModel() const
{
return this->krmodel;
}
bool operator==(const SatFuncControls& rhs) const; bool operator==(const SatFuncControls& rhs) const;
private: private:
double tolcrit; double tolcrit;
ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default;
}; };
class Runspec { class Runspec {
public: public:
enum class StoneType {
DEFAULT,
STONE1,
STONE2
};
Runspec() = default; Runspec() = default;
explicit Runspec( const Deck& ); explicit Runspec( const Deck& );
Runspec(const Phases& act_phases, Runspec(const Phases& act_phases,
@ -218,8 +225,7 @@ public:
const UDQParams& udqparams, const UDQParams& udqparams,
const EclHysterConfig& hystPar, const EclHysterConfig& hystPar,
const Actdims& actDims, const Actdims& actDims,
const SatFuncControls& sfuncctrl, const SatFuncControls& sfuncctrl);
StoneType stonetype);
const UDQParams& udqParams() const noexcept; const UDQParams& udqParams() const noexcept;
const Phases& phases() const noexcept; const Phases& phases() const noexcept;
@ -231,7 +237,6 @@ public:
const EclHysterConfig& hysterPar() const noexcept; const EclHysterConfig& hysterPar() const noexcept;
const Actdims& actdims() const noexcept; const Actdims& actdims() const noexcept;
const SatFuncControls& saturationFunctionControls() const noexcept; const SatFuncControls& saturationFunctionControls() const noexcept;
StoneType stoneType() const noexcept;
bool operator==(const Runspec& data) const; bool operator==(const Runspec& data) const;
@ -245,7 +250,6 @@ private:
EclHysterConfig hystpar; EclHysterConfig hystpar;
Actdims m_actdims; Actdims m_actdims;
SatFuncControls m_sfuncctrl; SatFuncControls m_sfuncctrl;
StoneType stonetype = StoneType::DEFAULT;
}; };

View File

@ -251,15 +251,24 @@ SatFuncControls::SatFuncControls(const Deck& deck)
this->tolcrit = deck.getKeyword<Kw>(0).getRecord(0) this->tolcrit = deck.getKeyword<Kw>(0).getRecord(0)
.getItem<Kw::VALUE>().getSIDouble(0); .getItem<Kw::VALUE>().getSIDouble(0);
} }
if (deck.hasKeyword<ParserKeywords::STONE1>())
krmodel = ThreePhaseOilKrModel::Stone1;
else if (deck.hasKeyword<ParserKeywords::STONE>() ||
deck.hasKeyword<ParserKeywords::STONE2>())
krmodel = ThreePhaseOilKrModel::Stone2;
} }
SatFuncControls::SatFuncControls(const double tolcritArg) SatFuncControls::SatFuncControls(const double tolcritArg,
ThreePhaseOilKrModel model)
: tolcrit(tolcritArg) : tolcrit(tolcritArg)
, krmodel(model)
{} {}
bool SatFuncControls::operator==(const SatFuncControls& rhs) const 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 ) : Runspec::Runspec( const Deck& deck ) :
@ -280,13 +289,7 @@ Runspec::Runspec( const Deck& deck ) :
hystpar( deck ), hystpar( deck ),
m_actdims( deck ), m_actdims( deck ),
m_sfuncctrl( deck ) m_sfuncctrl( deck )
{ {}
if (deck.hasKeyword<ParserKeywords::STONE1>())
stonetype = StoneType::STONE1;
else if (deck.hasKeyword<ParserKeywords::STONE>() ||
deck.hasKeyword<ParserKeywords::STONE2>())
stonetype = StoneType::STONE2;
}
Runspec::Runspec(const Phases& act_phases, Runspec::Runspec(const Phases& act_phases,
const Tabdims& tabdims, const Tabdims& tabdims,
@ -296,8 +299,7 @@ Runspec::Runspec(const Phases& act_phases,
const UDQParams& udqparams, const UDQParams& udqparams,
const EclHysterConfig& hystPar, const EclHysterConfig& hystPar,
const Actdims& actDims, const Actdims& actDims,
const SatFuncControls& sfuncctrl, const SatFuncControls& sfuncctrl) :
StoneType stone) :
active_phases(act_phases), active_phases(act_phases),
m_tabdims(tabdims), m_tabdims(tabdims),
endscale(endScale), endscale(endScale),
@ -306,8 +308,7 @@ Runspec::Runspec(const Phases& act_phases,
udq_params(udqparams), udq_params(udqparams),
hystpar(hystPar), hystpar(hystPar),
m_actdims(actDims), m_actdims(actDims),
m_sfuncctrl(sfuncctrl), m_sfuncctrl(sfuncctrl)
stonetype(stone)
{} {}
const Phases& Runspec::phases() const noexcept { const Phases& Runspec::phases() const noexcept {
@ -365,11 +366,6 @@ const UDQParams& Runspec::udqParams() const noexcept {
return this->udq_params; return this->udq_params;
} }
Runspec::StoneType Runspec::stoneType() const noexcept {
return this->stonetype;
}
bool Runspec::operator==(const Runspec& data) const { bool Runspec::operator==(const Runspec& data) const {
return this->phases() == data.phases() && return this->phases() == data.phases() &&
this->tabdims() == data.tabdims() && this->tabdims() == data.tabdims() &&
@ -378,8 +374,7 @@ bool Runspec::operator==(const Runspec& data) const {
this->wellSegmentDimensions() == data.wellSegmentDimensions() && this->wellSegmentDimensions() == data.wellSegmentDimensions() &&
this->hysterPar() == data.hysterPar() && this->hysterPar() == data.hysterPar() &&
this->actdims() == data.actdims() && this->actdims() == data.actdims() &&
this->saturationFunctionControls() == data.saturationFunctionControls() && this->saturationFunctionControls() == data.saturationFunctionControls();
this->stoneType() == data.stoneType();
} }
} }

View File

@ -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_CLOSE(sfctrl.minimumRelpermMobilityThreshold(), 5.0e-7, 1.0e-10);
BOOST_CHECK_MESSAGE(!(sfctrl == ::Opm::SatFuncControls{}), BOOST_CHECK_MESSAGE(!(sfctrl == ::Opm::SatFuncControls{}),
"Default-constructed SatFuncControl must NOT equal non-default"); "Default-constructed SatFuncControl must NOT equal non-default");