Merge pull request #2759 from joakim-hove/restart-errors
Validate restart input in constructor
This commit is contained in:
@@ -34,6 +34,76 @@
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
|
||||
const std::string full_deck1 = R"(
|
||||
START
|
||||
7 OCT 2020 /
|
||||
|
||||
RUNSPEC
|
||||
|
||||
DIMENS
|
||||
10 10 3 /
|
||||
|
||||
UNIFIN
|
||||
|
||||
GRID
|
||||
DXV
|
||||
10*100.0 /
|
||||
DYV
|
||||
10*100.0 /
|
||||
DZV
|
||||
3*10.0 /
|
||||
|
||||
DEPTHZ
|
||||
121*2000.0 /
|
||||
|
||||
PORO
|
||||
300*0.3 /
|
||||
|
||||
SOLUTION
|
||||
|
||||
RESTART
|
||||
NOBASE 6 /
|
||||
|
||||
SCHEDULE
|
||||
)";
|
||||
|
||||
const std::string full_deck2 = R"(
|
||||
START
|
||||
7 OCT 2020 /
|
||||
|
||||
RUNSPEC
|
||||
|
||||
DIMENS
|
||||
10 10 3 /
|
||||
|
||||
UNIFIN
|
||||
|
||||
GRID
|
||||
DXV
|
||||
10*100.0 /
|
||||
DYV
|
||||
10*100.0 /
|
||||
DZV
|
||||
3*10.0 /
|
||||
|
||||
DEPTHZ
|
||||
121*2000.0 /
|
||||
|
||||
PORO
|
||||
300*0.3 /
|
||||
|
||||
SOLUTION
|
||||
|
||||
RESTART
|
||||
BASE 6 /
|
||||
|
||||
SCHEDULE
|
||||
)";
|
||||
|
||||
|
||||
|
||||
|
||||
const std::string& deckStr =
|
||||
"RUNSPEC\n"
|
||||
"DIMENS\n"
|
||||
@@ -117,7 +187,22 @@ const std::string& deckWithEquil =
|
||||
|
||||
static Deck createDeck(const std::string& input) {
|
||||
Opm::Parser parser;
|
||||
return parser.parseString(input);
|
||||
auto deck = parser.parseString(input);
|
||||
// The call to setDataFile is completely bogus, it is just to ensure that a
|
||||
// meaningfull path for the input file has been specified - so that we can
|
||||
// locate restart files.
|
||||
deck.setDataFile("SPE1CASE1.DATA");
|
||||
return deck;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseStateTest) {
|
||||
Deck deck1 = createDeck(full_deck1);
|
||||
// This throws because the restart file does not exist
|
||||
BOOST_CHECK_THROW(EclipseState{deck1}, std::exception);
|
||||
|
||||
Deck deck2 = createDeck(full_deck2);
|
||||
// This throws because the restart file does not contain the requested report step
|
||||
BOOST_CHECK_THROW(EclipseState{deck2}, std::exception);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitConfigTest) {
|
||||
|
||||
Reference in New Issue
Block a user