Logs simulation time advance information (level: info).

This commit is contained in:
Williham Williham Totland 2020-09-28 14:21:35 +02:00 committed by Joakim Hove
parent 0ab50fbc95
commit 4c016660d8
3 changed files with 28 additions and 5 deletions

View File

@ -442,6 +442,9 @@ namespace Opm
}
}
std::string simulationDate(std::size_t currentStep) const;
std::string simulationDays(const UnitSystem&, std::size_t currentStep) const;
void applyEXIT(const DeckKeyword&, std::size_t currentStep);
void applyMESSAGES(const DeckKeyword&, std::size_t currentStep);
void applyWELOPEN(const DeckKeyword&, std::size_t currentStep, const ParseContext&, ErrorGuard&, const std::vector<std::string>& matching_wells = {});

View File

@ -17,6 +17,8 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ctime>
#include <fnmatch.h>
#include <iostream>
#include <optional>
@ -344,9 +346,13 @@ namespace {
if (deck_time == this->m_timeMap.restart_time()) {
restart_skip = false;
currentStep = this->m_timeMap.restart_offset();
}
} else
OpmLog::info(fmt::format("Found restart date"));
} else
OpmLog::info(fmt::format("Skipping date"));
} else {
OpmLog::info(fmt::format("End of report step ... at ... Processing simulation date {} ({}, step {}).", simulationDate(currentStep), simulationDays(section.unitSystem(), currentStep), currentStep));
currentStep += 1;
}
}
keywordIdx++;
continue;
@ -355,6 +361,7 @@ namespace {
if (keyword.name() == "TSTEP") {
checkIfAllConnectionsIsShut(currentStep);
currentStep += keyword.getRecord(0).getItem(0).data_size();
OpmLog::info(fmt::format("Advancing simulation by with TSTEP"));
keywordIdx++;
continue;
}
@ -1475,6 +1482,16 @@ namespace {
this->wellgroup_events == data.wellgroup_events;
}
std::string Schedule::simulationDate(std::size_t currentStep) const {
const auto ts { TimeStampUTC(simTime(currentStep)) } ;
return fmt::format("{:04d}-{:02d}-{:02d}" , ts.year(), ts.month(), ts.day());
}
std::string Schedule::simulationDays(const UnitSystem& unit_system, std::size_t currentStep) const {
const double sim_time { unit_system.from_si(UnitSystem::measure::time, simTime(currentStep)) } ;
return fmt::format("{} {}", sim_time, unit_system.name(UnitSystem::measure::time));
}
namespace {
// Duplicated from Well.cpp

View File

@ -22,6 +22,8 @@
#include <stddef.h>
#include <iomanip>
#include <fmt/format.h>
#include <opm/common/utility/TimeService.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
@ -385,9 +387,10 @@ namespace {
if (index >= m_timeList.size())
throw std::invalid_argument("Index out of range");
if (index > 0 && index < this->m_restart_offset)
throw std::invalid_argument("Tried to get time information from the base case in restarted run");
if (index > 0 && index < this->m_restart_offset) {
printf("What the f... \n");
throw std::invalid_argument(fmt::format("Tried to get time information from the base case in restarted run index:{} restart_offset:{}", index, this->m_restart_offset));
}
return m_timeList[index];
}