We pass an int pointer to the function initCornerPointGrid.
With ACTNUM this pointer was initialized with data pointer
of an int vector that we threw away before the function call
(otherwise it was null). To fix this we move the int-vector up one
scope.
Note that we have to reduce the year-range in the specific test
createDeckWithDRSDTthenDRVDT
in order not to wrap around for system_clock. This is a deficency of
the new time-service protocol.
Mostly for converting between std::time_t and broken-down time
stamps. Uses UTC and std::chrono::system_clock. May wrap in as
little as 292 years, depending on the period of system_clock.
Intended to replace various timestamping utility functions from
libecl. A comprehensive time-service protocol for Flow is much more
work than this, and will likely not be easily realized before we
have C++17 and its much expanded time/calendar library.
Instead, switch to 'int' for the 'before' and 'after' row indices.
The 'ssize_t' Posix type alias is not appropriate for this usage
since its range is only guaranteed to be [ -1 .. (1<<15)-1 ].
If you set CMAKE_INSTALL_PREFIX, have the dependencies installed there, but
the source of them lying around in the parent directory of the build
directory, then the build will fail starting with opm-models because
we assume that ../opm-material is a build directory and set opm-material_DIR
to it. CMake will complain about not finding opm-material-config.cmake or
Opm-materialConfig.cmake. With this commit we will only set opm-material_DIR
if the directory contains a file CMakeCache.txt (which should be the case in
a configured build directory.
Directory outline of the failing situation is
- ${CMAKE_INSTALL_PREFIX} # where all dependencies are installed
- parent_dir
|____ opm-common #source dir
|____ opm-material #source dir
|____ ...
|____ build #build directory for current module (e.g. opm-modules)
Change is tested with sibling build
- build
|___ opm-common #build dir
|___ opm-material #build dir
|___ ...
and the dune version of it
- parent_dir
|___ opm-common # source dir
|____ build # build dir opm-common
|___ opm-material # source dir
|____ build # build dir opm-material
...
This commit switches the 'test_Summary' unit test to use class ESmry
for inspecting the values output to disk by 'out::Summary'. As a
consequence, we are not able to verify units of measure for the
parameters, at least not for the time being. Moreover, class ESmry
exclusively uses the "i,j,k" sub-key for block-related parameters so
switch those to reference the IJK identifiers.
Finally, as class ESmry currently does not support reading separate
(multiple) summary files, switch the input decks to generate unified
output.
This commit switches a set of OPM-Common's unit tests away from
using direct calls to libecl functions and into using base types
from OPM-Common itself (along with Boost.Filesystem).
In particular summary related queries are replaced by calls to ESmry
member functions (wrapped in libecl-like interfaces to minimise code
changes). We disable checks on unit strings since ESmry currently
does not have a way of associating those with individual variables.
This commit takes a pass at the implementation files in opm-common
and removes references to libecl functions where practical. In
particular we switch to using types from C++'s standard library (and
Boost.Filesystem) to achieve the effects of the interfaces being
replaced.
We also insert direct calls to Posix function fnmatch() to preserve
existing pattern matching behaviour (well lists and well templates).
This commit introduces a new member function
int ESmry::miniStepIdxAtReportStep(rptStep)
which returns the zero-based ministep corresponding to the start of
the given report step (one-based indexing). This will simplify
decoupling a few unit tests from libecl.
This commit replaces the existing system for writing summary and
specification (SMSPEC) files with a new implementation based on
class EclOutput. We package the evaluators of individual parameters
in a set of classes determined by the parameter's category which
each implement a virtual 'update()' function. This update function
ultimately writes new values into a SummaryState object.
Add a factory-like system for instantiating the appropriate class
depending on a SummaryNode's 'category()'. Also, add a helper class
for managing the parameters that a configured in a simulation
model's SUMMARY section in order to distinguish these from those
parameters that are merely needed for restart purposes. The summary
class's 'eval()' function then becomes a loop over the evaluators
for parameters in SUMMARY followed by a loop over the evaluators for
restart vectors.
We reimplement the 'internal_store()' function in terms of an
std::vector of a helper structure 'MiniStep' which holds a ministep
ID (contiguous counter started at zero), a report step ID, and all
the evaluated parameters of this ministep. The final write function
then consists of outputting those ministep structures that have
accumulated since the previous call to write(). If a simulation
does not call write at all, then this will accumulate all parameters
for all ministeps throughout the simulation history.
We create the SMSPEC file at most once, and write to it at most each
report step. We create the summary file once (if unified) or at
each report step (if separate).
Needed to ensure we create the same summary/specification files as
the existing system. We will revert this change once the new system
is in place and we can afford to update the reference solutions.
Flow's saturation function finalizers don't currently handle models
with fewer than three active phases. Don't attempt to fill in
scaled endpoint vectors in this case, but issue a warning that we're
ignoring FILLEPS here.
The summary file must have DAYS (&c) for its TIME vector unit. This
is a step towards enabling new summary writer functionality.
Update the RFT writer accordingly.
This commit adds a single function, createSummaryFile, that opens an
EclOutput object on a file named as an ECLIPSE summary file
(formatted vs. unformatted, unified vs. separate) and returns a
unique_ptr to this.
This is a step towards enabling new summary writer functionality.
This commit extends Flow's support for separate restart files to
more than 10,000 report steps (not necessarily restart steps). In
particular, add support for generating separate restart files named
CASE.X000n, CASE.Y000n, CASE.Z000n (unformatted)
CASE.F000n, CASE.G000n, CASE.H000n (formatted)
This is mostly for completeness. We do not really expect to run
simulation models with more than 10,000 (or 20,000) report steps.
This commit pulls the 'well_efficiency_factor' function into
Summary.cpp's private/anonymous namespace. In addition to being a
step towards enabling new writer code for Flow's summary file, this
also fixes a "no previous declaration" warning on GCC.
This commit pulls the table of evaluation functions out of the Opm
namespace and into the existing anonymous namespace of Summary.cpp.
This is an intermediate step towards enabling new writer code for
Flow's summary files.
UDQConfig object has merged DEFINE & ASSIGN
Log use of UDA for output purposes
Output UDQ keywords to restart file
Add size() method to UDQConfig
Add UDQVarTYpe member to UDQInput class
Add UDQIndex type to keep track of sequence number of variable types
Add unit to UDQInput class
use maps
Add operator[] to UDQConfig class
Use UDQInput class when creating restart file
UDQInput: use correct input index
Add UDQActive::get() method
Make sure UDQ DEFINE overwrite correctly
WIP
WIP - further code to output IGPH vector
WIP
Fix IUAD input index
Output use_index for IUAD
Fix bug with size of IUAD array
UAD usage hashing based on udqstring and controltype
Add UDQ test and input file
Refactor UDQActive - handles vanishing UDA
minor correction for iuad[1] and for test_UDQ_x.cpp
Further work for making unit tests for UDQ restart data
WIP Further work unit tests
WIP some minor corrections
WIP changes to add first version of BOOST test for IUDQ
WIP Added code to write InteHead and DoubHead data as well as IGPH to restart file,
Further added unit tests to the writing of UDQ data
add code to output IUAP array
Fixed group-group2 transition, disable Restart output
WIP Initial changes to add DUDW array to restart output
WIP further work on DUDW data
WIP - further work to output and test DUDW vector data to restart file
Further changes to write DUDW array to Restartfile
Calls '.flush()' on the contained 'ofstream' object. Needed as a
means of ensuring that bits in the internal buffers of the I/O
system are promptly output to permanent storage. This, in turn, is
needed in upcoming work on the summary writing feature.
python Deckkeyword: can init with empty records.
python Deckkeyword: can record simple records, but not defaults.
python deckvalue: can take defauløt values.
To support field properties with only active cells the Box class has been
extended to give a set of active indices for a box. In addition the BoxManager
has been refactored:
- Use std::unique_ptr<Box> to enable "has no box" situation.
- Removed several unused getXXX() methods.
And the begin() and end() iterators have been removed from the Box class.
DeckKeyword: new constructor takes recordlist.
DeckKeyword: invalid arg for wrong nr. of records.
DeckValue: type_tag replaces DeckValueEnum.
DeckValue: added as source for genkw.
DeckValue: default is unknown type.
DeckKeyword cosntr w/ record-lists works, but not for defaults.
DeckKeyword: added function add_deckvalue.
.. xx --
...
...
...
...
...
...
...
DeckValue: is<double> true also if integer.
...
...
last commit .m
This commit introduces a new OutputStream class for representing the
summary specification file (.SMSPEC). The stream is constructed
with constant data (output directory, basename, start date &c), and
provides a single write() member function that outputs a summary
specification.
Each call to write rewinds the underlying stream's output position.
Class EclOutput grants friendship to the new output stream class in
order to support easy stream rewinding.
Add a unit test to exercise the new class.
This commit makes the table linearisation code independent of
LibECL's "ecl_kw_magic.h" header. In particular, we add a new set
of vector items (tabdims.hpp) that describe the items we currently
define and reimplement the member functions of the 'Tables' class in
terms of these items.
Update the unit test accordingly.
This commit removes the original member functions
void Tables::addPVTO()
void Tables::addPVTW()
void Tables::addPVTG()
since these are no longer needed. The PVT tables are now defined in
terms of the 'addPVTTables()' member function
While here, also remove the fwrite() free function which was defined
in terms of LibECL types.
Update the unit test accordingly.
This commit decouples the UnitSystem class from the LibECL type
ert_ecl_unit_enum. This, in turn, makes UnitSystem independent of
LibECL.
Update the unit test accordingly, and include <ert/util/util.h>
where needed. This header was included transitively through
UnitSystem.hpp before.
This commit reimplements the SummaryNode class in order not to use
the ecl::smspec_node class from LibECL. Consequently, we remove
class SummaryConfig's binding to LibECL.
Class SummaryNode maintains the same information as before. We also
implement a "named constructor" strategy to assign data members that
only make sense for a subset of the node categories. The previous
member function 'type' is renamed to 'category' to identify the
attachment category (e.g., Well, Group, Field, Block, Region). In
turn, we introduce a new 'type' member function to identify the
parameter kind (e.g, pressure, rate, cumulative total, well count)
represented by a given node. We furthermore capture whether or not
the node is a user defined quantity (i.e., a UDQ).
We reimplement the keyword classifier operations that are currently
needed as free functions named 'is_*()' in SummaryConfig.cpp.
Note that in addition to the renamed member functions of class
SummaryNode, this commit also switches the summary key strategy for
block parameters. Rather than capturing the 'ijk' values
individually as "BOSAT:3,3,6", we now store the equivalent global
(Cartesian) index (i.e., as "BOSAT:523"). Code that directly
constructs block parameter keys must be updated accordingly.
Chase the API change in the 'Summary' constructor and update unit
tests as needed.
This commit removes the member function
void SummaryState::update(const ecl::smspec_node&, double)
and places an equivalent implementation into Summary.cpp's private
helper function namespace. Doing so allows us to make the summary
state object independent of the 'libecl' library.
python: exposes Schedule.
python: added constructor for Schedule.
test_schedule: reintroduced most tests.
python test_schedule: all test works.
python test_wells. opened up some tests.
test_wells: opened up most.
test_wells.py ok.
calculated and stored as private data members in EclipseGrid.
The API for the class is unchanged except for some minor changes for exportACTNUM, exportZCORN and exportCOORD.
These changes have triggered some very few modifications in the opm-grid and opm-simulators repo.
This commit adds a new query method,
bool Schedule::hasGroup(groupName, timeStep)
which report whether or not a particular named group exists at a
particular time step (zero-based report step index). If this
function returns 'true', then it is always safe to call
Schedule::getGroup2(groupName, timeStep)
with the same arguments. Otherwise, the latter will throw an exception.
The new 'hasGroup' overload thus enables the same query types as the
existing 'hasWell' overload set. The immediate use case for this
new overload is a reworking of the system for evaluating derived
summary parameters (e.g., FOPT or GGLR).
Add a new unit test to exercise the new overload.
This commit replaces the existing RFT file output defined in terms
of private class 'RFT' with the function RftIO::write(). While
here, also explicitly add requisite headers that were included only
transitively.
This commit implements a new file writing function
void Opm::RftIO::write()
that is intended to replace the current RFT output functionality
defined in terms of private class 'RFT' in EclipseIO.cpp. We
support the basic RFT output consisting of
- Timestamp (elapsed and date)
- WELLETC metadata including all unit conventions
- Connection cell (I,J,K), connection cell hostgrid (blank for
main grid only), connection cell centre depth, connection cell
pressure, and connection cell water and gas saturations
Connections in inactive cells are omitted. Note that unit of
measure strings aren't implemented in terms of UnitSystem::name()
due to the strings being padded on the left for centering effect.
Add unit tests to exercise the new writer.
This commit introduces a new output stream, 'RFT', that is intended
as a new backend for writing RFT files. At present this supports
integer, float, and PaddedOutputString<8> element types since those
are the types needed for basic RFT data. We will extend the element
support if needed for PLT and/or Segment data.
We support formatted and unformatted output streams and distinguish
between opening a new stream and opening an existing output stream
(essentially between open modes ios_base::out and ios_base::app).
Add unit tests to exercise the possible combinations.
The DeckKeyword::DeckKeyword(const std::string&) constructor has been removed
and the DeckKeyword now requires a ParserKeyword pointer in the constructor.
This commit extends the 'maxGroupSize' function to also consider the
sizes of node groups (i.e., the number of child nodes/child groups)
when determining what the largest group size is on a particular step.
Add a unit test to demonstrate.
This commit switches the `test_RFT` unit test to using the `ERft`
class introduced in commit 24a8efb2 (PR #699). This is the first
step towards reimplementing the RFT file output in terms of class
EclOutput. The downside to doing this is that we can no longer use
the node-based queries of libecl and have to implement a wrapper on
top of the raw vectors to be able to ask for the pressure in a given
connection's cell.
- Reduced the amount of state in the RawKeyword and ParserState classes.
- RawKeyword class has normal constructor - remove init method.
- The Rawxxx symbols are module private and the header files are not installed.
- Removed several unused static methods from Rawxxx and ParserKeyword.
setup.py: test_suite -> tests_suite .
libsunbeam -> libopmcommon_python.
sunbeam -> opm: test_connection ok.
test_deck ok.
test_group_tree ok.
test_grupnet ok.
test_parse_deck.py ok.
test_parse.py ok.
python all tests ok.
This list contains only summary vector TCPU.
keywordsBlackList will work on all file types (INIT, UNRST, RFT and SMSPEC/UNSMRY)
wildcards (*) not supported
currently, the python bindings are built on every make invocation,
including the 'make install' command.
this improves on this situation by tracking whether or not the target
needs to be rebuilt through a custom output and dependencies.
the list of dependencies is not very pretty, but necessary when
linking two build systems like this.
With this commit the result of a ACTIONX evaluation goes to the new type
Action::Result which in addition to the overall thruthness of the expression
keeps track of the list of matching wells.
Introduced a new namespace Action for everything related to the ACTIONX
implemenentation.
setup.py moved to python/python.
moved python tests to python/python.
added __init__.py under python/tests.
added 'test_' before all python test names.
test_ prefix added to tests.
setup.py and python tests moved back to python base.
setuptools executes from root python.
python: tests run from root python w/ setup.py.
python tests: temp reduced to test_deck only.
python setup.py: manually linked opmcommon.
setup.py: linked ecl.
setup.py linked boost_filesystem.
setup.py: linked boost_regex.
python all tests run.
removec usr/local from setup.py ext_module.
cmake make copies entire python dir to build.
setup.py can execute from build.
setup.py executes from build/python.
python tests run under setup.py.
setup.py library_dirs and include-dirs set by cmake command.
removed cmake files from sunbeam.
sunbeam: added code for install.
setup.py: removed 'import ecl'.
python/src -> python->src_sunbeam.
setup.py: discontinued use of glob, all files listed instead.
build-opm_module.sh: added prefix_path to opm.
build-opm-module.sh: changed spell error for EXTRA_MODULE_FLAGS[opm-common].
setup.py: infer include directories from cmake target
CMakeLists.txt: under python: align install statement.
CMakeLists build python: removed find_package.
src_sunbeam -> cxx.
setup.py: test_suite as string.
setup.py: tests_suite -> test_suite.
setup.py: added exception if 'build_ext' not used.
temporarily moved files to python/sunbeam.
This commit makes the TRANNC INIT file output conditional on the vector
being non-empty. Previously we would alway output that vector even if
it did not contain any non-neighbouring connections.
This commit extends the previous support for writing scaled end-points
(and scaled function values) to outputting the sentinel value -1.0e+20
for those items (cell values) that have been defaulted in the input.
This operation does not apply if the simulation run specifies FILLEPS,
in which case we always output the actual scaled end-points, whether
taken from explicit assignment or derived from table values.
The overall approach is to pass an additional flag (needDflt) to
function writeDoubleCellProperties(), which then dispatches to two new
helper functions
writeCellPropertiesWithDefaultFlag()
writeCellPropertiesValuesOnly()
The former then expects a three-argument callable (lambda), the second
of which is the compressed version of the Property<T>::wasDefaulted()
value. This is then used to infer for which elements to output the
sentinel value. The ValuesOnly() property writer is the previous
version of writeDoubleCellProperties() and is mainly used to support the
FILLEPS operation.
This commit ensures that we set the correct end-point scaling flags in
LOGIHEAD (items 17..20, zero-based indices 16..19) according to the
run's requested end-point scaling behaviour. This in turn enables the
ResInsight postprocessor to distinguish between scaled and unscaled
saturation function curves in its "RelPerm" plot window.
Note that in order to set the correct flags and to not impact the
restart files, we've elected to copy the CreateLogiHead function here.
This incurs non-zero technical debt. We should seek to reunify the two
implementations to the extent possible.
This commit extracts the hard-coded list of end-point scaling vectors
out to a new helper class, ScalingVectors, and makes the specific list
dependent on the run's active phases. This means, in particular, that
we won't output water vectors unless water is an active phase and
similarly for gas and oil.
The added logic of active phases only was complicated enough to warrant
an encapsulating scope.
This commit introduces a new helper function,
writeSatFuncScaling()
that will extract scaled end-point arrays like SWL, SGCR, SOWCR,
KRORW, and PCG and output these to the INIT file. We support both
the drainage and imbibition keywords, but do not support the
directional versions of these keywords at this time.
Note that this first draft uses the keyword values directly from the
Eclipse3DProperties container. Therefore, the output behaves as if
the input deck always specifies the 'FILLEPS' option. Outputting
only the values that were specified in the input will be the subject
of future work.
This commit introduces a new helper function,
writeCellProperties()
that accepts a list of properties to output as well as a property
container (GridProperties<T>), an EclipseGrid and call-back write
function for individual properties. The helper invokes the callback
for each property that exists in the property container, passing it
the property description and the property values compressed to
active cells.
Reimplement function writeDoubleCellProperties() in terms of the new
helper.
This commit introduces a new helper function
void GridProperty<>::setElement(i, val, dflt)
that handles paired assignments to 'm_data' and 'm_defaulted'[%].
This simplifies the bookkeeping and implementation of the various
assignment and value operations.
While here, also add a unit test to demonstrate expected behaviour
of the m_defaulted flag. The only really questionable setting is
what happens if the deck applies a relative operator (e.g., ADD or
MULTIPLY) to a value that would otherwise be defaulted. In the
current implementation the m_defaulted flag will remain set in this
case, but it arguably should be switched to unset (false).
[%]: Suggested by [at]akva2
This commit adds a comment block to the new
setPostProcessor
member function, explaining the reasoning behind its excistence and
remarking on the fact that the ability to replace the post-processor
is essentially a hack. The hack suggests that we need to rethink
our handling of (3D) grid properties.
This commit calls the SOGCR post-processor hook if the simulation
run uses SGOF. In this case we need to subtract (scaled) connate
water saturations from defaulted SOGCR values.
This revealed a problem in one of the unit tests which used the
incorrect critical oil saturation due to a missing SGOF record.
This commit adds a new member function
Eclipse3DProperties::adjustSOGCRwithSWL
which mutates the SupportedKeywordInformation of the various *SOGCR*
keywords created by makeSupportedDoubleKeywords(). Specifically,
adjust*() installs new post-processors for the critical oil-in-gas
saturations--post-processors that subtract the (scaled) connate
water saturation from the defaulted SOGCR. This is only applicable
if the simulation run uses Family I (SWOF/SGOF) saturation function
keywords, because the SGOF table is implicitly defined in terms of
the connate water saturation.
This is a special purpose hook that is mainly intended to add a
post-processor after the keyword information is established only if
certain conditions are satisfied (e.g., if certain keyword relations
like the run using 'SGOF' tables hold).
Immediate use case is to install a post-processor for SOGCR to
subtract the scaled connate water saturation from defaulted SOGCR
values if the simulation run uses family I (SWOF/SGOF) saturation
function descriptions.
This commit alters the post-processor API to accept a vector<bool>
of defaulted flags (true if defaulted, false if explicitly
assigned). This, in turn, enables running the post-processor only
on defaulted (or assigned) property values.
Update existing post-processor implementation to honour the new
calling conventions.
This commit adds a new data member (GridProperty<T>::m_defaulted)
that keeps track of whether or not a particular data item has been
implicitly assigned from the input deck. GridProperty::setDataItem
assigns 'false', while the constructor initialises 'm_defaulted' to
true for all Cartesian cells.
The main objective is to be able to apply a post processor only to
those cells for which the input deck does not supply an explicit
value.
WELOPEN and WCON* can open well closed due to various reasons, physical
or economic.
If a well is shut with WELOPEN and WCON*, we do not try to re-open it
through WTEST.
This is necessary to support the table-based gas mobility reduction model.
In order to extend support to the function-based model the FOAMFSC-related
things have been kept.
- Use const reference to the dynamic state in handleWFOAM() and handleWPOLYMER().
- Throw if trying to set foam or polymer injection properties on a production well.
- Update some tests that failed due to the point above.
so we can easily tell when a new WTEST keyword joins.
When a new WTEST keyword, we will reset the counting of the num_attempt
and maximum number of attempts for the associated well.
There are models for which SATNUM and/or IMBNUM is zero in
deactivated cells (those for which ACTNUM is also zero in the input
deck). Allow this case in the initializers for the saturation
function properties (i.e., the endpoint arrays).
This commit extends the InitConfig class to support querying whether
or not the FILLEPS keyword is present in the PROPS section. Note
that we only look for the keyword in PROPS (not the whole input
deck), since the keyword is only permitted in PROPS.
Add unit tests to exercise the new ability.
This commit switches the implementation of
EclipseIO::Impl::writeINITFile()
to using the new helper function Opm::InitIO::write(). This, in
turn, replaces LibECL with the EclOutput class in writing the INIT
file similarly to the previous work on the restart files.
This commit adds a new facility for creating the simulation runs'
INIT file. This is intended to replace the implementation of class
EclipseIO::Impl's writeINITFile. Initial structure taken from
current implementation of EclipseIO::Impl::writeINITFile().
This commit introduces a new file manager,
Opm::EclIO::OutputStream::Init
that's intended to replace the low-level operations of Flow's INIT
file writer. The implementation uses the 'EclOutput' class and is
very similar to that of the 'Restart' stream introduced in commit
992d3b0c. The commonality between the two file managers might
possibly be extracted to a base class at a later time.
As of right now, the Init class supports outputting vectors of
'int', 'bool', 'float', and 'double'. Additional types will be
supported when needed.
The number of records is unrelated to AQUDIMS Item 5 (NANAQU). That
item sets the maximum aquifer ID permissible as Item 1 of AQUFETP.
Update unit test accordingly.
Commit 7986e99e intended to make OPM Flow able to run simulation
cases whose active number of groups might exceed the declared
maximum number of (non-FIELD) groups (Item 3 of WELLDIMS). However,
we did not ensure that Item 21 of INTEHEAD contained the larger of
WELLDIMS(3) and the actual number of active groups.
This, in turn, meant that downstream consumers--such as the code to
enumerate groups according to their order of appearance in the
simulation deck--would generate subscripts/indices that were out of
bounds for the allocated tables. Flow's restart code would then not
produce any output and the user would not be aware of the problem
until attempting to restart a simulation or trying to visualise 3D
simulation results.
This commit corrects the situation by ensuring that we always store
the larger of the two sizes in INTEHEAD(21).
Pointy Hat: @bska
It is perfectly fine to have groups whose size (number of children)
is equal to the declared maximum (Item 4 of WELLDIMS). It is only
questionable to have groups whose active size exceeds that of the
declared maximum.
Pointy Hat: @bska
This commit reimplements the private RestartFileView class in terms
of the ERst class. The latter supports all operations we currently
need, although we can no longer use a 'const' object since loading
arrays mutates the ERst instance.
Most changes here are fairly mechanic and most of the new complexity
concerns how to identify a vector (keyword) of a particular element
type. We make special concessions for INTEHEAD, since this vector
plays a central role in accessing the other data vectors. The
mutability of RestartFileView is underscored by using shared_ptr<>
in the various helper facilities.
This commit makes class 'Opm::EclIO::ERst' able to open separate
restart files (*.X000n, *.F000n). Specifically, we refactor the
existing class constructor body into a new helper function
'initUnified'. We add a new helper function 'initSeparate' that
builds the requisite indices in the case of a single report step,
and make the constructor body call 'initUnified' or 'initSeparate'
depending on whether or not the SEQNUM keyword exists in the restart
stream.
Add two new unit tests to exercise the new ability.
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.
Space-padded vectors of N (usually 8) characters is the typical
representation of character data in ECLIPSE output files. Support
this type natively in the ECLIPSE IO library.
this is not supported in older version of boost::filesystem.
furthermore, it was always an experimental feature and
and has been deprecated in newer versions.
generic_string is available in all versions, so use that.
Then we don't have to store copies of the 'formatted' and 'unified'
flags, and are also able to remove the 'prepareStep()' function. We
will reintroduce these features if we decide to add support for
keeping the output stream open between separate restart output
requests (i.e., between calls to EclipseIO::writeTimeStep()).
In particular, make the stream() function into a private detail of
the implementation and add an overload set for outputting keyword
data and messages to the underlying output stream. Update unit test
accordingly.
Suggested by: Atgeirr F. Rasmussen
This commit introduces a new class,
Opm::ecl::OutputStream::Restart
that handles the details of opening restart output streams (all
combinations of formatted/unformatted and unified/separate), as well
as correctly positioning the stream 'put' indicator if we're opening
an existing unified restart file. In most cases, this will be a
simple append operation (std::ios_base::app), but there are some
subtleties that require more precise control. The new class is
befriended by EclOutput and ERst in order to access private member
functions and data members of these classes. That is needed in
order to handle file resize operations since some of the requisite
information is only available in those two classes.
We use Boost.Filesystem to implement file resize, as if by POSIX
function ::truncate(), and also to simplify filename generation.
These calls can be switched to std::filesystem once the project
requires C++17.
Intended use of the Restart class is
Restart rst(resultSet, formatted, unified);
rst.prepareStep(17); // Report step/SEQNUM 17.
rst.write("INTEHEAD", ihead);
// ...
The 'prepareStep' operation opens the file stream (if needed) and
also outputs a SEQNUM record in the case of a unified output stream.
Moreover, the 'resultSet' is a pair of output directory and case's
base name (e.g., "./mpi.np4/2019.05.14.01" and "NORNE_ATW2013") and
the formatted/unified flags are bools wrapped in structures.
The Restart class is intended to take over the role of the
'filename' string parameter of RestartIO::save().
Add a set of unit tests to demontrate usage and abilities of class
Restart.
This commit extends the EclOutput constructor to support letting the
client specify a particular open mode. This in turn prepares using
EclOutput as the basis for a restart file writer. Passing
mode=openmode::out is the common case for a new restart file, while
mode=openmode::app is the common case for an existing restart file.
Specifically, add a member function
EclOutput::message(const std::string&)
that outputs the string as an 'eclArrType::MESS'. This is in order
to support outputting 'STARTSOL' and 'ENDSOL' demarcations in a
restart file.
This commit introduces a new member function,
ERst::restartStepWritePosition(seqnum)
that translates a SEQNUM ID into a std::streampos object pointing to
the start of the data for that SEQNUM ID. Return std::streampos(-1)
if the sequence number exceeds all known sequence numbers in this
restart set.
The member function is private because it is supposed to be called
only by the class itself and a select set of class friends.
This commit introduces a new member function
EclFile::seekPosition(arrayIndex)
that retrieves the file (seek) position of the start of the header
of the arrayIndex-th keyword. The expected use case for this is
seeking to the start of a particular SEQNUM value in a unified
restart file. If the array index exceeds all supported index
values, then we return the position of the file's EOF mark (captured
as the last item in the EclFile constructor).
The member function is protected to be accessible in derived classes
and by friends of derived classes.
With this commit the code to evaluate UDQ values has been extended/refactored in
many ways:
- There is an increased awarenwss of variable type, i.e. a well related UDQ
versus a field related UDQ. The variable type flows through the AST, and it
is verified that the expression to evaluate and the target variable are of
compatible types.
- Have added support for UDQ field variables and UDQ group variables.
- The UDQSet type and the UDQDefine::eval() have been refactored to multiplex
on all the UDQ types, and the specialized UDQWellSet has been removed.
This makes the facility usable for the restart read/write code.
Specifically, import the I/O classes into namespace Opm::ecl, and
place the files in physical location opm/io/eclipse, and move the
test utilities to new top-level directory 'test_util/'. While here,
discontinue the 'testutil' static library since most of its features
are now available in the main 'opmcommon' library. This does entail
compiling a few of the test_util/ CPP files multiple times, and
adding the objects to each executable independently.
Turns out that for clang this is no a bool and therefore a template
specialization is missing. We workaround this by some template (black) magic
that does the explicit instantiation for clang and for others adds another
unused instantiation for char.
Copied changes already made for INIT-file export to restart file export
for eclipse compatible restart file export. The changes apply to
LOGIHEAD and account for whether live oil or wet gas is present
Allow output of:
BOSAT
BWKR
BOKR
BKRO
BGKR
BKRG
BKRW
BWPC
BGPC
BVWAT
BWVIS
BVGAS
BGVIS
BVOIL
BOVIS
For this to work, appropriate changes to opm-simulators in
ecloutputblackoilmodule.hh needs to be included. This is
made in a separate branch since it belongs to a different repo.
- 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.
We were simply defaulting this flag to fals for all runs. While
using constant Co is uncommon for real field models, it does come up
in academic settings.
Pointy Hat: @bska
This commit replaces the existing calls to
Tables::addPVTO()
Tables::addPVTG()
Tables::addPVTW()
with the new umbrella member function
Tables::addPVTTables()
This, in turn, activates table normalisation for all PV{D,T}{G,O},
PVCDO, and PVTW keywords and produces ECLIPSE compatibly sized TAB
vector representations for these data sources.
As a prerequisite for this work, to enable users such as ResInsight
to correctly interpret the table contents, we need to ensure that
the contents of LOGIHEAD reflect the data sources used to form TAB.
As a consequence, we now control the contents of INTEHEAD, LOGIHEAD,
and DOUBHEAD directly from EclipseIO.cpp rather than from LibECL
library function ecl_init_file_fwrite_header().
We reuse header functionality from the restart files. This changes
the size of the *HEAD vectors in the init file:
Vector Old New
INTEHEAD 95 411
LOGIHEAD 80 121
DOUBHEAD 1 229
which matches ECLIPSE 2017.2. Note that this is taking a bit of a
shortcut, because there are items in restart files that differ from
those of the init file. However, for the items that affect tables,
the items are the same in both init and restart files. We will need
to refine this at a later point.
This commit introduces two functions,
LogiHEAD::pvtModel()
LogiHEAD::saturationFunction()
that set LOGIHEAD flags pertaining to a subset of activated
features. In particular, we add the ability to control whether or
not a particular run applies to a live/dead oil case, a wet/dry gas
case and/or whether or not a dead oil case is specified in terms of
constant oil compressibility (PVCDO keyword). Saturation function
flags identify attributes of end-point scaling and directionally
dependent and/or reversible relative permeability functions.
Add unit tests to exercise these features.
This commit removes the restriction that cumulative totals are not
output in the case of creating OPM Extended Restart files. There
was a reason why we did not do this when the new restart facility
was introduced, but that reason no longer applies.
Actually, the compiler does not complain about const in void func(const T type).
It just complains about const qualifiers before by-value return types.
the FILEUNIT functionality currently does not work because the name of
the unit system specified by the keyword is almost always fully
capitalized (e.g., "FIELD"), while the name of the unit system
returned by the parser isn't (e.g., "Field"). This patch "fixes" this
by simply capitalizing all strings.
currently, this keyword is basically ignored: setting the unit system
of a file to something different than the deck unit system will cause
`Opm::checkDeck()` to produce a warning.
This commit switches the segment result reload code to indexing the
RSEG vector primarily by the segment number from the input file.
The original scheme of using the linear index and extracting the
segment number from ISEG was based on a terrible misunderstanding [%].
This is the second half of commit 0a730d94 (PR #697)
[%] Pointy Hat: @bska
This commit switches to using the explicit type std::function rather
than an implied callable entity whose interface is defined only in a
comment. That adds compiler type checking at the cost of (possibly)
introducing virtual function calls. The size overhead in the object
file is mostly negligible in Release mode.
Suggested by: [at]joakim-hove
Left over from when the function was extracted from the saturation
function code. While here, fix an incorrect comment that mistakenly
implied that the primary key of PVTO is pressure rather than the
dissolved gas/oil ratio (Rs), and correct a type in 'composition'.
This commit expands the private member function
Tables::addGasPVTTables(const EclipseState&)
to create structurally correct TAB vector entries from the PVTG
(wet gas) input table data when gas is an active phase in a
simulation run. Specifically, the main result array has the columns
[ Rv, 1/Bg, 1/(Bg*mu_g), d(1/Bg)/dRv, d(1/(Bg*mu_g))/dRv ]
and the ancillary table (base pointer JBPVTG) holds the gas pressure
nodes.
Note that while we do create structurally correct output tables, we
do not fill in undersaturated states that have been defaulted in the
input table.
The number of table rows in the main table is equal to number of PVT
regions times the number of declared pressure nodes (TABDIMS item 4,
NPPVT) times the number of declared composition nodes (TABDIMS item
6, NRPVT). In other words, the main result array is expanded to
fill NRPVT rows per gas pressure node per PVT region. Fill value
-2.0e+20. We have verified the results with ECLIPSE 100. The
ancillary table is expanded to the number of declared pressure nodes
for each PVT region. Here the fill value is +2.0e+20.
As an OPM extension, we will use the maximum number of active
composition and pressure nodes across all PVTG tables if the
declared maximum pressure nodes in TABDIMS is too small. This will
create TAB vector representations that are not compatible with
ECLIPSE, but which will nevertheless be useful in the context of
ResInsight's flux calculation.
Add unit tests for all gas-related PVT tables.
This commit expands the public member function
Tables::addPVTTables(const EclipseState&)
to call into a new private member function
Tables::addGasPVTTables(const EclipseState&)
which will create structurally correct TAB vector entries from the
PVDG (dry gas) input table data when gas is an active phase in a
simulation run. Specifically, the result array has the columns
[ Pg, 1/Bg, 1/(Bg*mu_g), d(1/Bg)/dPg, d(1/(Bg*mu_g))/dPg ]
The number of table rows is equal to number of PVT regions times the
number of pressure nodes declared in input keyword TABDIMS (NPPVT,
Item 4). In other words, the result array is expanded to fill NPPVT
rows per PVT region. Fill value +2.0e+20. We have verified the
results with ECLIPSE 100.
As an OPM extension, we will use the maximum number of active
pressure nodes across all PVDG tables if the declared maximum
pressure nodes in TABDIMS is too small. This will create a TAB
vector that is not compatible with ECLIPSE, but which will
nevertheless be useful in the context of ResInsight's flux
calculation.
This commit expands the private member function
Tables::addOilPVTTables(const EclipseState&)
to create structurally correct TAB vector entries from the PVTO
(live oil) input table data when oil is an active phase in a
simulation run. Specifically, the main result array has the columns
[ Po, 1/Bo, 1/(Bo*mu_o), d(1/Bo)/dPo, d(1/(Bo*mu_o))/dPo ]
and the ancillary table (base pointer JBPVTO) holds the composition
nodes.
Note that while we do create structurally correct output tables, we
do not fill in undersaturated states that have been defaulted in the
input table.
The number of table rows in the main table is equal to number of PVT
regions times the number of declared composition nodes (TABDIMS item
6, NRPVT) times the number of declared pressure nodes (TABDIMS item
4, NPPVT). In other words, the main result array is expanded to
fill NPPVT rows per Rs node per PVT region. Fill value +2.0e+20.
We have verified the results with ECLIPSE 100. The ancillary table
is expanded to number of declared composition nodes for each PVT
region. Fill value +2.0e+20.
As an OPM extension, we will use the maximum number of active
pressure and composition nodes across all PVTO tables if the
declared maximum pressure nodes in TABDIMS is too small. This will
create a TAB vector representations that are not compatible with
ECLIPSE, but which will nevertheless be useful in the context of
ResInsight's flux calculation.
Add unit tests for all supported oil-related PVT tables.
This commit expands the private member function
Tables::addOilPVTTables(const EclipseState&)
to create structurally correct TAB vector entries from the PVDO
(dead oil) input table data when oil is an active phase in a
simulation run. Specifically, the result array has the columns
[ Po, 1/Bo, 1/(Bo*mu_o), d(1/Bo)/dPo, d(1/(Bo*mu_o))/dPo ]
The number of table rows is equal to number of PVT regions times the
number of pressure nodes declared in input keyword TABDIMS (NPPVT,
Item 4). In other words, the result array is expanded to fill NPPVT
rows per PVT region. Fill value +2.0e+20. We have verified the
results with ECLIPSE 100.
As an OPM extension, we will use the maximum number of active
pressure nodes across all PVDO tables if the declared maximum
pressure nodes in TABDIMS is too small. This will create a TAB
vector that is not compatible with ECLIPSE, but which will
nevertheless be useful in the context of ResInsight's flux
calculation.
This commit expands the public member function
Tables::addPVTTables(const EclipseState&)
to call into a new private member function
Tables::addOilPVTTables(const EclipseState&)
which will create structurally correct TAB vector entries from the
PVCDO input table data when oil is an active phase in a simulation
run. Specifically, the result array has the columns
[ Po, Bo, Co, mu_o, Cv ]
in which 'Co' denotes the oil compressibility and 'Cv' denotes the
oil viscosibility. The number of table rows is equal to number of
PVT regions times the number of pressure nodes declared in input
keyword TABDIMS (NPPVT, Item 4). In other words, the result array
is a copy of the input table but expanded to fill NPPVT rows per PVT
region. Fill value -1.0e+20. We have verified the results with
ECLIPSE 100.
At present the function is not called by Flow's INIT file writer.
This commit adds a new public member function
Tables::addPVTTables(const EclipseState&)
that calls into a new private member function
Tables::addWaterPVTTables(const EclipseState&)
to create structurally correct TAB vector entries from the PVTW
input table data when water is an active phase in a simulation run.
Specifically, the result array has the columns
[ Pw, 1/Bw, Cw, 1/(Bw * mu_w), Cw - Cv ]
in which 'Cw' denotes the water compressibility and 'Cv' denotes the
water viscosibility. Column 4 and 5 follow ECLIPSE 100 conventions.
Number of table rows equal to number of PVT regions. This result
array differs from the existing Tables::addPVTW() member function in
the treatment of viscosity and viscosibility data. We have verified
the results with ECLIPSE 100.
At present the function is not called by Flow's INIT file writer.
Add a unit test to exercise the new member function.
In particular, expose the internals of
SatFunc::detail::createSatfuncTable()
as a new free function, createPropfuncTable(). The latter knows
about sub-tables as present in live oil (PVTO) and wet gas (PVTG)
input data and will loop over all primary keys of a single table
(i.e., region) before advancing to the next table.
The primary purpose of createPropfuncTable() is to support creating
the normalised (ECLIPSE 100 style) INIT file tables for PVT data.
Reimplement original constructor in terms of the new constructor.
The main purpose of the new constructor is to support PVT tables
which use a fill/padding value different from 1.0e+20.
Differentiate between the input type, as specified in the json configuration
file, and the internal native type used to store data. This is a many-to-one
mapping, where e.g. both the input types STRING and RAW_STRING map to the
internal datatype std::string.
Additional changes:
- Have removed several ParserItem() constructors.
- The size_type::SINGLE is default for a ParserItem, and not set explicitly in
the generated ParserKeywords.cpp file.
- Have removed a call to boost::lexical_cast<> - just use std::to_string()
they are just like their non-PC postfixed counterparts, except that
they only apply to capillary pressures, not to the relperms and they
seem to overwrite the values specified via S[WG]L for the capillary
pressures but not for relperms.
For the output code the total number of connections entered in the input deck is
required, we therefor keep track of the number of connections filtered out due
to inactive cells - and return the total in WellConnection::inputSize()
if `which` thought there was an error, some ugly error messages were
printed when pressing the tabulator key. note that this probably obly
affected people who used this as the default completor...
The records are norally terminated on the first unquoted '/', but for the UDQ
and ACTIONX keywords the data sections of a keyword contain mathematical
expressions which can contain '/' literals. This commit adds a per-keyword
ability to terminate the records on the last '/' instead of the first '/'.
1) Start of new class EclFile which includes one anonomus namespace with routines for reading binary eclipse format files
2) One very basic test of EclFile constructor included in test_EclFile.cpp
- testing that file exist, throwing an exception if not.
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.
The upstream signature is updated to take an error guard, which on top
of breaking the interface since no default is provided, tears down (!)
the host process on invalid input.
The way of stopping this happening is to call the clear() method after
running the parser.
currently, the following message is produced:
```
/var/lib/jenkins/workspace/opm-material-PR-builder/deps/opm-common/jenkins/build-opm-module.sh: line 88: cd: -D: invalid option
```
this is caused by trying to change the working directory to $1 which
represents additional cmake parameters, instead of to $3 which
represents the source directory. This mistake currently (probably)
prevents the pre-build hook from ever being executed.
In PR #578 a bool was introduced that should determine whether we log warnings
during RestartConfig::getWriteRestartFile. Unfortunately, it introduced a bug that
made a false value of log return false from the function. This is fixed by this commit.
This commit adds the ability of SummaryRegressionTest to bypass the
check for equal number keywords/summary vectors in the two result
sets being compared. The primary purpose of this is to continue
comparing contents of existing summary vectors if new summary
keywords are introduced in a GitHub Pull Request.
Extend the 'compareECL' utility to take advantage of this ability.
The previous logic was slightly incomplete in that it checked size
inconsistencies for all connections, not just open connections.
This, in turn would in turn generate diagnostics like
Report step 19/247 at day 252/3312, date = 16-Jul-1998
Time step 0, stepsize 16 days.
ERROR: Uncaught std::exception when running tasklet: Inconsistent number of open connections I in vector<Opm::data::Connection*> (3) in Well B-4H. Trying to continue.
With this update we look for size inconsistencies between a well's
open connections and data::Wells::connections only.
There are still systematic warnings that need suppression in this file:
-Wgnu-zero-variadic-macro-arguments
-Wformat-nonliteral
-Wcast-align
These are too hard to fix quickly, and likely not indicating errors.
This commit ensures that we never try to read more than a single
record of data when parsing the RSCONST keyword. Previously, the
parser would attempt to parse RSCONST as if it were an unbounded
keyword that was terminated by an empty record. This, in turn,
would produce the diagnostic message
Inner exception: Malformed floating point number 'INCLUDE'
when trying to read a specification like
RSCONST
0.35 932 /
-- Check for these data in the future this is important
INCLUDE
'RP.dat' /
While here, also implement 'getSIDouble()' for the Rs value (item 1)
in keywords RSCONST and RSCONSTT by adding the correct unit of
measurement ("dimension") to the keyword specification.
Add unit tests to verify new behaviours.
Substraction of two unsigned int might cause trouble as
the result might have to be signed to be meaningful. In
addition there have overload resolution issues with g++-7.
This commit makes the parser aware of the keywords STONE and STONE2
which both request that the simulation run use Stone's second model
for three-phase relative permeability for oil.
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.
This commit introduces a new predicate,
bool SimulationConfig::isThermal() const
that determines whether or not either of the keywords
TEMP or THERMAL
are specified in the RUNSPEC section of a simulation run.
We only support a small subset of segment-related summary vectors
and must avoid being tricked by other SUMMARY section keywords that
happen to begin with a character 'S' (e.g., SUMMARY itself or the
SUMTHIN keyword). Add an explicit white-list of the vectors we do
support and bypass all others in helper function 'keywordS()'.
Introduce a dummy 'SUMTHIN' specification to SOFR_TEST.DATA to
ensure that we don't accidentally match this in 'keywordS()'.
This commit extends the logic of determining which wells to consider
as multi-segmented to scanning all declared report steps. We also
use a similar protocol to determine the maximum number of segments
for an MS well across all declared report steps.
Segment flow rates and pressures retrieved from a SummaryState
object do not need additional processing steps. The SummaryState
protocol guarantees that the quantities are already stored according
to their proper output unit conventions and abide by the flow rate
sign requirements of the summary/restart files (production
flows--from reservoir to well--treated as positive).
Remove the pertinent processing from RSeg::staticContrib().
This commit completes the set of unit tests for the segment-related
summary vectors
SOFR, SGFR, SWFR, and SPR
by adding a test (Restart_Segment/Write_Read) that serializes the
result of multiple Summary::add_timestep() calls for SOFR_TEST.DATA
and reads that summary file back in.
This commit makes the helper function find_wells() aware of summary
vectors defined on segments. Previously, this helper function would
return an empty list of wells in the case of ECL_SMSPEC_SEGMENT_VAR
whence all segment-related summary vectors would be zero at all
times.
Add a small set of unit tests to verify that we transmit the known
(small) set of segment-related summary vectors (SOFR, SGFR, SWFR,
SPR) to the internal "prev_state" with correct output units and sign
convention (producing flow rates--reservoir to well--positive).
This commit extends the processing of segment-related summary
vectors to also support specifications of the form
SOFR
/
designating all segments of all multi-segmented wells at all times.
Expand SummaryConfig unit test to exercise this extended record
processing mode.
This commit extends the SummaryConfig class to recognise a small
subset of segment-related summary vectors. In particular, this
brings support for 'SGFR', 'SOFR', 'SPR', and 'SWFR'--at least in a
restricted sense. We do not yet support cases like
SOFR
/
which designates all segments in all wells at all times.
The unit testing is presently minimal and must be expanded before
this is ready for inclusion into master. In particular, we only
check that cases like
SOFR
'PROD01' 1 /
/
generate the expected summary vector nodes (class SummaryNode).
This commit extends Opm::data::Wells to include a set of output
vectors for well segment information. At present we define output
structures for segment rates and segment pressures. The immediate
use case is properly assigning restart vector items RSEG[8 .. 11],
but these same values are also usable for outputting the summary
vectors SPR, SOFR, SGFR, and SWFR. Future expansion is likely.
If the keyword is present then the transimissibilities of the corresponding NNC
entries will be scalled with the factor specified via EDITNNC. Multiple entries
for the same cell pairs are allowed and will result in multiple scalings.
Cell pairs specified in EDITNNC that are not present in NNC are silently ignored.
The deckAssigned() query method is added to the GridProperty class to enable the
simulator to check whether a property has been explicitly assigned in the deck
or autocreated through the use of some EDIT operators like MULTIPLY.
Using const string as key type instead of plain string fails with libc++,
the standard library implementation used by clang. The libc++ implementation
assumes that map keys can be copied, and the standard requires map keys to be
copyable.
Using const string as a value also fails with clang, I am not 100% sure why.
It does severely restrict how you can interact with the container, and seems to
make it noncopyable. The error is reported from DynamicState<GroupTree>::update(),
the std::fill() call.
This commit ensures that the data members 'headI' and 'headJ' are
properly initialised in the constructor
WellConnections(const WellConnections&, const EclipseGrid&)
which powers the implementation of
Well::getActiveConnections()
We do not use it in OPM, but for whatever reason I was experiencing
linker errors (unresolved symbol) when compiling ebos with DUNE 2.6
and g++-8.2. dune-grid exports its alberta wrapper libraries in dune-grid_LIBRARIES. Previously this did not pose a problem. Somehow it does now. If
I strip the libraries from the linker line everything is fine but this
is not a good solution.
Therefore I have added a test for Alberta that is triggered by the test of
dune-grid.
Some configuration scripts probe and just set HAVE_FOO without any
values, whereas others set it explicitly to 1. If these two are mixed,
for instance that the same package is used by two of our prerequisites,
but in different manner, then we get compatibility warnings when we try
to run the configuration script, even though there is no real conflict.
dune-fem, dune-alugrid and dune-localfunctions have this problem (around
release 2018.04).
This patch special-code the test so if the old value was previously
either just defined or explicitly set to the value 1, a warning will not
be issued if then suddenly the other variant is used.
Commit 36af2aad (PR #496) switched to not calculating the well's
summary vectors in the case of outputting the initial condition
(SEQNUM=0). Account for this possibility when creating SWEL and
XWEL.
This commit extends function RestartIO::load() to retrieve most of
the well restart data (aggregate flow rates per well connection,
or per well) from the standard ECL restart vectors IWEL, XWEL, ICON,
and XCON. We still prefer the dedicated OPM_* variants if
available, but this commit brings us closer to being able to retire
OPM_XWEL.
While here, also add WELLDIMS to FIRST_SIM_THPRES to restore the
STORE_THPRES unit test.
This commit adds a simple facility for outputting surface rates of
the oil, gas, and water components for each well connection, as well
as total reservoir voidage rate per well connection if available in
the data::Connection object.
In particular, reimplement write_kw() in terms of vector<T> rather
than EclKW<T> to simplify callers. While here, also move some file
handling operations out to separate helper functions to make control
flow more linear in the body of RestartIO::save(), and prune unused
arguments from other helper functions.
Well info at correct step for save & load RESTART
Retrieve number of wells and completions at the beginning of the
simulated step. Otherwise a well introduced at the same time step as the
report will be included - even though there doesn't exist any simulated
data yet.
This issue would trigger a throw if WRFTPLT was added at the same time
step as a well is introduced in the schedule section.
Removed one DATES item in FIRST_SIM.DATA. The
EclipseReadWriteWellStateData in test_Restart compared state at T1,
which did not include any well data as it was. No other tests were
affected.
Added new implementation of serialize_ICON
The new function has been added to the file WriteRestartHelpers, and
intended to take over for the local function 'serialize_ICON' in
`restartIO.cpp` when `restartIO::save()` is to be updated. The purpose
of the new implementation is to be compatible with Eclipse.
Handle wildcard in group keywords
Added function getGroups(pattern) to allow records with wildcard.
Included the functionality for GCONPROD, GCONINJE and GEFAC - currently
the only group keywords that should accept wildcards.
Add key string to RestartKey
Pass dimension information for extra fields in restart
Verify that the extra container has THPRES
- The calculation of well connection transmissibility CF and effective
permeability is calculated.
- The Connection objects are immutable; should never be updated.
- The properties of the Connection class are just plain properties, have
removed getter methods and the use of Value<double>.
the update_data command needs a full opm-tests checkout,
not just a shallow clone of the PR branch. we thus first
copy the shared copy, then we pull the PR branch into that copy.
- The first seven timesteps were specified as steps of length 365/7.0 days,
when converted to seconds one second was lost due to rounding. This has been
changed by using integer length TSTEP.
- assertEqual() statements use full datetime; which has been shifted one full
day forward to account for rounding errors due to the lost seconds.
- EclipseState.getFirstRestartStep( ) is changed because we have configured to
get restart data for the first report step every year, and that is now step 7
instead of step 8.
* Extend Completion class implementation
Added access to several variables from the completion class. The Well
interface has been changed so that completions for any timestep can be
accessed rather than just the last.
* Bump version to 0.0.3
* Removed single space
The previous setting was correct, but was a bit of a problem cloning on
the linux laptop. Because of an issue with the VPN and SSH (ask Kjell
for the details), repos with git: must be cloned with the VPN off, while
repos with https: require the VPN to be on. After this change, both
sunbeam and pycmake can be cloned with the VPN off (now you can do git
clone --recursive)
Some of the user facing functions and methods in sunbeam have no
implementation in the python-defined classes, but are forwarded from
boost python. This forwarding is done by hijacking the method call at
runtime, which means that python help() cannot resolve the docstring.
Copy the docstring into the hijacking attribute so that the docstring is
available as if the method/function was implemented directly in python.
help(eclipse_state_object) will now correcly forward the docstrings from
the forwarded EclipseState class.
Sunbeam can now be used to parse eclipse files to deck representations.
Added support for dynamic parser extensions which can be used to handle
unsupported eclipse keywords when parsing to deck representations.
Fixed missing function declarations
Some primitive Well support, and the needed classes to get a well from a
deck.
In an effort to reduce boilerplate, the delegate decorator is
introduced. Delegated classes from sunbeam.py can wrap around the python
classes generated by boost and augment their interface, but leverage the
original C++-object as its storage. Methods defined on the immediate
python objects bubble up.
Adds the pycmake makefile dependency and provides a submodule for build
convenience. Adds the SPE3CASE1 test case for some simple test writing
and a test template file.
Sets up python library structure.
# - Build satellites that are dependent of main library
option(ADD_DISABLED_CTESTS"Add the tests which are disabled due to failed preconditions to the ctest output (this makes ctest return an error if such a test is present)"ON)
mark_as_advanced(ADD_DISABLED_CTESTS)
#
# Enumerate all source code in a "satellite" directory such as tests/,
# compile each of them and optionally set them as a test for CTest to
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include<opm/test_util/EclFilesComparator.hpp>
#include<opm/common/ErrorMacros.hpp>
#include<ert/util/util.h>
#include<ert/util/stringlist.h>
#include<ert/ecl/ecl_endian_flip.h>
#include<ert/ecl/ecl_file.h>
#include<iostream>
#include<string>
#include<getopt.h>
staticvoidprintHelp(){
std::cout<<"\ncompareECL compares ECLIPSE files (restart (.RST), unified restart (.UNRST), initial (.INIT) or .RFT) and gridsizes (from .EGRID or .GRID file) from two simulations.\n"
<<"The program takes four arguments:\n\n"
<<"1. Case number 1 (full path without extension)\n"
<<"2. Case number 2 (full path without extension)\n"
<<"3. Absolute tolerance\n"
<<"4. Relative tolerance (between 0 and 1)\n\n"
<<"In addition, the program takes these options (which must be given before the arguments):\n\n"
<<"-h Print help and exit.\n"
<<"-i Execute integration test (regression test is default).\n"
<<" The integration test compares SGAS, SWAT and PRESSURE in unified restart files, so this option can not be used in combination with -t.\n"
<<"-I Same as -i, but throws an exception when the number of keywords in the two cases differ. Can not be used in combination with -t.\n"
<<"-k Specify specific keyword to compare (capitalized), for example -k PRESSURE.\n"
<<"-l Only do comparison for the last occurrence. This option is only for the regression test, and can therefore not be used in combination with -i or -I.\n"
<<"-n Do not throw on errors.\n"
<<"-p Print keywords in both cases and exit. Can not be used in combination with -P.\n"
<<"-P Print common and uncommon keywords in both cases and exit. Can not be used in combination with -p.\n"
<<"-t Specify ECLIPSE filetype to compare (unified restart is default). Can not be used in combination with -i or -I. Different possible arguments are:\n"
<<" -t UNRST \t Compare two unified restart files (.UNRST). This the default value, so it is the same as not passing option -t.\n"
<<" -t INIT \t Compare two initial files (.INIT).\n"
<<" -t RFT \t Compare two RFT files (.RFT).\n"
<<" -t RST \t Compare two cases consisting of restart files (.Xnnnn).\n"
<<" -t RST1 \t Compare two cases where the first case consists of restart files (.Xnnnn), and the second case consists of a unified restart file (.UNRST).\n"
<<" -t RST2 \t Compare two cases where the first case consists of a unified restart file (.UNRST), and the second case consists of restart files (.Xnnnn).\n"
<<" Note that when dealing with restart files (.Xnnnn), the program concatenates all of them into one unified restart file, which is used for comparison and stored in the same directory as the restart files.\n"
<<" This will overwrite any existing unified restart file in that directory.\n\n"
<<"Example usage of the program: \n\n"
<<"compareECL -k PRESSURE <path to first casefile> <path to second casefile> 1e-3 1e-5\n"
<<"compareECL -t INIT -k PORO <path to first casefile> <path to second casefile> 1e-3 1e-5\n"
<<"compareECL -i <path to first casefile> <path to second casefile> 0.01 1e-6\n\n"
<<"Exceptions are thrown (and hence program exits) when deviations are larger than the specified "
<<"tolerances, or when the number of cells does not match -- either in the grid file or for a "
<<"specific keyword. Information about the keyword, keyword occurrence (zero based) and cell "
<<"coordinate is printed when an exception is thrown. For more information about how the cases "
<<"are compared, see the documentation of the EclFilesComparator class.\n\n";
std::cout<<"\n\nThe program can handle both unified and non-unified summary files."<<std::endl;
std::cout<<"In the case of non-unified summary files all the files must be located in the same directory. Only the basename (full path without extension) is needed as input."<<std::endl<<std::endl;
std::cout<<"\nThe program takes four arguments"<<std::endl;
std::cout<<"1) <path to file1>/<base_name>, basename without extension"<<std::endl;
std::cout<<"2) <path to file2>/<base_name>, basename without extension"<<std::endl;
std::cout<<"3) absolute tolerance"<<std::endl;
std::cout<<"4) relative tolerance (between 0 and 1)"<<std::endl;
std::cout<<"The program will only throw an exception when both the absolute and relative tolerance are exceeded."<<std::endl;
std::cout<<"The program is capable of performing both a regression test and an integration test, \nhowever only one type of test at a time. ";
std::cout<<"By default the program will run a regression test."<<std::endl;
std::cout<<"\nThe program have command line options:"<<std::endl;
std::cout<<"-h \t\tPrint help message."<<std::endl<<std::endl;
std::cout<<"For the regression test: "<<std::endl;
std::cout<<"-r \t\tChoosing regression test (this is default)."<<std::endl;
std::cout<<"-k keyword \tSpecify a specific keyword to compare, for example - k WOPR:PRODU1."<<std::endl;
std::cout<<"-p \t\tWill print the keywords of the files."<<std::endl;
std::cout<<"-R \t\tWill allow comparison between a restarted simulation and a normal simulation. The files must end at the same time."<<std::endl<<std::endl;
std::cout<<"For the integration test:"<<std::endl;
std::cout<<"-d \t\tThe program will not throw an exception when the volume error ratio exceeds the limit."<<std::endl;
std::cout<<"-g \t\tWill print the vector with the greatest error ratio."<<std::endl;
std::cout<<"-k keyword \tSpecify a specific keyword to compare, for example - k WOPR:PRODU1."<<std::endl;
std::cout<<"-K \t\tWill not allow different amount of keywords in the two files. Throws an exception if the amount are different."<<std::endl;
std::cout<<"-m mainVar \tWill calculate the error ratio for one main variable. Valid input is WOPR, WWPR, WGPR or WBHP."<<std::endl;
std::cout<<"-n \tDo not throw on errors."<<std::endl;
std::cout<<"-p \t\tWill print the keywords of the files."<<std::endl;
std::cout<<"-P keyword \tWill print the summary vectors of a specified kewyord, for example -P WOPR:B-3H."<<std::endl;
std::cout<<"-s int \t\tSets the number of spikes that are allowed for each keyword, for example: -s 5."<<std::endl;
std::cout<<"-v \t\tFor the rate keywords WOPR, WGPR, WWPR and WBHP. Calculates the error volume of \n\t\tthe two summary files. This is printed to screen."<<std::endl;
std::cout<<"-V keyword \tWill calculate the error rate for a specific keyword."<<std::endl<<std::endl;
std::cout<<"Suggested combination of command line options:"<<std::endl;
std::cout<<" -i -g -m mainVariable, will print the vector which have the greatest error ratio of the main variable of interest.\n"<<std::endl;
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
For *nix builds that support visibility attribute, you can define similar behavior by
setting default visibility to hidden by adding
-fvisibility=hidden (for gcc)
or
-xldscope=hidden (for sun cc)
to CFLAGS
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
*/
#define CJSON_CDECL __cdecl
#define CJSON_STDCALL __stdcall
/* export symbols by default, this is necessary for copy pasting the C and header file */
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
#elif defined(CJSON_IMPORT_SYMBOLS)
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
#endif
#else /* !__WINDOWS__ */
#define CJSON_CDECL
#define CJSON_STDCALL
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
#else
#define CJSON_PUBLIC(type) type
#endif
#endif
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 7
#define CJSON_VERSION_PATCH 10
#include<stddef.h>
/* cJSON Types: */
#define cJSON_False 0
#define cJSON_True 1
#define cJSON_NULL 2
#define cJSON_Number 3
#define cJSON_String 4
#define cJSON_Array 5
#define cJSON_Object 6
#define cJSON_Invalid (0)
#define cJSON_False (1 << 0)
#define cJSON_True (1 << 1)
#define cJSON_NULL (1 << 2)
#define cJSON_Number (1 << 3)
#define cJSON_String (1 << 4)
#define cJSON_Array (1 << 5)
#define cJSON_Object (1 << 6)
#define cJSON_Raw (1 << 7) /* raw json */
#define cJSON_IsReference 256
#define cJSON_StringIsConst 512
/* The cJSON structure: */
typedefstructcJSON{
structcJSON*next,*prev;/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
structcJSON*child;/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
typedefstructcJSON
{
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
structcJSON*next;
structcJSON*prev;
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
structcJSON*child;
inttype;/* The type of the item, as above. */
/* The type of the item, as above. */
inttype;
char*valuestring;/* The item's string, if type==cJSON_String */
intvalueint;/* The item's number, if type==cJSON_Number */
doublevaluedouble;/* The item's number, if type==cJSON_Number */
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
char*valuestring;
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
intvalueint;
/* The item's number, if type==cJSON_Number */
doublevaluedouble;
char*string;/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
char*string;
}cJSON;
typedefstructcJSON_Hooks{
void*(*malloc_fn)(size_tsz);
void(*free_fn)(void*ptr);
typedefstructcJSON_Hooks
{
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
void*(CJSON_CDECL*malloc_fn)(size_tsz);
void(CJSON_CDECL*free_fn)(void*ptr);
}cJSON_Hooks;
typedefintcJSON_bool;
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
* This is to prevent stack overflows. */
#ifndef CJSON_NESTING_LIMIT
#define CJSON_NESTING_LIMIT 1000
#endif
/* returns the version of cJSON as a string */
CJSON_PUBLIC(constchar*)cJSON_Version(void);
/* Supply malloc, realloc and free functions to cJSON */
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
CJSON_PUBLIC(cJSON*)cJSON_Parse(constchar*value);
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
externconstchar*cJSON_GetErrorPtr(void);
CJSON_PUBLIC(constchar*)cJSON_GetErrorPtr(void);
/* Check if the item is a string and return its valuestring */
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.