Merge pull request #1654 from joakim-hove/skiprest-exceptions

Skiprest exceptions
This commit is contained in:
Joakim Hove
2020-04-01 09:38:54 +02:00
committed by GitHub
5 changed files with 28923 additions and 4 deletions

View File

@@ -448,6 +448,8 @@ if(ENABLE_ECL_INPUT)
tests/SPE1CASE1A.UNSMRY
tests/SPE1CASE1_RST60.SMSPEC
tests/SPE1CASE1_RST60.UNSMRY
tests/MODEL2_RESTART.DATA
tests/restart/MODEL2.UNRST
)
list (APPEND EXAMPLE_SOURCE_FILES
examples/opmi.cpp

View File

@@ -18,10 +18,11 @@
*/
#include <fnmatch.h>
#include <string>
#include <vector>
#include <stdexcept>
#include <iostream>
#include <stdexcept>
#include <string>
#include <unordered_set>
#include <vector>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/common/utility/numeric/cmp.hpp>
@@ -484,6 +485,13 @@ void Schedule::iterateScheduleSection(const std::string& input_path, const Parse
const auto& unit_system = section.unitSystem();
std::vector<std::pair< const DeckKeyword* , size_t> > rftProperties;
size_t keywordIdx = 0;
/*
The keywords in the skiprest_whitelist set are loaded from the
SCHEDULE section even though the SKIPREST keyword is in action. The
full list includes some additional keywords which we do not support at
all.
*/
std::unordered_set<std::string> skiprest_whitelist = {"VFPPROD", "VFPINJ", "RPTSCHED", "RPTRST", "TUNING", "MESSAGES"};
size_t currentStep;
if (this->m_timeMap.skiprest())
@@ -525,7 +533,7 @@ void Schedule::iterateScheduleSection(const std::string& input_path, const Parse
}
else {
if (currentStep >= this->m_timeMap.restart_offset())
if (currentStep >= this->m_timeMap.restart_offset() || skiprest_whitelist.count(keyword.name()))
this->handleKeyword(input_path, currentStep, section, keywordIdx, keyword, parseContext, errors, grid, fp, unit_system, rftProperties);
else
OpmLog::info("Skipping keyword: " + keyword.name() + " while loading SCHEDULE section");

28892
tests/MODEL2_RESTART.DATA Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3817,3 +3817,20 @@ END
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W7", 10), st), 7);
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W8", 10), st), 6);
}
BOOST_AUTO_TEST_CASE(SKIPREST_VFP) {
auto python = std::make_shared<Python>();
Parser parser;
auto deck = parser.parseFile("MODEL2_RESTART.DATA");
EclipseState es{ deck };
const auto& init_config = es.getInitConfig();
auto report_step = init_config.getRestartStep();
const auto& rst_filename = es.getIOConfig().getRestartFileName( init_config.getRestartRootName(), report_step, false );
Opm::EclIO::ERst rst_file(rst_filename);
const auto& rst = Opm::RestartIO::RstState::load(rst_file, report_step);
const auto sched = Schedule{ deck, es, python , &rst};
const auto& tables = sched.getVFPProdTables(3);
BOOST_CHECK( !tables.empty() );
}

BIN
tests/restart/MODEL2.UNRST Normal file

Binary file not shown.