Runspec: Add Support for Parsing Limited Subset of WELLDIMS
Capture the maximum number of connections/perforations per well, the maximum number of wells (or sub-groups) per well/node group, and the maximum number of well/node groups in the field. These maximum sizes are needed to correctly define the portions of the contents of the INTEHEAD vector in a restart step.
This commit is contained in:
@@ -53,6 +53,31 @@ class Phases {
|
||||
};
|
||||
|
||||
|
||||
class Welldims {
|
||||
public:
|
||||
explicit Welldims(const Deck& deck);
|
||||
|
||||
int maxConnPerWell() const
|
||||
{
|
||||
return this->nCWMax;
|
||||
}
|
||||
|
||||
int maxWellsPerGroup() const
|
||||
{
|
||||
return this->nWGMax;
|
||||
}
|
||||
|
||||
int maxGroupsInField() const
|
||||
{
|
||||
return this->nGMax;
|
||||
}
|
||||
|
||||
private:
|
||||
int nCWMax { 0 };
|
||||
int nWGMax { 0 };
|
||||
int nGMax { 0 };
|
||||
};
|
||||
|
||||
class Runspec {
|
||||
public:
|
||||
explicit Runspec( const Deck& );
|
||||
@@ -60,12 +85,14 @@ class Runspec {
|
||||
const Phases& phases() const noexcept;
|
||||
const Tabdims& tabdims() const noexcept;
|
||||
const EndpointScaling& endpointScaling() const noexcept;
|
||||
const Welldims& wellDimensions() const noexcept;
|
||||
int eclPhaseMask( ) const noexcept;
|
||||
|
||||
private:
|
||||
Phases active_phases;
|
||||
Tabdims m_tabdims;
|
||||
EndpointScaling endscale;
|
||||
Welldims welldims;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -72,6 +72,23 @@ size_t Phases::size() const noexcept {
|
||||
return this->bits.count();
|
||||
}
|
||||
|
||||
Welldims::Welldims(const Deck& deck)
|
||||
{
|
||||
if (deck.hasKeyword("WELLDIMS")) {
|
||||
const auto& wd = deck.getKeyword("WELLDIMS", 0).getRecord(0);
|
||||
|
||||
this->nCWMax = wd.getItem("MAXCONN") .get<int>(0);
|
||||
this->nWGMax = wd.getItem("MAX_GROUPSIZE").get<int>(0);
|
||||
|
||||
// This is the E100 definition. E300 instead uses
|
||||
//
|
||||
// Max{ "MAXGROUPS", "MAXWELLS" }
|
||||
//
|
||||
// i.e., the maximum of item 1 and item 4 here.
|
||||
this->nGMax = wd.getItem("MAXGROUPS").get<int>(0);
|
||||
}
|
||||
}
|
||||
|
||||
Runspec::Runspec( const Deck& deck ) :
|
||||
active_phases( Phases( deck.hasKeyword( "OIL" ),
|
||||
deck.hasKeyword( "GAS" ),
|
||||
@@ -80,7 +97,8 @@ Runspec::Runspec( const Deck& deck ) :
|
||||
deck.hasKeyword( "POLYMER" ),
|
||||
deck.hasKeyword( "THERMAL" ) ) ),
|
||||
m_tabdims( deck ),
|
||||
endscale( deck )
|
||||
endscale( deck ),
|
||||
welldims( deck )
|
||||
{}
|
||||
|
||||
const Phases& Runspec::phases() const noexcept {
|
||||
@@ -95,6 +113,11 @@ const EndpointScaling& Runspec::endpointScaling() const noexcept {
|
||||
return this->endscale;
|
||||
}
|
||||
|
||||
const Welldims& Runspec::wellDimensions() const noexcept
|
||||
{
|
||||
return this->welldims;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns an integer in the range 0...7 which can be used to indicate
|
||||
available phases in Eclipse restart and init files.
|
||||
|
||||
@@ -270,6 +270,100 @@ BOOST_AUTO_TEST_CASE( endpoint_scaling_throw_invalid_argument ) {
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WELLDIMS_FullSpec)
|
||||
{
|
||||
const auto input = std::string {
|
||||
R"(
|
||||
RUNSPEC
|
||||
|
||||
WELLDIMS
|
||||
130 36 15 84 /
|
||||
)" };
|
||||
|
||||
const auto wd = Welldims {
|
||||
Parser{}.parseString(input, ParseContext{})
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(wd.maxConnPerWell(), 36); // WELLDIMS(2)
|
||||
BOOST_CHECK_EQUAL(wd.maxWellsPerGroup(), 84); // WELLDIMS(4)
|
||||
BOOST_CHECK_EQUAL(wd.maxGroupsInField(), 15); // WELLDIMS(3)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WELLDIMS_AllDefaulted)
|
||||
{
|
||||
const auto input = std::string {
|
||||
R"(
|
||||
RUNSPEC
|
||||
|
||||
WELLDIMS
|
||||
/
|
||||
)" };
|
||||
|
||||
const auto wd = Welldims {
|
||||
Parser{}.parseString(input, ParseContext{})
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(wd.maxConnPerWell(), 0); // WELLDIMS(2), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxWellsPerGroup(), 0); // WELLDIMS(4), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxGroupsInField(), 0); // WELLDIMS(3), defaulted
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WELLDIMS_MaxConn)
|
||||
{
|
||||
const auto input = std::string {
|
||||
R"(
|
||||
RUNSPEC
|
||||
|
||||
WELLDIMS
|
||||
1* 36 /
|
||||
)" };
|
||||
|
||||
const auto wd = Welldims {
|
||||
Parser{}.parseString(input, ParseContext{})
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(wd.maxConnPerWell(), 36); // WELLDIMS(2)
|
||||
BOOST_CHECK_EQUAL(wd.maxWellsPerGroup(), 0); // WELLDIMS(4), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxGroupsInField(), 0); // WELLDIMS(3), defaulted
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WELLDIMS_MaxGroups)
|
||||
{
|
||||
const auto input = std::string {
|
||||
R"(
|
||||
RUNSPEC
|
||||
|
||||
WELLDIMS
|
||||
2* 4 /
|
||||
)" };
|
||||
|
||||
const auto wd = Welldims {
|
||||
Parser{}.parseString(input, ParseContext{})
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(wd.maxConnPerWell(), 0); // WELLDIMS(2), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxWellsPerGroup(), 0); // WELLDIMS(4), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxGroupsInField(), 4); // WELLDIMS(3)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(WELLDIMS_MaxWellsInGrp)
|
||||
{
|
||||
const auto input = std::string {
|
||||
R"(
|
||||
RUNSPEC
|
||||
|
||||
WELLDIMS
|
||||
3* 33 /
|
||||
)" };
|
||||
|
||||
const auto wd = Welldims {
|
||||
Parser{}.parseString(input, ParseContext{})
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(wd.maxConnPerWell(), 0); // WELLDIMS(2), defaulted
|
||||
BOOST_CHECK_EQUAL(wd.maxWellsPerGroup(), 33); // WELLDIMS(4)
|
||||
BOOST_CHECK_EQUAL(wd.maxGroupsInField(), 0); // WELLDIMS(3), defaulted
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( SWATINIT ) {
|
||||
const std::string input = R"(
|
||||
|
||||
Reference in New Issue
Block a user