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 {
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;
};

View File

@ -251,15 +251,24 @@ SatFuncControls::SatFuncControls(const Deck& deck)
this->tolcrit = deck.getKeyword<Kw>(0).getRecord(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)
, 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<ParserKeywords::STONE1>())
stonetype = StoneType::STONE1;
else if (deck.hasKeyword<ParserKeywords::STONE>() ||
deck.hasKeyword<ParserKeywords::STONE2>())
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();
}
}

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_MESSAGE(!(sfctrl == ::Opm::SatFuncControls{}),
"Default-constructed SatFuncControl must NOT equal non-default");