Add INVALID_WELL context to W(INJ)TEMP

Handle well template (e.g. W*) in the .DATA file for WTEMP and WINJTEMP
and add INVALID_WELL_CONTEXT
This commit is contained in:
Lars Petter Øren Hauge
2018-04-26 14:41:39 +02:00
parent e6b57fa422
commit 580a64563f
4 changed files with 148 additions and 8 deletions

View File

@@ -157,8 +157,8 @@ namespace Opm
void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep);
void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep);
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep);
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep);
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep );
void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep);

View File

@@ -181,10 +181,10 @@ namespace Opm {
handleWSOLVENT(keyword, currentStep);
else if (keyword.name() == "WTEMP")
handleWTEMP(keyword, currentStep);
handleWTEMP(keyword, currentStep, parseContext);
else if (keyword.name() == "WINJTEMP")
handleWINJTEMP(keyword, currentStep);
handleWINJTEMP(keyword, currentStep, parseContext);
else if (keyword.name() == "WCONINJH")
handleWCONINJH(section, keyword, currentStep, parseContext);
@@ -762,11 +762,15 @@ namespace Opm {
}
}
void Schedule::handleWTEMP( const DeckKeyword& keyword, size_t currentStep) {
void Schedule::handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) {
for( const auto& record : keyword ) {
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
auto wells = getWells( wellNamePattern );
for (auto* well : getWells(wellNamePattern)) {
if (wells.empty())
InvalidWellPattern( wellNamePattern, parseContext, keyword);
for (auto* well : wells) {
// TODO: Is this the right approach? Setting the well temperature only
// has an effect on injectors, but specifying it for producers won't hurt
// and wells can also switch their injector/producer status. Note that
@@ -782,13 +786,17 @@ namespace Opm {
}
}
void Schedule::handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep) {
void Schedule::handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext) {
// we do not support the "enthalpy" field yet. how to do this is a more difficult
// question.
for( const auto& record : keyword ) {
const std::string& wellNamePattern = record.getItem("WELL").getTrimmedString(0);
auto wells = getWells( wellNamePattern );
for (auto* well : getWells(wellNamePattern)) {
if (wells.empty())
InvalidWellPattern( wellNamePattern, parseContext, keyword);
for (auto* well : wells) {
// TODO: Is this the right approach? Setting the well temperature only
// has an effect on injectors, but specifying it for producers won't hurt
// and wells can also switch their injector/producer status. Note that

View File

@@ -548,6 +548,40 @@ BOOST_AUTO_TEST_CASE( test_invalid_wtemplate_config ) {
)";
testSamples.push_back(testSample);
// Invalid well name in WTEMP
testSample = R"(
COMPDAT
'INJ' 10 10 3 3 'OPEN' 1* 1* 0.5 /
/
WCONINJE
'INJ' 'WATER' 'OPEN' 'RATE' 20000 4* /
/
DATES
15 OKT 2008 /
/
WTEMP
'SOMETHINGELSE' 40.0 /
/
)";
testSamples.push_back(testSample);
// Invalid well name in WINJTEMP
testSample = R"(
COMPDAT
'INJ' 10 10 3 3 'OPEN' 1* 1* 0.5 /
/
WCONINJE
'INJ' 'WATER' 'OPEN' 'RATE' 20000 4* /
/
DATES
15 OKT 2008 /
/
WINJTEMP
'SOMETHINGELSE' 1* 40.0 1* /
/
)";
testSamples.push_back(testSample);
std::string deckinput;
for (std::string sample : testSamples) {

View File

@@ -1415,6 +1415,104 @@ BOOST_AUTO_TEST_CASE(change_ref_depth) {
BOOST_CHECK_CLOSE( 2873.94, well.getRefDepth( 1 ), 1e-5 );
}
BOOST_AUTO_TEST_CASE(WTEMP_well_template) {
std::string input = R"(
START -- 0
19 JUN 2007 /
SCHEDULE
DATES -- 1
10 OKT 2008 /
/
WELSPECS
'W1' 'G1' 3 3 2873.94 'OIL' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
'W2' 'G2' 5 5 1 'WATER' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
'W3' 'G2' 6 6 1 'WATER' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
/
WCONINJE
'W2' 'WATER' 'OPEN' 'RATE' 20000 4* /
'W3' 'WATER' 'OPEN' 'RATE' 20000 4* /
/
DATES -- 2
15 OKT 2008 /
/
WTEMP
'W*' 40.0 /
/
)";
ParseContext ctx;
auto deck = Parser().parseString(input, ctx);
EclipseGrid grid(10,10,10);
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
// Producerwell - currently setting temperature only acts on injectors.
const auto& w1 = *schedule.getWell( "W1" );
BOOST_CHECK_CLOSE( 288.71, w1.getInjectionProperties( 1 ).temperature, 1e-5 ); // Default value
BOOST_CHECK_CLOSE( 288.71, w1.getInjectionProperties( 1 ).temperature, 1e-5 ); // Default value Remains
const auto& w2 = *schedule.getWell( "W2" );
BOOST_CHECK_CLOSE( 288.71, w2.getInjectionProperties( 1 ).temperature, 1e-5 );
BOOST_CHECK_CLOSE( 313.15, w2.getInjectionProperties( 2 ).temperature, 1e-5 );
const auto& w3 = *schedule.getWell( "W3" );
BOOST_CHECK_CLOSE( 288.71, w3.getInjectionProperties( 1 ).temperature, 1e-5 );
BOOST_CHECK_CLOSE( 313.15, w3.getInjectionProperties( 2 ).temperature, 1e-5 );
}
BOOST_AUTO_TEST_CASE(WTEMPINJ_well_template) {
std::string input = R"(
START -- 0
19 JUN 2007 /
SCHEDULE
DATES -- 1
10 OKT 2008 /
/
WELSPECS
'W1' 'G1' 3 3 2873.94 'OIL' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
'W2' 'G2' 5 5 1 'WATER' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
'W3' 'G2' 6 6 1 'WATER' 0.00 'STD' 'SHUT' 'NO' 0 'SEG' /
/
WCONINJE
'W2' 'WATER' 'OPEN' 'RATE' 20000 4* /
'W3' 'WATER' 'OPEN' 'RATE' 20000 4* /
/
DATES -- 2
15 OKT 2008 /
/
WINJTEMP
'W*' 1* 40.0 1* /
/
)";
ParseContext ctx;
auto deck = Parser().parseString(input, ctx);
EclipseGrid grid(10,10,10);
TableManager table ( deck );
Eclipse3DProperties eclipseProperties ( deck , table, grid);
Schedule schedule( deck, grid, eclipseProperties, Phases( true, true, true ) ,ctx);
// Producerwell - currently setting temperature only acts on injectors.
const auto& w1 = *schedule.getWell( "W1" );
BOOST_CHECK_CLOSE( 288.71, w1.getInjectionProperties( 1 ).temperature, 1e-5 ); // Default value
BOOST_CHECK_CLOSE( 288.71, w1.getInjectionProperties( 1 ).temperature, 1e-5 ); // Default value Remains
const auto& w2 = *schedule.getWell( "W2" );
BOOST_CHECK_CLOSE( 288.71, w2.getInjectionProperties( 1 ).temperature, 1e-5 );
BOOST_CHECK_CLOSE( 313.15, w2.getInjectionProperties( 2 ).temperature, 1e-5 );
const auto& w3 = *schedule.getWell( "W3" );
BOOST_CHECK_CLOSE( 288.71, w3.getInjectionProperties( 1 ).temperature, 1e-5 );
BOOST_CHECK_CLOSE( 313.15, w3.getInjectionProperties( 2 ).temperature, 1e-5 );
}
BOOST_AUTO_TEST_CASE( COMPDAT_sets_automatic_complnum ) {
std::string input = R"(
START -- 0