Fix TSTEP unit in LAB mode

If unit system is LAB, the TSTEP is interpreted as hours not days
This commit is contained in:
Tor Harald Sandve
2019-01-21 14:56:27 +01:00
parent 7f6fd34fd3
commit a668248aa1
2 changed files with 30 additions and 2 deletions

View File

@@ -191,8 +191,7 @@ namespace {
const auto &item = TSTEPKeyword.getRecord(0).getItem(0);
for (size_t itemIndex = 0; itemIndex < item.size(); itemIndex++) {
const double days = item.get<double>(itemIndex);
const int64_t seconds = static_cast<int64_t>(days * 24 * 60 * 60);
const int64_t seconds = static_cast<int64_t>(item.getSIDouble(itemIndex));
addTStep(seconds);
}
}

View File

@@ -353,6 +353,35 @@ BOOST_AUTO_TEST_CASE(initTimestepsLongStep) {
}
BOOST_AUTO_TEST_CASE(TimestepsLabUnit) {
const char *deckData =
"START\n"
" 1 JAN 1983 /\n"
"\n"
"LAB\n"
" \n"
"TSTEP\n"
" 24*10 /\n";
Opm::Parser parser;
auto deck = parser.parseString(deckData);
const Opm::TimeMap tmap(deck);
/*deckData timesteps:
0 1 jan 1983 START
1 11 jan 1983*/
const std::time_t tEnd = tmap.getEndTime();
int year, day, month;
util_set_date_values_utc(tEnd, &day, &month, &year);
BOOST_CHECK_EQUAL(year, 1983);
BOOST_CHECK_EQUAL(month, 1);
BOOST_CHECK_EQUAL(day, 11);
}
BOOST_AUTO_TEST_CASE(initTimestepsDistantDates) {
const char *deckData =
"START\n"