Merge pull request #545 from bska/summary-ensure-inc-elapsed
Summary: Ensure that we don't step backwards during simulation
This commit is contained in:
commit
a241a1bd07
@ -1113,6 +1113,9 @@ Summary::Summary( const EclipseState& st,
|
||||
restart_step = init_config.getRestartStep();
|
||||
} else
|
||||
OpmLog::warning("Restart case too long - not embedded in SMSPEC file");
|
||||
|
||||
this->prev_time_elapsed =
|
||||
schedule.getTimeMap().getTimePassedUntil(restart_step);
|
||||
}
|
||||
ecl_sum.reset( ecl_sum_alloc_restart_writer2(basename,
|
||||
restart_case,
|
||||
@ -1356,6 +1359,21 @@ void Summary::add_timestep( int report_step,
|
||||
const std::map<std::string, std::vector<double>>& region_values,
|
||||
const std::map<std::pair<std::string, int>, double>& block_values) {
|
||||
|
||||
if (secs_elapsed < this->prev_time_elapsed) {
|
||||
const auto& usys = es.getUnits();
|
||||
const auto elapsed = usys.from_si(measure::time, secs_elapsed);
|
||||
const auto prev_el = usys.from_si(measure::time, this->prev_time_elapsed);
|
||||
const auto unt = '[' + std::string{ usys.name(measure::time) } + ']';
|
||||
|
||||
throw std::invalid_argument {
|
||||
"Elapsed time ("
|
||||
+ std::to_string(elapsed) + ' ' + unt
|
||||
+ ") must not precede previous elapsed time ("
|
||||
+ std::to_string(prev_el) + ' ' + unt
|
||||
+ "). Incorrect restart time?"
|
||||
};
|
||||
}
|
||||
|
||||
auto* tstep = ecl_sum_add_tstep( this->ecl_sum.get(), report_step, secs_elapsed );
|
||||
const double duration = secs_elapsed - this->prev_time_elapsed;
|
||||
SummaryState st;
|
||||
|
@ -9,6 +9,9 @@ UNIFIN
|
||||
DIMENS
|
||||
10 10 10 /
|
||||
|
||||
START -- 0
|
||||
1 NOV 1979 /
|
||||
|
||||
WELLDIMS
|
||||
-- Item 1: NWMAX (Maximum number of wells in model)
|
||||
-- Item 2: NCWMAX (Maximum number of connections per well)
|
||||
@ -36,9 +39,6 @@ RESTART
|
||||
FIRST_SIM 1/
|
||||
|
||||
|
||||
START -- 0
|
||||
1 NOV 1979 /
|
||||
|
||||
SCHEDULE
|
||||
SKIPREST
|
||||
RPTRST
|
||||
|
@ -209,11 +209,11 @@ BOOST_AUTO_TEST_CASE(test_RFT2) {
|
||||
|
||||
Schedule schedule(deck, grid, eclipseState.get3DProperties(), eclipseState.runspec().phases(), parse_context);
|
||||
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ), parse_context);
|
||||
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
|
||||
time_t start_time = schedule.posixStartTime();
|
||||
const auto& time_map = schedule.getTimeMap( );
|
||||
|
||||
for (int counter = 0; counter < 2; counter++) {
|
||||
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
|
||||
for (size_t step = 0; step < time_map.size(); step++) {
|
||||
time_t step_time = time_map[step];
|
||||
|
||||
|
@ -412,7 +412,7 @@ RestartValue first_sim(const EclipseState& es, EclipseIO& eclWriter, bool write_
|
||||
auto num_cells = grid.getNumActive( );
|
||||
|
||||
auto start_time = ecl_util_make_date( 1, 11, 1979 );
|
||||
auto first_step = ecl_util_make_date( 10, 10, 2008 );
|
||||
auto first_step = ecl_util_make_date( 1, 2, 2011 ); // Must be after 2011-01-20
|
||||
|
||||
auto sol = mkSolution( num_cells );
|
||||
auto wells = mkWells();
|
||||
|
Loading…
Reference in New Issue
Block a user