Mostly removing leading 'tab' characters, splitting long lines and
realigning '=' characters where appropriate. Also make a few more
objects 'const'.
Finally, don't copy large objects (e.g., the Schedule) when we only
need to read from it.
In particular, defer unit conversion to the member function
RestartValue::convertFromSI()
and detect presence of multisegment wells using std::any_of(). We
don't need to know the exact number of MS wells to activate segment
output.
This commit refines our understanding of IWEL items relating to well
constraints. In particular Item 8 is the well's active control mode
as determined by the simulator from dynamic state variables. On the
other hand, Item 16 is the constraint that is requested in the
simulation run input for prediction wells (keywords WCONINJE,
WCONPROD) while Item 50 is the requested constraint for wells
controlled by observed rates (WCONINJH, WCONHIST).
Special Note: This commit outputs the requested control mode to Item
8 and will need an update later once the simulator becomes aware of
the distinction.
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 adds an intermediate layer to the save/restore code that
will translate between Flow's hysteresis parameters and a compatible
subset of ECLIPSE's hysteresis model parameters when creating a
stricly ECLIPSE compatible restart file. In particular we save and
restore Flow's KRNSW_OW and PCSWM_OW parameters in terms of the
SOMAX parameter using the relations
KRNSW_OW = 1 - SOMAX
PCSWM_OW = 1 - SOMAX
Similarly, we save and restore Flow's KRNSW_GO and PCSWM_GO
parameters in terms of ECLIPSE's SGMAX parameter using the relations
KRNSW_GO = 1 - SGMAX
PCSWM_GO = 1 - SGMAX
This does implicitly assume that KRNSW_OW = PCSWM_OW and that
KRNSW_GO = PCSWM_GO and will likely need refinement later. On the
other hand, the current relations are sufficient for the Norne
model.
Further analysis suggests Item 35 (index 34) of XCON is the
connection pressure. Use this information to save/restore the
values of data::Connection::pressure.
While here, also fix a spelling error in LoadRestart.cpp.
This commit activates the support for storing Flow's suggested next
timestep size as the TSINIT item (zero-based index 1) of the restart
file's DOUBHEAD vector. Local testing suggests that this value is
essential to even being able to restart Flow from a result set
generated by Flow itself.
This commit restores Flow's suggested next timestep size from the
TSINIT item of the DOUBHEAD vector pertaining to a particular
restart/report step. If the item is defaulted, which typically
happens if the result set is created by ECLIPSE, then we don't try
to restore the stepsize and RestartValue::hasExtra("OPMEXTRA") will
be false.
This commit creates an OPM-specific extension of the DOUBHEAD vector
of a restart step. We reuse the TSINIT item (zero-based index 1) to
store the next timestep. Local testing suggests that ECLIPSE does
not use this value as part of restarting a simulation so this item
is a reasonable compromise for creating a mostly ECLIPSE-compatible
restart file that still enables communicating the suggested next
timestep if we're restarting Flow from a result set created by Flow.
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 introduces a new helper function
restore_cumulative()
which creates a SummaryState object containing a subset of known
cumulative quantities--notably cumulative phase and reservoir
voidage production and cumulative water and gas injection for
individula wells and groups--including FIELD. This is the main
facility for resetting the simulator's notion of cumulative
production following simulation restart.
This commit introduces a new mutating operation on Summary objects,
Summary::reset_cumulative_quantities(const SummaryState&)
which overwrites the values of cumulative ("total") summary
quantities with those of the input argument. The only *intended*
use case is reinitialising cumulative quantities in the case of
simulation restart, but other uses may exist.
Add a test case to exercise the new interface.
This commit extends RestartIO::load() to also pick up segment
related quantities (flow rates SOFR, SGFR, SWFR, and pressure SPR)
if these are available in the current restart file.
This commit adds two new helper classes, {Well,Group}Vectors which
simplify accessing the portions of {I,X}{CON,WEL,GRP} pertaining to
any individual connection, well or group. These classes are both
implemented in terms of the existing helper functions
getPtr()
getDataWindow()
getInteHeadElem()
but hide away the complexity of passing the correct maximum number
of connections and number of vector elements per connection, well or
group.
Reimplement the vector queries in terms of these helper classes to
(hopefully) reduce the mental load when reading the restart code.
This commit adds a few identifiers for items in the XGRP and RSEG
restart vectors to enable restoring segment rates and cumulative
group production/injection quantities.
This commit revises the output layer to size object arrays according
to the maximum of the static, declared maximum sizes (from WELLDIMS)
and the actual dynamic array sizes from the simulation run itself.
When creating strictly ECLIPSE compatible restart files, this
maximum must always be the value from WELLDIMS, but Flow might
support sizes that are more lenient.
This commit introduces a new function,
Opm::checkConsistentArrayDimensions()
that inspects various dynamic array/table sizes and compares those
to the maximum dimensions requested in the relevant *DIMS keywords
of the RUNSPEC section.
At present we check only items one through four of WELLDIMS since
those are directly relevant for the ECLIPSE-compatible output code.
We leverage the ErrorGuard to integrate into the existing mechanism
for terminating a simulation run if there's a parse failure.
This commit introduces Parse Context keys that govern the parser's
behaviour in the case of a simulation run using dynamic sizes that
happen to exceed the maximum sizes declared in the RUNSPEC keyword
WELLDIMS. The default action for these keys is DELAYED_EXIT1, which
reflects the fact that it is impossible to create ECLIPSE-compatible
restart files if the run exceeds those maximum sizes.
The ParserContext error mode PARSE_LONG_KEYWORD is used to handle keywords
longer than 8 characters. The lenient option is to only consider the first 8
characters.