Track Schedule event GEO_MODIFIERS.

This commit is contained in:
Joakim Hove
2015-10-30 12:55:17 +01:00
parent d3a38b5039
commit b20f46649d
4 changed files with 104 additions and 21 deletions

View File

@@ -65,7 +65,13 @@ namespace Opm
/*
The well group topolyg has changed.
*/
GROUP_CHANGE = 128
GROUP_CHANGE = 128,
/*
Geology modifier.
*/
GEO_MODIFIER = 256
};
}

View File

@@ -86,21 +86,21 @@ namespace Opm {
}
void Schedule::iterateScheduleSection(const ParseMode& parseMode , std::shared_ptr<const SCHEDULESection> section, IOConfigPtr ioConfig) {
const std::map<std::string,bool> unsupportedModifiers = {{"MULTFLT" , true},
{"MULTPV" , true},
{"MULTX" , true},
{"MULTX-" , true},
{"MULTY" , true},
{"MULTY-" , true},
{"MULTZ" , true},
{"MULTZ-" , true},
{"MULTREGT" , true},
{"MULTR" , true},
{"MULTR-" , true},
{"MULTSIG" , true},
{"MULTSIGV" , true},
{"MULTTHT" , true},
{"MULTTHT-" , true}};
const std::map<std::string,bool> geoModifiers = {{"MULTFLT" , true},
{"MULTPV" , true},
{"MULTX" , true},
{"MULTX-" , true},
{"MULTY" , true},
{"MULTY-" , true},
{"MULTZ" , true},
{"MULTZ-" , true},
{"MULTREGT" , true},
{"MULTR" , true},
{"MULTR-" , true},
{"MULTSIG" , true},
{"MULTSIGV" , true},
{"MULTTHT" , true},
{"MULTTHT-" , true}};
size_t currentStep = 0;
std::vector<std::pair<DeckKeywordConstPtr , size_t> > rftProperties;
@@ -185,7 +185,7 @@ namespace Opm {
if (keyword->name() == "COMPORD")
handleCOMPORD(parseMode , keyword, currentStep);
if (keyword->name() == "DRSDT")
handleDRSDT(keyword, currentStep);
@@ -196,9 +196,14 @@ namespace Opm {
handleVAPPARS(keyword, currentStep);
if (unsupportedModifiers.find( keyword->name() ) != unsupportedModifiers.end()) {
std::string msg = "OPM does not support grid property modifier " + keyword->name() + " in the Schedule section. Error at report: " + std::to_string( currentStep );
parseMode.handleError( ParseMode::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , msg );
if (geoModifiers.find( keyword->name() ) != geoModifiers.end()) {
{
std::string msg = "OPM does not support grid property modifier " + keyword->name() + " in the Schedule section. Error at report: " + std::to_string( currentStep );
parseMode.handleError( ParseMode::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , msg );
}
{
m_events->addEvent( ScheduleEvents::GEO_MODIFIER , currentStep);
}
}
}

View File

@@ -4,7 +4,8 @@ foreach(tapp TimeMapTest ScheduleTests WellTests
CompletionTests CompletionSetTests
DynamicStateTests GroupTreeNodeTests
GroupTreeTests TuningTests EventTests
WellSolventTests DynamicVectorTests)
WellSolventTests DynamicVectorTests
GeomodifierTests)
opm_add_test(run${tapp} SOURCES ${tapp}.cpp
LIBRARIES opmparser ${Boost_LIBRARIES})
endforeach()

View File

@@ -0,0 +1,71 @@
/*
Copyright 2013 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 <stdexcept>
#include <iostream>
#include <boost/filesystem.hpp>
#define BOOST_TEST_MODULE GeoModifiersTests
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords.hpp>
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( CheckUnsoppertedInSCHEDULE ) {
const char * deckString =
"START\n"
" 10 'JAN' 2000 /\n"
"RUNSPEC\n"
"DIMENS\n"
" 10 10 10 / \n"
"SCHEDULE\n"
"TSTEP -- 1,2\n"
" 10 10/\n"
"MULTFLT\n"
" 'F1' 100 /\n"
"/\n"
"TSTEP -- 3,4\n"
" 10 10/\n"
"\n";
ParseMode parseMode;
Parser parser(true);
auto deck = parser.parseString( deckString , parseMode );
std::shared_ptr<EclipseGrid> grid = std::make_shared<EclipseGrid>( deck );
std::shared_ptr<IOConfig> ioconfig = std::make_shared<IOConfig>( "path" );
parseMode.update( ParseMode::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , InputError::IGNORE );
{
Schedule schedule( parseMode , grid , deck , ioconfig );
auto events = schedule.getEvents( );
BOOST_CHECK_EQUAL( false , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 1 ));
BOOST_CHECK_EQUAL( true , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 2 ));
BOOST_CHECK_EQUAL( false , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 3 ));
}
}