Skip to content

Commit

Permalink
Merge pull request #1010 from jokva/new-keyword-definitions
Browse files Browse the repository at this point in the history
Parse new set of keywords
  • Loading branch information
jokva authored Dec 16, 2016
2 parents ee0e0aa + 3ff085b commit da58abd
Show file tree
Hide file tree
Showing 32 changed files with 877 additions and 15 deletions.
23 changes: 23 additions & 0 deletions opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ namespace {
"AAQR", "AAQRG", "AAQT", "AAQTG"
};

const Deck GMWSET_keywords = {
"SUMMARY",
"GMCTG", "GMWPT", "GMWPR", "GMWPA", "GMWPU", "GMWPG", "GMWPO", "GMWPS",
"GMWPV", "GMWPP", "GMWPL", "GMWIT", "GMWIN", "GMWIA", "GMWIU", "GMWIG",
"GMWIS", "GMWIV", "GMWIP", "GMWDR", "GMWDT", "GMWWO", "GMWWT"
};

const Deck FMWSET_keywords = {
"SUMMARY",
"FMCTF", "FMWPT", "FMWPR", "FMWPA", "FMWPU", "FMWPF", "FMWPO", "FMWPS",
"FMWPV", "FMWPP", "FMWPL", "FMWIT", "FMWIN", "FMWIA", "FMWIU", "FMWIF",
"FMWIS", "FMWIV", "FMWIP", "FMWDR", "FMWDT", "FMWWO", "FMWWT"
};

