Merge pull request #2073 from joakim-hove/summary-completion-commits

Summary completion commits
This commit is contained in:
Joakim Hove 2020-11-05 12:40:06 +01:00 committed by GitHub
commit 25dee84f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 91 additions and 74 deletions

View File

@ -488,6 +488,7 @@ public:
const std::string& groupName() const;
Phase getPreferredPhase() const;
const std::vector<const Connection *> getConnections(int completion) const;
const WellConnections& getConnections() const;
const WellSegments& getSegments() const;
@ -530,9 +531,6 @@ public:
connections. The integer ID is assigned with the COMPLUMP keyword.
*/
bool hasCompletion(int completion) const;
const std::vector<const Connection *> getConnections(int completion) const;
bool updatePrediction(bool prediction_mode);
bool updateAutoShutin(bool auto_shutin);
bool updateCrossFlow(bool allow_cross_flow);

View File

@ -95,7 +95,7 @@ namespace Opm {
};
SummaryConfigNode::Category parseKeywordCategory(const std::string& keyword);
SummaryConfigNode::Type parseKeywordType(const std::string& keyword);
SummaryConfigNode::Type parseKeywordType(std::string keyword);
bool operator==(const SummaryConfigNode& lhs, const SummaryConfigNode& rhs);
bool operator<(const SummaryConfigNode& lhs, const SummaryConfigNode& rhs);
@ -212,6 +212,9 @@ namespace Opm {
return runSummaryConfig.create;
}
const SummaryConfigNode& operator[](std::size_t index) const;
private:
SummaryConfig( const Deck& deck,
const Schedule& schedule,

View File

@ -1036,8 +1036,8 @@ bool Well::handleWELOPEN(const DeckRecord& record, Connection::State state_arg,
bool Well::handleCOMPLUMP(const DeckRecord& record) {
auto match = [=]( const Connection &c) -> bool {
if (!match_eq(c.getI(), record, "I" , -1)) return false;
if (!match_eq(c.getJ(), record, "J" , -1)) return false;
if (!match_eq(c.getI(), record, "I" , -1)) return false;
if (!match_eq(c.getJ(), record, "J" , -1)) return false;
if (!match_ge(c.getK(), record, "K1", -1)) return false;
if (!match_le(c.getK(), record, "K2", -1)) return false;

View File

@ -395,6 +395,14 @@ inline void keywordAquifer( SummaryConfig::keyword_list& list,
}
}
inline std::array< int, 3 > getijk( const DeckRecord& record ) {
return {{
record.getItem( "I" ).get< int >( 0 ) - 1,
record.getItem( "J" ).get< int >( 0 ) - 1,
record.getItem( "K" ).get< int >( 0 ) - 1
}};
}
inline void keywordW( SummaryConfig::keyword_list& list,
const std::string& keyword,
KeywordLocation loc,
@ -577,14 +585,6 @@ inline void keywordF( SummaryConfig::keyword_list& list,
keywordF( list, keyword.name(), keyword.location() );
}
inline std::array< int, 3 > getijk( const DeckRecord& record,
int offset = 0 ) {
return {{
record.getItem( offset + 0 ).get< int >( 0 ) - 1,
record.getItem( offset + 1 ).get< int >( 0 ) - 1,
record.getItem( offset + 2 ).get< int >( 0 ) - 1
}};
}
inline std::array< int, 3 > getijk( const Connection& completion ) {
return { { completion.getI(), completion.getJ(), completion.getK() }};
@ -711,7 +711,7 @@ inline void keywordMISC( SummaryConfig::keyword_list& list,
auto cijk = getijk( connection );
int global_index = 1 + dims.getGlobalIndex(cijk[0], cijk[1], cijk[2]);
if( ijk_defaulted || ( cijk == getijk(record, 1) ) )
if( ijk_defaulted || ( cijk == getijk(record) ) )
list.push_back( param.number(global_index) );
}
}
@ -999,7 +999,7 @@ inline void handleKW( SummaryConfig::keyword_list& list,
// =====================================================================
SummaryConfigNode::Type parseKeywordType(const std::string& keyword) {
SummaryConfigNode::Type parseKeywordType(std::string keyword) {
if (is_rate(keyword)) return SummaryConfigNode::Type::Rate;
if (is_total(keyword)) return SummaryConfigNode::Type::Total;
if (is_ratio(keyword)) return SummaryConfigNode::Type::Ratio;
@ -1327,6 +1327,10 @@ bool SummaryConfig::hasSummaryKey(const std::string& keyword ) const {
return summary_keywords.find(keyword) != summary_keywords.end();
}
const SummaryConfigNode& SummaryConfig::operator[](std::size_t index) const {
return this->m_keywords[index];
}
bool SummaryConfig::match(const std::string& keywordPattern) const {
int flags = 0;

View File

@ -73,61 +73,73 @@ static Deck createDeck_no_wells( const std::string& summary ) {
static Deck createDeck( const std::string& summary ) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
"RUNSPEC\n"
"\n"
"DIMENS\n"
" 10 10 10 /\n"
"REGDIMS\n"
" 3/\n"
"AQUDIMS\n"
"1* 1* 1* 1* 3 200 1* 1* /\n"
"GRID\n"
"DXV \n 10*400 /\n"
"DYV \n 10*400 /\n"
"DZV \n 10*400 /\n"
"TOPS \n 100*2202 / \n"
"PERMX\n"
" 1000*0.25 /\n"
"COPY\n"
" PERMX PERMY /\n"
" PERMX PERMZ /\n"
"/\n"
"PORO \n"
" 1000*0.15 /\n"
"REGIONS\n"
"FIPNUM\n"
"200*1 300*2 500*3 /\n"
"FIPREG\n"
"200*10 300*20 500*30 /\n"
"SOLUTION\n"
"AQUCT\n"
"1 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /\n"
"2 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /\n"
"3 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /\n"
"/\n"
"AQUANCON\n"
"1 1 10 10 2 10 10 'I-' 0.88 1 /\n"
"2 9 10 10 10 10 10 'I+' 0.88 1 /\n"
"3 9 9 8 10 9 8 'I+' 0.88 1 /\n"
"/\n"
"SCHEDULE\n"
"WELSPECS\n"
" \'W_1\' \'OP\' 1 1 3.33 \'OIL\' 7* / \n"
" \'WX2\' \'OP\' 2 2 3.33 \'OIL\' 7* / \n"
" \'W_3\' \'OP\' 2 5 3.92 \'OIL\' 7* / \n"
" 'PRODUCER' 'G' 5 5 2000 'GAS' /\n"
"/\n"
"COMPDAT\n"
"'PRODUCER' 5 5 1 1 'OPEN' 1* -1 0.5 / \n"
"'W_1' 3 7 2 2 'OPEN' 1* * 0.311 4332.346 2* 'X' 22.123 / \n"
"'W_1' 2 2 1 1 /\n"
"'WX2' 2 2 1 1 /\n"
"/\n"
"SUMMARY\n"
+ summary;
std::string input = R"(
START -- 0
10 MAI 2007 /
RUNSPEC
DIMENS
10 10 10 /
REGDIMS
3/
AQUDIMS
1* 1* 1* 1* 3 200 1* 1* /
GRID
DXV
10*400 /
DYV
10*400 /
DZV
10*400 /
TOPS
100*2202 /
PERMX
1000*0.25 /
COPY
PERMX PERMY /
PERMX PERMZ /
/
PORO
1000*0.15 /
REGIONS
FIPNUM
200*1 300*2 500*3 /
FIPREG
200*10 300*20 500*30 /
SOLUTION
AQUCT
1 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /
2 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /
3 2040 1* 1000 .3 3.0e-5 1330 10 360.0 1 1* /
/
AQUANCON
1 1 10 10 2 10 10 'I-' 0.88 1 /
2 9 10 10 10 10 10 'I+' 0.88 1 /
3 9 9 8 10 9 8 'I+' 0.88 1 /
/
SCHEDULE
WELSPECS
'W_1' 'OP' 1 1 3.33 'OIL' 7* /
'WX2' 'OP' 2 2 3.33 'OIL' 7* /
'W_3' 'OP' 2 5 3.92 'OIL' 7* /
'PRODUCER' 'G' 5 5 2000 'GAS' /
/
COMPDAT
'PRODUCER' 5 5 1 1 'OPEN' 1* -1 0.5 /
'W_1' 3 7 2 2 'OPEN' 1* * 0.311 4332.346 2* 'X' 22.123 /
'W_1' 2 2 1 1 /
'W_1' 2 2 2 2 /
'WX2' 2 2 1 1 /
/
COMPLUMP
W_1 3 7 2 2 2 /
W_1 2 2 2 2 2 /
W_1 2 2 1 1 4 /
/
SUMMARY
)" + summary;
return parser.parseString(input);
}
@ -353,11 +365,11 @@ BOOST_AUTO_TEST_CASE(completions) {
"/\n";
const auto summary = createSummary( input );
const auto keywords = { "CGIR", "CGIR", "CGIR", "CGIR",
const auto keywords = { "CGIR", "CGIR", "CGIR", "CGIR", "CGIR",
"CGIT", "CGIT",
"CPRL", "CPRL", "CPRL", "CPRL",
"CPRL", "CPRL", "CPRL", "CPRL", "CPRL",
"CWIR", "CWIR",
"CWIT", "CWIT" };
"CWIT", "CWIT", "CWIT" };
const auto names = sorted_keywords( summary );
BOOST_CHECK_EQUAL_COLLECTIONS(