Merge pull request #1431 from bska/expose-tolcrit
Internalise TOLCRIT Keyword
This commit is contained in:
commit
eed3c290b3
@ -183,7 +183,22 @@ private:
|
||||
int krHystMod { 0 };
|
||||
};
|
||||
|
||||
class SatFuncControls {
|
||||
public:
|
||||
SatFuncControls();
|
||||
explicit SatFuncControls(const Deck& deck);
|
||||
explicit SatFuncControls(const double tolcritArg);
|
||||
|
||||
double minimumRelpermMobilityThreshold() const
|
||||
{
|
||||
return this->tolcrit;
|
||||
}
|
||||
|
||||
bool operator==(const SatFuncControls& rhs) const;
|
||||
|
||||
private:
|
||||
double tolcrit;
|
||||
};
|
||||
|
||||
class Runspec {
|
||||
public:
|
||||
@ -196,7 +211,8 @@ public:
|
||||
const WellSegmentDims& wsegDims,
|
||||
const UDQParams& udqparams,
|
||||
const EclHysterConfig& hystPar,
|
||||
const Actdims& actDims);
|
||||
const Actdims& actDims,
|
||||
const SatFuncControls& sfuncctrl);
|
||||
|
||||
const UDQParams& udqParams() const noexcept;
|
||||
const Phases& phases() const noexcept;
|
||||
@ -207,6 +223,7 @@ public:
|
||||
int eclPhaseMask( ) const noexcept;
|
||||
const EclHysterConfig& hysterPar() const noexcept;
|
||||
const Actdims& actdims() const noexcept;
|
||||
const SatFuncControls& saturationFunctionControls() const noexcept;
|
||||
|
||||
bool operator==(const Runspec& data) const;
|
||||
|
||||
@ -219,10 +236,10 @@ private:
|
||||
UDQParams udq_params;
|
||||
EclHysterConfig hystpar;
|
||||
Actdims m_actdims;
|
||||
SatFuncControls m_sfuncctrl;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // OPM_RUNSPEC_HPP
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/T.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
|
||||
@ -234,6 +235,32 @@ bool EclHysterConfig::operator==(const EclHysterConfig& data) const {
|
||||
this->krHysteresisModel() == data.krHysteresisModel();
|
||||
}
|
||||
|
||||
SatFuncControls::SatFuncControls()
|
||||
: tolcrit(ParserKeywords::TOLCRIT::VALUE::defaultValue)
|
||||
{}
|
||||
|
||||
SatFuncControls::SatFuncControls(const Deck& deck)
|
||||
: SatFuncControls()
|
||||
{
|
||||
using Kw = ParserKeywords::TOLCRIT;
|
||||
|
||||
if (deck.hasKeyword<Kw>()) {
|
||||
// SIDouble doesn't perform any unit conversions here since
|
||||
// TOLCRIT is a pure scalar (Dimension = 1).
|
||||
this->tolcrit = deck.getKeyword<Kw>(0).getRecord(0)
|
||||
.getItem<Kw::VALUE>().getSIDouble(0);
|
||||
}
|
||||
}
|
||||
|
||||
SatFuncControls::SatFuncControls(const double tolcritArg)
|
||||
: tolcrit(tolcritArg)
|
||||
{}
|
||||
|
||||
bool SatFuncControls::operator==(const SatFuncControls& rhs) const
|
||||
{
|
||||
return this->minimumRelpermMobilityThreshold() == rhs.minimumRelpermMobilityThreshold();
|
||||
}
|
||||
|
||||
Runspec::Runspec( const Deck& deck ) :
|
||||
active_phases( Phases( deck.hasKeyword( "OIL" ),
|
||||
deck.hasKeyword( "GAS" ),
|
||||
@ -250,7 +277,8 @@ Runspec::Runspec( const Deck& deck ) :
|
||||
wsegdims( deck ),
|
||||
udq_params( deck ),
|
||||
hystpar( deck ),
|
||||
m_actdims( deck )
|
||||
m_actdims( deck ),
|
||||
m_sfuncctrl( deck )
|
||||
{}
|
||||
|
||||
Runspec::Runspec(const Phases& act_phases,
|
||||
@ -260,7 +288,8 @@ Runspec::Runspec(const Phases& act_phases,
|
||||
const WellSegmentDims& wsegDims,
|
||||
const UDQParams& udqparams,
|
||||
const EclHysterConfig& hystPar,
|
||||
const Actdims& actDims) :
|
||||
const Actdims& actDims,
|
||||
const SatFuncControls& sfuncctrl) :
|
||||
active_phases(act_phases),
|
||||
m_tabdims(tabdims),
|
||||
endscale(endScale),
|
||||
@ -268,7 +297,8 @@ Runspec::Runspec(const Phases& act_phases,
|
||||
wsegdims(wsegDims),
|
||||
udq_params(udqparams),
|
||||
hystpar(hystPar),
|
||||
m_actdims(actDims)
|
||||
m_actdims(actDims),
|
||||
m_sfuncctrl(sfuncctrl)
|
||||
{}
|
||||
|
||||
const Phases& Runspec::phases() const noexcept {
|
||||
@ -302,6 +332,11 @@ const EclHysterConfig& Runspec::hysterPar() const noexcept
|
||||
return this->hystpar;
|
||||
}
|
||||
|
||||
const SatFuncControls& Runspec::saturationFunctionControls() const noexcept
|
||||
{
|
||||
return this->m_sfuncctrl;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns an integer in the range 0...7 which can be used to indicate
|
||||
available phases in Eclipse restart and init files.
|
||||
@ -329,7 +364,8 @@ bool Runspec::operator==(const Runspec& data) const {
|
||||
this->wellDimensions() == data.wellDimensions() &&
|
||||
this->wellSegmentDimensions() == data.wellSegmentDimensions() &&
|
||||
this->hysterPar() == data.hysterPar() &&
|
||||
this->actdims() == data.actdims();
|
||||
this->actdims() == data.actdims() &&
|
||||
this->saturationFunctionControls() == data.saturationFunctionControls();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -477,6 +477,54 @@ BOOST_AUTO_TEST_CASE( SWATINIT ) {
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TolCrit)
|
||||
{
|
||||
{
|
||||
const auto sfctrl = ::Opm::SatFuncControls{};
|
||||
BOOST_CHECK_CLOSE(sfctrl.minimumRelpermMobilityThreshold(), 1.0e-6, 1.0e-10);
|
||||
BOOST_CHECK_MESSAGE(sfctrl == ::Opm::SatFuncControls{},
|
||||
"Default-constructed SatFuncControl must equal itself");
|
||||
}
|
||||
|
||||
{
|
||||
const auto sfctrl = ::Opm::SatFuncControls{ 5.0e-7 };
|
||||
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");
|
||||
|
||||
const auto deck = ::Opm::Parser{}.parseString(R"(
|
||||
TOLCRIT
|
||||
5.0E-7 /
|
||||
)");
|
||||
BOOST_CHECK_CLOSE(sfctrl.minimumRelpermMobilityThreshold(),
|
||||
::Opm::SatFuncControls{deck}.minimumRelpermMobilityThreshold(),
|
||||
1.0e-10);
|
||||
}
|
||||
|
||||
{
|
||||
const auto deck = ::Opm::Parser{}.parseString(R"(
|
||||
RUNSPEC
|
||||
END
|
||||
)");
|
||||
|
||||
const auto rspec = ::Opm::Runspec{deck};
|
||||
const auto sfctrl = rspec.saturationFunctionControls();
|
||||
|
||||
BOOST_CHECK_CLOSE(sfctrl.minimumRelpermMobilityThreshold(), 1.0e-6, 1.0e-10);
|
||||
}
|
||||
|
||||
{
|
||||
const auto deck = ::Opm::Parser{}.parseString(R"(
|
||||
TOLCRIT
|
||||
5.0E-7 /
|
||||
)");
|
||||
|
||||
const auto rspec = ::Opm::Runspec{deck};
|
||||
const auto sfctrl = rspec.saturationFunctionControls();
|
||||
|
||||
BOOST_CHECK_CLOSE(sfctrl.minimumRelpermMobilityThreshold(), 5.0e-7, 1.0e-10);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Solvent) {
|
||||
const std::string input = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user