/*
When the error handling config says that the error should be
logged, the handleMissingWell and handleMissingGroup routines
Expand Down Expand Up @@ -137,6 +151,8 @@ inline void keywordG( std::vector< ERT::smspec_node >& list,

const auto type = ECL_SMSPEC_GROUP_VAR;

if( keyword.name() == "GMWSET" ) return;

if( keyword.size() == 0 ||
!keyword.getDataRecord().getDataItem().hasValue( 0 ) ) {

Expand All @@ -160,6 +176,7 @@ inline void keywordG( std::vector< ERT::smspec_node >& list,

inline void keywordF( std::vector< ERT::smspec_node >& list,
const DeckKeyword& keyword ) {
if( keyword.name() == "FMWSET" ) return;
list.emplace_back( keyword.name() );
}

Expand Down Expand Up @@ -314,6 +331,12 @@ SummaryConfig::SummaryConfig( const Deck& deck,
if( section.hasKeyword( "ALL" ) )
this->merge( { ALL_keywords, schedule, props, parseContext, n_xyz } );

if( section.hasKeyword( "GMWSET" ) )
this->merge( { GMWSET_keywords, schedule, props, parseContext, n_xyz } );

if( section.hasKeyword( "FMWSET" ) )
this->merge( { FMWSET_keywords, schedule, props, parseContext, n_xyz } );

uniq( this->keywords );
for (const auto& kw: this->keywords)
this->short_keywords.insert( kw.keyword() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,92 @@ BOOST_AUTO_TEST_CASE( REMOVE_DUPLICATED_ENTRIES ) {
keys.begin(), keys.end(),
uniq_keys.begin(), uniq_keys.end() );
}

BOOST_AUTO_TEST_CASE( ANALYTICAL_AQUIFERS ) {
const std::string input = R"(
AAQR
1 2 /
AAQP
2 1 /
AAQT
/
AAQRG
/
AAQTG
/
AAQTD
/
AAQPD
/
)";
const auto summary = createSummary( input );
}

BOOST_AUTO_TEST_CASE( NUMERICAL_AQUIFERS ) {
const std::string input = R"(
ANQR
1 2 /
ANQP
2 1 /
ANQT
/
)";
const auto summary = createSummary( input );
}

static const auto GMWSET_keywords = {
"GMCTG", "GMWPT", "GMWPR", "GMWPA", "GMWPU", "GMWPG", "GMWPO", "GMWPS",
"GMWPV", "GMWPP", "GMWPL", "GMWIT", "GMWIN", "GMWIA", "GMWIU", "GMWIG",
"GMWIS", "GMWIV", "GMWIP", "GMWDR", "GMWDT", "GMWWO", "GMWWT"
};

BOOST_AUTO_TEST_CASE( summary_GMWSET ) {

const auto input = "GMWSET\n";
const auto summary = createSummary( input );
const auto key_names = sorted_key_names( summary );

std::vector< std::string > all;

for( std::string kw : GMWSET_keywords ) {
all.emplace_back(kw + ":G");
all.emplace_back(kw + ":OP");
}

std::sort( all.begin(), all.end() );

BOOST_CHECK_EQUAL_COLLECTIONS( all.begin(), all.end(),
key_names.begin(), key_names.end() );

BOOST_CHECK( summary.hasKeyword( "GMWPS" ) );
BOOST_CHECK( summary.hasKeyword( "GMWPT" ) );
BOOST_CHECK( summary.hasKeyword( "GMWPR" ) );

BOOST_CHECK( !summary.hasKeyword("NO-NOT-THIS") );
}

static const auto FMWSET_keywords = {
"FMCTF", "FMWPT", "FMWPR", "FMWPA", "FMWPU", "FMWPF", "FMWPO", "FMWPS",
"FMWPV", "FMWPP", "FMWPL", "FMWIT", "FMWIN", "FMWIA", "FMWIU", "FMWIF",
"FMWIS", "FMWIV", "FMWIP", "FMWDR", "FMWDT", "FMWWO", "FMWWT"
};

BOOST_AUTO_TEST_CASE( summary_FMWSET ) {

const auto input = "FMWSET\n";
const auto summary = createSummary( input );
const auto key_names = sorted_key_names( summary );

std::vector< std::string > all( FMWSET_keywords.begin(),
FMWSET_keywords.end() );
std::sort( all.begin(), all.end() );

BOOST_CHECK_EQUAL_COLLECTIONS( all.begin(), all.end(),
key_names.begin(), key_names.end() );

BOOST_CHECK( summary.hasKeyword( "FMWPS" ) );
BOOST_CHECK( summary.hasKeyword( "FMWPT" ) );
BOOST_CHECK( summary.hasKeyword( "FMWPR" ) );

BOOST_CHECK( !summary.hasKeyword("NO-NOT-THIS") );
}
13 changes: 7 additions & 6 deletions opm/parser/eclipse/IntegrationTests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
add_definitions( -DKEYWORD_DIRECTORY="${PROJECT_SOURCE_DIR}/opm/parser/share/keywords/000_Eclipse100")

foreach(tapp TransMultIntegrationTests CheckDeckValidity IntegrationTests ParseWellProbe
ParseTITLE ParseTOPS ParseWCONHIST ParseWellWithWildcards
ParseDEBUG ParseTITLE ParseTOPS ParseWCONHIST ParseWellWithWildcards
ParsePORO ParsePLYVISC ParsePLYDHFLF ParsePLYSHLOG ParseDATAWithDefault
ParseTVDP ParseDENSITY ParseVFPPROD ScheduleCreateFromDeck
CompletionsFromDeck ParseEND IncludeTest ParseEQUIL
ParseRSVD ParsePVTG ParsePVTO ParseSWOF BoxTest
ParseTVDP ParseDENSITY ParseVFPPROD ParsePRORDER ScheduleCreateFromDeck
CompletionsFromDeck ParseEND ParseLGR ParseTRACERS IncludeTest ParseEQUIL
ParseRSVD ParsePVTG ParsePVTO ParseSWOF ParseCOORDSYS ParseGRUPRIG BoxTest
ParseMULTREGT ParseSGOF ParseSLGOF EclipseGridCreateFromDeck NNCTests
ResinsightTest IOConfigIntegrationTest
Polymer ParsePLYADSS ParseMULTSEGWELL ParseMiscible)
ResinsightTest IOConfigIntegrationTest ParseCECON ParseWDFACCOR
ParseWORKLIM ParseTUNINGDP
ParseWEFAC Polymer ParsePLYADSS ParseMULTSEGWELL ParseMiscible)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

Expand Down
38 changes: 38 additions & 0 deletions opm/parser/eclipse/IntegrationTests/ParseCECON.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/

#include <string>

#define BOOST_TEST_MODULE ParserIntegrationTests
#include <boost/test/unit_test.hpp>

#include <opm/parser/eclipse/Parser/Parser.hpp>

using namespace Opm;

BOOST_AUTO_TEST_CASE( parse_CECON ) {
const std::string input = R"(
CECON
PROD1 4* 0.7 /
'P*' 2* 2 2 1* 3.5 /
/
)";
Parser().parseString( input );
}

54 changes: 54 additions & 0 deletions opm/parser/eclipse/IntegrationTests/ParseCOORDSYS.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/

#include <string>

#define BOOST_TEST_MODULE ParserIntegrationTests
#include <boost/test/unit_test.hpp>

#include <opm/parser/eclipse/Parser/Parser.hpp>

using namespace Opm;

BOOST_AUTO_TEST_CASE( parse_COORDSYS ) {
const std::string input = R"(
RUNSPEC
NUMRES
1 /
GRID
COORDSYS
1 1141 /
COORDSYS
1 1141 'COMP' 'JOIN' 1 2 /
COORDSYS
1 1141 'COMP' 'JOIN' /
COORDSYS
1 1141 'INCOMP' /
)";
Parser().parseString( input );
}

29 changes: 29 additions & 0 deletions opm/parser/eclipse/IntegrationTests/ParseDEBUG.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/

#define BOOST_TEST_MODULE ParserIntegrationTests
#include <boost/test/unit_test.hpp>

#include <opm/parser/eclipse/Parser/Parser.hpp>

using namespace Opm;

BOOST_AUTO_TEST_CASE( parse_DEBUG ) {
Parser().parseFile( "testdata/integration_tests/DEBUG/DEBUG.DATA" );
}
41 changes: 41 additions & 0 deletions opm/parser/eclipse/IntegrationTests/ParseGRUPRIG.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/

#include <string>

#define BOOST_TEST_MODULE ParserIntegrationTests
#include <boost/test/unit_test.hpp>

#include <opm/parser/eclipse/Parser/Parser.hpp>

using namespace Opm;

BOOST_AUTO_TEST_CASE( parse_GRUPRIG ) {
const std::string input = R"(
--
-- GRUP WORK DRILL RIG
-- NAME RIG RIG OPTN
GRUPRIG
'FIELD' 1 1 ADD /
'FIELD' 2* REMOVE /
/
)";
Parser().parseString( input );
}

29 changes: 29 additions & 0 deletions opm/parser/eclipse/IntegrationTests/ParseLGR.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/

#define BOOST_TEST_MODULE ParserIntegrationTests
#include <boost/test/unit_test.hpp>

#include <opm/parser/eclipse/Parser/Parser.hpp>

using namespace Opm;

BOOST_AUTO_TEST_CASE( parse_LGR ) {
Parser().parseFile( "testdata/integration_tests/LGR/LGR.DATA" );
}
Loading

0 comments on commit da58abd

Please sign in to comment.