This commit switches the file handling operations of the gateway
function RestartIO::save() to using the OutputStream::Restart
component. Briefly, this means replacing write_kw() function calls
with calls to Restart::write(), especially since the latter natively
handles PaddedString<8> data.
- Change SummaryState::add() -> SummaryState::update(), the
SummaryState::update() method is semantically aware of totals.
- Add an internal variable to the SummaryState class to keep track of the
elapsed simulation time.
This commit adds support for saving and restoring cumulative
production quantities like WOPTH, GWPTH, FGPTH, GGITH, and WWITH.
While here, also cater to the case of wells alternating between
injecting gas and injecting water. This means that we'll save and
restore cumulative gas/water injection for all injectors,
irrespective of current injecting phase.
Update unit tests accordingly.
This commit hooks the new helper function restore_cumulative() up to
the gateway restart function
RestartIO::load()
by changing the return type from "RestartValue" to
std::pair<RestartValue, SummaryState>
with the pair's '.second' being restore_cumulative()'s return value.
Update callers including unit tests accordingly, specifically such
that the gateway function
EclipseIO::loadRestart()
internally resets its Summary object's cumulative quantities using
'load().second'. This is, strictly speaking, a violation of the
"const" qualifier on EclipseIO::loadRestart(), but the language
permits the usage because the 'impl' pointer in this case will be a
constant pointer to a mutable 'Impl' object.
This commit, a preparation for restoring cumulative quantities from
a restart file, reinitialises Summary::prev_time_elapsed in the case
of simulation restart and adds a check to
Summary::write_timestep()
which throws if the input argument 'secs_elapsed' is prior to the
previously recorded elapsed time. The latter is a change in the
behaviour of write_timestep(), but ensures that we don't integrate
rate quantities across a very large timestep in the case of
simulation restart and also prevents double accumulation.
Update impacted unit tests accordingly, and move FIRST_SIM's START
date into the RUNSPEC section where it belongs.
- Will throw an exception if solution data has wrong size.
- struct ResatrtValue used as RestartIO::load( ) return value.
- RestartIO can take arbitrary double vectors as extra data.
The main content of this commit is that the loading of restart files is
based on map of keys passed in from calling scope. This way the
selection of keywords to save and load is fully under control of calling
scope, but in addition there are many small refactorings:
- The EclipseWriter class and implementation has been renamed
EclipseIO.
- The loading and saving of restart files has been moved to file and
namespace RestartIO, which contains two loose functions load( ) and
save( ).
- The Summary() and RFT( ) data get their own copies of the data::Cells
vector.
- Removed some abstractions and wrrappers around C / ert
datastructures. Using ecl_file_view when loading restart files,
instead of bare ecl_file. Simplified opening of unified restart
files.
- Removed the ability to save restart keywords in double precision.
The data exchanged in data::Well::Completions is now a vector, more
closely matching the disk format and the order exposed by the simulator.
Zero'd wells and complations are still written for shut wells, or wells
the simulator does not provide any information for; however, all
non-closed wells (according to the schedule) will be restored. The
completions are written and restored in the same order as CompletionSet
from parser.
Change the structure used to populate OPM_XWEL to use a plain map of
data::Wells objects rather than dumping a series of vectors to
data::Wells. Tests are added for serialising and restoring wells.