Compare commits

..

1737 Commits

Author SHA1 Message Date
Markus Blatt
ef6f42d457 Bump version to 2019.10-rc3 2019-11-04 12:34:46 +01:00
Markus Blatt
69a0a31309 Merge pull request #1183 from blattms/backport-of-pr-1176
Added changelog 2019.10 release (Backport of pr #1176)
2019-10-30 21:58:22 +01:00
Joakim Hove
3be35ec286 Add bullet point about Eclipse restart capabilities 2019-10-30 21:55:45 +01:00
Markus Blatt
0469d28fa2 Skipped python and restart in changelog 2019-10-30 21:55:45 +01:00
Markus Blatt
7cd7c7a158 Added entries to changelog concerning 2019.10 release 2019-10-30 21:55:45 +01:00
Markus Blatt
7bc1fc8362 Merge pull request #1172 from blattms/backport-of-pr-1171
update redhat packaging (backport of PR #1171)
2019-10-28 12:38:13 +01:00
Arne Morten Kvarving
b573c28594 update redhat packaging 2019-10-28 12:36:22 +01:00
Markus Blatt
693c4607c8 Merge pull request #1161 from akva2/2019.10_rc2
bump version to 2019.10-rc2
2019-10-25 14:06:59 +02:00
Arne Morten Kvarving
1c17a5daed bump version to 2019.10-rc2 2019-10-25 08:33:05 +02:00
Markus Blatt
edee59df30 Merge pull request #1160 from blattms/backport-of-pr-1158
Keywords on Q (backport of PR #1158)
2019-10-24 19:51:01 +02:00
Joakim Hove
c5fcbf2084 Keywords on Q 2019-10-24 19:38:43 +02:00
Markus Blatt
8e860c4b7a Merge pull request #1159 from blattms/backport-of-pr-1154
added more keywords beginning with M. (backport of #1154)
2019-10-24 19:37:42 +02:00
Steinar Foss
ad9fbfe4ea added more keywords beginning with M.
added keywords MULTOUTS, MULTREAL, MULTREGD.

added keywords MULTREGH, MULTSIG, MULTSIGV.

added keywords NARROW, NCONSUMP, NEFAC.
2019-10-24 19:22:54 +02:00
Markus Blatt
53fff6bb3f Merge pull request #1155 from blattms/backport-of-pr-1149
fixing severe performance issue with ESmry (backport of PR #1149)
2019-10-24 13:08:01 +02:00
Torbjørn Skille
8e23316eba fixing severe performance issue with ESmry 2019-10-24 12:07:39 +02:00
Markus Blatt
d4e6c9ec44 Merge pull request #1147 from blattms/backport-of-pr-1142
Multiply MULT(XYZ) keywords in the EDIT section (backport of #1142)
2019-10-22 19:58:36 +02:00
Joakim Hove
ae9712232e Multiply MULT(XYZ) keywords in the EDIT section 2019-10-22 19:43:34 +02:00
Markus Blatt
d376ee9ed4 Merge pull request #1140 from blattms/backport-of-pr-1128
Exc warning (Backport of pr #1128)
2019-10-21 08:48:32 +02:00
Joakim Hove
1067b66696 Use const& to avoiw warnings 2019-10-21 08:44:17 +02:00
Joakim Hove
ac43482944 Remove trailing whitespace 2019-10-21 08:44:17 +02:00
Markus Blatt
3ca39f2e62 Merge pull request #1139 from blattms/backport-of-pr-1096
Some janitoring (partial backport of pr #1096)
2019-10-21 08:36:27 +02:00
Arne Morten Kvarving
aaaa22e279 remove noop explicit template instantation after specialization 2019-10-21 08:29:19 +02:00
Arne Morten Kvarving
646d263883 avoid returning uninitialized result if wrong indices are given 2019-10-21 08:29:19 +02:00
Arne Morten Kvarving
f1e0dcea81 remove unused assignment 2019-10-21 08:29:19 +02:00
Arne Morten Kvarving
7b3b26c452 remove unused initialization 2019-10-21 08:29:19 +02:00
Arne Morten Kvarving
5f9d67a6eb remove unused variable 2019-10-21 08:27:35 +02:00
Arne Morten Kvarving
8e44ca1b2c remove unused function 2019-10-21 08:27:35 +02:00
Markus Blatt
89e2ebd5f9 Merge pull request #1137 from blattms/backport-of-pr-1119
Added keywords beginning w/ M. (backport of PR #1119)
2019-10-21 07:55:12 +02:00
Steinar Foss
06287e8631 Added keywords beginning w/ M.
added keywords MINPORV, MLANG, MLANGSLV.
2019-10-20 12:13:36 +02:00
Markus Blatt
4cd26c5f9a Merge pull request #1136 from blattms/backport-of-pr-1101
Add keywords starting with R (backport of #1101)
2019-10-20 12:11:00 +02:00
Joakim Hove
d4ce9fe909 Add keywords starting with R 2019-10-20 11:23:17 +02:00
Markus Blatt
7ee05a9ceb Merge pull request #1135 from blattms/backport-of-pr-1109
added keywords beginning w/ L. (backport of #1099)
2019-10-20 11:20:48 +02:00
Steinar Foss
8a9814ad16 added keywords beginning w/ L.
added keywords LSLTWNUM, LSNUM, LSOGCR.

added keywords LSOWCR, LSWCR, LSWL.

LSWLPC, LSWU, LTOSIGMA.

added keywords LWKRO, LWKRORG, LWKRORW.

added keywords LWKRW, LWKRWR, LWPCW.

LWSLTNUM, LWSNUM, LWSOGCR.

added keywords LWSOWCR, LWSWCR, LWSWL.

added keywords LWSWLPC, LWSWU, LX.

added keywords LY, LZ, MATCORR.

...
2019-10-20 11:17:45 +02:00
Markus Blatt
96b7bb65e2 Merge pull request #1134 from blattms/backport-of-pr-1099
added keywords beginning w/ I, J, K and L. (backport of PR #1099)
2019-10-20 11:09:25 +02:00
Steinar Foss
4761fe724b added keywords beginning w/ I, J, K and L.
added keyword JFUNCR.

added keywords KRNUN, KRNUMMF.

added keywords LANGMPL, LANGMUIR, LANGSOLV.

added keywords LGRCOPY, LGRFREE, LGRLOCK.

added keywords LGROFF, LGRON, LINKPERM.

added keywords LKRO, LKRORG, LKRORW.

added keywords LKRW, LKRWR, LOAD.
2019-10-20 10:53:29 +02:00
Markus Blatt
8488efde1f Merge pull request #1126 from blattms/backport-of-pr-1125
Fix memory error during EclipseGrid creation with Actnum. (backport PR #1125)
2019-10-17 20:29:25 +02:00
Markus Blatt
3a89d05646 Fix memory error during EclipseGrid creation with Actnum.
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.
2019-10-17 20:26:55 +02:00
Markus Blatt
0d3037383a Merge pull request #1120 from blattms/backport-of-pr-1116
fixed: build using gcc 5 (ubuntu xenial) (backport of PR #1116
2019-10-17 13:25:35 +02:00
Arne Morten Kvarving
de67ce4083 fixed: build using gcc 5 (ubuntu xenial)
the tuple-from-initializer-list constructor is explicit.
2019-10-17 13:21:25 +02:00
Markus Blatt
0fadb026af Merge pull request #1118 from blattms/backport-of-pr-1107
Decouple OPM Flow From Libecl  (Backport of pr #1107)
2019-10-17 13:08:52 +02:00
Bård Skaflestad
fe275a55fd Drop libecl From Python Setup
Suggested by [at]akva2.
2019-10-17 12:21:53 +02:00
Arne Morten Kvarving
a44febc314 remove libecl from buildsystem, jenkins and packaging 2019-10-17 12:21:53 +02:00
Bård Skaflestad
895c43dff0 Reimplement test_Restart in Terms of TimeStampUTC
Only affects the 'first_sim()' helper function.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
e2ca798005 Reimplement test_EclipseIO in Terms of TimeStampUTC
Mostly just to provide a simple overload of the utility function

    ecl_util_make_date

from libecl.  The rest of the test code remains intact.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
8fa07537fc Reimplement ScheduleTests in Terms of TimeStampUTC
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.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
7f9d250fd3 Reimplement TimeMap in Terms of TimeStampUTC 2019-10-17 11:53:15 +02:00
Bård Skaflestad
5eab9b003f Add Simple 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.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
14625b3279 Defaulted Table Column: Don't Use 'ssize_t'
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 ].
2019-10-17 11:53:15 +02:00
Bård Skaflestad
3cb23e6857 Reimplement 'test_EclipseIO' in Terms of Opm-Common Classes
In particular, use EGrid, ERst and EclFile as appropriate.
2019-10-17 11:53:15 +02:00
Markus Blatt
f8f1efc0ac Merge pull request #1111 from blattms/backport-of-pr-1110
Allow building a module with dependencies installed (backport of #1110)
2019-10-16 13:56:12 +02:00
Markus Blatt
6d92c1f5de Allow building a module with dependencies installed but source lying around.
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
...
2019-10-16 13:52:47 +02:00
Markus Blatt
c68ec9c28b Merge pull request #1108 from blattms/backport-of-pr-1092
Update of ESmry, now supporting non-unified result files. (backport of PR #1092)
2019-10-16 09:47:38 +02:00
Torbjørn Skille
2dd6400d06 Update of ESmry, now supporting non-unified result files. 2019-10-16 09:12:02 +02:00
Markus Blatt
aa10ded01a Merge pull request #1104 from blattms/backport-of-pr-1094
Make RestartKey default contructable. (Backport of #1094)
2019-10-14 22:13:54 +02:00
Markus Blatt
edaa5ae561 Make RestartKey default contructable.
Otherwise we cannot even resize a vector of it and this will be needed
for restart when getting rid off the global grid on all processes.
2019-10-14 21:46:43 +02:00
Markus Blatt
aa56a40e8d Merge pull request #1103 from blattms/backport-pr-1088
Backport of pr #1088
2019-10-14 21:43:00 +02:00
Bård Skaflestad
2d7ba6a3c9 INTEHEAD Test: Initialize Maximum Number of Wells in Field
Fixes a warning about missing initializers.
2019-10-14 21:38:32 +02:00
Bård Skaflestad
6c397ff2a8 Make 'test_Restart' Mostly Independent of libecl
In particular, swith to using class EclIO::ERst to read the files
produced by RestartIO::save().
2019-10-14 21:29:27 +02:00
Bård Skaflestad
c83feddb28 Make 'test_Summary' Independent of LibeECL
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.
2019-10-14 21:29:27 +02:00
Bård Skaflestad
6d9deefb29 Make Most Unit Tests Independent of LibECL
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.
2019-10-14 21:29:27 +02:00
Bård Skaflestad
afaa99d3f4 Decouple Most of OPM-Common From LibECL
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).
2019-10-14 21:29:27 +02:00
Bård Skaflestad
c69a111e7a ESmry: Add Way of Retrieving Ministep Index at Start of Report Step
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.
2019-10-14 21:29:27 +02:00
Markus Blatt
112e698d0a Merge pull request #1102 from blattms/backport-pr-1082
Backport PR #1082
2019-10-14 21:12:11 +02:00
Bård Skaflestad
7dffd9f2e7 Replace Writer for Summary/SMSPEC Files
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).
2019-10-14 20:47:36 +02:00
Bård Skaflestad
a3f2c115f1 SMSPEC: Temporarily Restore Unconditional RESTART Vector
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.
2019-10-14 20:47:36 +02:00
Joakim Hove
32ac0034a7 Merge pull request #1091 from stefoss23/deck_keyword_vector
deckkeyword: new constructors takes (ParserKeyword, std::vector).
2019-10-11 20:04:50 +02:00
Steinar Foss
17f246c1a7 deckkeyword: new constructors takes (ParserKeyword, std::vector).
DeckKeyword: test for vector<int> data constructor.

DeckKeyword takes std::vector<int> and std::vector<double>.

...

...

...

...
2019-10-11 13:47:14 +02:00
Joakim Hove
d66f0a664c Merge pull request #1067 from joakim-hove/box-grid
Consider active cells in BOX implementation
2019-10-11 10:57:39 +02:00
Joakim Hove
9af248f889 Merge pull request #1072 from stefoss23/python_deck_values
python: new DeckKeyword constructor takes DeckRecords
2019-10-11 10:57:14 +02:00
Joakim Hove
3c26314475 Merge pull request #1087 from bska/bypass-filleps-for-2p
INIT File: Bypass FILLEPS for Two-Phase Systems
2019-10-11 10:56:25 +02:00
Joakim Hove
12e2c9c545 Merge pull request #1081 from bska/prepare-new-summary-writer
Prepare New Summary Writer
2019-10-11 10:39:59 +02:00
Joakim Hove
79d3f236c2 Merge pull request #1086 from stefoss23/python_conn
Python: removed properties.py, shedule.py, parser_module.py and sunbeam.py
2019-10-11 08:42:07 +02:00
Joakim Hove
5c280ed72a Merge pull request #1083 from joakim-hove/T
Keywords on starting with T
2019-10-11 08:39:19 +02:00
Joakim Hove
73cc9cff3a Merge pull request #1085 from stefoss23/add_keywords_H
Adding keywords beginning w/ H and I.
2019-10-11 08:39:07 +02:00
Bård Skaflestad
c736e71e46 INIT File: Bypass FILLEPS for Two-Phase Systems
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.
2019-10-10 22:28:41 -05:00
Steinar Foss
92f69d7648 removed sunbeam.py. 2019-10-10 12:57:49 +02:00
Steinar Foss
bad1b1d3fb removed parser_module.py. 2019-10-10 12:56:51 +02:00
Steinar Foss
0e1339e648 removed all test suppoert for parser_module.py. 2019-10-10 12:54:22 +02:00
Steinar Foss
3cc205ee93 ELIMINATED 'properties.py'. 2019-10-10 12:54:22 +02:00
Steinar Foss
ad564ad651 python connection: exposed directly via pybind11.
python connection. added property pos.

removed shedule.py.

test_connection.py passed.

test_wells.py: test_completion passes.

removed opm.io.config.

renamed test_state2.py -> test_state.py.
2019-10-10 12:54:40 +02:00
Steinar Foss
39c1056c87 added keywords beginning w/ H and I.
added keywords HMWELCON, HMWPIMPLT.

added keyword HMxxxxxx.

added keywords HRFIN, HWKRO, HWKRORH.

added keywords HWKRORW, HWKRWM HWKRWR.

added keyword HWPCW.

added keywords HWSNUM, HWSOGCR, HWSOWCR.

added keyword HWSWCR.

added keywords HWSWL, HWSWLPC, HWSWU.

added keywords HXFIN, HYDRHEAD, HYFIN.

added keywords HYMOBGDR, HYST, HYSTCHCK.

added keyword HZFIN.

added keywords IHOST, IMBNUMMF, IMPCVD.

IMPLICIT, IMPORT, IMSPCVD.

added keywords INSPEC, INTPC, IONROCK.

added keywords IONXROCK, IONXSURF.

...
2019-10-09 15:29:48 +02:00
Joakim Hove
9f1858265a Create ParserKeywords in try catch block 2019-10-09 11:53:25 +02:00
Joakim Hove
5a9f5c0999 Keywords on starting with T 2019-10-09 08:10:50 +02:00
Bård Skaflestad
a5d943fd8f Unit System: Use Plural for TIME Names
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.
2019-10-08 23:25:48 -05:00
Bård Skaflestad
e598aa8cae Output Stream: Add File Creation for Summary Files
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.
2019-10-08 23:20:39 -05:00
Bård Skaflestad
359558536e Output: Support More Than 10,000 Report Steps
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.
2019-10-08 23:12:37 -05:00
Bård Skaflestad
e6e8b070d7 Merge pull request #1077 from joakim-hove/compile-fixup
Compile fixup
2019-10-08 17:36:51 -05:00
Joakim Hove
278f4ff3c9 Merge pull request #1079 from stefoss23/python_context_recovery
python: rewrite of tests using ParseContext.
2019-10-08 23:42:44 +02:00
Joakim Hove
2f6160ec17 Minor change to fix compile error 2019-10-08 18:47:26 +02:00
Joakim Hove
a319d7be4f Add missing GPL / Copyright header 2019-10-08 18:42:58 +02:00
Joakim Hove
8101591277 White space 2019-10-08 18:42:58 +02:00
Steinar Foss
223fe5e7df python: rewrite of tests using ParseContext.
test_state: recalled slash test and made it work.

...

test_parse_deck ok.
2019-10-08 17:30:56 +02:00
Joakim Hove
b6824af640 Merge pull request #967 from jalvestad/udq_dynamic
Code to write dynamic UDQ data to Eclipse compatible restart file
2019-10-08 12:47:11 +02:00
Steinar Foss
3bce48586a Python: DeckKeyword: can accept DeckValues( parserkw, [["5*$VALUE"]])
python : deckkeyword accepts 5*.

...
2019-10-08 11:04:15 +02:00
Jostein Alvestad
d1d651a70d commented out change of Doubhead to avoid test-problems 2019-10-08 08:27:51 +02:00
Bård Skaflestad
4de3391fda Merge pull request #1076 from bska/private-smryfcn-table
Make Summary.cpp's Function Table Fully Private
2019-10-07 15:49:54 -05:00
Jostein Alvestad
90d0deeafb further changes to remove changes to data in the pull request 2019-10-07 16:34:35 +02:00
Bård Skaflestad
2fa017b29b Summary Evaluation: Make Efficiency Factor Function Private
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.
2019-10-07 13:44:51 +02:00
Bård Skaflestad
e495207e9f Summary Evaluation: Make Function Table Private
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.
2019-10-07 13:32:31 +02:00
Jostein Alvestad
5d9a9880ec comment unused function getRandSeedPar 2019-10-07 12:52:12 +02:00
Jostein Alvestad
390b6c6f5c changes to ensure no change in data for pull request 2019-10-07 12:35:22 +02:00
Jostein Alvestad
b7543d4bc9 made change to allow for change of Summarystate object 2019-10-07 09:54:44 +02:00
Jostein Alvestad
967954fc4b corrections and changes according to comments from maintainer 2019-10-07 09:54:42 +02:00
Jostein Alvestad
d99791d442 corrections to allocation function plus addition to unit tests 2019-10-07 09:54:40 +02:00
Jostein Alvestad
20523b46cc additions and corrections for restart export DUDF, DUDG andn DUDW 2019-10-07 09:54:38 +02:00
Jostein Alvestad
202651c34d corrections after complex rebase to write DUDW data to ECL-compatible restart file 2019-10-07 09:54:36 +02:00
Joakim Hove
16a8f4040c Renamed UDQInput -> UDQCOnfig
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
2019-10-07 09:54:34 +02:00
Joakim Hove
f2bc961bd4 Merge pull request #1074 from bska/prepare-new-summary-writer
Prepare New Summary Writer
2019-10-07 08:56:07 +02:00
Steinar Foss
7555c00ac3 python DeckKeyword constr. resolved nested try blocks.
...
2019-10-06 19:17:14 +02:00
Bård Skaflestad
68ff2f08a7 Test Summary: Ensure Uppercase Case Names in Result Sets
Simplifies introduction of a new writer for the summary file.
2019-10-05 14:33:55 +02:00
Bård Skaflestad
7bac89429e Summary Test: Include ert_unique_ptr.hpp
Intermediate step towards enabling a new summary writer that is
independent of libecl.
2019-10-05 14:32:13 +02:00
Bård Skaflestad
032de6c289 SummaryConfig: Capture Keyword Type for Connection Keywords
Overlooked when making the 'SummaryNode' class independent of LibECL.
2019-10-05 14:29:22 +02:00
Bård Skaflestad
aa9471dff1 Forward Declare 'out::Summary' Class in EclipseIO
Mostly to reduce build coupling.  Include Summary.hpp where needed.
2019-10-05 14:27:51 +02:00
Bård Skaflestad
5a5a87d602 EclOutput: Add Stream Flushing Operation
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.
2019-10-05 14:23:21 +02:00
Joakim Hove
cefdd86f1b Merge pull request #1071 from joakim-hove/python-install
Use ${PYTHON_EXECUTABLE} instead of 'python' in CMakeLists.txt
2019-10-05 07:37:38 +02:00
Steinar Foss
6865278ac5 pyhon DeckKeyword: New constructor takes parserkeyword and list of records.
python Deckkeyword: can init with empty records.

python Deckkeyword: can record simple records, but not defaults.

python deckvalue: can take defauløt values.
2019-10-04 21:07:06 +02:00
Joakim Hove
204ea1a1a2 Use ${PYTHON_EXECUTABLE} instead of 'python' in CMakeLists.txt 2019-10-04 20:14:27 +02:00
Joakim Hove
b4908c6fa0 Box: add active index property
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.
2019-10-04 17:02:13 +02:00
Joakim Hove
2991ce0aea Merge pull request #1070 from stefoss23/deck_keyword_value_constructor
DeckKeyword constructor w/ DeckValue records
2019-10-04 11:49:17 +02:00
Steinar Foss
b9ded4433a DeckKeyword constructor w/ DeckValue fails for sizetype ALL. 2019-10-04 10:51:25 +02:00
Steinar Foss
7199e1ede4 DeckValueTests: added test for DeckKeyword constructor taking DeckValue vectors.
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
2019-10-04 10:13:56 +02:00
Bård Skaflestad
3280f26f10 Merge pull request #1069 from joakim-hove/degenrate-cells
Degenrate cells
2019-10-03 19:26:23 +02:00
Joakim Hove
fbe1d211b2 Protect against division by zero in degenerate cells 2019-10-03 18:19:06 +02:00
Joakim Hove
9167359570 Remove trailing whitespace in EclipseGrid files 2019-10-03 18:19:06 +02:00
Joakim Hove
07a998f3c2 Merge pull request #1058 from bska/new-smspec-writer
Add File Manager Stream for Summary Specification
2019-10-03 10:08:33 +02:00
Bård Skaflestad
080225d8e5 Add File Manager Stream for Summary Specification
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.
2019-10-03 10:04:10 +02:00
Joakim Hove
37203833b3 Merge pull request #1066 from bska/uncouple-table-linearisation
Decouple Table Linearisation from LibECL
2019-10-03 09:46:22 +02:00
Bård Skaflestad
c01dae67f9 Decouple Table Linearisation from LibECL
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.
2019-10-02 23:11:56 +02:00
Joakim Hove
b8cfa8be68 Merge pull request #1064 from joakim-hove/W
Add remaining W keywords
2019-10-02 19:31:00 +02:00
Joakim Hove
b28540c57f Merge pull request #1065 from joakim-hove/python-link-zlib
Link to zlib in setup.py libraries
2019-10-02 19:24:28 +02:00
Joakim Hove
1aa4685b62 Link to zlib in setup.py libraries 2019-10-02 18:42:23 +02:00
Joakim Hove
0d31e87072 Merge pull request #1063 from stefoss23/add_keywords_G1
Adding keywords beginning w/ G and H.
2019-10-02 16:52:46 +02:00
Joakim Hove
c1cb489106 Add remaining W keywords 2019-10-02 16:51:21 +02:00
Steinar Foss
c60032e227 added keywords beginning w/ G and H.
added keywords GSEPCOND, GSSCPTST, GSWING, GTADD.

added keywords GTMULT, GUIDECAL, GUPFREQ.

added keyword GWRTWC.

added keywords HALFTRAN, HMPROPS.

added keywords HAxxxxxx, HBNUM, HDISP.

added keywords HMADUCT, HMAQUFET, HMAQUNUM.

added keywords HDIMS, HMFAULTS, FMNLAQUN.

added keywords HMMLCTAW, HMMLFTAQ, HMMLTWCN.

added HMMULTFT, HMMULTXX.
2019-10-02 15:32:13 +02:00
Joakim Hove
d9916d6e50 Merge pull request #1062 from alfbr/log-consistent
Made Reading message consistent with other messages.
2019-10-02 15:28:16 +02:00
Alf Birger Rustad
19d12e7ba2 Made Reading message consistent with other messages. 2019-10-02 14:09:37 +02:00
Joakim Hove
ab14d99f0a Merge pull request #1061 from bska/remove-original-pvttable-linearisation
Table Linearisation: Remove Original PVT Functions
2019-10-02 07:46:48 +02:00
Bård Skaflestad
3db106dd5c Table Linearisation: Remove Original PVT Functions
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.
2019-10-02 00:47:35 +02:00
Joakim Hove
adebeba784 Merge pull request #1060 from joakim-hove/debug-msg
Modify warning message
2019-10-01 22:30:05 +02:00
Joakim Hove
44ae1fd574 Modify warning message 2019-10-01 21:12:18 +02:00
Joakim Hove
04eb33771c Merge pull request #1045 from joakim-hove/guide-rate-nnn
Guide rate nnn
2019-10-01 07:27:22 +02:00
Joakim Hove
78820654c7 Merge pull request #1057 from bska/uncouple-libecl
Make UnitSystem Independent of LibECL
2019-10-01 07:26:30 +02:00
Bård Skaflestad
c51842d65b Make UnitSystem Independent of LibECL
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.
2019-09-30 23:49:57 +02:00
Atgeirr Flø Rasmussen
51b3d14851 Merge pull request #1044 from joakim-hove/deck-sistate
DeckItem - use same store for both si and raw
2019-09-30 23:14:37 +02:00
Joakim Hove
650dd32274 Ensure that DeckItem is written raw in output 2019-09-30 19:08:06 +02:00
Joakim Hove
809177af03 Update DeckItem::equal() implementation
When the DeckItem::dval vector is used transparently for both raw values and SI
values the ::equal implementation must be aware of this.
2019-09-30 18:51:35 +02:00
Joakim Hove
6c34aee00e Use only one double vector in DeckItem 2019-09-30 18:51:35 +02:00
Joakim Hove
25f8ec6641 Merge pull request #1049 from bska/revised-summary-node
Decouple SummaryConfig Class From LibECL
2019-09-30 18:50:22 +02:00
Joakim Hove
c55c1799f6 Merge pull request #1053 from joakim-hove/W
Add W keywords up to WSEGTABL
2019-09-30 18:43:27 +02:00
Joakim Hove
6cdd4fd76f Protext against zero potential 2019-09-30 16:15:35 +02:00
Joakim Hove
3f83f2ed56 Fix bug 2019-09-30 16:15:24 +02:00
Tor Harald Sandve
f7b611afec various fixes to make guiderate work 2019-09-30 14:14:09 +02:00
Joakim Hove
a55f691581 Improvements to GuideRate 2019-09-30 14:14:09 +02:00
Joakim Hove
e738712ad5 GuideRateConfig class has a pointer to GuideRateModel 2019-09-30 14:14:09 +02:00
Bård Skaflestad
70daf0f2c8 Decouple SummaryConfig From LibECL
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.
2019-09-30 13:59:34 +02:00
Bård Skaflestad
dff62946dd Summary Config: Simplify Derivation of Maximum Number of Segments
Since switching to Well2 we no longer need a time loop to derive the
maximum number of segments in an MSW.
2019-09-30 13:27:32 +02:00
Bård Skaflestad
0a6dda5d6d Summary Config: Make 'is_udq' Predicate More Robust
In particular, don't classify 'RUNSUM' as a UDQ keyword.  Moreover,
restrict the known UDQ patterns to

    AU*, BU*, CU*, FU*, GU*, RU*, SU*, and WU*
2019-09-30 13:27:32 +02:00
Bård Skaflestad
d2db04ec13 Uncouple SummaryState from LibECL
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.
2019-09-30 13:27:32 +02:00
Joakim Hove
f799d7c6b9 Merge pull request #1055 from joakim-hove/rename-debug-class
Renamed DEBUG -> DEBUG_LEVEL
2019-09-30 12:57:14 +02:00
Joakim Hove
ce95cd5721 Renamed DEBUG -> DEBUG_LEVEL 2019-09-30 12:29:37 +02:00
Joakim Hove
4416721686 Merge pull request #1048 from stefoss23/deck_value
introduced new class DeckValue.
2019-09-30 10:16:13 +02:00
Steinar Foss
9c4ccd0ff6 DeckValue: DeckValueEnum as enum class. 2019-09-30 09:57:37 +02:00
Joakim Hove
4ca993400b Merge pull request #1052 from tskille/EGrid
Changed EGrid API, function getCellCorners.
2019-09-30 08:31:49 +02:00
Joakim Hove
1b63b8193b Add W keywords up to WSEGTABL 2019-09-30 08:13:18 +02:00
Steinar Foss
584f7ed5ca DeckValue: DeckValueEnum. 2019-09-29 20:12:57 +02:00
Steinar Foss
dc636e244c DeckValue: removed reset method. 2019-09-29 14:29:33 +02:00
Steinar Foss
7af66a6eab DeckValue: single arg constructors are explicit. 2019-09-29 14:20:02 +02:00
Torbjørn Skille
7b2a7aa419 Changed EGrid API, function getCellCorners. Changed from std::vector<double> to std::array<double,8> 2019-09-28 17:46:04 +02:00
Joakim Hove
3d3f315b0a Merge pull request #1050 from joakim-hove/keywords-V
Keywords v
2019-09-28 16:43:19 +02:00
Joakim Hove
fe99293f33 T keywords up to TRACTVD 2019-09-28 15:02:02 +02:00
Joakim Hove
c312c05732 Add T keywords up to TIGHTEN 2019-09-27 21:27:33 +02:00
Joakim Hove
b9fa2ec10d Add keywords on U 2019-09-27 21:27:33 +02:00
Joakim Hove
82a28a29bf Keywords on V 2019-09-27 21:27:20 +02:00
Joakim Hove
41a350ad23 Merge pull request #1047 from stefoss23/add_keywords_G
added keywords beginning w/ G only.
2019-09-27 20:57:16 +02:00
Steinar Foss
fd986cb397 DeckValue under namespace Opm. 2019-09-26 15:08:21 +02:00
Steinar Foss
af878ba229 introduced new class DeckValue.
added DeckValue.cpp.

completed DeckValue.
2019-09-26 14:12:05 +02:00
Steinar Foss
8c5ef89bd3 added keywords beginning w/ G only.
added keywords GCVD, GDCQ, GDCQECON.

added keywords GDIMS, GDRILPOT.

added keywords GETGLOB, GI.

added keywords GIMODEL, GINODE, GLIFTLIM.

added keywords GNETDP, GNETPUMP.

added keywords GRADGRUP, GRADRESV.

added keywords GRADRFT, GRADWELL, GRAVCONS.

added keywords GRAVDR, GRAVDRB, GRAVDRM.

keyword GRACONS set to size unlimited.

added keyword GRDREACH.

added keywords GRUPMAST, GRUPRIG.
2019-09-25 15:32:33 +02:00
Atgeirr Flø Rasmussen
0edd5c2207 Merge pull request #1035 from joakim-hove/equil-data
Changed EquilRecord to take SI values instead of DeckRecord
2019-09-24 08:28:17 +02:00
Joakim Hove
3f8a8f9de8 Merge pull request #1042 from joakim-hove/create_dkw
python: DeckKeyword constructor, w/ ParserKeyword arg.
2019-09-23 23:48:02 +02:00
Steinar Foss
11d1c7d634 python: DeckKeyword constructor, w/ ParserKeyword arg.
parserkeyword can create deckkeyword.

python parserkeyword: removed create_deckkeyword.

DeckKeyword: member parser_keyword is shared_ptr.

python DeckKeyword constructor.

python: no exposure of ParserKeyword.

DeckKeyword: shared_ptr<ParserKeyword> -> ParskerKeyword.

python/cxx/deck_keyword.cpp: cosntructor takes arg const ParskerKeyword&.

test_parser.py: simplified test_pyinut.

...
2019-09-23 23:27:03 +02:00
Joakim Hove
3229c343f7 Merge pull request #1010 from joakim-hove/python-context
Python context
2019-09-23 22:04:24 +02:00
Joakim Hove
9c96588f36 Changed EquilRecord to take SI values instead of DeckRecord 2019-09-23 21:44:59 +02:00
Joakim Hove
69ddffc966 Expose C++ objects to Python runtime 2019-09-23 21:31:45 +02:00
Bård Skaflestad
604c476554 Merge pull request #1041 from bska/fix-build-gcc49
Construct tuple<> Objects Explicitly
2019-09-23 19:01:34 +02:00
Bård Skaflestad
060fb59c57 Merge pull request #1040 from bska/index-out-of-bounds
Ensure ACTNUM Has Expect Number of Elements
2019-09-23 19:00:58 +02:00
Bård Skaflestad
d4ab231124 Construct tuple<> Objects Explicitly
Needed in GCC 4.9 due to incomplete standard library implementation
of class template tuple<>--especially its conditionally implicit
constructors.
2019-09-23 17:38:40 +02:00
Bård Skaflestad
c429a8a800 Ensure ACTNUM Has Expect Number of Elements 2019-09-23 17:32:52 +02:00
Joakim Hove
40570f1aba Merge pull request #1019 from joakim-hove/opmlog-python
Add Python wrapping for OpmLog
2019-09-23 16:54:18 +02:00
Atgeirr Flø Rasmussen
a5e897bdc7 Merge pull request #1039 from akva2/janitoring
fixed: remove unused variable
2019-09-23 15:59:32 +02:00
Atgeirr Flø Rasmussen
6100a90e49 Merge pull request #1009 from tskille/EclipseGrid2
ERT/libecl routines used in the EclipseGrid class has been replace by…
2019-09-23 15:55:28 +02:00
Arne Morten Kvarving
b41865d268 fixed: remove unused variable 2019-09-23 15:36:45 +02:00
Joakim Hove
a4c9b05000 Merge pull request #1032 from joakim-hove/deckitem-value-return
Misc small items
2019-09-23 15:03:48 +02:00
Joakim Hove
230c4494ed Add Python wrapping for OpmLog 2019-09-23 14:35:25 +02:00
Joakim Hove
883fb1a337 Merge pull request #1034 from stefoss23/python_replace_schedule
Python replace schedule
2019-09-23 14:22:35 +02:00
Joakim Hove
ca744afa27 Renamed the default dimension to "Dimensionless" 2019-09-21 20:47:46 +02:00
Joakim Hove
9eb0a01c7b Simplify ParserItem::dimensions() api 2019-09-21 20:47:46 +02:00
Joakim Hove
17c6d7dbad Remove unused DeckItem size hint 2019-09-21 19:24:05 +02:00
Joakim Hove
622a093315 Remove unused DeckItem constructor 2019-09-21 19:24:05 +02:00
Joakim Hove
388d0e99c3 The DeckItem::get() method returns a value 2019-09-21 19:24:05 +02:00
Joakim Hove
f3c065a899 Merge pull request #1033 from joakim-hove/dont-import-parserkeyword
Do not import ParserKeyword in Python
2019-09-21 18:13:39 +02:00
Steinar Foss
dd4cce4e9a python: removed group_tree. 2019-09-21 11:52:44 +02:00
Steinar Foss
0bc150794d python: Schedule bound directly by pybind11.
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.
2019-09-21 11:53:29 +02:00
Joakim Hove
f7a434f274 Do not import ParserKeyword in Python 2019-09-21 07:31:03 +02:00
Torbjørn Skille
34410cbe41 ERT/libecl routines used in the EclipseGrid class has been replace by new member functions. Grid properties are
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.
2019-09-20 14:21:23 +02:00
Bård Skaflestad
c3b0dab6e5 Merge pull request #1030 from joakim-hove/summary-state-time
Add std::time start_time argument to SummaryState
2019-09-20 13:32:26 +02:00
Joakim Hove
b5ba3405af Merge pull request #1031 from bska/has-group-time-predicate
Schedule: Add Query For Particular Group at Particular Time
2019-09-20 10:33:18 +02:00
Bård Skaflestad
882ce83e91 Schedule: Add Query For Particular Group at Particular Time
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.
2019-09-20 08:29:36 +02:00
Joakim Hove
a91c755194 Merge pull request #977 from bska/hookup-rft-writer
Hook New RFT File Writer up to Central ECLIPSE I/O Facility
2019-09-20 07:21:35 +02:00
Joakim Hove
727abd0907 Update DAY, MNTH and YEAR fields in SummaryState 2019-09-20 00:34:36 +02:00
Bård Skaflestad
f214c2cf0f Eclipse IO: Hook Up New RFT File Writer
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.
2019-09-19 22:31:45 +02:00
Joakim Hove
ff69737b99 Add start_time argument to SummaryState 2019-09-19 22:09:15 +02:00
Joakim Hove
ed5b8d0620 Merge pull request #1028 from stefoss23/py_install
setup.py: package_data: readjusted target and origin of libopmcommon.so
2019-09-19 22:07:40 +02:00
Steinar Foss
b1974db82c setup.py: package_data: readjusted target and origin of libopmcommon_python.so. 2019-09-19 14:14:55 +02:00
Joakim Hove
ae75aa3255 Merge pull request #1027 from stefoss23/add_keywords_F1
added keywords beginning w/ F and G.
2019-09-19 11:50:48 +02:00
Joakim Hove
4f276b896c Merge pull request #976 from bska/rft-through-eclio
Add New RFT File Writer
2019-09-18 21:59:17 +02:00
Bård Skaflestad
6c47cdb22f Add New RFT File Writer
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.
2019-09-18 16:48:53 +02:00
Bård Skaflestad
a281a3c6f4 Add RFT Output Stream
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.
2019-09-18 16:48:53 +02:00
Joakim Hove
4388c9d72f Merge pull request #1015 from joakim-hove/actionx-restart
Actionx restart
2019-09-18 16:45:24 +02:00
Steinar Foss
897edca773 added keywords beginning w/ F and G.
added keywords FOAMFSO, FOAMFST, FOAMFSW.

added keywords FOAMMOBP.

added keywords FOAMOBS, FORMFEED.

added keywords GASBEGIN, GASCONC.

added keywords GASEND, GASFCOMP.

added keywords GASFDECR, GASFDELC.

added keywords GASFIELD, GASFTARG.

added keywords GASMONTH, GASPERIO.

added keywords GASSATC, GASYEAR.

added keyword GCALECON.

added keywords GCONCAL, GCONENG.

added keyword GCONCAL.

keywords GASFCOMP, GCALECON: L*L*L -> GasSurfaceVolume.

FOAMFST: Density -> FoamDensity.
2019-09-18 15:49:58 +02:00
Joakim Hove
7d32890d99 Merge pull request #1025 from atgeirr/add-clang-format-spec
Add .clang-format specification.
2019-09-18 15:34:39 +02:00
Joakim Hove
4bed60df0f Merge pull request #1024 from akva2/janitoring
Some janitoring
2019-09-18 15:28:30 +02:00
Atgeirr Flø Rasmussen
93e4c2ffec Add .clang-format specification. 2019-09-18 14:15:21 +02:00
Arne Morten Kvarving
6bbf1fcde2 remove unused UDQParams member in UDQContext 2019-09-18 13:21:00 +02:00
Arne Morten Kvarving
93439cf41e quell shadowing warnings 2019-09-18 13:21:00 +02:00
Arne Morten Kvarving
8c874bf741 fixed: move file into correct directory 2019-09-18 13:21:00 +02:00
Arne Morten Kvarving
0e108311e3 changed: disable unused function
kept around as it is handy for debugging
2019-09-18 13:20:43 +02:00
Arne Morten Kvarving
d2aaff46e0 Merge pull request #1018 from tskille/convertECL
convertECL update, fixed bug with file extensions
2019-09-18 10:33:26 +02:00
Joakim Hove
8a88d64bd1 Merge pull request #1023 from joakim-hove/guiderate-warnings
Fix GuideRate warnings
2019-09-17 19:37:51 +02:00
Joakim Hove
d1fd6359af Merge pull request #1022 from joakim-hove/check-CC-env-variable
Check CC environment variable
2019-09-17 16:56:47 +02:00
Joakim Hove
2b75ff1c19 Fix GuideRate warnings 2019-09-17 16:52:34 +02:00
Joakim Hove
b7459231d2 Check CC environment variable 2019-09-17 14:18:36 +02:00
Joakim Hove
143d0d097a Merge pull request #1012 from joakim-hove/parser-value-semantics
Use ParserKeyword values in Parser instead std::unique_ptr<>
2019-09-17 13:53:46 +02:00
Tor Harald Sandve
efe7a97b1d Merge pull request #994 from joakim-hove/guide-rate
GuideRateConfig object
2019-09-17 13:12:24 +02:00
Joakim Hove
18ead60ccc Merge pull request #1020 from joakim-hove/W
W keywords up to WSEGAICD
2019-09-16 22:49:32 +02:00
Joakim Hove
f9a2c02c5e W keywords up to WSEGAICD 2019-09-16 21:45:29 +02:00
Joakim Hove
f375213d4b Merge pull request #1017 from tskille/EclFile
Ecl file
2019-09-16 18:37:33 +02:00
Joakim Hove
a1f35584a9 Add GuideRate state/cache object 2019-09-16 16:28:45 +02:00
Joakim Hove
dd609e857a Add keywords LINCOM and LCUNIT 2019-09-16 16:28:45 +02:00
Torbjørn Skille
8664ce4af7 convertECL update, fixed bug with file extensions when converting from formatted to binary 2019-09-16 15:02:21 +02:00
Torbjørn Skille
0c526b39f5 EclFile update, fix on reading CHAR type from formatted eclfile 2019-09-16 14:02:42 +02:00
Joakim Hove
de7752b3e5 GuideRateConfig object 2019-09-16 10:52:35 +02:00
Atgeirr Flø Rasmussen
48aba21941 Merge pull request #1016 from joakim-hove/deck-constructor
Deck constructor
2019-09-16 08:59:20 +02:00
Joakim Hove
3070bf4a31 Change DeckKeyword constructor
The DeckKeyword::DeckKeyword(const std::string&) constructor has been removed
and the DeckKeyword now requires a ParserKeyword pointer in the constructor.
2019-09-16 00:47:34 +02:00
Joakim Hove
c8919ba088 Fix typo in NLINEARS keyword 2019-09-16 00:29:31 +02:00
Joakim Hove
4078451840 Action::Condition has lhs and rhs member properties 2019-09-14 08:26:51 +02:00
Joakim Hove
1a23df1e2f Merge pull request #1013 from stefoss23/properties_py_decap
Replace python class EclipseState
2019-09-14 08:23:55 +02:00
Joakim Hove
8efe3cf6a6 Remove unused member Condition::expression 2019-09-13 19:24:53 +02:00
Joakim Hove
546cd46926 Add cmp_string() method to Action::Condition class 2019-09-13 19:22:02 +02:00
Joakim Hove
74291cc57f Merge pull request #1014 from joakim-hove/w
W keywords including WPOTCALC
2019-09-13 19:05:11 +02:00
Joakim Hove
fd0cb01957 Add W keywords - up to WPOTCALC 2019-09-13 18:40:48 +02:00
Joakim Hove
f3bd813f46 Use ParserKeyword values in Parser instead std::unique_ptr<> 2019-09-13 16:21:31 +02:00
Steinar Foss
b957ca6a69 opm.io.ecl_state: unexposes constructor free classes. 2019-09-13 16:17:35 +02:00
Steinar Foss
b68fe2e63a test_state2: added test_config. 2019-09-13 16:17:35 +02:00
Steinar Foss
c826e24607 test_props: uncommented tests. 2019-09-13 16:17:35 +02:00
Steinar Foss
41a05a7a98 test_state.py: uncommented test_summary. 2019-09-13 16:17:35 +02:00
Steinar Foss
4504b8812f test_state2. added function test_jfunc. 2019-09-13 16:17:35 +02:00
Steinar Foss
365fbd355b test_state2: added test_faults. 2019-09-13 16:17:35 +02:00
Steinar Foss
78ab86e2a3 test_state2.py: added test_tables. 2019-09-13 16:17:35 +02:00
Steinar Foss
0ae8c4b235 python grid: properties as small cap. 2019-09-13 16:17:35 +02:00
Steinar Foss
3ecb446c20 test_state2: added test_simulation. 2019-09-13 16:17:35 +02:00
Steinar Foss
97728e9fda test_state2.py: added test_grid. 2019-09-13 16:17:35 +02:00
Steinar Foss
af096fddf9 test_state2: added test_state_nnc. 2019-09-13 16:17:35 +02:00
Steinar Foss
0257528ea9 test_state2: added test_repr_title. 2019-09-13 16:17:35 +02:00
Steinar Foss
fcca1fa823 python EclipseState: added constructor. 2019-09-13 16:17:35 +02:00
Steinar Foss
7fc7a8f0ba python class Sunbeamstate: remove state. 2019-09-13 16:17:35 +02:00
Steinar Foss
15d70c446f properties.py: removed class EclipseState. 2019-09-13 16:17:35 +02:00
Steinar Foss
b97503d34d exposed class TableManager as Tables. 2019-09-13 16:17:35 +02:00
Steinar Foss
c01d3b0139 propertes.py: removed Tables. 2019-09-13 16:17:35 +02:00
Steinar Foss
7811054029 properties.py: EclipeState: removed faults. 2019-09-13 16:17:35 +02:00
Steinar Foss
e1bffe7b3d python: exposed class Eclipse3DProperties. 2019-09-13 16:17:35 +02:00
Steinar Foss
525dfdcd69 properties.py: removed Eclipse3DProperties. 2019-09-13 16:17:35 +02:00
Steinar Foss
369a99a64a python: exposed class EclipseGrid. 2019-09-13 16:17:35 +02:00
Steinar Foss
d5e0d72f0f properties.py: removed class EclipseGrid. 2019-09-13 16:17:35 +02:00
Joakim Hove
6dee117f55 Merge pull request #1011 from joakim-hove/python-namespace
Python namespace
2019-09-13 10:05:29 +02:00
Joakim Hove
d2ff536cf3 Renamed python/cxx/common -> python/cxx/export 2019-09-13 09:40:13 +02:00
Joakim Hove
f264c358e7 Placed the Python cxx wrapping in namespace python::common 2019-09-13 09:22:49 +02:00
Joakim Hove
edf6440113 Merge pull request #1007 from stefoss23/add_keywords_F
Add keywords F
2019-09-13 07:30:24 +02:00
Joakim Hove
ab51fce599 Merge pull request #1008 from joakim-hove/remove-invalid-keyword
Will not attempt to internalize invalid keywords
2019-09-12 13:50:06 +02:00
Joakim Hove
f7d4ba037d Will not attempt to internalize invalid keywords 2019-09-12 13:21:37 +02:00
Steinar Foss
77d6cb24ad keyword FOAMFCN as 'special'. 2019-09-12 12:00:55 +02:00
Steinar Foss
4000b3226b added keywords FOAMDCYO, FOAMDCYW. 2019-09-12 11:54:24 +02:00
Steinar Foss
1e10398b52 added keyword FMTHMD. 2019-09-12 11:37:19 +02:00
Steinar Foss
b07632ee50 added keyword FLUXREG. 2019-09-12 11:30:17 +02:00
Steinar Foss
bd18a82ae3 added keywords FIPNUM, FIPSEP. 2019-09-12 11:06:13 +02:00
Steinar Foss
a0f05b380b FIP as 'special' kw. 2019-09-12 10:21:34 +02:00
Steinar Foss
b15b0bbec7 added keyword FHERCHBL. 2019-09-12 10:04:38 +02:00
Steinar Foss
832a3222fb added keywords NNEWTF. 2019-09-12 09:53:52 +02:00
Steinar Foss
377513fec9 added keywords EXTREPGL, FBHPDEF. 2019-09-12 09:42:34 +02:00
Steinar Foss
7ad764f92f added keywords EXTHOST. 2019-09-12 09:16:34 +02:00
Joakim Hove
6676eb9953 Merge pull request #984 from joakim-hove/python-runtime
Python runtime
2019-09-11 23:23:40 +02:00
Joakim Hove
7dce180581 Merge pull request #1006 from stefoss23/add_keywords_E
Add keywords E
2019-09-11 23:21:49 +02:00
Steinar Foss
a88c1d0513 added keyword ENDDYN, EXCAVATE, ESSNODE, EQLZCORN, EPSDEBUG, EPSDBGS, ENSPCVD, ENPCVD, EHYSTRR, ENDDYN.
added keyword EHYSTRR.

added keyword ENPCVD.

added keyword ENSPCVD.

added keyword EPSDBGS.

added keyword EPSDEBUG.

added keyword EQLZCORN.

added keyword ESSNODE.

added keyword EXCAVATE.

added keyword EXTFIN.

...
2019-09-11 15:12:46 +02:00
Steinar Foss
58bca59892 added keywords DZNET, ECLMC, EDITNNCR 2019-09-10 11:11:45 +02:00
Joakim Hove
5267c07444 Merge pull request #1004 from joakim-hove/keywords-W
Add W keywords - including WNETCTRL
2019-09-10 09:31:28 +02:00
Joakim Hove
ad96affbbf Add W keywords - including WNETCTRL 2019-09-10 07:32:02 +02:00
Joakim Hove
c8e09ff751 Merge pull request #1001 from joakim-hove/add-parserkeyword-member
Add ParserKeyword member to DeckKeyword
2019-09-09 16:00:14 +02:00
Arne Morten Kvarving
16d38c3245 fix python link for dependents 2019-09-09 11:16:58 +02:00
Arne Morten Kvarving
97ad4baa99 quell warnings 2019-09-09 11:16:58 +02:00
Joakim Hove
690cf8c43b Pass -DOPM_ENABLE_EMBEDDED_PYTHON when building for tests 2019-09-09 11:16:55 +02:00
Joakim Hove
15c2e69e9f Add ParserKeyword member to DeckKeyword 2019-09-09 11:12:59 +02:00
Joakim Hove
058cefeafa Merge pull request #1000 from joakim-hove/actionx-cmp
Accept <= and >= in the ActionX::Condition
2019-09-09 11:10:05 +02:00
Joakim Hove
e7639f77d0 Merge pull request #1003 from akva2/remove_disabled_ctest_option
changed: remove ADD_DISABLED_CTEST option
2019-09-09 11:08:07 +02:00
Joakim Hove
ab2ea1acf3 Add basic manager class fro Python interpreter 2019-09-09 10:58:26 +02:00
Arne Morten Kvarving
1edf46ffd1 changed: remove ADD_DISABLED_CTEST option
a disabled test is disabled. end of story.
2019-09-09 10:42:29 +02:00
Atgeirr Flø Rasmussen
1c6e5f5099 Merge pull request #1002 from akva2/remove_option
remove unused opm-common module specific OPM_PREFIX_PATH option
2019-09-09 10:38:21 +02:00
Arne Morten Kvarving
5ad0c66f55 remove unused opm-common module specific OPM_PREFIX_PATH option 2019-09-09 09:31:39 +02:00
Joakim Hove
04239afc03 Remove debug output 2019-09-07 18:19:01 +02:00
Joakim Hove
6683ac1be6 Accept <= and >= in the ActionX::Condition 2019-09-07 18:17:05 +02:00
Joakim Hove
49d61cb4f6 Merge pull request #999 from stefoss23/PYINPUT
Can extract parserkw's in python.
2019-09-06 23:22:26 +02:00
Steinar Foss
318d396adc Parserkeyword property -> name/ ParserKW -> ParserKeyword. 2019-09-06 22:50:25 +02:00
Arne Morten Kvarving
5455bc8425 Merge pull request #998 from akva2/quell_pythonpath_exception
fixed: quell exception if PYTHONPATH env var is nonexistent
2019-09-06 16:00:35 +02:00
Steinar Foss
ff79a404be Can extract parserkw's in python.
added keyword PYINPUT.

added pythonclass ParserKW.

python acces to ParserKW.

removed wrong kw PYINPUT.

...
2019-09-06 15:40:31 +02:00
Arne Morten Kvarving
1c988dc721 fixed: quell exception if PYTHONPATH env var is nonexistent 2019-09-06 14:57:52 +02:00
Joakim Hove
7577e6d851 Merge pull request #997 from atgeirr/check-file-streamlog
Make StreamLog throw if it fails to open file.
2019-09-06 13:41:57 +02:00
Joakim Hove
7c2a2e574d Merge pull request #996 from joakim-hove/keywords-W
W keywords up to an including WFRICTNL
2019-09-06 13:26:32 +02:00
Atgeirr Flø Rasmussen
752a9e2501 Make StreamLog throw if it fails to open file. 2019-09-06 13:11:54 +02:00
Joakim Hove
2c8d827945 W keywords up to an including WFRICTNL 2019-09-06 11:18:58 +02:00
Joakim Hove
cf9744ff1f Merge pull request #995 from stefoss23/remove_py_class_EclipseConfig
Remove py class eclipse config
2019-09-06 10:39:44 +02:00
Steinar Foss
132fc1ff1b moved pyclass EclipseConfig to ecl_state. 2019-09-06 09:42:46 +02:00
Steinar Foss
6dfab9c621 added new python test state2. 2019-09-06 09:13:30 +02:00
Steinar Foss
dedc74f299 exposed cxx class EclipseConfig to python dir. via pybind11. 2019-09-06 09:05:02 +02:00
Joakim Hove
11eb0049da Merge pull request #973 from stefoss23/add_keywords_D1
Add keywords D1
2019-09-06 07:24:00 +02:00
Joakim Hove
753d6dcb92 Merge pull request #992 from atgeirr/add-missing-include
Add missing include.
2019-09-06 06:40:50 +02:00
Joakim Hove
db6b5d2502 Merge pull request #991 from bska/fix-nwgmax-check
Fix ArrayDimsChecker's Maximum Group Size (WELLDIMS) Check
2019-09-05 22:58:37 +02:00
Steinar Foss
ad50a22ed7 removed python class EclipseConfig. 2019-09-05 21:05:19 +02:00
Steinar Foss
e0ff18ee09 added kw DIFF(deck_names), DIFFCOAL, DEPTHTAB, CSKIN, COMPVEL, COMPRPL, COMPRP, COMPVE, COMPDATX(deck_names).
added keywords COMPRP, COMPVE.

added keyword COMPRPL.

added keyword COMPVEL.

addded keyword CSKIN.

added keyword DEPTHTAB.

added keyword DIFFCOAL.

added deck_names DIFF.

...

...
2019-09-05 13:54:51 +02:00
Atgeirr Flø Rasmussen
1588f3227e Add missing include. 2019-09-05 13:52:42 +02:00
Bård Skaflestad
f813a04269 Consider Node Group Size When Calculating Maximum Group Size
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.
2019-09-05 13:36:35 +02:00
Bård Skaflestad
705be62be6 ArrayDimChecker Unit Test: Refactor ParseContext Update
This commit adds a little helper function to simplify assigning the
same InputError::Action to all WELLDIMS-related contexts.
2019-09-05 13:32:18 +02:00
Joakim Hove
7a3b693471 Merge pull request #986 from joakim-hove/python-parser
Python parser
2019-09-05 10:49:07 +02:00
Joakim Hove
08c5e342b2 Merge pull request #987 from joakim-hove/overload-sans-error-guard
Add Parser::parseFile(fname, parseContext) overload
2019-09-05 10:48:22 +02:00
Joakim Hove
7984d2a0f4 Expose the Parser class properly to Python 2019-09-05 08:44:47 +02:00
Joakim Hove
1d8f07fe62 Rename parser/parser.py -> parser/parser_module.py 2019-09-05 08:44:47 +02:00
Joakim Hove
723113b3b9 Add small shell script templates to simplify Python development 2019-09-05 08:44:47 +02:00
Joakim Hove
922afa26c4 Merge pull request #985 from akva2/janitoring
Some janitoring
2019-09-05 08:40:54 +02:00
Joakim Hove
41bd1eb449 Add missing const to Parser methods 2019-09-05 08:14:55 +02:00
Joakim Hove
17e6599749 Add Parser overloads without ErrorGuard 2019-09-05 07:42:13 +02:00
Joakim Hove
c54639fc34 Merge pull request #935 from joakim-hove/parse-python
Started to parse Python code
2019-09-04 23:09:43 +02:00
Joakim Hove
74baa18cd9 Merge pull request #972 from joakim-hove/class-enum
Move Well status enum to Well2 class
2019-09-04 16:29:18 +02:00
Joakim Hove
807fa9ecdb Add keyword PYINPUT 2019-09-04 15:20:13 +02:00
Joakim Hove
4073722771 Basic support for parsing verbatim keywords with code 2019-09-04 15:20:13 +02:00
Joakim Hove
8553bbf326 Remove ScheduleEnum files 2019-09-04 14:49:12 +02:00
Joakim Hove
7bdd294ec5 Refactor Well GuideRateTarget enum 2019-09-04 14:49:12 +02:00
Joakim Hove
ee26316f92 Refactor Group GuideRateTarget enum 2019-09-04 14:49:12 +02:00
Joakim Hove
af72086db8 Refactor enum for GuideRate target 2019-09-04 14:49:12 +02:00
Joakim Hove
e026660c80 Move / refactor Group production control enum 2019-09-04 14:49:12 +02:00
Joakim Hove
0296759ad0 Move GroupType enum to Group2 2019-09-04 14:49:12 +02:00
Joakim Hove
9d442d3d4f Refactor Group injection enum 2019-09-04 14:49:12 +02:00
Joakim Hove
5d5bcf6f24 Refactor enum exceed action 2019-09-04 14:49:12 +02:00
Joakim Hove
9690588dd4 Refactor enums for Segments 2019-09-04 14:49:12 +02:00
Joakim Hove
7021669758 Remove enum WellQueryMode 2019-09-04 14:49:12 +02:00
Joakim Hove
3c22559849 Refactor OilVap enum 2019-09-04 14:49:12 +02:00
Joakim Hove
5965b194df Refactor RFT enums 2019-09-04 14:49:12 +02:00
Joakim Hove
a449636dde Enum refactor EconLimits 2019-09-04 14:49:12 +02:00
Joakim Hove
9e6f8bd1c1 Move well production control enum to Well2 2019-09-04 14:49:12 +02:00
Joakim Hove
a2fc480e16 Move enum CompletionOrder to Connection class 2019-09-04 14:46:58 +02:00
Joakim Hove
15e192876e Move direction enum to Connection class 2019-09-04 14:46:58 +02:00
Joakim Hove
dcf4347aee Moved connection state enum to Connection class 2019-09-04 14:46:58 +02:00
Joakim Hove
82accba45b Move injection control enum to Well2 class 2019-09-04 14:46:58 +02:00
Joakim Hove
22a9ffa7d9 Move Injection properties inside Well2 class 2019-09-04 14:46:58 +02:00
Joakim Hove
a7c5483b0f Move Well status enum to Well2 class 2019-09-04 14:46:58 +02:00
Atgeirr Flø Rasmussen
be795af931 Merge pull request #979 from joakim-hove/actionx-dynamic
Convert Schedule::Actions to a DynamicState<Actions>
2019-09-04 14:25:06 +02:00
Steinar Foss
4cce5f5f1c keyword_list.cmake: added record of 'special' keywords. 2019-09-03 23:06:12 +02:00
Steinar Foss
3e1822770d added keywords DZMATRIX, DZMTRX, DZMTRXV. 2019-09-03 23:06:12 +02:00
Steinar Foss
f124fc692f added keyword DYNRDIMS. 2019-09-03 23:06:12 +02:00
Steinar Foss
dc26fd6364 added keywords DUALPORO, DUMPCUPL. 2019-09-03 23:06:12 +02:00
Steinar Foss
80afcd852f added keywords DRILPRI, DSDPEINT, DUALPERM. 2019-09-03 23:06:12 +02:00
Steinar Foss
17e5e3fec3 added keywords DPGRID, DPKRMOD, DPNUM. 2019-09-03 23:06:12 +02:00
Steinar Foss
ab235a1eae added keywords DIMPES, DISPERSE, DOMAINS. 2019-09-03 23:06:12 +02:00
Steinar Foss
974fef2c44 modified kw DIFFC, added keywords DIMPLICT, DISPDIMS. 2019-09-03 23:06:12 +02:00
Steinar Foss
440049ab6c added keywords DIFFX, DIFFY, DIFFZ. 2019-09-03 23:06:12 +02:00
Steinar Foss
6cdae955d2 added keywords DIFFR, DIFFTHT, DIFFUSE. 2019-09-03 23:06:12 +02:00
Joakim Hove
af2a09bde5 Make sure actionx keywords can be redefined 2019-09-03 13:47:30 +02:00
Joakim Hove
2aa10a0435 Internalize ActionX conditions to enable restart 2019-09-03 13:47:30 +02:00
Joakim Hove
208c1a7143 Convert Schedule::Actions to a DynamicState<Actions> 2019-09-03 13:47:30 +02:00
Joakim Hove
12a8656647 Changed Actions::at() to const 2019-09-03 13:46:02 +02:00
Joakim Hove
de5246c701 Add DeckKeyword::location() 2019-09-03 13:46:02 +02:00
Arne Morten Kvarving
c0c6f35099 fixed: use of iterator after erase 2019-09-03 12:33:11 +02:00
Arne Morten Kvarving
8d858903f1 changed: reduce scope of variable 2019-09-03 12:28:29 +02:00
Joakim Hove
fa964b5820 Merge pull request #983 from joakim-hove/welldims-exception
Default error handler for WELLDIMS errors is exception
2019-09-02 10:15:58 +02:00
Joakim Hove
dad13d2633 Default error handler for WELLDIMS errors is exception 2019-08-31 15:23:02 +02:00
Joakim Hove
6b2aadaef7 Merge pull request #981 from totto82/nupcol
support nupcol
2019-08-31 07:27:51 +02:00
Joakim Hove
ec36c227d7 Merge pull request #982 from akva2/fix_negative_index_deref
fixed: dereferencing string at index -1 is not adviced.
2019-08-30 19:09:13 +02:00
Arne Morten Kvarving
d097660fcc fixed: dereferencing string at index -1 is not adviced.
if there is no dot, p is -1 which leads to an exception thrown
2019-08-30 14:59:58 +02:00
Tor Harald Sandve
09b445f69d support nupcol 2019-08-30 13:07:13 +02:00
Arne Morten Kvarving
8ef902bee5 Merge pull request #980 from bska/fix-nightly
RFT Unit Test: Use Actual 'BOOST_FAIL' Macro
2019-08-30 11:36:38 +02:00
Bård Skaflestad
38b6451c73 RFT Unit Test: Use Actual 'BOOST_FAIL' Macro
BOOST_TEST_FAIL was a figment of my imagination.
2019-08-30 09:39:15 +02:00
Joakim Hove
ec250f19f8 Merge pull request #974 from bska/rft-utest-through-erft
Reimplement RFT Unit Test in Terms of 'ERft' Class
2019-08-29 17:10:37 +02:00
Bård Skaflestad
f0adb01941 Reimplement RFT Unit Test in Terms of 'ERft' Class
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.
2019-08-29 09:24:31 +02:00
Joakim Hove
a69b0bd06f Merge pull request #978 from joakim-hove/ACTDIMS
Add micro class to contain information from ACTDIMS keyword
2019-08-29 07:14:52 +02:00
Joakim Hove
07b2f47c7d Add micro class to contain information from ACTDIMS keyword 2019-08-28 23:22:02 +02:00
Bård Skaflestad
a7956bcf31 Merge pull request #975 from joakim-hove/icon-bug
Correct ICON and SCON when flow has deacivated connection cell
2019-08-28 12:10:28 +02:00
Joakim Hove
aa9ed7a995 Correct ICON and SCON when flow as deacivated connection cell 2019-08-27 22:00:10 +02:00
Joakim Hove
d06c0bfebb Merge pull request #971 from joakim-hove/python-reorg
Python reorg
2019-08-24 05:30:56 +02:00
Joakim Hove
c516f868e4 Slight reorganizing of Python tree 2019-08-23 19:15:51 +02:00
Atgeirr Flø Rasmussen
a9cff8f7a1 Merge pull request #970 from akva2/rename_ewoms
changed: rename ewoms to opm-models
2019-08-23 16:21:12 +02:00
Joakim Hove
8e8abee556 Renamed opm.parser -> opm.io 2019-08-23 11:24:15 +02:00
Joakim Hove
c0d95e01db Merge pull request #963 from tskille/EclFile
EclFile - improved ascii read efficiency
2019-08-23 11:16:03 +02:00
Joakim Hove
b00615d21f Merge pull request #968 from joakim-hove/guiderate-model
Adds GuideRateModel
2019-08-23 10:05:40 +02:00
Joakim Hove
16daa52fbc Merge pull request #969 from joakim-hove/w-kw
W keywords up to and including WELOPENL
2019-08-23 09:32:41 +02:00
Arne Morten Kvarving
41f18d718c changed: rename ewoms to opm-models 2019-08-23 08:29:28 +02:00
Joakim Hove
00661d6767 W keywords up to and including WELOPENL 2019-08-23 08:28:18 +02:00
Joakim Hove
44bedf0f23 Adds GuideRateModel 2019-08-23 08:21:14 +02:00
Joakim Hove
65f9fdec5c Merge pull request #966 from stefoss23/add_keywords_D
Add keywords D
2019-08-22 16:51:25 +02:00
Steinar Foss
611dc0b565 added keywords DIFFMX, DIFFMY, DIFFMZ. 2019-08-22 15:26:12 +02:00
Steinar Foss
eb30af2b11 added keywords DIFFMMF, DIFFMR, DIFFMTHT. 2019-08-22 15:26:12 +02:00
Steinar Foss
31357cf40d added keywords DIAGDISP, DIFFC, DIFFDP. 2019-08-22 15:26:12 +02:00
Steinar Foss
3a15a16848 added keywords DELAYACT. 2019-08-22 15:26:12 +02:00
Steinar Foss
19ca93f227 added keywords DATUMR, DATUMRX, DCQDEFN. 2019-08-22 15:26:12 +02:00
Joakim Hove
ba34a9fed0 Merge pull request #961 from stefoss23/GUIDE_RATE
WIP: kw GCONPROD: reads GUIDE_RATE.
2019-08-22 13:28:19 +02:00
Steinar Foss
7f484b736d ScheduleTests: removed whitespace. 2019-08-22 12:15:42 +02:00
Steinar Foss
30b44ef233 SheduleEnums: GuideRateDef as enum class.
...
2019-08-22 12:00:50 +02:00
Joakim Hove
c7497497f6 Merge pull request #964 from joakim-hove/add-gpmaint
Add JSON keyword WSEGVALV
2019-08-22 11:08:41 +02:00
Joakim Hove
df4e94e351 Merge pull request #954 from joakim-hove/rawkeyword-partial
Rawkeyword + Parser: simplifications
2019-08-22 11:08:17 +02:00
Joakim Hove
f7b50a97f7 Add JSON keyword WSEGVALV 2019-08-22 10:47:19 +02:00
Torbjørn Skille
6f7d45750f changed from int to size_t for index. Changed loading of all data, reading data from disk array by array 2019-08-22 10:28:13 +02:00
Joakim Hove
e5013125f1 Refactor initial parsing stage
- 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.
2019-08-22 09:32:11 +02:00
Steinar Foss
9a6065509b kw GCONPROD: GUIDE_RATE_DEF INJ, POTN, FORM handled as warning.
added enum guide_ref_enum.

...

field.

.tt
2019-08-21 12:46:50 +02:00
Joakim Hove
441b065b3d Merge pull request #962 from joakim-hove/empty__init
Emptied the opm/__init__.py file and create opm.parser package
2019-08-20 16:19:59 +02:00
Torbjørn Skille
6d79ab4715 EclFile - improved ascii read efficiency 2019-08-20 13:37:22 +02:00
Joakim Hove
86b7d4406e Merge pull request #933 from joakim-hove/parser-print-progress
Add log message with parsing progress
2019-08-19 16:52:58 +02:00
Joakim Hove
7e775ecd17 Emptied the opm/__init__.py file and create opm.parser package 2019-08-19 16:01:19 +02:00
Steinar Foss
6e93c5ee1f kw GCONPROD: reads GUIDE_RATE.
group2: production_properties: added guide_rate.

..

GCONPROD reads meaningless GUIDE_RATE.

guide_rate_def.

..2

...
2019-08-19 15:41:32 +02:00
Arne Morten Kvarving
d6cbf47e38 Merge pull request #940 from akva2/parallel_tests_in_check_target
Execute tests in parallel for the 'check' target
2019-08-19 13:51:23 +02:00
Atgeirr Flø Rasmussen
079cb5fd0b Merge pull request #960 from joakim-hove/rm-printf
Remove printf debug
2019-08-19 12:34:50 +02:00
Joakim Hove
6f7a6d47f2 Remove printf debug 2019-08-19 11:59:22 +02:00
Joakim Hove
a6eef07c76 Merge pull request #951 from stefoss23/sunbeam_to_opm
Sunbeam to opm
2019-08-19 09:57:42 +02:00
Joakim Hove
a961f38c63 Merge pull request #959 from joakim-hove/move-tests
Move tests
2019-08-18 15:30:04 +02:00
Joakim Hove
bc2e5f7d00 Moved test in filesystem 2019-08-18 13:21:04 +02:00
Joakim Hove
3846c8c7ab Moved ResinsightTest 2019-08-18 13:21:04 +02:00
Joakim Hove
e186761f4a Merge pull request #958 from joakim-hove/inline-resinsight-data
Inlined deck data for test
2019-08-17 12:57:34 +02:00
Joakim Hove
8efaa4dc66 Inlined deck data for test 2019-08-17 12:00:44 +02:00
Joakim Hove
bb6fb37ea1 Add log message with parsing progress 2019-08-16 19:50:23 +02:00
Joakim Hove
97a73ea5a5 Merge pull request #953 from joakim-hove/w-keywords
Add some W keywords
2019-08-16 17:44:10 +02:00
Joakim Hove
eee75da9ef Merge pull request #957 from stefoss23/add_keywords_c
Add keywords c
2019-08-16 16:30:42 +02:00
Steinar Foss
cb165fb418 removed keywords file CECONT. 2019-08-16 14:41:07 +02:00
Steinar Foss
c9420d1883 added keywords COMPRIV, COMPSEGL, COPYBOX, CRITPERM. 2019-08-16 14:25:08 +02:00
Steinar Foss
01f0beb8ca added keywords: COMPFLSH, COMPLMPL, COMPOFF. 2019-08-16 13:41:43 +02:00
Steinar Foss
7e62206481 added keywords COARSEN, COLLAPSE, COLUMNS. 2019-08-16 12:45:48 +02:00
Steinar Foss
3aefa3a953 added keywords COAL, COALADS, COALPP. 2019-08-16 11:54:33 +02:00
Joakim Hove
e32853808f Merge pull request #955 from joakim-hove/string_view_find_char
String view find char
2019-08-16 11:29:26 +02:00
Steinar Foss
10142b482e setup.py discontinue glob use. 2019-08-16 10:37:48 +02:00
Steinar Foss
522dee0a47 setuptools install PYTHONPATH circumvention. 2019-08-16 10:35:28 +02:00
Joakim Hove
659fb45d04 Changed string_view::substr() to take(from, len) arguments 2019-08-16 09:04:49 +02:00
Joakim Hove
cf6161ecfe Add method string_view::find( char ) 2019-08-16 09:04:49 +02:00
Joakim Hove
03b81d116f Add some W keywords 2019-08-15 17:05:06 +02:00
Steinar Foss
554ceb87dd setup.py will install python packages.
setup.py install to CMAKE_INSTALL_PREFIX.

cmake will create python install dir.
2019-08-15 17:00:43 +02:00
Joakim Hove
7e3ad77329 Merge pull request #952 from joakim-hove/rawkeyword-refactor
Rawkeyword refactor
2019-08-15 16:45:29 +02:00
Joakim Hove
31bb6a0164 Merge pull request #945 from joakim-hove/keywords-z
Keywords Z and W
2019-08-15 14:29:54 +02:00
Joakim Hove
4eb9d5d46a Remove ParserState member rawKeyword 2019-08-15 14:26:25 +02:00
Joakim Hove
4258bce6c5 Use reference instead of pointer 2019-08-15 13:39:33 +02:00
Joakim Hove
1d5326f664 Change std::shared_ptr -> std::unique_ptr 2019-08-15 13:23:21 +02:00
Joakim Hove
79a2c1bd4d Removed public property from RawKeyword class 2019-08-15 12:23:29 +02:00
Joakim Hove
e3ade4dff9 Use reference instead of pointer 2019-08-15 11:51:08 +02:00
Steinar Foss
36338c8a71 namespace sunbeam -> opmcommon_python. 2019-08-15 11:35:28 +02:00
Steinar Foss
c94ed2f643 renaming python/cxx/sunbeam*.* -> common *.* 2019-08-15 11:19:18 +02:00
Joakim Hove
5cd93cd702 Add some keywords on W 2019-08-15 11:13:23 +02:00
Joakim Hove
6dc4804a57 Add keyword ZIPP2OFF 2019-08-15 11:13:23 +02:00
Joakim Hove
d0634114c7 Add some this-> and an explicit throw for unrecognized dimension 2019-08-15 11:13:22 +02:00
Joakim Hove
ee482b9a5f Merge pull request #948 from joakim-hove/unit-system-api-energy
Add missing energy to unit system measure table
2019-08-15 11:07:01 +02:00
Steinar Foss
e25416c236 renamed python pkg sunbeam -> opm.
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.
2019-08-15 11:02:09 +02:00
Joakim Hove
c40eed027b Merge pull request #937 from joakim-hove/rawkeyword-minor
Remove superfluos check in RawKeyword assembly
2019-08-15 08:17:45 +02:00
Joakim Hove
bef36f6c0d Add missing energy to unit system measure table 2019-08-15 07:10:44 +02:00
Joakim Hove
1ff60496c6 Merge pull request #946 from atgeirr/remove-slow-call
Remove an unused call that is very slow.
2019-08-15 06:57:10 +02:00
Atgeirr Flø Rasmussen
b0ad018a74 Remove an unused call that is very slow. 2019-08-14 23:02:50 +02:00
Joakim Hove
f898d33e65 Merge pull request #876 from tskille/compareECL2
Update of compareECL - check output files for reference case
2019-08-14 16:31:16 +02:00
Joakim Hove
e79b546544 Merge pull request #938 from joakim-hove/gconprod-exceed-action
GCONPROD: The exceed action should be unconditionally set to RATE
2019-08-14 16:30:17 +02:00
Arne Morten Kvarving
1903b9517b Merge pull request #944 from tskille/compareECL
Updated with vector of back listed keywords. These keywords will not b…
2019-08-14 13:42:45 +02:00
Arne Morten Kvarving
d12426b9e8 Merge pull request #939 from akva2/parallel_tests
added: environment variable TESTTHREADS in build-opm-module.sh
2019-08-14 12:54:04 +02:00
Torbjørn Skille
d51c31634a Updated with vector of backlisted keywords. These keywords will not be checked.
This list contains only summary vector TCPU.

keywordsBlackList will work on all file types (INIT, UNRST, RFT and SMSPEC/UNSMRY)

wildcards (*) not supported
2019-08-14 12:25:38 +02:00
Steinar Foss
cbf477e502 keywords CECONT started. 2019-08-14 10:36:22 +02:00
Steinar Foss
51517ec6a3 Merge remote-tracking branch 'origin/add_keywords_C' into add_keywords_c 2019-08-14 10:01:17 +02:00
Joakim Hove
50902686b5 Merge pull request #936 from joakim-hove/string-view-methods
Add string_view::starts_with() and string_view::find() methods
2019-08-14 07:50:22 +02:00
Joakim Hove
2002be13e2 Remove unused method declaration 2019-08-14 07:41:57 +02:00
Joakim Hove
5103e7b604 Removed filename and keyword members from RawRecord 2019-08-14 07:34:56 +02:00
Joakim Hove
de107379a1 Return if final keyword in file is of type Raw::UNKNOWN 2019-08-14 07:34:56 +02:00
Joakim Hove
b70140dd4e Add newlines in if 2019-08-14 07:34:56 +02:00
Joakim Hove
ae27c8a9c6 Reorganized if ( ) testing slightly 2019-08-14 07:34:56 +02:00
Joakim Hove
1936f12356 Add small method RawKeyword::terminateRecord() 2019-08-14 07:34:56 +02:00
Joakim Hove
de19aca322 Remove superfluos check in RawKeyword assembly 2019-08-14 07:34:56 +02:00
Joakim Hove
f51420c6c6 Merge pull request #942 from akva2/improve_sunbeam_build
Improve sunbeam build
2019-08-13 19:36:33 +02:00
Joakim Hove
27ffc41361 Merge pull request #928 from jalvestad/udqrst-pull909
Output of UDQ properties to Eclipse compatible restart file
2019-08-13 19:33:50 +02:00
Arne Morten Kvarving
ca42ca5968 changed: use a custom output to avoid rebuilds
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.
2019-08-13 15:56:45 +02:00
Arne Morten Kvarving
86b1a93b0e fixed: clean python bindings with 'make clean' 2019-08-13 15:56:45 +02:00
Jostein Alvestad
84116a7d70 Merge remote-tracking branch 'upstream/master' into udqrst-pull909 2019-08-13 13:05:28 +02:00
Arne Morten Kvarving
7c15d79a93 changed: run tests in parallel with the 'check' target 2019-08-13 12:35:12 +02:00
Atgeirr Flø Rasmussen
eb1d00f9dc Merge pull request #941 from atgeirr/make-prodinjprops-public
Make two headers public again.
2019-08-13 12:28:35 +02:00
Atgeirr Flø Rasmussen
d20c58da07 Make two headers public again. 2019-08-13 11:56:17 +02:00
Arne Morten Kvarving
a1edb0a1f7 changed: simplify by using built-in support
use built-in support to obtain number of processor cores
instead of custom osx and linux code.
2019-08-13 11:33:43 +02:00
Jostein Alvestad
ff956e7aff Made changes to avoid compiler warnings, ref comments from akva2 2019-08-13 11:23:18 +02:00
Arne Morten Kvarving
377294316e added: environment variable TESTTHREADS in build-opm-module.sh
set this to run tests in parallel
2019-08-13 10:47:13 +02:00
Jostein Alvestad
1715565920 Merge pull request #6 from joakim-hove/remove-udqParam
Remove struct udqParam use existing class UDQParams
2019-08-13 08:26:08 +02:00
Joakim Hove
f467d05035 Remove struct udqParam use existing class UDQParams 2019-08-13 08:21:46 +02:00
Jostein Alvestad
02278912d6 Merge pull request #5 from joakim-hove/udq-output-fixup
Minor update to UDQ settings of DoubHEAD
2019-08-13 08:20:00 +02:00
Joakim Hove
3f773b956f Minor update to UDQ settings of DoubHEAD 2019-08-13 08:06:08 +02:00
Joakim Hove
4334256c5b GCONPROD: The exceed action should be unconditionally set to RATE 2019-08-12 17:28:47 +02:00
Jostein Alvestad
a3f74c19c4 WIP removed additional code that altered DoubHEAD data 2019-08-12 13:04:59 +02:00
Jostein Alvestad
d6d1dbd38b code changes to avoid changes in InteHead and DoubHead in Restart file 2019-08-12 13:04:57 +02:00
Jostein Alvestad
1a02bb105a Fixed group-group2 transition, disable Restart output 2019-08-12 13:04:55 +02:00
Jostein Alvestad
e3dc5e07d7 add code to output IUAP array 2019-08-12 13:04:53 +02:00
Jostein Alvestad
af811d2eaf 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
2019-08-12 13:04:51 +02:00
Jostein Alvestad
083742c368 WIP changes to add first version of BOOST test for IUDQ 2019-08-12 13:04:50 +02:00
Jostein Alvestad
2bfad7ae37 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
2019-08-12 13:04:48 +02:00
Joakim Hove
c8cd730d5c Refactor UDQActive - handles vanishing UDA 2019-08-12 13:04:47 +02:00
Joakim Hove
4cde3e7e44 More UDQ fixes 2019-08-12 13:04:45 +02:00
Joakim Hove
8416680368 Add UDQ test and input file 2019-08-12 13:04:44 +02:00
Joakim Hove
44ddd382a3 UAD usage hashing based on udqstring and controltype 2019-08-12 13:04:42 +02:00
Joakim Hove
79da1ba5eb Fix bug with size of IUAD array 2019-08-12 13:04:41 +02:00
Joakim Hove
a218a1c936 Remove unused arg 2019-08-12 13:04:40 +02:00
Joakim Hove
e00a32f75c Output use_index for IUAD 2019-08-12 13:04:38 +02:00
Joakim Hove
29c3310671 Fix IUAD input index 2019-08-12 13:04:37 +02:00
Joakim Hove
e02fa5d04f WIP 2019-08-12 13:04:35 +02:00
Jostein Alvestad
9eda0ee1b8 WIP - further code to output IGPH vector 2019-08-12 13:04:34 +02:00
Joakim Hove
0fb287b789 WIP 2019-08-12 13:04:32 +02:00
Joakim Hove
858e0b84cf Make sure UDQ DEFINE overwrite correctly 2019-08-12 13:04:31 +02:00
Joakim Hove
39346c3b97 Add UDQActive::get() method 2019-08-12 13:04:30 +02:00
Joakim Hove
bcfc8b4966 Add operator bool() to UDQActive 2019-08-12 13:04:28 +02:00
Joakim Hove
98338e3326 UDQInput: use correct input index 2019-08-12 13:04:27 +02:00
Joakim Hove
fadcddbc92 Use UDQInput class when creating restart file 2019-08-12 13:04:26 +02:00
Joakim Hove
1a79e811dd Add operator[] to UDQConfig class 2019-08-12 13:04:24 +02:00
Arne Morten Kvarving
1caca2df4a use maps 2019-08-12 13:04:23 +02:00
Joakim Hove
5e751bb26c Add unit to UDQInput class 2019-08-12 13:04:21 +02:00
Joakim Hove
520df29bd8 Add UDQIndex type to keep track of sequence number of variable types 2019-08-12 13:04:20 +02:00
Joakim Hove
354c20786d Add UDQVarTYpe member to UDQInput class 2019-08-12 13:04:18 +02:00
Joakim Hove
9e309375b6 Add size() method to UDQConfig 2019-08-12 13:04:17 +02:00
Jostein Alvestad
74d0703dc2 Output UDQ keywords to restart file 2019-08-12 13:04:14 +02:00
Joakim Hove
5064519e83 Add function to get keyword enum 2019-08-12 13:04:12 +02:00
Joakim Hove
1a62ceff7d Log use of UDA for output purposes 2019-08-12 13:04:10 +02:00
Joakim Hove
4d1b747b42 UDQConfig object has merged DEFINE & ASSIGN 2019-08-12 13:04:08 +02:00
Joakim Hove
28c2e7024c Renamed UDQInput -> UDQCOnfig 2019-08-12 13:04:07 +02:00
Joakim Hove
9ff301625b Merge pull request #931 from joakim-hove/group-controls-space
Add ParseContext behaviour to trimming of well/group names
2019-08-12 11:05:28 +02:00
Joakim Hove
49d32a02fb Add ParseContext behaviour to trimming of well/group names 2019-08-12 11:01:14 +02:00
Joakim Hove
9d9099a8fc Add string_view::starts_with() and string_view::find() methods 2019-08-10 18:05:22 +02:00
Joakim Hove
ef91e18586 Merge pull request #934 from joakim-hove/parse-test-spe9
Add parse testing of SPE9 variations
2019-08-09 19:53:05 +02:00
Joakim Hove
31176bacbb Add parse testing of SPE9 variations 2019-08-09 18:46:53 +02:00
Steinar Foss
d1052d2034 setup.py: uses ccache c++. 2019-08-09 18:14:02 +02:00
Steinar Foss
cf9aa917dc setup.py: may use ccache.
added note.
2019-08-09 18:14:02 +02:00
Joakim Hove
de641d83d6 Merge pull request #873 from joakim-hove/actionx-eval-field
ACTIONX: Fix bug with matching wells + refactor
2019-08-09 17:41:08 +02:00
Joakim Hove
359955efc3 Action: capture matching wells correctly + large refactor
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.
2019-08-09 15:43:58 +02:00
Joakim Hove
2747f20e24 Add utility to output Action::TokenType to string 2019-08-09 15:43:58 +02:00
Joakim Hove
27e1cc654a ActionContext uses a reference to SummaryState 2019-08-09 15:43:58 +02:00
Joakim Hove
f0c5b914ad Merge pull request #930 from GitPaean/recovering_ALL_Summary_2
removing potential keywords from ALL in SUMMARY (attempt no. 2)
2019-08-09 14:41:27 +02:00
Joakim Hove
37b49cabf6 Merge pull request #917 from stefoss23/setuptools
Setuptools
2019-08-09 13:45:50 +02:00
Steinar Foss
b0ad3a2b26 resolved merge conflict. 2019-08-09 10:48:43 +02:00
Steinar Foss
c208a59597 Sunbeam will be compiled with setuptools.
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.
2019-08-09 10:40:33 +02:00
Joakim Hove
b55e073182 Merge pull request #923 from joakim-hove/group-uda
Group uda
2019-08-09 08:50:20 +02:00
Steinar Foss
e013066040 added keyword CECONT. 2019-08-09 08:32:19 +02:00
Joakim Hove
f63c408ba4 Add has_control() functionality to group 2019-08-08 18:43:19 +02:00
Joakim Hove
bd28038327 Add Group2 getters for cmode and phase 2019-08-08 17:28:34 +02:00
Joakim Hove
02c43b7a09 Merge pull request #927 from stefoss23/add_keywords_B
Add keywords beginning w/ B
2019-08-08 17:22:56 +02:00
Steinar Foss
3852c5224e added keywords CALTRAC, CART, CMBOPTS. 2019-08-08 16:03:04 +02:00
Steinar Foss
692edfbf5c added keywords BPDIMS, BRINE, BTOBALFA, BTOBALFV. 2019-08-08 15:10:08 +02:00
Steinar Foss
887a567869 added keywords BIGMODEL, BOUNDARY, BPARA. 2019-08-08 15:10:08 +02:00
Joakim Hove
8ff8d23146 Merge pull request #926 from stefoss23/add_keywords_A
WIP: Add keywords a
2019-08-08 14:03:28 +02:00
Steinar Foss
0bfe490609 AUTOREF: corrected name. 2019-08-08 11:54:42 +02:00
Steinar Foss
0f7062ef2a added keywords: AQUNNC, AUTOCOAR, AUTOREF. 2019-08-08 11:50:54 +02:00
Joakim Hove
6016cd43b3 Evaluate UDA variuables for group rates 2019-08-08 06:52:48 +02:00
Joakim Hove
93b53df02a Merge pull request #900 from joakim-hove/remove-group
Use new Group2 class
2019-08-07 21:52:56 +02:00
Kai Bao
a06194ecae fixing requiredRestartVectors() in Summary.cpp
adding the following to the requiredRestartVectors()

    “OPP”, “WPP”, “GPP”,
    “OPI”, “WPI”, “GPI”
2019-08-07 10:55:58 +02:00
Kai Bao
8a57e491c2 removing potential keywords from ALL in SUMMARY
which were added from OPM/opm-common#585
2019-08-07 10:55:58 +02:00
Steinar Foss
9516fdd3e6 added keywords AQUFET, AQUFLUX. 2019-08-07 10:29:30 +02:00
Joakim Hove
7c856f681d Use new classes Group2 and GTNode 2019-08-06 22:59:16 +02:00
Bård Skaflestad
9875d5fbd8 Merge pull request #925 from atgeirr/fix-satfuncpropertyinitializers-slgof
Bugfix: multiple bugs in dealing with SLGOF dealt with.
2019-08-06 15:29:47 +02:00
Atgeirr Flø Rasmussen
b9cdb9fb78 Minor modifications requested by reviewer. 2019-08-06 14:14:00 +02:00
Atgeirr Flø Rasmussen
8c9674856a Bugfix: multiple bugs in dealing with SLGOF dealt with. 2019-08-06 11:10:57 +02:00
Joakim Hove
8633f07018 Merge pull request #913 from joakim-hove/sort-wells
Sort the child wells according to insert index
2019-08-06 09:24:10 +02:00
Joakim Hove
22ef5a4cd2 Merge pull request #924 from joakim-hove/group-add-unitsystem
Add UnitSystem member ot Group2 class
2019-08-06 06:38:18 +02:00
Joakim Hove
ed4bf054fa Add UnitSystem member ot Group2 class 2019-08-05 18:37:01 +02:00
Joakim Hove
5bb56ff4a8 Merge pull request #922 from joakim-hove/well_uda_rename
Minor reorg to use the same UDA code for wells and groups
2019-08-05 17:11:13 +02:00
Joakim Hove
bab637ab67 Merge pull request #921 from bska/include-stdexcept
Include <stdexcept> Where Necessary
2019-08-05 17:11:01 +02:00
Joakim Hove
658dc20f36 Minor reorg to use the same UDA code for wells and groups 2019-08-05 14:35:00 +02:00
Bård Skaflestad
7d26cf44e1 Include <stdexcept> Where Necessary
Issue hidden by transitive includes in some standard library
implementations.
2019-08-05 11:12:06 +02:00
Steinar Foss
7dfc20a4cc added keywords AQANCONL, AQANNC, AQANTRC, AQUCWFAC. 2019-08-05 10:12:24 +02:00
Joakim Hove
119cbc33f7 Sort the child wells according to insert index 2019-07-31 13:28:24 +02:00
Joakim Hove
24393cc2ef Merge pull request #892 from joakim-hove/group2-testing
Group2
2019-07-31 08:18:28 +02:00
Joakim Hove
9e6666357b Add method Group2::wellgroup() 2019-07-31 07:13:08 +02:00
Joakim Hove
2d66d15d96 Refactor GroupTree - create on demand 2019-07-30 09:37:55 +02:00
Joakim Hove
dc4aa882be Integration testing of Group2 in Schedule constructor 2019-07-30 09:36:57 +02:00
Joakim Hove
12294cb637 Initialize Group2 structure during Schedule construction 2019-07-30 09:36:48 +02:00
Joakim Hove
8a52da5851 Replace SCHEDULE_WELL_ERROR -> SCHEDULE_GROUP_ERROR 2019-07-30 09:33:48 +02:00
Joakim Hove
b48f0affea Add size() method to DynamicState 2019-07-30 09:32:26 +02:00
Bård Skaflestad
cc14a83ecf Merge pull request #912 from joakim-hove/windowed-array-zero-size
Add invalid size zero in WindowArray and WindowMatrix
2019-07-29 07:56:38 -05:00
Joakim Hove
ad9448c87d Add invalid size zero in WindowArray and WindowMatrix 2019-07-29 14:09:07 +02:00
Joakim Hove
3655aeb579 Merge pull request #910 from stefoss23/add_keywords_1
Added keywords beginning w/ A
2019-07-27 08:19:09 +02:00
Steinar Foss
57c27d603a added keywords: ALPOLADS, ALSURFAD, ALSURFST. 2019-07-26 18:01:59 +02:00
Steinar Foss
d35a321214 added keywords ALKALINE, ALKROCK. 2019-07-26 16:47:18 +02:00
Joakim Hove
c7532005b2 Merge pull request #905 from joakim-hove/handle-seqindex-private
Make GroupTree::handleSeqIndex() private
2019-07-26 16:40:37 +02:00
Steinar Foss
c24e220626 added keywords: ADDZCORN, AITSOFF, ALKADS. 2019-07-26 16:30:22 +02:00
Steinar Foss
bb8cfc2e60 added keywords: ACTIONR, ACTIONW, ACTPARAM. 2019-07-26 14:22:59 +02:00
Joakim Hove
a304f560d5 Merge pull request #907 from stefoss23/add_keywords_0
added keywork ACTIONG.
2019-07-26 13:59:46 +02:00
Steinar Foss
1073ef3d55 added keywork ACTIONG. 2019-07-26 12:21:09 +02:00
Joakim Hove
787d9d3948 Refactor sequende index mapping in GroupTree 2019-07-26 08:50:53 +02:00
Joakim Hove
8873eb29e4 Merge pull request #906 from joakim-hove/private-iter
Make GroupTree iterators private
2019-07-26 08:45:32 +02:00
Joakim Hove
03b2a5c946 Make GroupTree iterators private 2019-07-26 07:47:54 +02:00
Bård Skaflestad
729948b712 Merge pull request #849 from bska/initfile-sfunc-eps
INIT File Saturation Function End-Point Scaling
2019-07-25 19:47:56 -05:00
Bård Skaflestad
d9fea19c5b INIT: Don't Write Empty TRANNC Vector
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.
2019-07-25 07:15:15 +02:00
Bård Skaflestad
7639dd7e5f INIT/EPS: Output Sentinel Value if Input Defaulted
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.
2019-07-25 07:08:52 +02:00
Bård Skaflestad
43a5a153b1 INIT: Activate EPS-Related Flags in LOGIHEAD
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.
2019-07-25 04:17:58 +02:00
Bård Skaflestad
a06a49b4d8 Refactor EPS Vector Collection to New Helper Class
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.
2019-07-25 04:17:58 +02:00
Bård Skaflestad
cd48199c1e INIT File: Honour FILLEPS Keyword
If the input deck specifies FILLEPS, we should always output
end-point arrays whether or not the vectors are explictly assigned
in the input deck.
2019-07-25 04:17:58 +02:00
Bård Skaflestad
5bcb80ba70 INIT File: Output Scaled End-Point Arrays for Saturation Functions
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.
2019-07-25 04:17:58 +02:00
Bård Skaflestad
ccefe04230 Cell Properties (INIT): Refactor Write Loop Into Helper
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.
2019-07-25 04:17:58 +02:00
Joakim Hove
65c4d91b19 Merge pull request #902 from joakim-hove/iorder-set
Add insert ordered set
2019-07-24 15:03:56 +02:00
Joakim Hove
f386404408 Add insert ordered set 2019-07-24 14:52:49 +02:00
Joakim Hove
28e0b1cc3a Merge pull request #899 from joakim-hove/invalid-group-rate
Remove #define INVALID_GROUP_RATE - just use 0
2019-07-24 08:10:50 +02:00
Joakim Hove
5b1020151b Merge pull request #901 from joakim-hove/reformat-aggregate-group-data
Indentation changes
2019-07-24 08:10:33 +02:00
Joakim Hove
3c77d66cd7 Indentation changes 2019-07-22 17:34:54 +02:00
Joakim Hove
fd49cb7787 Merge pull request #866 from joakim-hove/udq-usage-wip
Udq usage - preparations
2019-07-22 17:13:52 +02:00
Joakim Hove
e14b938fde Add UDAControl enum 2019-07-22 16:07:36 +02:00
Joakim Hove
11fe1d6e03 Maintain insert order in UDQINput 2019-07-22 16:07:36 +02:00
Joakim Hove
2fb64e21d9 Add method UDQDefine::input_string() 2019-07-22 16:07:36 +02:00
Joakim Hove
370ce5de1f Removed public tokens() property for UDQDefine 2019-07-22 16:07:36 +02:00
Joakim Hove
5a39b0e249 Remove #define INVALID_GROUP_RATE - just use 0 2019-07-22 09:21:01 +02:00
Bård Skaflestad
2e1ef048df Merge pull request #897 from joakim-hove/unit-system-refactor
Unit system refactor
2019-07-21 16:55:08 -05:00
Joakim Hove
2ff8816bb7 UnitSystem refactor
- Add new constructor based on deck names 'FIELD', 'METRIC', 'PVT-M' and 'LAB'.
 - Refactor UnitSystem construction.
2019-07-21 13:12:01 +02:00
Bård Skaflestad
eede6b05b5 Merge pull request #896 from tskille/convertECL
convertECL, new option for unified restart file
2019-07-19 22:22:01 -05:00
Torbjørn Skille
a23c87be94 convertECL, new option for unified restart file 2019-07-19 10:39:12 +02:00
Joakim Hove
693395e78d Merge pull request #894 from joakim-hove/group-types
Add enum GroupType
2019-07-19 08:26:26 +02:00
Joakim Hove
6324d5d6c8 Add enum GroupType 2019-07-19 07:20:21 +02:00
Bård Skaflestad
bc1403e1c6 Merge pull request #895 from tskille/ERst
Enabling load on the demand for class ERst
2019-07-18 08:35:17 -05:00
Torbjørn Skille
f509c3e236 Enabling load on the demand for class ERst 2019-07-18 14:49:51 +02:00
Bård Skaflestad
f2fe00b819 Merge pull request #869 from bska/adjust-sogcr-with-swl
Adjust Critical Oil-in-Gas Saturation with Scaled Connate Water Saturation
2019-07-16 08:06:11 -05:00
Bård Skaflestad
a886a2334b GridProperty: Collect Paired Assignment in Single Operation
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
2019-07-15 13:03:21 +02:00
Bård Skaflestad
e79d1396df GridProperty<T>: Track Defaulted Cell Status In More Operations
In particular, update 'm_defaulted' in

  - maxvalue, minvalue
  - maskedSet, maskedCopy
  - copyFrom
  - setScalar
2019-07-15 13:03:21 +02:00
Bård Skaflestad
63c6eeb30e SupportedKeywordInfo: Remark on Hacky Nature of setPostProcessor
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.
2019-07-15 13:03:21 +02:00
Bård Skaflestad
10890cc793 3D Properties: Hook Up adjustSOGCRwithSWL for SGOF
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.
2019-07-15 13:03:21 +02:00
Bård Skaflestad
7494990611 3D Properties: Add Special Purpose Treatment for SOGCR
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.
2019-07-15 13:03:21 +02:00
Bård Skaflestad
9bb64df26e Keyword Information: Add Means to Replace Post-Processor
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.
2019-07-15 13:03:21 +02:00
Bård Skaflestad
ceb9f01571 GridProperty: Pass 'Defaulted' Flag to Post-Processor
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.
2019-07-15 13:03:21 +02:00
Bård Skaflestad
430cc9d7b2 GridProperty<T>: Track Defaulted Cell Status
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.
2019-07-15 13:03:21 +02:00
Joakim Hove
ffba2b114b Merge pull request #888 from joakim-hove/group-names
Add method Schedule::groupNames()
2019-07-15 07:42:22 +02:00
Joakim Hove
160f0f83e1 Remove Schedule::getGroups() 2019-07-15 06:01:44 +02:00
Joakim Hove
7559c31e43 Use Schedule::groupNames() intead of getGroups() 2019-07-15 06:01:44 +02:00
Joakim Hove
6426644ce4 Add method Schedule::groupNames() 2019-07-15 06:01:44 +02:00
Joakim Hove
3d07072f08 Merge pull request #893 from joakim-hove/remove-group-injection-rate
Remove unused group rate
2019-07-14 10:57:21 +02:00
Joakim Hove
2248a1133d Remove unused group rate 2019-07-14 08:33:45 +02:00
Arne Morten Kvarving
2c8e4cb6b0 Merge pull request #891 from akva2/janitoring
Various janitoring
2019-07-10 15:51:10 +02:00
Arne Morten Kvarving
492fba07fc fixed: remove unused assignments 2019-07-10 15:10:29 +02:00
Arne Morten Kvarving
c87acf6571 fixed: remove unused variable and limit scope for another 2019-07-10 15:10:29 +02:00
Arne Morten Kvarving
c720dfe8a8 fixed: move string to avoid copy 2019-07-10 15:10:18 +02:00
Arne Morten Kvarving
b860fdbccc fixed: use initializer list 2019-07-10 09:03:36 +02:00
Arne Morten Kvarving
4dbb33cce6 changed: rescope code relying on grid under if()
rewrite to aid static code analyzer
2019-07-10 09:03:36 +02:00
Arne Morten Kvarving
6a7191c376 fixed: sources should include the extension 2019-07-10 09:03:36 +02:00
Arne Morten Kvarving
6039cfa7ed Merge pull request #890 from akva2/improve_sca_support
Improve static analysis support
2019-07-09 14:40:14 +02:00
Arne Morten Kvarving
3e078e76b1 fix indenting 2019-07-09 14:39:11 +02:00
Arne Morten Kvarving
43c504593f added: static analysis for targets added using opm_add_test 2019-07-09 10:35:40 +02:00
Arne Morten Kvarving
3e576b6332 added: support object libraries in static analysis macro 2019-07-09 10:35:40 +02:00
Arne Morten Kvarving
748fd20e57 fixed: make sure path is absolute before attempting conversion to relative 2019-07-09 10:35:40 +02:00
Arne Morten Kvarving
8d59054112 fixed: make sure not to re-add static analysis tests 2019-07-09 09:49:16 +02:00
Joakim Hove
8d439e6260 Merge pull request #880 from joakim-hove/opmi-loggin
Add basic log output to the opmi application
2019-07-08 13:51:32 +02:00
Joakim Hove
085d7d23b6 Merge pull request #889 from akva2/janitoring
mark constructor explicit
2019-07-08 13:29:52 +02:00
Arne Morten Kvarving
83e2029af4 mark constructor explicit 2019-07-08 11:17:45 +02:00
Joakim Hove
88afb50d09 Merge pull request #881 from joakim-hove/group2
WIP: Group2
2019-07-06 07:30:25 +02:00
Joakim Hove
f0215f1a3d Merge pull request #887 from joakim-hove/normal-libecl-build
Remove hardcoded libecl commit in jenkins pipeline
2019-07-05 17:42:43 +02:00
Kai Bao
2b41c40c58 Merge pull request #878 from GitPaean/welopen_wtest
WELOPEN and WCON* interact with WECON and WTEST
2019-07-05 11:43:14 +02:00
Joakim Hove
1c777c5ba5 Remove hardcoded libecl commit in jenkins pipeline 2019-07-05 11:16:09 +02:00
Kai Bao
011666b3f9 WELOPEN and WCON* interact with WECON and WTEST
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.
2019-07-05 10:01:03 +02:00
Atgeirr Flø Rasmussen
6aabb6958d Merge pull request #883 from atgeirr/allow-no-foamfsc
Allow FOAM without FOAMFSC
2019-07-05 09:24:13 +02:00
Joakim Hove
0694515c69 Merge pull request #886 from joakim-hove/jenkins-libecl-build
Jenkins libecl build
2019-07-05 07:07:04 +02:00
Joakim Hove
7f521652f4 Update libecl pr build 2019-07-04 20:17:21 +02:00
Joakim Hove
8740a8dc1a Update libecl github organisation to equinor 2019-07-04 19:06:35 +02:00
Atgeirr Flø Rasmussen
3f5f4c1b40 Merge pull request #885 from atgeirr/use-fixed-libecl-jenkins
Set default commit to use for libecl to a known OPM-compatible commit
2019-07-04 17:42:27 +02:00
Atgeirr Flø Rasmussen
54c8e107b7 Do not use master branch for libecl by default. 2019-07-04 16:35:48 +02:00
Atgeirr Flø Rasmussen
c3dcedc392 Allow FOAM without FOAMFSC
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.
2019-07-04 12:57:43 +02:00
Atgeirr Flø Rasmussen
e877de94bb Merge pull request #882 from atgeirr/add-wfoam-support
Add WFOAM support
2019-07-04 11:16:46 +02:00
Atgeirr Flø Rasmussen
5144456aa4 Address review comments.
- 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.
2019-07-04 09:23:11 +02:00
Atgeirr Flø Rasmussen
5f8d24c431 Add tests for WFOAM. 2019-07-03 12:39:35 +02:00
Atgeirr Flø Rasmussen
13bd564edf Add WFOAM support to Schedule and Well2. 2019-07-03 12:39:35 +02:00
Atgeirr Flø Rasmussen
0aaf9823c1 Merge pull request #879 from atgeirr/add-foammob
Add FOAMMOB and friends
2019-07-03 12:38:33 +02:00
Joakim Hove
a64745193d Add empty Group2 skeleton 2019-07-03 11:15:51 +02:00
Joakim Hove
fe83324746 Moved Group related files to Group/ folder in filesystem 2019-07-03 11:15:51 +02:00
Atgeirr Flø Rasmussen
f48462841f Add table support for FOAMMOB. 2019-07-03 11:12:12 +02:00
Atgeirr Flø Rasmussen
89acca0fd7 Add FOAMMOB, FOAMOPTS and WFOAM keywords. 2019-07-03 11:12:12 +02:00
Joakim Hove
c41ea17ba6 Add basic log output to the opmi application 2019-07-03 10:16:16 +02:00
Atgeirr Flø Rasmussen
1cd6ebb403 Merge pull request #877 from atgeirr/add-foamrock
Add FOAMROCK including FoamConfig support and test.
2019-07-02 17:53:51 +02:00
Atgeirr Flø Rasmussen
522db6d093 Address issues from review. 2019-07-02 16:58:04 +02:00
Torbjørn Skille
a7aa78b7e9 Update of compareECL. Checks that at least one output file (EGRID, INIT, SMSPEC, RFT or UNRST) present for reference case. Throws if not the case 2019-07-02 15:46:48 +02:00
Atgeirr Flø Rasmussen
33783b1e9f Add FOAMROCK including FoamConfig support and test. 2019-07-02 13:55:42 +02:00
Atgeirr Flø Rasmussen
d61d9c920b Merge pull request #875 from atgeirr/add-foamconfig
Add FoamConfig class and support
2019-07-02 11:45:37 +02:00
Atgeirr Flø Rasmussen
17a2e5d334 Address review comments.
- Use a raw literal.
 - Use 'index', not 'id'.
 - Use FoamConfig(const Deck&) constructor.
2019-07-02 10:43:13 +02:00
Joakim Hove
8f7e6ccd94 Merge pull request #874 from tskille/compareECL
Added new option to compareECL
2019-07-02 07:24:48 +02:00
Torbjørn Skille
51adb23728 Added new option (report steps only) for compareECL for comparing summary results 2019-07-01 16:37:49 +02:00
Atgeirr Flø Rasmussen
7245598952 Include cstddef for std::size_t. 2019-07-01 15:29:21 +02:00
Atgeirr Flø Rasmussen
ba462d67cf Add test for FoamConfig. 2019-07-01 14:40:59 +02:00
Atgeirr Flø Rasmussen
62a3b7334d Add FoamConfig to InitConfig. 2019-07-01 14:40:37 +02:00
Atgeirr Flø Rasmussen
c314464ef3 Add unit support for FoamSurfactantConcentration.
Note that FoamDensity and FoamSurfactantConcentration differ in field units,
as one is then poind/barrel and the other is pound/(1000 cubic feet)!
2019-07-01 14:40:05 +02:00
Atgeirr Flø Rasmussen
57cc97af47 Bugfix: do not use std::fixed output format.
This change lets 1e-20 be printed correctly.
2019-07-01 14:19:41 +02:00
Atgeirr Flø Rasmussen
34d1918a2d Add copyright notice to new files. 2019-07-01 10:49:33 +02:00
Atgeirr Flø Rasmussen
39f8eb18c7 Change class name Foam -> FoamConfig. 2019-07-01 10:47:48 +02:00
Steinar Foss
597bbde151 jenkins will build python. (#865)
Jenkins will build with -DOPM_ENABLE_PYTHON=ON
2019-06-29 08:20:00 +02:00
Joakim Hove
28ba27184a Merge pull request #870 from joakim-hove/udq-summary-name
Make sure that well UDQ with last letter 'L' are included in output
2019-06-29 00:17:53 +02:00
Franz G. Fuchs
4baff64d63 implemented faom config 2019-06-28 12:37:04 +02:00
Joakim Hove
0cf83567eb Make sure that well UDQ with last letter 'L' are included in output 2019-06-28 12:23:33 +02:00
Kai Bao
034488c902 Merge pull request #864 from GitPaean/fixing_maximum_wtest_attempt_with_multiple_wtest
recording the report step that WTEST keyword is specified
2019-06-28 10:36:29 +02:00
Kai Bao
fb8de64487 addressing comments for PR#864 2019-06-28 09:47:40 +02:00
Kai Bao
7c0b2df272 adding test to test the functionality 2019-06-28 09:47:40 +02:00
Kai Bao
290123bc33 Do not keep multiple WTESTWell has same name and reason
when add_well in WellTestConfig .
2019-06-28 09:47:40 +02:00
Kai Bao
11bc26d28d recording the report step that WTEST keyword is specified
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.
2019-06-28 09:47:40 +02:00
Franz G. Fuchs
a68db0a857 update 2019-06-28 09:44:33 +02:00
Franz G. Fuchs
563c6317d4 udpate 2019-06-28 09:43:20 +02:00
Joakim Hove
8dbb8d70fc Merge pull request #868 from joakim-hove/ignore-SUMTHIN
Do not classify 'SUMTHIN' directive as UDQ keyword
2019-06-27 17:53:35 +02:00
Joakim Hove
90ebc66c0b Merge pull request #867 from joakim-hove/rename-enable-python
Rename cmake symbol ENABLE_PYTHON -> OPM_ENABLE_PYTHON
2019-06-27 16:17:37 +02:00
Joakim Hove
d32e0f6eaf Do not classify 'SUMTHIN' directive as UDQ keyword 2019-06-27 16:11:02 +02:00
Joakim Hove
dba43a4a5e Rename cmake symbol ENABLE_PYTHON -> OPM_ENABLE_PYTHON 2019-06-27 15:19:03 +02:00
Joakim Hove
82535a9136 Merge pull request #863 from stefoss23/python_subdir
Python subdirectory
2019-06-27 12:54:43 +02:00
Joakim Hove
ad9c818574 Merge pull request #858 from atgeirr/more-warnings
Turn on -Wextra and -Wshadow warning flags.
2019-06-27 12:53:45 +02:00
Steinar Foss
143c73cdd0 ENABLE_PYTHON OFF. 2019-06-27 12:31:38 +02:00
Steinar Foss
ef936afeaa opm set to PIC with PYTHON ON. 2019-06-27 12:10:02 +02:00
Bård Skaflestad
5bed559f96 Merge pull request #860 from atgeirr/foam_module
Foam module
2019-06-26 11:54:17 +02:00
Atgeirr Flø Rasmussen
c26538f433 Merge pull request #862 from joakim-hove/warnings
Warnings
2019-06-26 11:04:00 +02:00
Joakim Hove
0d5cd70536 Merge pull request #854 from GitPaean/fixing_maximum_wtest_attempt
not removing the well from WellTestState when testing is successful
2019-06-26 09:20:31 +02:00
Joakim Hove
7475636610 Rename arguments to avoid shadowing 2019-06-26 07:51:36 +02:00
Joakim Hove
cd43bb7a5f Remove debug printf() 2019-06-26 07:51:36 +02:00
Joakim Hove
b116eda8bc Remove unused arguments 2019-06-26 07:51:36 +02:00
Joakim Hove
29697a0906 Remove members keywords1 and keywords2 from EclFilesComparator 2019-06-26 07:51:36 +02:00
Kai Bao
28110584a3 removing funciton dropWell for WellTestState 2019-06-25 22:18:55 +02:00
Kai Bao
c0c9d70dcf not removing the well from WellTestState when testing is successful 2019-06-25 22:15:28 +02:00
Joakim Hove
fbfdf5c244 Merge pull request #844 from GitPaean/fixing_warnings
Fixing warnings
2019-06-25 21:08:12 +02:00
Bård Skaflestad
c63e23c140 Allow Saturation Region = 0 in Deactivated Cells
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).
2019-06-25 20:51:11 +02:00
Bård Skaflestad
465ab091e0 Support Automatic Generation of Scaled Endpoint Arrays
The endpoint arrays (SWLPC, SGU, KRORW etc) can all be automatically
generated from the unscaled input saturation function tables.
2019-06-25 20:51:11 +02:00
Joakim Hove
189e84d40e Merge pull request #856 from bska/internalize-filleps-kw
InitConfig: Internalize FILLEPS Keyword
2019-06-25 20:49:25 +02:00
Joakim Hove
b0d180b409 Merge pull request #861 from GitPaean/default_reason_wtest
for WTEST, the reason default to be ``
2019-06-25 20:43:38 +02:00
Kai Bao
a8396de668 for WTEST, the reason default to be `` 2019-06-25 15:13:46 +02:00
Atgeirr Flø Rasmussen
ae7ea2a286 Silence some switch-case warnings. 2019-06-25 14:51:40 +02:00
Franz G. Fuchs
694d17a228 added copyright statement 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
a84771013b remove commented out code 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
31415679f7 defined FoamDensity, added test 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
ecc653cce4 foamadstable added 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
bb292365ff added Foamadstable 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
95070310f3 changed order 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
6efe981234 use correct size of bit set, test added 2019-06-25 13:32:11 +02:00
Franz G. Fuchs
2fbf3c4fc9 added keyword for foam 2019-06-25 13:32:11 +02:00
Kai Bao
ca7fe55934 silencing shadowing warnings 2019-06-25 13:16:41 +02:00
Kai Bao
a3d411279f removing redeclaration of function setKeywordBox 2019-06-25 11:44:35 +02:00
Atgeirr Flø Rasmussen
4de0a7e9e3 Turn on -Wextra and -Wshadow warning flags. 2019-06-25 11:18:47 +02:00
Bård Skaflestad
ffecc035c0 InitConfig: Internalize FILLEPS Keyword
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.
2019-06-24 14:15:55 +02:00
Joakim Hove
763702fd0f Merge pull request #774 from joakim-hove/use-UDAValue
Use uda value
2019-06-24 13:56:25 +02:00
Joakim Hove
6eea66a332 Use UDAValue for rates and pressure limits in WCONPROD & WCONINJE 2019-06-24 12:54:07 +02:00
Joakim Hove
a4eeb57a58 Merge pull request #855 from joakim-hove/uda-value-raw
When writing deck output the UDAValue will write raw values
2019-06-24 12:53:44 +02:00
Joakim Hove
4a08b57b23 When writing deck output the UDAValue will write raw values 2019-06-24 11:53:56 +02:00
Joakim Hove
65f8812e46 Merge pull request #847 from joakim-hove/rft-first-open-bug
Fix bug in RFTConfig first open - for WRFTPLT keyword
2019-06-24 10:02:03 +02:00
Joakim Hove
b14bd5acce Merge pull request #848 from joakim-hove/scan-ignore-SOH
Ignore character SOH (ASCII 1) while parsing
2019-06-24 10:01:51 +02:00
Joakim Hove
677009317e Merge pull request #834 from bska/init-from-EclOutput
Replace LibECL Backend in Flow's INIT File Writing
2019-06-24 10:01:40 +02:00
Bård Skaflestad
e487dc1da5 writeInitial: Switch to Using InitIO::write() for INIT
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.
2019-06-24 09:52:56 +02:00
Bård Skaflestad
281f701f27 writeInitial(): Don't Copy 'int_data' Unnecessarily
The object does potentially hold multiple grid-sized vectors and we
already have a copy on entry into the function.  We can use move().
2019-06-24 09:52:56 +02:00
Bård Skaflestad
fa37250446 INIT File: Add Writer Based on OutputStream::Init
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().
2019-06-24 09:52:56 +02:00
Bård Skaflestad
323e9903b4 File Output: Add Manager for 'INIT' File Based on EclOutput
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.
2019-06-24 09:52:56 +02:00
Joakim Hove
a4b9b0d460 Merge pull request #851 from joakim-hove/uda-wconprod-resv
Use UDA for WCONPROD::RESV
2019-06-24 09:33:28 +02:00
Joakim Hove
cbc7394d60 Use UDA for WCONPROD::RESV 2019-06-24 08:29:14 +02:00
Joakim Hove
9ed68a9f1f Merge pull request #850 from joakim-hove/add-uda-test-deck
Add test deck for UDA simulation
2019-06-24 07:49:28 +02:00
Joakim Hove
ab6ea86eac Add test deck for UDA simulation 2019-06-24 07:36:36 +02:00
Joakim Hove
747a643288 Ignore character SOH (ASCII 1) while parsing 2019-06-23 12:09:54 +02:00
Joakim Hove
41a74beb3e Fix bug in RFTConfig first open - for WRFTPLT keyword 2019-06-23 10:21:40 +02:00
Joakim Hove
886e90c770 Merge pull request #846 from joakim-hove/remove-summarystate-reset-testing
Remove SUmmaryState::reset() testing
2019-06-23 10:14:58 +02:00
Joakim Hove
6bbfd66744 Minor testing of UDQValue 2019-06-23 09:10:39 +02:00
Joakim Hove
0f52c6a0ee Cleanuup 2019-06-23 08:45:59 +02:00
Joakim Hove
fe6fdf4589 Remove SUmmaryState::reset() testing 2019-06-23 08:32:22 +02:00
Joakim Hove
0631d4ad01 Merge pull request #842 from joakim-hove/well-prop-name
Well prop name
2019-06-22 11:47:43 +02:00
Joakim Hove
746a62b149 Add udq_default argument when creating ProductionControls 2019-06-22 08:01:25 +02:00
Joakim Hove
e4d030c891 Add argument when calling injection controls 2019-06-22 08:01:25 +02:00
Joakim Hove
bf6a0335b0 Add name property to WellInjectionProperties 2019-06-22 08:01:25 +02:00
Joakim Hove
96b7797c4e Add name to WellProductionPropertis 2019-06-22 08:01:25 +02:00
Joakim Hove
f8aa13f6e8 Merge pull request #841 from joakim-hove/add-st-arg
Add st arg
2019-06-21 22:38:06 +02:00
Joakim Hove
ead8cfc1e9 Merge pull request #840 from joakim-hove/aggregate-well-data-uda
Aggregate well data uda
2019-06-21 22:23:44 +02:00
Joakim Hove
98aafa4a9e Pass unused SummaryState argument 2019-06-21 21:24:07 +02:00
Joakim Hove
260365870a Merge pull request #839 from joakim-hove/summarystate-operator<<
Summarystate operator<<
2019-06-21 21:03:31 +02:00
Joakim Hove
df74ac102e Use proper SummaryState argument in AggregateWellData 2019-06-21 21:01:25 +02:00
Joakim Hove
2ecfa6e7b2 Add basic operator<< for SummaryState 2019-06-21 19:32:51 +02:00
Joakim Hove
5604c4c3ba Add basic operator<< for SummaryState 2019-06-21 19:22:27 +02:00
Joakim Hove
3d7bcb19ee Merge pull request #837 from bska/fix-aquct-numrec
Don't Infer Number of AQUFETP Records from AQUDIMS
2019-06-21 18:57:50 +02:00
Bård Skaflestad
63c802666d Don't Infer Number of AQUFETP Records from AQUDIMS
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.
2019-06-21 18:06:43 +02:00
Joakim Hove
036951444c Merge pull request #838 from joakim-hove/udq-ast-something
UDQASTNode: check if well/group exists before assigning
2019-06-21 18:04:16 +02:00
Joakim Hove
217e63b1fd UDQASTNode: check if well/group exists before assigning 2019-06-21 16:53:23 +02:00
Joakim Hove
c9ca9717bc Merge pull request #836 from atgeirr/silence-warnings
Silence shadowing warnings
2019-06-21 16:21:42 +02:00
Atgeirr Flø Rasmussen
4018e4b70b This silences many, but not all shadowing warnings in opm-common.
Includes minor refactoring of ESMry and AggregateGroupData undertaken
with the aid of the original authors to ensure correctness.
2019-06-21 14:48:23 +02:00
Bård Skaflestad
b72439387e Merge pull request #835 from bska/fix-test-failures
Copy SPE1_TESTCASE.[FX]0025 to Build Directory
2019-06-21 12:40:18 +02:00
Bård Skaflestad
5395add039 Copy SPE1_TESTCASE.[FX]0025 to Build Directory
Restores 'test_ERst' Unit Test.

Pointy Hat: @bska
2019-06-21 10:29:54 +02:00
Bård Skaflestad
f71dec426a Merge pull request #832 from tskille/ERst
Modified class ERst, added 1 new test to test_ERst
2019-06-21 10:10:55 +02:00
Joakim Hove
bf752c81a5 Merge pull request #833 from joakim-hove/usa-UDAValue-init
Usa uda value init
2019-06-20 14:09:19 +02:00
Joakim Hove
fcdca4a4d7 UDA: GCONPROD 2019-06-20 12:38:20 +02:00
Joakim Hove
acfa281f77 UDA: GCONINJE 2019-06-20 12:36:23 +02:00
Joakim Hove
1da4bd2ea4 UDA: GECON 2019-06-20 12:14:13 +02:00
Joakim Hove
729dc8dbd9 UDA: WSOLVENT 2019-06-20 12:11:57 +02:00
Joakim Hove
7a8d092c8b UDA: WTRACER 2019-06-20 12:11:17 +02:00
Joakim Hove
1c8d0bb0ab UDA: WECON 2019-06-20 12:08:13 +02:00
Joakim Hove
36651b803c UDA: WPOLYMER 2019-06-20 12:07:29 +02:00
Joakim Hove
e360b4b34e Add private utility to evaluate well related UDA 2019-06-20 12:05:10 +02:00
Steinar Foss
af2e3190a2 python tests: runs ok directly under opm-common. 2019-06-20 12:04:09 +02:00
Joakim Hove
73839c43d2 Moved file injection.hpp 2019-06-20 11:24:49 +02:00
Joakim Hove
3f2eefc638 UDQContext:
- add member const UDQParams&
- add functions has_well_var() and has_group_var()
2019-06-20 11:20:47 +02:00
Steinar Foss
da1fb0b744 python compiles directly. 2019-06-20 10:05:53 +02:00
Torbjørn Skille
7394a654bb Modified class ERst, added 1 new test to test_ERst 2019-06-19 22:35:49 +02:00
Joakim Hove
7e5c9dee67 Merge pull request #830 from stefoss23/compile_sunbeam2
Compile sunbeam2
2019-06-19 15:41:17 +02:00
Joakim Hove
c638e5d1a0 Merge pull request #828 from joakim-hove/well-udq-params
Add member udq_undefined to Well2 object
2019-06-19 15:37:29 +02:00
Joakim Hove
2da74c7d80 Merge pull request #829 from bska/groupid-out-of-bounds
INTEHEAD: Store Actual Maximum Number of Groups in Item 21
2019-06-19 15:36:33 +02:00
Steinar Foss
5e88782e51 sunbeam test schedule.py works for new Well2. 2019-06-19 14:43:59 +02:00
Steinar Foss
24f44c1c64 sunbeam test connections.py works for new Well2. 2019-06-19 14:06:20 +02:00
Steinar Foss
4161a1339a test well.py all pass with new Well2. 2019-06-19 13:51:43 +02:00
Joakim Hove
7d0b6f1bf6 Add member udq_undefined to Well2 object 2019-06-19 13:24:21 +02:00
Bård Skaflestad
212150e7b8 INTEHEAD: Store Actual Maximum Number of Groups in Item 21
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
2019-06-19 13:23:34 +02:00
Steinar Foss
a1d4fe13af sunbeam scheduls: get_wells as a function. 2019-06-19 11:51:38 +02:00
Steinar Foss
55f9c8c24f can compile sunbeam. 2019-06-19 11:41:37 +02:00
Joakim Hove
599ed7136f Merge pull request #819 from stefoss23/compile_sunbeam
WIP: Compile sunbeam
2019-06-19 09:47:06 +02:00
Atgeirr Flø Rasmussen
93256637af Merge pull request #825 from akva2/janitoring
More janitoring
2019-06-19 09:35:49 +02:00
Arne Morten Kvarving
fc4fa45b69 mark constructors explicit 2019-06-19 08:19:56 +02:00
Arne Morten Kvarving
faff634bab use initializer list 2019-06-19 08:19:56 +02:00
Arne Morten Kvarving
b259c807fd remove unused variable 2019-06-19 08:19:56 +02:00
Joakim Hove
ef949aef7e Merge pull request #822 from bska/fix-groupsize-criterion
Array Dimension Checker: Correct Groupsize Criterion
2019-06-18 17:33:30 +02:00
Bård Skaflestad
52881467d6 Array Dimension Checker: Correct Groupsize Criterion
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
2019-06-18 15:31:06 +02:00
Joakim Hove
d2f692ebae Merge pull request #818 from joakim-hove/udq-eval-scalar-wells
UDQSet::eval - make sure to return well node
2019-06-17 18:56:35 +02:00
Joakim Hove
e6d299c726 Merge pull request #821 from akva2/janitoring
remove unused variables
2019-06-17 18:55:12 +02:00
Joakim Hove
a2817325fd Merge pull request #820 from joakim-hove/well2-injector-type
Add Well2::injectorType() accessor
2019-06-17 18:50:18 +02:00
Steinar Foss
ea208bbd56 pybind11: added note to README file. 2019-06-17 09:55:59 +02:00
Steinar Foss
79a5ba09e2 removed sunbeam specific files. 2019-06-17 09:42:01 +02:00
Arne Morten Kvarving
2c82787ee9 remove unused variables
quell warnings
2019-06-17 09:08:47 +02:00
Joakim Hove
1bc47ca8a2 Add Well2 accesor functions which bypass SummaryState 2019-06-17 07:39:23 +02:00
Steinar Foss
d73d0ccc99 added from libecl FindPythonModule/PythonPackage, from pycmake pycmake_test_runner. 2019-06-16 22:00:41 +02:00
Steinar Foss
5bc282d60e removed pycmake. 2019-06-16 19:13:47 +02:00
Joakim Hove
c09bc36c03 UDQSet::eval - make sure to return well node 2019-06-16 08:42:54 +02:00
Joakim Hove
87d13c24f1 Merge pull request #817 from akva2/janitoring
Some janitoring
2019-06-15 07:49:39 +02:00
Joakim Hove
f01ed130af Merge pull request #813 from joakim-hove/udq-eval-set
Udq eval set
2019-06-14 16:55:51 +02:00
Steinar Foss
51b484d930 python/CMakeLists: changed pycmake path. 2019-06-14 16:42:37 +02:00
Arne Morten Kvarving
cc5b74fa94 fix parameter and member name being the same
this might have worked as-is, but it is very very confusing.
change parameter name to make code clearer.
2019-06-14 16:18:47 +02:00
Arne Morten Kvarving
53c1e07edf initialize variables
strictly speaking we throw whenever these are used uninitialized,
but the compiler does not realize -> initialize to quell warnings.
2019-06-14 16:17:41 +02:00
Arne Morten Kvarving
542353b118 remove unused lambda capture
consequently the variable is unused. remove it
2019-06-14 16:17:14 +02:00
Arne Morten Kvarving
2c5d0af37a remove unused lambda capture 2019-06-14 16:16:53 +02:00
Joakim Hove
51a779df67 Merge pull request #816 from joakim-hove/remove-summary-args
Remove unused arguments from EclipseIO::writeTimestep()
2019-06-14 16:05:50 +02:00
Arne Morten Kvarving
7a1ed147f4 fixed: forward struct as struct 2019-06-14 16:05:21 +02:00
Steinar Foss
141aa41e30 added embedded repo pycmake. 2019-06-14 14:45:08 +02:00
Joakim Hove
5748d06914 Remove unused arguments from EclipseIO::writeTimestep() 2019-06-14 14:38:25 +02:00
Steinar Foss
8d2398612b added embedded repo pybind11. 2019-06-14 14:34:20 +02:00
Steinar Foss
327e6c3a5c removed submodules pycmake and pybind11. 2019-06-14 14:32:08 +02:00
Steinar Foss
d45731a205 added option ENABLE_PYTHON. 2019-06-14 13:20:51 +02:00
Joakim Hove
772bd3cee5 UDQ: Ensure that scalar right hand side is accepted into sets 2019-06-14 11:54:12 +02:00
Joakim Hove
83cb209ad8 DeckItem: call set_dim for UDAValue objects 2019-06-14 11:47:59 +02:00
Joakim Hove
49ac8e85d6 DeckItem: improve error message for value type mismatch 2019-06-14 11:47:59 +02:00
Joakim Hove
a19d253aa7 UDQParser: verify the UDQVarType of the expression 2019-06-14 11:47:59 +02:00
Joakim Hove
eb05c5b6aa Add SummaryState argument to Summary fn_args context 2019-06-14 11:47:59 +02:00
Joakim Hove
9087323265 UDQ: add function for string name of UDQ variable types 2019-06-14 11:47:59 +02:00
Joakim Hove
fac74432d4 msim updates:
- add boolean flag report_only to simulation run.
 - add SummaryState argument to well rate callbacks
2019-06-14 11:47:59 +02:00
Joakim Hove
6376e4dcc6 Merge pull request #810 from bska/drop-libeclrestart
Drop "libeclrestart"
2019-06-14 11:17:26 +02:00
Bård Skaflestad
b630ecfb5b RestartIO: Drop LibECLRestart Component
It is no longer needed since both save() and load() now use ERst and
EclOutput.
2019-06-13 16:06:48 +02:00
Bård Skaflestad
8cdc72549d RestartIO: Prune Unused Headers in Public Interface 2019-06-13 16:06:48 +02:00
Bård Skaflestad
6aea354ff4 Merge pull request #811 from tskille/master
Use tolerances from command line for restart array SWEL
2019-06-13 15:32:09 +02:00
Torbjørn Skille
66e8068494 Use tolerances from command line for restart array SWEL 2019-06-12 19:06:52 +02:00
Joakim Hove
193eeca5ff Merge pull request #797 from bska/load-using-ERst
Reimplement RestartIO::load() in Terms of Class ERst
2019-06-12 13:50:22 +02:00
Bård Skaflestad
d1ec2e151c RestartIO::load: Prune 'sim_step' Where Possible 2019-06-12 12:03:55 +02:00
Bård Skaflestad
3d6ace0f97 RestartIO: Reimplement load() in Terms of ERst
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.
2019-06-12 12:03:55 +02:00
Bård Skaflestad
71c046bef4 Merge pull request #808 from joakim-hove/injection-unitsystem
Add UnitSystem member to Well2 class
2019-06-12 11:46:45 +02:00
Bård Skaflestad
0a3d26e9be Merge pull request #806 from joakim-hove/UDAValue-reset
Uda value reset
2019-06-12 11:02:48 +02:00
Joakim Hove
edbc9d2af7 UDAValue: add reset() methods 2019-06-12 10:13:01 +02:00
Joakim Hove
44e21101bc UDAValue: the get<double>() method will return SI values 2019-06-12 10:13:01 +02:00
Joakim Hove
f3abbf4981 UDAValue: add method assert_numeric() 2019-06-12 10:13:01 +02:00
Bård Skaflestad
ba2a12e876 Merge pull request #795 from joakim-hove/use-eval-timestep
Use eval timestep
2019-06-11 20:34:31 +02:00
Atgeirr Flø Rasmussen
1c14c0d921 Merge pull request #807 from GitPaean/tesing_master
some white space cleaning up
2019-06-11 15:50:28 +02:00
Joakim Hove
3961f724db Add UnitSsystem member to Well2 class 2019-06-08 12:39:22 +02:00
Kai Bao
0c43f49f13 some white space cleaning up 2019-06-07 14:57:54 +02:00
Joakim Hove
08305b6e30 Extract Summary::eval() out from Summary::add_timestep() 2019-06-07 14:45:18 +02:00
Joakim Hove
51bd7a197d Merge pull request #805 from OPM/joakim-hove-patch-1
Update url to equinor repo in submodule
2019-06-07 09:06:52 +02:00
Joakim Hove
498a1bb677 Update url to equinor repo in submodule 2019-06-07 08:43:28 +02:00
Joakim Hove
bab231287e Merge pull request #804 from markusdregi/submodule_fix
Move .gitmodules to root
2019-06-07 08:27:09 +02:00
Markus Fanebust Dregi
ebcac44715 Move .gitmodules to root 2019-06-07 08:26:15 +02:00
Joakim Hove
edfacf2af8 Merge pull request #801 from joakim-hove/uda-operator<<
Add operator<< support to UDAValue
2019-06-06 17:14:08 +02:00
Joakim Hove
40b556112f Add operator<< support to UDAValue 2019-06-06 15:58:36 +02:00
Bård Skaflestad
7413ce5a40 Merge pull request #800 from joakim-hove/add-report-step-accessor
Add public access to report_step in RestartView()
2019-06-06 13:35:13 +02:00
Joakim Hove
66fee23319 Add public access to report_step in RestartView() 2019-06-06 12:19:10 +02:00
Bård Skaflestad
dff91dd742 Merge pull request #798 from joakim-hove/summary-total-fixup
Update total check in SummaryState
2019-06-06 11:06:54 +02:00
Joakim Hove
82f88ce973 Update total check in SummaryState 2019-06-06 09:39:33 +02:00
Bård Skaflestad
b1067dbc98 Merge pull request #793 from joakim-hove/serialize-summary-state
Add serialization of SummaryState
2019-06-05 15:45:13 +02:00
Bård Skaflestad
4cde0ac8a8 Merge pull request #796 from bska/ERst-separate-files
Teach ERst About Separate Restart Files
2019-06-04 23:53:06 +02:00
Bård Skaflestad
a3074d12b5 Teach ERst About Separate Restart Files
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.
2019-06-04 11:01:13 +02:00
Joakim Hove
6af9b00bee Merge pull request #792 from bska/save-using-EclOutput
Re-implement RestartIO::save() in Terms of OutputStream::Restart
2019-06-03 22:57:39 +02:00
Joakim Hove
ec20274fa3 Add serialization of SummaryState 2019-06-03 14:55:38 +02:00
Bård Skaflestad
8d65ba4e49 OutputStream::Restart: Don't Mention 'prepareStep'
The member function does not exist.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
16e49a0223 RestartIO: Reimplement save() in Terms of OutputStream::Restart
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.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
c98bf7d4c8 Ecl Output: Add write<>() Support for PaddedOutputString<8>
This is in preparation of using the EclOutput output facility in

    RestartIO::save()
2019-06-03 14:19:48 +02:00
Bård Skaflestad
725ac521ba Promote 'CharArrayNullTerm' to EclIO::PaddedOutputString
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.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
82b0a2d82b ECLIPSE I/O: Rename Namespace Opm::ecl -> Opm::EclIO
This reduces the risk of conflicting with the 'ecl' namespace from
LibECL, especially when the latter name is used from within the Opm
namespace.
2019-06-03 14:19:48 +02:00
Bård Skaflestad
cb106240bf Merge pull request #794 from joakim-hove/summary-state-totals
Correctly detect totals in SummaryState
2019-06-03 14:17:34 +02:00
Joakim Hove
89c8cb886b Correctly detect totals in SummaryState 2019-06-03 12:42:51 +02:00
Bård Skaflestad
9aee2bee71 Merge pull request #668 from joakim-hove/udq-fieldset
UDQ field and group variables
2019-06-03 12:01:37 +02:00
Bård Skaflestad
0757bd97cf Merge pull request #791 from bska/restart-output-code-reformat
Restart Output Code Reformatting
2019-05-29 11:07:17 +02:00
Bård Skaflestad
add1a96d99 Restart Well Data: Restore Indentation
Whitespace only.
2019-05-29 09:28:40 +02:00
Bård Skaflestad
8eda3aaa15 Restart::save(): Prune 'sim_step' Where Possible
Enabled by commit 94b16025.
2019-05-29 09:12:58 +02:00
Joakim Hove
32a1c3b5da Merge pull request #762 from joakim-hove/well-controls
Well controls
2019-05-29 06:46:47 +02:00
Arne Morten Kvarving
7ec2ee9bff Merge pull request #789 from akva2/fix_filesystem_generic
fixed: avoid usage of boost::filesystem::path::generic()
2019-05-28 09:11:37 +02:00
Arne Morten Kvarving
c9d1c50986 fixed: avoid usage of boost::filesystem::path::generic()
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.
2019-05-28 06:28:57 +02:00
Joakim Hove
48c363dafa Merge pull request #783 from bska/add-restart-io-operations
Add Restart I/O Operations to New ECLIPSE I/O Classes
2019-05-27 23:06:54 +02:00
Bård Skaflestad
a2ec7d7f6d OutputStream::Restart: Pull File Creation Into Constructor
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()).
2019-05-27 21:00:52 +02:00
Bård Skaflestad
df1a011b78 Redo Public Interface of OutputStream::Restart
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
2019-05-27 21:00:52 +02:00
Bård Skaflestad
992d3b0ce5 Restart Output: Add File Management Facility
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.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
c71f57f635 Ecl Output: Add Support for Opening File in Specific Mode
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.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
2580a273f4 Ecl Output: Add Support for Generating Messages
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.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
b9aeeab005 ERst: Support Retrieving File Position of Particular SEQNUM
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.
2019-05-27 21:00:52 +02:00
Bård Skaflestad
0dfe6ce7da Ecl File: Add Method to Convert Linear Array Index to File Position
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.
2019-05-27 21:00:52 +02:00
Joakim Hove
2682eef9b3 Merge pull request #788 from joakim-hove/remove-welltest
Removed well testing from Schedule constructor
2019-05-27 20:13:45 +02:00
Joakim Hove
8189dd8c9f Merge pull request #785 from joakim-hove/summary-state-num
Add size() and num_wells() methods to SummaryState
2019-05-27 20:13:35 +02:00
Joakim Hove
5c65299c0a Add size() and num_wells() methods to SummaryState 2019-05-27 17:56:27 +02:00
Joakim Hove
35a70310c6 Removed well testing from Schedule constructor 2019-05-27 17:47:55 +02:00
Joakim Hove
54af290cc0 Extend UDQ eval code
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.
2019-05-27 16:43:22 +02:00
Joakim Hove
c8b0988191 Add size() and num_wells() methods to SummaryState 2019-05-27 16:43:22 +02:00
Joakim Hove
e6b8e53d0a Merge pull request #786 from joakim-hove/summarystate-group-var
Add group awareness to SummaryState
2019-05-27 16:43:00 +02:00
Joakim Hove
779a2b8d89 Add group awareness to SummaryState 2019-05-27 14:38:13 +02:00
Joakim Hove
0c23aafc34 Merge pull request #784 from joakim-hove/UDQ-test-only-one
UDQ error test - use correct well variablec
2019-05-27 12:32:01 +02:00
Joakim Hove
4439882402 UDQ error test - use correct well variablec 2019-05-27 09:44:14 +02:00
Joakim Hove
8e87ffc7da Merge pull request #781 from akva2/janitoring
Remove unused variables and reduce scope
2019-05-24 15:44:48 +02:00
Joakim Hove
418241137c Rebase fixup 2019-05-24 15:31:27 +02:00
Joakim Hove
01db100439 WellProductionProperties and WellInjectionProperties are private 2019-05-24 15:31:27 +02:00
Joakim Hove
e3d9ef07eb Temporarily reverted UDA -> double in keyword def. 2019-05-24 15:31:27 +02:00
Joakim Hove
51aee6e8cb Add structs InjectionControls and ProductionControls 2019-05-24 15:31:27 +02:00
Joakim Hove
73667596fc Add some testing 2019-05-24 15:31:27 +02:00
Arne Morten Kvarving
9dacc42c8a reduce scope of variables 2019-05-24 14:31:26 +02:00
Arne Morten Kvarving
8fdb08b0ad remove unused variables 2019-05-24 14:31:21 +02:00
Joakim Hove
0942e2dce1 Merge pull request #720 from GitPaean/throw_for_problem_in_compsegs
throw when end distance not bigger than start distance in COMPSEGS
2019-05-24 13:34:45 +02:00
Kai Bao
01c0820d4c addressing reviewing comments from PR#720
and adding more tests
2019-05-24 10:19:50 +02:00
Kai Bao
d11d26a2f1 adding test WrongDistanceCOMPSEGS 2019-05-24 10:19:50 +02:00
Kai Bao
584defebe0 ParseContext is used to handle the exceptions when parsing COMPSEGS 2019-05-24 10:19:50 +02:00
Kai Bao
43c5d3509a throw when end distance not bigger than start distance in COMPSEGS 2019-05-24 10:19:50 +02:00
Joakim Hove
1caf9ecff0 Merge pull request #761 from joakim-hove/sunbeam
Sunbeam import
2019-05-24 09:44:12 +02:00
Bård Skaflestad
51c805d280 Merge pull request #763 from bska/import-eclio-into-common
Import New ECLIPSE I/O Classes Into Main OPM Common Library
2019-05-23 15:07:30 +02:00
Bård Skaflestad
eb24f72e5e Ecl Output: Consume Facilities from 'std' Namespace
No functional changes.
2019-05-23 10:23:02 +02:00
Bård Skaflestad
e654915069 Move ECLIPSE I/O Into Main OPM Common Library
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.
2019-05-23 10:23:01 +02:00
Joakim Hove
464bc4b795 Merge pull request #731 from joakim-hove/remove-old-well
Remove old well
2019-05-22 23:15:58 +02:00
Joakim Hove
94b160258e Remove old well implementation 2019-05-22 21:44:50 +02:00
Bård Skaflestad
1d31de03c7 Merge pull request #765 from tskille/compareECL
update of compareECL, failes test if output file present for reference
2019-05-22 13:32:10 +02:00
Joakim Hove
ad9cc20258 Merge pull request #779 from joakim-hove/new-keywords
New keywords
2019-05-22 11:52:47 +02:00
Joakim Hove
c0ccd06250 Add keyword GCONSALE 2019-05-22 07:13:57 +02:00
Joakim Hove
eb2c0b7441 Add keyword BRANPROP 2019-05-22 07:13:57 +02:00
Joakim Hove
c986c49113 Add keyword NODEPROP 2019-05-22 07:13:57 +02:00
Joakim Hove
5a31ae874b Add keyword GUIDERAT 2019-05-22 07:13:57 +02:00
Joakim Hove
cd55d69ef7 Add keyword GCONSUMP 2019-05-22 07:13:57 +02:00
Joakim Hove
76acb98c67 Add keyword GPMAINT 2019-05-22 07:13:57 +02:00
Joakim Hove
30a1a0b26e Improve error message for invalid json 2019-05-22 07:13:57 +02:00
Joakim Hove
16dabd5dc4 Merge pull request #777 from joakim-hove/well2-prediction-mode
Add method bool Well2::predictionMode()
2019-05-21 06:52:59 +02:00
Joakim Hove
272d0fc9a1 Merge pull request #776 from joakim-hove/parse-WOPRL
Parse WOPRL
2019-05-20 16:31:35 +02:00
Joakim Hove
8231b84a11 Add method bool Well2::predictionMode() 2019-05-20 16:13:20 +02:00
Joakim Hove
c1f60b769c Split summary keywords WxxxL in separate config 2019-05-20 12:52:05 +02:00
Joakim Hove
d42e86426f Remove extra whitespace 2019-05-20 12:34:37 +02:00
Bård Skaflestad
4010399f08 Merge pull request #773 from tskille/convertECL
Fix issue with missing STARTSOL and ENDSOL headers when converting un…
2019-05-15 16:01:43 +02:00
Bård Skaflestad
5f43a18050 Merge pull request #758 from jalvestad/pvt-type-eclrst
Generalize eclipse compatible restart to a broad set of PVT-options
2019-05-15 13:44:33 +02:00
Torbjørn Skille
cf970df48f Fix issue with missing STARTSOL and ENDSOL headers when converting unified restart files 2019-05-15 10:25:55 +02:00
Atgeirr Flø Rasmussen
c1f4c69c30 Merge pull request #772 from blattms/alternative-clang-fix
Fixes clang linking error when using std::vector<bool>::const_reference.
2019-05-15 09:20:07 +02:00
Joakim Hove
0c70d71df8 Merge pull request #766 from joakim-hove/summary-eval
Split Summary::add_timestep in eval()
2019-05-15 07:02:57 +02:00
Joakim Hove
07b02ed151 Factor out eval() method from Summary::add_timestep() 2019-05-15 06:58:10 +02:00
Bård Skaflestad
2c7eb20726 Merge pull request #724 from jalvestad/cell-summary-props
Changes to provide Summary output of more Block properties
2019-05-14 18:30:36 +02:00
Markus Blatt
255ffc5bba Fixes clang linking error when using std::vector<bool>::const_reference.
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.
2019-05-14 14:12:42 +02:00
Jostein Alvestad
d7e41a5ac0 Remove two tests for initalisation in conflict with more general model 2019-05-14 09:40:13 +02:00
Bård Skaflestad
d554334316 Merge pull request #768 from joakim-hove/summary-state-update
Summary state update
2019-05-13 18:22:02 +02:00
Jostein Alvestad
4989c6cfec Added change to improve code quality
Make sure that the changes made in PVTModel is not overwritten by
variousParam
2019-05-13 15:36:20 +02:00
Jostein Alvestad
c92d74107f Initial changes for allowing all pvt-type data for eclipse restart file 2019-05-13 15:36:19 +02:00
Jostein Alvestad
8126e8cb66 Added initial change to account for different PVT-types in ECL Restart file
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
2019-05-13 15:36:18 +02:00
Jostein Alvestad
ba1c30fd4a Added unit tests for grid block summary data variables 2019-05-13 15:29:57 +02:00
Jostein Alvestad
25f25d15bf Added unit tests to new grid block summary properties 2019-05-13 15:29:56 +02:00
Jostein Alvestad
bd58468930 changes to allow Summary output of additional block variables
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.
2019-05-13 15:29:56 +02:00
Jostein Alvestad
546517784e Initial changes to add more block props to summary file
this  branch will add
BOSAT
BWKR
BKRW (=BWKR)
BOKR
BKRO (=BOKR)
BGKR
BKRG (=BGKR)
to summary file
2019-05-13 15:29:55 +02:00
Joakim Hove
9e288a9d78 Refactor SummaryState
- 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.
2019-05-13 11:06:32 +02:00
Joakim Hove
294c8aa2f7 Merge pull request #767 from GitPaean/fixing_wconprod
clearning existing controls when handleWCONPROD
2019-05-12 11:58:37 +02:00
Kai Bao
de17c851bc clearning existing controls when handleWCONPROD 2019-05-11 14:07:15 +02:00
Torbjørn Skille
50f907f608 update of compareECL, failes if output file present in reference folder, but not in test folder" 2019-05-10 15:07:04 +02:00
Joakim Hove
38f483ae37 Merge pull request #764 from akva2/janitoring
mark constructors explicit
2019-05-10 14:56:00 +02:00
Arne Morten Kvarving
9b9fc2ef37 mark constructors explicit 2019-05-10 12:43:02 +02:00
Joakim Hove
a8e7c03a4f Merge pull request #740 from joakim-hove/well-static
Add alternative well implementation Well2
2019-05-09 11:07:34 +02:00
Joakim Hove
1c82a8ad39 Add alternative well implementation Well2 2019-05-09 09:20:23 +02:00
Arne Morten Kvarving
0ddf4d675e Merge pull request #703 from akva2/compareECL
Use new ECL I/O classes in compareECL
2019-05-09 08:54:03 +02:00
Bård Skaflestad
bce535c19f Merge pull request #707 from bska/print-pvtfunc-to-init
Structurally Correct PVT Tables in INIT File (Part 2)
2019-05-08 21:24:32 +02:00
Bård Skaflestad
a265a99469 Init File LOGIHEAD: Correctly Set Constant Co Flag
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
2019-05-08 11:24:02 +02:00
Bård Skaflestad
7835eeb142 Init File: Activate New PVT Table Normalisation
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.
2019-05-08 11:24:02 +02:00
Bård Skaflestad
4b8743d10f Eclipse IO: Add Ability to Output vector<bool> Data
Needed to support dynamically controlling contents of LOGIHEAD
vector in the INIT file.
2019-05-08 11:24:02 +02:00
Bård Skaflestad
30733e4966 LogiHEAD: Add Protocol for Communicating PVT and Satfunc Models
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.
2019-05-08 11:24:02 +02:00
Bård Skaflestad
9fe4b23dcb LogiHEAD: Identify Selection of Array Elements
Information mostly gleaned from LibECL's ecl_kw_magic.h.
2019-05-08 11:24:02 +02:00
Arne Morten Kvarving
eb30732444 Merge pull request #753 from tskille/fixESmry
Fixed defect in ESmry constructor.
2019-05-08 10:56:35 +02:00
Joakim Hove
77795b5005 Add 'python/' from commit '278373703455ea6562a0f8e5278b4db46eb1fc7e'
git-subtree-dir: python
git-subtree-mainline: e8dbf7d8ee
git-subtree-split: 2783737034
2019-05-08 07:20:29 +02:00
Atgeirr Flø Rasmussen
e8dbf7d8ee Merge pull request #754 from joakim-hove/whistctl-unknown-well
Internalize a global WHISTCTL setting in the Schedule object
2019-05-03 10:37:55 +02:00
Joakim Hove
0660ced877 Merge pull request #752 from joakim-hove/region-wells-required
Add query function need_wells() in the Summary implementation
2019-05-03 07:18:24 +02:00
Kai Bao
ccd6a2b9da Merge pull request #751 from GitPaean/fixing_over_flow_of_c_string
fixing an overflow problem in EclOutput::make_doub_string
2019-05-02 21:35:13 +02:00
Joakim Hove
452742a6a2 Add query function need_wells() in the Summary implementation 2019-05-02 19:08:26 +02:00
Joakim Hove
0f3dabc3aa Internalize a global WHISTCTL setting in the Schedule object 2019-05-02 16:01:29 +02:00
Torbjørn Skille
49cc815136 Fixed defect in ESmry constructor. Fails when using class on Summary files generated from commercial simulator Eclipse 2019-05-02 10:32:18 +02:00
Kai Bao
a3da1e23a2 fixing an overflow problem in EclOutput::make_doub_string 2019-05-02 10:18:48 +02:00
Joakim Hove
7dba7a50cf Merge pull request #748 from GitPaean/test_WCONHIST_control_mode
modifying the ScheduleTests to handle control mode change with WCONHIST
2019-05-02 10:13:38 +02:00
Kai Bao
8687a8a709 modifying the ScheduleTests to handle control mode change with WCONHIST 2019-05-02 09:25:52 +02:00
Joakim Hove
92caf4f010 Merge pull request #747 from joakim-hove/grouptree<<
Add operator<< to GroupTree class + whitespace
2019-05-01 14:42:26 +02:00
Joakim Hove
894ad7a226 Add operator<< to GroupTree class + whitespace 2019-05-01 13:42:07 +02:00
Bård Skaflestad
a9775f6945 Merge pull request #746 from atgeirr/minor-fixes
Two small but critical fixes
2019-04-30 17:38:03 +02:00
Atgeirr Flø Rasmussen
559783d311 Bugfix: do not keep old control modes.
They will be treated as limits, and cause wrong behaviour.
2019-04-30 14:48:49 +02:00
Joakim Hove
b7b9697fc5 Merge pull request #745 from joakim-hove/upgrade-dune-module
Change version and label in dune.module file
2019-04-30 12:55:45 +02:00
Joakim Hove
35516f1b90 Change version and label in dune.module file 2019-04-30 12:54:45 +02:00
Atgeirr Flø Rasmussen
7a47f7cf2d Add missing standard library includes. 2019-04-30 11:39:21 +02:00
Joakim Hove
0466effc93 Merge pull request #725 from joakim-hove/uda-value
UDA values in the deck
2019-04-30 07:57:08 +02:00
Atgeirr Flø Rasmussen
bf6964522e Merge pull request #744 from bska/continuous-cumulatives-opm-ext-rst
Restart: Provide Continuous Cumulatives in OPM Extended Files
2019-04-29 14:30:40 +02:00
Bård Skaflestad
d08760a922 Restart: Provide Continuous Cumulatives in OPM Extended Files
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.
2019-04-28 21:44:13 +02:00
Joakim Hove
b148769cc6 Internalize UDA values in the deck 2019-04-28 16:08:02 +02:00
Joakim Hove
656878d649 Add class UDAValue to hold UDA values from the Deck 2019-04-28 16:08:02 +02:00
Joakim Hove
8f7724409c UDA datatype can only be used with scalar input data 2019-04-28 16:08:02 +02:00
Joakim Hove
de96af682a Rename variable to increase readability 2019-04-28 16:08:02 +02:00
Joakim Hove
f4009fc6d8 Add default constructor for unit Dimension 2019-04-28 16:08:02 +02:00
Arne Morten Kvarving
9d8b08a8d8 Merge pull request #699 from akva2/new_ecl_io
New ECL I/O classes
2019-04-26 09:53:01 +02:00
Bård Skaflestad
605d7399a6 Merge pull request #742 from jalvestad/msw-rstout-corr
An improvement / correction of the writing of MSW data to Eclipse compatible restart file
2019-04-26 08:28:59 +02:00
Jostein Alvestad
58a039c04a Added a improvement to the handling of MSW data for writing to restart file
Improvement to handle more general MSW data  for writing to
Eclipse compatible restart file
2019-04-25 19:14:55 +02:00
Atgeirr Flø Rasmussen
e954836774 Merge pull request #741 from hnil/fixed_unset_return
fixed unset return value causing segfault in release build on ubuntu …
2019-04-25 08:29:52 +02:00
hnil
2d69121b5a fixed unset return value causing segfault in release build on ubuntu 18.10 2019-04-24 13:11:20 +02:00
Joakim Hove
1cde5a4879 Merge pull request #739 from joakim-hove/minor-minor
Misc minor changes: whitespace++
2019-04-23 08:32:02 +02:00
Joakim Hove
fffe259621 Misc minor changes: whitespace++ 2019-04-23 07:25:05 +02:00
Joakim Hove
b955ecf6b4 Merge pull request #737 from joakim-hove/process-segments
Add WellSegments::process() front-end method
2019-04-20 13:14:01 +02:00
Joakim Hove
5cfb91df24 Merge pull request #736 from joakim-hove/remove-branch-number
Remove unused member WellSegments::m_branch_number
2019-04-20 13:13:46 +02:00
Joakim Hove
a4bdba5841 Merge pull request #734 from joakim-hove/del-getwells
Use wellNames() instead of getWells()
2019-04-20 13:12:56 +02:00
Joakim Hove
dcdcc659b2 Merge pull request #738 from joakim-hove/segment-cmp-bug
Fix bug in WellSegments==
2019-04-20 12:59:22 +02:00
Joakim Hove
e833377bea Fix bug in WellSegments== 2019-04-20 10:55:22 +02:00
Joakim Hove
fbece57167 Add WellSegments::process() front-end method 2019-04-19 12:35:10 +02:00
Joakim Hove
54f45eaba7 Remove unused member WellSegments::m_branch_number 2019-04-19 12:03:01 +02:00
Joakim Hove
7aa55f86a0 Merge pull request #735 from joakim-hove/FLUXNUM
Add configuration for keyword FLUXTYPE
2019-04-19 12:02:30 +02:00
Joakim Hove
c3bd4b9e3a Add configuration for keyword FLUXTYPE 2019-04-19 10:57:23 +02:00
Joakim Hove
688edd6f63 Remove well iteration out of function 2019-04-19 08:08:22 +02:00
Joakim Hove
c1af5a313f Use wellNames() instead of getWells() 2019-04-19 07:24:10 +02:00
Joakim Hove
167a7a8c38 Merge pull request #733 from joakim-hove/use-wellname
Use wellname in Group::addWell()
2019-04-18 21:12:29 +02:00
Joakim Hove
abc674d40f Merge pull request #732 from joakim-hove/use-to_bool
Use DeckItem::to_bool( )
2019-04-18 21:11:49 +02:00
Joakim Hove
9c93a9349c Use wellname in Group::addWell() 2019-04-18 16:45:24 +02:00
Joakim Hove
44f8a5d94e Use DeckItem::to_bool( ) 2019-04-18 16:24:54 +02:00
Joakim Hove
7ef2d8b9a3 Merge pull request #729 from joakim-hove/dynamic-state-unique
Implement unique() method on DynamicState
2019-04-18 08:57:06 +02:00
Joakim Hove
efb8375bac Merge pull request #730 from joakim-hove/white-space
White space
2019-04-18 08:56:07 +02:00
Joakim Hove
eff44e4fdc White space 2019-04-18 08:29:10 +02:00
Joakim Hove
d5f240050a Implement unique() method on DynamicState 2019-04-18 08:09:31 +02:00
Joakim Hove
454a933b5a Merge pull request #727 from joakim-hove/get-child-wells
Remove Schedule::getWells(group, step)
2019-04-17 15:50:49 +02:00
Joakim Hove
5e76f624ef Remove Schedule::getWells(group, step) 2019-04-17 14:47:00 +02:00
Joakim Hove
14168f3ea6 Merge pull request #728 from joakim-hove/inline-ncwmax
Inline Schedule::getMaxNumCompletionsForWells() in test
2019-04-17 14:29:50 +02:00
Joakim Hove
b5dbc3d8e5 Delete unused code for ?CON serialization 2019-04-17 14:28:58 +02:00
Joakim Hove
34dfbee01b Merge pull request #726 from joakim-hove/parse-invalid-keyword
Add "size" : 1 attribute to CARFIN keyword
2019-04-17 07:20:27 +02:00
Joakim Hove
027be42f70 Add "size" : 1 attribute to CARFIN keyword 2019-04-17 06:38:34 +02:00
Bård Skaflestad
eef4cad54f Merge pull request #722 from blattms/remove-warnings-g++-8.3
Removes nearly all warnings experienced with g++-8.3
2019-04-12 23:09:12 +02:00
Markus Blatt
19ccc21786 Reintroduce overeagerly removed const qualifiers before function parameters.
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.
2019-04-12 21:31:51 +02:00
Markus Blatt
521838dbdd reintroduce some const with elegance 2019-04-12 21:14:36 +02:00
Markus Blatt
393a543ed5 Removes nearly all warnings experienced with g++-8.3
Namely:
- unused parameter
- type qualifiers ignored ...
- catchinhg polymorphic type ... by value
2019-04-12 13:37:03 +02:00
Joakim Hove
b562bef1af Merge pull request #719 from joakim-hove/aquancon-segfault
Aquancon segfault
2019-04-11 15:29:02 +02:00
Andreas Lauser
414b6820b4 Merge pull request #721 from andlaus/fix_FILEUNIT
fix FILEUNIT
2019-04-11 14:51:04 +02:00
Andreas Lauser
5dbc22484e fix FILEUNIT
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.
2019-04-11 14:20:44 +02:00
Joakim Hove
8b838264dd Add comment about face when comparing AQUANCON records 2019-04-11 14:09:28 +02:00
Joakim Hove
c533e1206f Protect against nullptr access when combining AQUANCON records 2019-04-11 14:09:28 +02:00
Joakim Hove
d87f9edf60 Minor refactor of temporary variable
- Move declaration inside { ... } scope
 - Use vector.push_back() instead of resize() and at()
2019-04-11 14:09:15 +02:00
Joakim Hove
dbff25f79b Remove m_ prefix from local variables 2019-04-11 14:03:08 +02:00
Joakim Hove
4b657fc4cf Use reference instead of value 2019-04-11 14:03:08 +02:00
Joakim Hove
a4e66a5484 White space change 2019-04-11 14:03:08 +02:00
Joakim Hove
226bfbe524 Merge pull request #718 from joakim-hove/weltarg
Weltarg
2019-04-11 12:14:23 +02:00
Joakim Hove
164ab30fa1 The WELTARG treatment is moved out from Schedule.cpp 2019-04-11 12:13:43 +02:00
Joakim Hove
d5ce2b6a76 Merge pull request #713 from joakim-hove/cjson-update
Update cJSON library to version 1.7.10
2019-04-10 09:19:36 +02:00
Joakim Hove
2997338eb2 Merge pull request #712 from joakim-hove/udq-tokens
Internalize UDQ tokens in the UDQ define keyword
2019-04-09 18:29:27 +02:00
Joakim Hove
ebedc9b0b6 Merge pull request #711 from joakim-hove/prod-properties-refactor
Refactor WellProductionProperties construction
2019-04-09 18:27:04 +02:00
Joakim Hove
ac58d8428c Refactor WellProductionProperties construction
Use default copy constructor and handleWCONPROD() and handleWCONHIST() for
prediction and history wells respectively.
2019-04-09 17:25:00 +02:00
Joakim Hove
ba58cbc166 Update cJSON library to version 1.7.10 2019-04-09 00:34:49 +02:00
Joakim Hove
bd0c0f6356 Internalize UDQ tokens in the UDQ define keyword 2019-04-08 15:12:15 +02:00
Torbjørn Skille
135f2d491a remove unused summary comparison classes 2019-04-08 11:38:34 +02:00
Torbjørn Skille
fbfac1f797 update compareECL to use new ECL I/O classes 2019-04-08 11:38:34 +02:00
Torbjørn Skille
4768f72400 added: new utility convertECL
for converting between formatted and binary ecl files
2019-04-08 11:36:20 +02:00
Torbjørn Skille
db142f698b added: ESmry class for reading summary data from ECL files 2019-04-08 11:36:20 +02:00
Torbjørn Skille
c54cb2195b added: ERst class for reading restart simulation data from ECL files 2019-04-08 11:36:20 +02:00
Torbjørn Skille
24a8efb2e3 added: ERft class for reading RFT simulation data from ECL files 2019-04-08 11:36:20 +02:00
Torbjørn Skille
181eeffbdb added: EGrid class for reading GRID data from ECL files 2019-04-08 11:36:20 +02:00
Torbjørn Skille
46f2542487 finish class EclFile
this is a base class for ECL I/O classes
2019-04-08 11:36:20 +02:00
Torbjørn Skille
6d1b2f3f4f added: EclOutput class for writing ECL files 2019-04-08 11:36:20 +02:00
Torbjørn Skille
188f78f2d6 add some common utilities used by Ecl IO classes 2019-04-08 11:36:20 +02:00
Joakim Hove
de9a93377c Merge pull request #710 from andlaus/implement_FILEUNIT
Implement FILEUNIT
2019-04-05 12:07:19 +02:00
Atgeirr Flø Rasmussen
55057540e2 Merge pull request #709 from bska/restart_msw_fix
RSEG: Index Results by Segment Number
2019-04-05 10:49:20 +02:00
Andreas Lauser
fe1272a2e6 add the FILEUNIT keyword
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.
2019-04-04 16:55:19 +02:00
Andreas Lauser
c25275d0ee add parseContext and errorGuard parameters to Opm::checkDeck()
this requires a small downstream cleanup.
2019-04-04 16:55:19 +02:00
Bård Skaflestad
ffba48d7f2 RSEG: Index Results by Segment Number
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
2019-04-04 15:26:15 +02:00
Joakim Hove
dbfad81253 Merge pull request #700 from bska/print-pvtfunc-to-init-pt1
Structurally Correct PVT Tables in INIT File (Part 1)
2019-04-04 15:11:20 +02:00
Joakim Hove
a0aafc5d5b Merge pull request #672 from jalvestad/restart_conn_test
Unit tests for writing well connection data to Eclipse Compatible restart file
2019-04-04 15:06:00 +02:00
Andreas Lauser
9afaa32ca7 checkDeck(): only require a const reference to the deck 2019-04-04 14:17:30 +02:00
Bård Skaflestad
68a254ffdc Create Prop-Func Table: Elucidate Motives for Unusual Loop Counters
Thanks to my colleague Francesca Watson for wording assistance.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
4dafe9456a Create Prop-Func Table: Switch to std::function
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
2019-04-04 14:11:07 +02:00
Bård Skaflestad
8e49c35c18 Create Prop-Func Table: Prune Vacuous Assignment
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'.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
25d7b538aa Tables: Add Structurally Correct Gas PVT Output from PVTG
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
877ff028be Tables: Add Structurally Correct Gas PVT Output from PVDG
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
c5eca4b1e4 Tables: Add Structurally Correct Oil PVT Output from PVTO
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
b4915e7b55 Tables: Add Structurally Correct Oil PVT Output from PVDO
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
b2a37d1e54 Tables: Add Structurally Correct Oil PVT Output from PVCDO
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
466341fa0f Tables: Add Structurally Correct Water PVT Output
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
c279184229 Tables: Make Table Constructor More Generally Callable
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.
2019-04-04 14:11:07 +02:00
Bård Skaflestad
bd73bb6c55 Linearised Table: Add Constructor with User-Defined Fill Value
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.
2019-04-04 14:11:07 +02:00
Joakim Hove
78170ccfce Merge pull request #704 from joakim-hove/rft_config
Add class RFTConfig
2019-04-04 14:05:07 +02:00
Joakim Hove
7852e584f9 Slight reorganisation to avoid possible memory leak 2019-04-03 19:46:08 +02:00
Joakim Hove
a9bb73559d Use RFTConfig instead of per well RFT configuration 2019-04-03 19:46:08 +02:00
Joakim Hove
be36439600 Add class RFTConfig to manage when RFTs should be created 2019-04-03 19:46:07 +02:00
Joakim Hove
9e40f3be4f Add DynamicState::find_if() 2019-04-03 19:46:07 +02:00
Joakim Hove
0d172c9a1c Merge pull request #705 from totto82/fix_well_event2
update well event also for WCONINJH
2019-04-02 17:51:00 +02:00
Joakim Hove
ad6c98e0da Merge pull request #706 from totto82/fix_overburd
Fix the unit of the overburden pressure
2019-04-02 17:50:17 +02:00
Tor Harald Sandve
8fb0e1e222 Fix overburden units 2019-04-02 13:42:38 +02:00
Tor Harald Sandve
d7bd8d25cd update well event also for WCONINJH 2019-04-02 13:40:47 +02:00
Bård Skaflestad
d0d6d57472 Merge pull request #695 from joakim-hove/data-type-UDA
Input Data type uda
2019-04-01 19:53:22 +02:00
Joakim Hove
0923ffeef2 Replace std::endl with \n in code generator 2019-04-01 18:32:06 +02:00
Joakim Hove
7a158fc45c Use UDA datatype in the keyword configuration 2019-04-01 18:32:06 +02:00
Joakim Hove
fdac0f576c Add input type UDA -> double 2019-04-01 18:32:06 +02:00
Joakim Hove
e6aecbd7ac ParserItem: differentiate between input type and internal data type
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()
2019-04-01 18:32:06 +02:00
Jostein Alvestad
5083db3715 Has added name for integer shift values as requested 2019-04-01 16:09:30 +02:00
Jostein Alvestad
1247309b3f Corrections / improvments according to comments from maintaniners 2019-04-01 14:52:27 +02:00
Jostein Alvestad
a1365ffc99 Added test to account for inactive well connections
That is handling of well connections that are defined by COMPDAT
and that become inactive of some reason.
2019-04-01 14:52:27 +02:00
Jostein Alvestad
4b62303f36 Added unit tests for the writing of well connection data
That is writing well connection data to eclipse compatible restart file
2019-04-01 14:52:26 +02:00
Jostein Alvestad
d7249ea6e6 Initial work on unit tests for well connection data to restart file
Establish framework and test data
2019-04-01 14:52:25 +02:00
Joakim Hove
810aa6970b Merge pull request #702 from joakim-hove/udq-summary-bug
Section keyword 'SUMMARY' was incorrectly identified as UDQ a keyword
2019-03-29 17:12:36 +01:00
Joakim Hove
598b5b1ff4 Section keyword 'SUMMARY' was incorrectly identified as UDQ a keyword 2019-03-29 15:40:37 +01:00
Joakim Hove
5734923b1e Add size() method to SummaryConfig class 2019-03-29 15:40:37 +01:00
Joakim Hove
4eb41c569e Merge pull request #692 from andlaus/add_SWLPC_et_all
add the S[WG]LPC and IS[WG]LPC keywords
2019-03-28 14:32:51 +01:00
Arne Morten Kvarving
85f13c3e64 Merge pull request #698 from akva2/extra_cmake_params_jenkins
added: array of extra cmake parameters for each module
2019-03-28 14:22:38 +01:00
Joakim Hove
01090a8722 Merge pull request #693 from andlaus/add_THPRESFT
add the THPRESFT keyword
2019-03-28 12:57:43 +01:00
Andreas Lauser
2b4212bac0 add comment about the value of the SWLPC keywords being sometimes wrong
This is a corner case that I don't think will matter in practice.
2019-03-28 12:01:41 +01:00
Arne Morten Kvarving
4bee03be6f added: array of extra cmake parameters for each module
use this to enable ebos extensions in opm-simulators
2019-03-28 11:45:40 +01:00
Andreas Lauser
7360755c63 fix detection of mixed satfunc family usage
We now simply complain if the deck features keywords from more than
one family.
2019-03-28 09:37:25 +01:00
Andreas Lauser
f7cf50830d add the THPRESFT keyword
it is like THPRES, but for faults instead of PVT regions.
2019-03-28 09:37:00 +01:00
Joakim Hove
21dbd82bb9 Merge pull request #697 from jalvestad/restart_msw_fix
Added a fix for an index error in writing of RSEG data to ECL Restart file
2019-03-27 20:24:18 +01:00
Jostein Alvestad
0a730d949f Added correction to segment number index for RSEG
Added correction to segment number index
for writing of RSEG data to eclipse compatible
restart file. AggregateMSWData.cpp
2019-03-27 16:59:35 +01:00
Jostein Alvestad
ba1f9e882b Back to master equal to upstream 2019-03-27 16:56:57 +01:00
Jostein Alvestad
745720ef99 Added correction to writing MSW data to restart file
Corrected segment number index for writing of
RSEG data to eclipse compatible restart file
in AggregateMSWData.cpp
2019-03-27 16:52:49 +01:00
Andrea Brambilla
2783737034 Fixed travis build status in README.md 2019-03-27 13:41:06 +01:00
Tor Harald Sandve
3595eb7c82 Merge pull request #685 from totto82/refactorBC
Combine BCRATE and FREEBC to BC
2019-03-27 10:21:46 +01:00
Joakim Hove
75d28fc6ce Merge pull request #691 from joakim-hove/wellproperties-constructor
Wellproperties constructor
2019-03-26 21:07:51 +01:00
Andreas Lauser
ade0cd059e add the S[WG]LPC and IS[WG]LPC keywords
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.
2019-03-25 11:36:02 +01:00
Joakim Hove
daf9337599 Extract phase dependent SI conversion to separate file 2019-03-25 10:36:40 +01:00
Joakim Hove
9bff0094f1 Extract WellInjectionProperties from Schedule.cpp 2019-03-25 10:36:16 +01:00
Joakim Hove
c3e992f996 Use constructor for WellProductionProperties 2019-03-25 10:23:13 +01:00
Joakim Hove
d9c81da18c Merge pull request #690 from joakim-hove/use-wellnames
Use wellnames
2019-03-25 10:20:06 +01:00
Joakim Hove
94fae0da30 Remove Schedule::getWells(pattern) 2019-03-24 07:54:39 +01:00
Joakim Hove
6cd420ed9b All Schedule::handleWxxxx() functions go via well name 2019-03-24 07:54:33 +01:00
Joakim Hove
19dde5e6d3 Add Schedule::wellNames() overloads 2019-03-24 07:54:33 +01:00
Joakim Hove
5b1065df45 For a connection set with 0 connections is "OPEN" 2019-03-23 16:13:11 +01:00
Joakim Hove
e452058b4e Merge pull request #686 from totto82/fix_units_fip
Output FIP as surface volumes
2019-03-21 17:54:14 +01:00
Joakim Hove
e84edae209 Merge pull request #688 from joakim-hove/remove-well-events
Remove well events
2019-03-21 14:51:58 +01:00
Joakim Hove
a3f08ca6ea Disable POLYMER related events 2019-03-21 13:08:25 +01:00
Joakim Hove
858e06044e Move well specific event logging from Well to Schedule 2019-03-21 13:08:25 +01:00
Joakim Hove
1812acccec Merge pull request #684 from joakim-hove/update-testdata
Add PERM values to testdata
2019-03-20 15:38:43 +01:00
Joakim Hove
1d402bdca3 Add PERM values to testdata 2019-03-20 15:10:08 +01:00
Tor Harald Sandve
d24c327a90 Output FIP as surface volumes 2019-03-20 15:06:54 +01:00
Bård Skaflestad
fe12e48b5c Merge pull request #683 from joakim-hove/udq-define-bug
Fix bug with ouf of bounds access in UDQ parser

Fixes: #682
2019-03-20 09:21:25 +01:00
Tor Harald Sandve
088f8ff9e0 Combine BCRATE and FREEBC to BC 2019-03-20 08:49:21 +01:00
Joakim Hove
57c1c2d984 Merge pull request #680 from joakim-hove/enable-welltest
Add optional code for well testing
2019-03-19 17:53:30 +01:00
Joakim Hove
7335d72e8b Fix bug with ouf of bounds access in UDQ parser 2019-03-19 17:05:59 +01:00
Joakim Hove
b741a73957 Merge pull request #679 from joakim-hove/remove-totno-conn
Removed well property total number of connections
2019-03-19 16:52:50 +01:00
Joakim Hove
bf971c0ede Pass -DENABLE_WELL_TEST when coniguring jenkins build 2019-03-19 16:51:46 +01:00
Joakim Hove
c910a51359 Add optional code for well testing 2019-03-19 16:51:46 +01:00
Joakim Hove
a73e82110c Merge pull request #681 from joakim-hove/well-static-util
Well static util
2019-03-18 17:11:34 +01:00
Tor Harald Sandve
daa67dc8d6 Add parser support for water induced rock compaction (#676)
Add support for water induced rock compaction
2019-03-18 17:08:38 +01:00
Joakim Hove
eb15695ed0 Removed well property total number of connections
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()
2019-03-18 15:44:18 +01:00
Joakim Hove
75e196cdd8 Add PERM values to testdata 2019-03-18 14:46:03 +01:00
Joakim Hove
00cc2b9075 Remove unused keywords from test input 2019-03-18 11:24:02 +01:00
Joakim Hove
53c29e56d4 Wellname pattern '*' should not be interpreted as WLIST 2019-03-18 10:44:11 +01:00
Joakim Hove
205c4a94db Add method DynamicState::find_not() 2019-03-18 10:34:18 +01:00
Joakim Hove
25522dc424 Add to_bool(string) function 2019-03-18 10:34:18 +01:00
Joakim Hove
5421efd79d Merge pull request #677 from joakim-hove/well-names
Implement Schedule::wellNames()
2019-03-17 08:03:25 +01:00
Joakim Hove
c5935c97f6 Implement Schedule::wellNames() 2019-03-17 07:26:40 +01:00
Joakim Hove
fa77187871 Merge pull request #656 from joakim-hove/udq-parse
UDQ: Complete well related UDQ's
2019-03-14 13:45:55 +01:00
Joakim Hove
345452109f Merge pull request #678 from akva2/janitoring
fix warnings
2019-03-14 13:30:44 +01:00
Arne Morten Kvarving
4d8f75e24d fix warnings
- signed/unsigned comparisons
- unused variables
- unused typedefs
2019-03-14 13:06:57 +01:00
Joakim Hove
c9821faddc Changed UDQDefine to take UDQParams argument 2019-03-14 12:40:57 +01:00
Joakim Hove
ef5f90c12b Add ParseContext and ErrorGuard arguments to UDQDefine 2019-03-14 12:40:57 +01:00
Joakim Hove
066dca43ba UDQ Parsing - rest 2019-03-14 12:40:57 +01:00
Joakim Hove
16c9d7d04d UDQFunctionTable: const arg + default constructor 2019-03-14 09:28:26 +01:00
Joakim Hove
2a07a2e8a2 Removed extra pow function in functiontable 2019-03-14 09:28:26 +01:00
Joakim Hove
118f4dd3de Update eval_udq() in Summary 2019-03-14 09:28:26 +01:00
Joakim Hove
7a2c1157a0 Merge pull request #673 from joakim-hove/udq-parsecontext
Udq parsecontext
2019-03-14 09:27:30 +01:00
Joakim Hove
0caf039bcb Merge pull request #670 from joakim-hove/ordered-map
Change OrderMap to more closely resemble std::map
2019-03-11 11:37:43 +01:00
Joakim Hove
f80b220b44 Change OrderMap to more closely resemble std::map
- Removed the hasKey() and get() methods.
 - Key type is a template parameter
 - insert takes a pair
 - implement count()
 - implement find()
 - implement operator[]
 - implement erase
2019-03-11 10:34:04 +01:00
Joakim Hove
3542d43c72 Merge pull request #675 from joakim-hove/aquifer-include
Aquifer include
2019-03-11 10:20:39 +01:00
Joakim Hove
8c6cfdc704 Forward declare EclipseState in AquiferCT header 2019-03-11 08:58:43 +01:00
Joakim Hove
f38e1511b5 White space 2019-03-11 08:54:33 +01:00
Joakim Hove
130208b20e Merge pull request #669 from totto82/fix_bgsat
Fix bgsat
2019-03-11 06:51:56 +01:00
Joakim Hove
094f17532d Check if UDQ unit is assigned before 2019-03-09 10:19:27 +01:00
Joakim Hove
f4196ff25e Add ParseContext for undefined UDQ 2019-03-09 10:19:11 +01:00
Joakim Hove
25d7e99413 Add UDQInput methods has_keyword() and has_unit() 2019-03-09 10:19:03 +01:00
Joakim Hove
b4edd0acda White space 2019-03-09 09:01:21 +01:00
Joakim Hove
9c5acbb304 Merge pull request #649 from jalvestad/restart_msw_test
Unit tests for writing of multisegment well (MSW) data to Eclipse Compatible restart file.
2019-03-08 21:04:33 +01:00
Joakim Hove
1ecd62d98d Merge pull request #667 from joakim-hove/move-wells
Move all well related files to subfolder Well/
2019-03-08 12:42:08 +01:00
Joakim Hove
f293bcfc3c Merge pull request #666 from andlaus/add_DEFAULT_ENABLE_IF
opm_add_test(): add condition to specify if a test ought to be compiled by default
2019-03-08 10:31:50 +01:00
Tor Harald Sandve
7e70d85c83 Fix bgsat 2019-03-08 08:52:23 +01:00
Joakim Hove
595efe7e48 Merge pull request #665 from joakim-hove/udq-parse-pre
Udq parse pre commits
2019-03-08 07:23:13 +01:00
Joakim Hove
04d42c2f4e Move well and well related files to Well/ subfolder 2019-03-08 07:15:49 +01:00
Andreas Lauser
f700053736 opm_add_test(): add condition to specify if a test ought to be compiled by default
this argument is optional and called *drumroll* `DEFAULT_ENABLE_IF`.
2019-03-07 12:44:28 +01:00
Joakim Hove
ccba767b24 Add utility constructors and testing to UDQWellSet 2019-03-07 11:35:55 +01:00
Joakim Hove
568506627e Minor improvement in error message 2019-03-07 11:35:55 +01:00
Joakim Hove
585447fd22 Move UDQ action enum to UDQEnums 2019-03-07 11:35:55 +01:00
Joakim Hove
fa2e0efd17 Make UDQFunctionTable copyable with std::shared 2019-03-07 11:35:55 +01:00
Joakim Hove
c244625865 Add wells() method to SummaryState 2019-03-07 11:35:55 +01:00
Joakim Hove
15a7d7597d Update ASTNode::eval() to handle Well selectors like 'P*' 2019-03-07 11:35:55 +01:00
Joakim Hove
c7368949dd Merge pull request #662 from joakim-hove/raw-strings
Raw strings
2019-03-07 11:13:16 +01:00
Joakim Hove
9b383db145 Merge pull request #664 from andlaus/improve_tab_completors
tab completors: be quiet even if the `which` command would like to complain
2019-03-07 09:56:42 +01:00
Andreas Lauser
201978c9b2 tab completors: be quiet even if the which command would like to complain
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...
2019-03-07 09:33:15 +01:00
Arne Morten Kvarving
8058167310 Merge pull request #663 from akva2/fix_rh_packaging
fixed: redhat packaging
2019-03-06 11:18:09 +01:00
Arne Morten Kvarving
dcdbf36ec3 fixed: redhat packaging
something changes in os image so these directories
are not guaranteed to exists any longer. make them
2019-03-06 11:14:05 +01:00
Jostein Alvestad
3e03a7d93f Final changes / improvements to multisegment well restart data unit tests
Minor code changes to adapt to coding style
2019-03-06 08:31:13 +01:00
Jostein Alvestad
db0139e842 Added unit tests to AggregateMSWData.cpp, i.e. for the writing of multisegment well data to the restart file 2019-03-06 08:31:12 +01:00
Jostein Alvestad
6df9cf66ea Changes to allow for more general MSW structure with discontinuous segment numbering, initial work for making unit tests for writing MSW data to restart file 2019-03-06 08:23:37 +01:00
Joakim Hove
8967c13d3e Merge pull request #653 from jalvestad/restart_group_test
Added unit tests to the functions that writes group & field data to Eclipse-restart file
2019-03-06 07:17:05 +01:00
Jostein Alvestad
167b344506 Added adjustments and corrections
Corrections to code for compile errors for boost check of string-variables
and adjustments of code according to comments from maintainer (Joakim)
2019-03-05 14:26:29 +01:00
Jostein Alvestad
6b8e04460c Added some corrections / improvements 2019-03-05 14:26:28 +01:00
Jostein Alvestad
184ba02df8 Added unit tests to the code that writes the group and field data to the eclipse compatible restart file
The unit tests covers the group numbering structure stored in IGRP,
the summary data export in XGRP and the group name export
into ZGRP
2019-03-05 14:26:27 +01:00
Jostein Alvestad
6eff5158df Initial changes to implement unit tests for AggregateGroupData 2019-03-05 14:26:25 +01:00
Joakim Hove
af7693ef6b Add parse option keep '/' in data sections
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 '/'.
2019-03-05 07:15:29 +01:00
Joakim Hove
03a2bbdf80 Add UDQ / parsing test with '/' in data item 2019-03-05 07:15:29 +01:00
Joakim Hove
43cc132651 Merge pull request #660 from akva2/janitoring
mark constructor explicit
2019-02-27 11:18:06 +01:00
Arne Morten Kvarving
f55d3e1578 mark constructor explicit
pass string by const ref
avoid a potential no return from function
2019-02-27 11:14:36 +01:00
Joakim Hove
3dc347f894 Merge pull request #659 from sogoogos/patch-2
Include <string>
2019-02-27 07:47:34 +01:00
Sogo Shiozawa
275cf03f0d Include <string> 2019-02-27 15:42:21 +09:00
Joakim Hove
6ff4d8b136 Merge pull request #651 from joakim-hove/udq-summary-assign
Udq summary assign
2019-02-25 12:54:36 +01:00
Joakim Hove
010dd03c6d UDQ ASSIGN keywords will appear in Summary output 2019-02-25 11:15:12 +01:00
Joakim Hove
6bf64b18fe Add method to get filtered UDQ assignment types 2019-02-25 11:15:12 +01:00
Joakim Hove
a91d47f191 Add name property to UDQSet 2019-02-25 11:15:12 +01:00
Joakim Hove
228aacd390 Merge pull request #654 from joakim-hove/opm-summarize
Small utility to hash a deck
2019-02-25 10:37:31 +01:00
Joakim Hove
40aad6d64e Merge pull request #638 from joakim-hove/udq-functions
Udq functions
2019-02-25 09:35:00 +01:00
Joakim Hove
7425f8b988 Implement UDQ functions 2019-02-25 08:37:04 +01:00
Joakim Hove
945438b210 Add rng to UDQParams 2019-02-25 08:36:33 +01:00
Joakim Hove
f0eed83b12 Merge pull request #652 from joakim-hove/udq-types
Udq types
2019-02-22 09:18:43 +01:00
Joakim Hove
b02578655d Small utility to hash deck 2019-02-22 08:54:49 +01:00
Joakim Hove
19988494c0 Add UDQVartype member to assignment and expression 2019-02-21 13:36:08 +01:00
Joakim Hove
b5542c4e56 Add UDQEnum type for the different variable types 2019-02-21 13:36:08 +01:00
Joakim Hove
40bd7b86b0 Renamed UDQ -> UDQInput 2019-02-21 13:36:08 +01:00
Joakim Hove
ab737ab4d3 Merge pull request #647 from joakim-hove/udq-assign
Udq assign
2019-02-21 08:27:31 +01:00
Joakim Hove
732c5ae4d2 Add class UDQAssign 2019-02-20 18:21:23 +01:00
Joakim Hove
999b06b0eb Add dervied class UDQWellSet : UDQSet 2019-02-20 18:21:23 +01:00
Joakim Hove
e27933270a Change UDQExpression() constructor to take enum 2019-02-20 18:21:23 +01:00
Joakim Hove
e00a5d5fa9 Merge pull request #645 from joakim-hove/use-slash-termination
Use slash termination to determine size of keywords SKPRPOLY SKPRWAT
2019-02-20 17:53:33 +01:00
Joakim Hove
785d80b677 Use slash termination to determine size of keywords SKPRPOLY SKPRWAT 2019-02-20 16:57:10 +01:00
Joakim Hove
ef19a67617 Merge pull request #648 from totto82/massratebc
WIP Add OPM keyword for setting massrate for the boundary
2019-02-20 11:30:29 +01:00
Joakim Hove
10a225785e Merge pull request #644 from joakim-hove/vfp-parse-error
Vfp parse error
2019-02-19 16:22:55 +01:00
Tor Harald Sandve
4e8352dabb Add OPM keyword for setting massrate for the boundary 2019-02-19 15:52:43 +01:00
Joakim Hove
1617d2b434 Merge pull request #642 from joakim-hove/udq-scalar
Udq set
2019-02-18 11:02:58 +01:00
Joakim Hove
946d1cb877 Add subdirectory Schedule/UDQ/ 2019-02-18 08:58:20 +01:00
Joakim Hove
a1b8303ac3 Add class UDQSet() to hold UDQ values 2019-02-18 08:58:20 +01:00
Joakim Hove
4c0c394b77 Changed copyright holder 2019-02-18 08:58:20 +01:00
Joakim Hove
5b86ef115c Clear trailing part of string when looking for possible valid keyword 2019-02-17 15:55:55 +01:00
Joakim Hove
1fee73481e Merge pull request #633 from tskille/Ecl_IO
New class (EclIO) for formatted and binary eclipse format results files.
2019-02-17 15:53:35 +01:00
Torbjørn Skille
c914b7e07c updated path for EclIOdata.hpp in CMakeLists_files.cmake 2019-02-17 14:39:47 +01:00
Torbjørn Skille
ff68195c4f 1) Updated test for EclFile. 2019-02-15 18:01:38 +01:00
Joakim Hove
a1c7e8f5d4 Merge pull request #643 from akva2/bsys_cleanup
some cleanup in buildsystem
2019-02-15 16:22:51 +01:00
tskille
a27b39ff05 changed copyright header for EclIOdata.hpp 2019-02-15 14:05:58 +01:00
Torbjørn Skille
1be3e88f58 New routines for reading binary eclipse format files
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.
2019-02-15 13:04:06 +01:00
Arne Morten Kvarving
7c3aacd118 some cleanup in buildsystem 2019-02-15 11:03:08 +01:00
Joakim Hove
159ffeaef3 Merge pull request #548 from bska/flow-flow-restart
Add Support for Restarting Flow from ECLIPSE Compatible Restart File
2019-02-13 18:49:30 +01:00
Bård Skaflestad
c345aa3f4e Restart Output: Move Group Name Assignment to Separate Helper
Mostly for consistency.  Also, look up window index by group name.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
a51d18cab0 Restart Output: Adjust Whitespace
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
0d0b8b257f Well Data: Prune Disabled Code Blocks
These have not been used for a long time.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
c9331d7fed Save: Simplify Main Gateway Function
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
849eb80e41 IWEL: Identify Items for Active and Requested Well Controls
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
e685eccdc9 Restart: Save/Restore Historical Cumulative Production
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
169ec76605 Save/Restore: Support ECLIPSE Compatible Hysteresis Vectors
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
b311fbb9d0 Save/Restore Connection Index and Pressure Values
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
bfe2507184 Restart Facility: Output Suggested Next Timestep as TSINIT
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
466693f1d0 Load Restart: Add Means of Retrieving Next Timestep From DOUBHEAD
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.
2019-02-10 19:14:30 -06:00
Bård Skaflestad
ecca78af85 DOUBHEAD: Add OPM-Specific Method for Storing Next Timestep
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
551f1f8c76 Connection Rates: Lookup Connections by (I,J,K) Index
This is more robust than the linear index.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
9e97dde466 Restore Cumulative Summary Quantities in Restart
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
b3cfb4ee78 Load Restart: Add Means of Restoring Cumulative Quantities
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
bed76c330b Summary: Add Means of Resetting Cumulative Quantities
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
8f2a36593d Load Restart: Load Segment Vectors if Available
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
5736dd6e9c Load Restart: Add Windowed Views into Well and Group Data
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
ff1b245b8f Restart Facility: Idenfity Certain Items in XGRP and RSEG
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.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
e77bd172c5 Solution Output: Remove Special Treatment for TEMP
It is no longer needed as this aspect is handled further up in the
call chain.
2019-02-10 19:14:29 -06:00
Bård Skaflestad
0301d402a4 Load Restart: Chase Semantic Update of data::Connection
Commit ef606711 switched to saving data::Connection::index as the
global cell index of the reservoir connection.  Update restore layer
accordingly.
2019-02-10 19:14:29 -06:00
Joakim Hove
fde95a69d1 Merge pull request #641 from totto82/freeBC
Add input keywords for setting free boundary conditions
2019-02-08 18:18:14 +01:00
Joakim Hove
75d93f196d Merge pull request #625 from joakim-hove/summary-udq
Summary udq
2019-02-08 17:03:36 +01:00
Tor Harald Sandve
62b826e14f Add input keywords for setting free boundary conditions 2019-02-08 13:27:12 +01:00
Joakim Hove
96c02c9d35 UDQ - hooked up to the Summary Output 2019-02-08 06:42:38 +01:00
Joakim Hove
3d4b467a2f Add UDQContext class to be used while evaluating UDQ keywords 2019-02-08 06:34:05 +01:00
Joakim Hove
7451e6618f Minor reformatting/white space change 2019-02-08 06:34:05 +01:00
Joakim Hove
cf0b7db534 Merge pull request #640 from bska/arraydim-consistency-checker
Add Array Dimension Consistency Checker (Take 2)
2019-02-07 18:37:55 +01:00
Bård Skaflestad
7986e99e61 Intehead: Use Maximum of Declared/Dynamic Sizes
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.
2019-02-07 14:29:08 +01:00
Bård Skaflestad
6cc65ada59 Add Tool for Checking Array Dimensions
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.
2019-02-07 14:29:08 +01:00
Bård Skaflestad
7bf635ef59 Parse Context: Add Keys for Items 1-4 of WELLDIMS
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.
2019-02-07 14:29:08 +01:00
Bård Skaflestad
c138e78ddb Group Tree: Prune Undefined Function
Member function GroupTree::groupTreeSize() was never defined (or
used).  Remove its declaration to reduce opportunity for confusion.
2019-02-07 14:29:08 +01:00
Bård Skaflestad
1bca0f6480 Merge pull request #637 from joakim-hove/long-keywords
Add ParseContext::PARSE_LONG_KEYWORD
2019-02-07 14:26:29 +01:00
Bård Skaflestad
16f6e3ee0c Merge pull request #639 from joakim-hove/remove-warning
Temporarily remove warning about missing summary variables
2019-02-07 14:16:37 +01:00
Joakim Hove
d6a9ea162d Temporarily remove warning about missing summary variables 2019-02-07 12:07:19 +01:00
Joakim Hove
b900441ac6 Merge pull request #610 from jalvestad/restart_hyster
Add changes to correct problems/errors with Eclipse restarts from flow  with hysteresis and well crossflow
2019-02-06 16:45:17 +01:00
Joakim Hove
65b629e423 Add ParseContext::PARSE_LONG_KEYWORD
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.
2019-02-04 17:17:00 +01:00
Joakim Hove
76f709aa70 Merge pull request #635 from joakim-hove/multio
Read keywords MULTIN and MULTOUT
2019-02-04 12:52:10 +01:00
Joakim Hove
57d19c9cdb Read keywords MULTIN and MULTOUT 2019-02-04 09:55:40 +01:00
Bård Skaflestad
e9756c3ee5 Merge pull request #622 from joakim-hove/udq-units
UDQ - hook the configuration up in the Schedule object
2019-02-03 22:24:02 +01:00
Bård Skaflestad
19c81fad9c Merge pull request #632 from joakim-hove/summary-pull
Change from push to pull when initializing ecl_sum object
2019-02-03 22:23:07 +01:00
Bård Skaflestad
ecca175ccd Merge pull request #615 from joakim-hove/msim-actionx
Msim actionx
2019-02-03 22:19:54 +01:00
Joakim Hove
2caf82baff Move check for legitimate keywords to ActionX 2019-02-03 18:07:04 +01:00
Joakim Hove
d82be29745 ACTIONX: Works with WELOPEN and msim 2019-02-02 17:35:56 +01:00
Joakim Hove
8eb10b33ce Change from push to pull when initializing ecl_sum object 2019-02-02 17:21:41 +01:00
Joakim Hove
42d08db25b Add UDQ configuration as DynamicState<> to schedule 2019-02-02 17:09:44 +01:00
Joakim Hove
d7d3d2538a Merge pull request #634 from sogoogos/patch-1
include `<cstdlib>`
2019-02-02 08:20:38 +01:00
Sogo Shiozawa
e0fad15f0a include <cstdlib>
add `#include <cstdlib>` to support older version of clang.
2019-02-02 09:38:33 +09:00
Jostein Alvestad
4c2105f85c changes to correct problem / error on output of historical injection rates and cumulatives 2019-02-01 08:36:12 +01:00
Jostein Alvestad
981e6c9b22 Added changes to improve code quality according to comments from Joakim Hove 2019-02-01 08:36:11 +01:00
Jostein Alvestad
4e83b63a0d minor change on code in CreateDoutHead to avoid conflicts with pullrequest 548 2019-02-01 08:36:09 +01:00
Jostein Alvestad
4c1333fb4f Added correction to element [25] in DoubHead (DRSDT) to account for unitsystem conversion of time 2019-02-01 08:36:07 +01:00
Jostein Alvestad
6db8a45d88 Changes to avoid name conflict 2019-02-01 08:36:05 +01:00
Jostein Alvestad
c33f69fd1b Added changes to extend the eclipse restart file export to handle hysteresis option in eclipse 2019-02-01 08:33:13 +01:00
tskille
92b1b34dca new class Ecl_IO including 14 unit tests 2019-01-31 22:07:41 +01:00
Joakim Hove
bb5b2f4232 Merge pull request #629 from joakim-hove/initial-complump
Initial completion number set to connection number
2019-01-31 15:42:48 +01:00
Joakim Hove
ebe2f28c67 Initial completion number set to connection number 2019-01-31 12:40:39 +01:00
Joakim Hove
414661b898 Merge pull request #630 from akva2/janitoring
changed: add some harmless comparisons to test
2019-01-31 11:31:40 +01:00
Arne Morten Kvarving
4e00897117 changed: add some harmless comparisons to test
to avoid unused variable compiler warnings
2019-01-31 10:26:48 +01:00
Bård Skaflestad
98133f44fc Merge pull request #627 from GitPaean/fixing_restart_perf
[Disussion]using global_index in serialize_OPM_XWEL()
2019-01-31 10:05:19 +01:00
Joakim Hove
1574d7714d Merge pull request #617 from joakim-hove/simulator-missing-keyword
Simulator missing keyword
2019-01-30 16:26:50 +01:00
Joakim Hove
3c41d4c17a Merge pull request #626 from joakim-hove/MINVALUE-bug
Ensure units are applied with the MINVALUE and MAXVALUE keywords
2019-01-30 11:44:05 +01:00
Kai Bao
ef606711f2 using global_index in serialize_OPM_XWEL()
it looks like in data::Wells the index is global index.
2019-01-30 10:35:33 +01:00
Joakim Hove
ed9827bfcf Ensure units are applied with the MINVALUE and MAXVALUE keywords 2019-01-29 20:58:39 +01:00
Joakim Hove
fcadc69e49 Merge pull request #621 from joakim-hove/rename-UDQConfig
Renamed UDQConfig -> UDQParams
2019-01-28 17:40:39 +01:00
Joakim Hove
27eaeb2ec9 Renamed UDQConfig -> UDQParams 2019-01-28 16:53:01 +01:00
Joakim Hove
420b66822b Add iterators to the keywords in the body of ACTIONX 2019-01-28 11:58:31 +01:00
Joakim Hove
9913cb8600 Merge pull request #620 from joakim-hove/schedule-minor
Schedule minor
2019-01-28 11:58:09 +01:00
Joakim Hove
c874c8b6ea Add Schedule::simTime() method 2019-01-28 10:32:57 +01:00
Joakim Hove
6ca6f27640 White space cleanup 2019-01-28 10:32:22 +01:00
Joakim Hove
bd4e872230 Merge pull request #618 from joakim-hove/get-summary-state
Export SummaryState from EclipseIO object
2019-01-28 10:31:52 +01:00
Joakim Hove
3a9bab6285 Merge pull request #619 from atgeirr/fix-missing-include
Add missing <string> include.
2019-01-28 09:30:49 +01:00
Atgeirr Flø Rasmussen
30e2577f31 Add missing <string> include. 2019-01-28 09:13:27 +01:00
Joakim Hove
959502e8cd Export SummaryState from EclipseIO object 2019-01-28 08:59:19 +01:00
Joakim Hove
4a3c6b2058 Left adjust error messages from ErrorGuard 2019-01-25 18:07:46 +01:00
Joakim Hove
29db657757 Add new error modes SIMULATOR_KEYWORD_NOT_SUPPORTED 2019-01-25 18:07:46 +01:00
Joakim Hove
91734f13c4 Merge pull request #616 from joakim-hove/msim-actionx-preparations
Msim actionx preparations
2019-01-23 10:34:58 +01:00
Joakim Hove
b4c86e73af Members ActionX::last_run and ActionX::run_count mutable 2019-01-22 18:08:14 +01:00
Joakim Hove
f3a82ddd70 Add Schedule::simTime() method 2019-01-22 18:08:14 +01:00
Joakim Hove
4174602da2 Remove Schedule::evalAction() and add Schedule::actions() 2019-01-22 16:36:11 +01:00
Andrea Brambilla
a6587b3f68 Remove unneeded printout of gcc version in travis 2019-01-22 16:18:13 +01:00
Markus Fanebust Dregi
6ab8c9611c Add optional log argument to getWriteRestartFile 2019-01-22 16:18:13 +01:00
Markus Fanebust Dregi
249cee7766 Use gcc 4.9 for build on Travis 2019-01-22 16:18:13 +01:00
Jørgen Kvalsvik
70ba4fbc81 Run tests against opm-parser upstream HEAD 2019-01-22 16:18:13 +01:00
Jørgen Kvalsvik
93485e2aec Pass ErrorGuard to parse file/string function
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.
2019-01-22 16:18:13 +01:00
Joakim Hove
749353a4b0 Merge pull request #614 from joakim-hove/msim-on
Turn on the mock simulator by default
2019-01-22 15:56:22 +01:00
Joakim Hove
a8db1f155c Default building of MOCK simulator to ON 2019-01-22 13:12:06 +01:00
Joakim Hove
59b4ca4b20 Change msim simulator to not hold Schedule object 2019-01-22 13:12:06 +01:00
Joakim Hove
261f7c3c03 Merge pull request #609 from joakim-hove/capture-wells-operation
Capture wells operation
2019-01-22 12:03:37 +01:00
Joakim Hove
a1214ba49e Merge pull request #613 from totto82/tstepLAB
Fix TSTEP unit in LAB mode
2019-01-21 19:05:48 +01:00
Joakim Hove
d9585d6585 Reorganized the ACTIONX implementation - made large parts private 2019-01-21 18:07:24 +01:00
Tor Harald Sandve
a668248aa1 Fix TSTEP unit in LAB mode
If unit system is LAB, the TSTEP is interpreted as hours not days
2019-01-21 15:37:15 +01:00
Atgeirr Flø Rasmussen
d40177dacb Merge pull request #612 from akva2/janitoring
Some janitoring
2019-01-21 14:53:09 +01:00
Arne Morten Kvarving
67acaaa637 Merge pull request #611 from andlaus/fix_jenkins_warning
try to get around a non-fatal bash warning in the jenkins build script
2019-01-21 14:23:13 +01:00
Andreas Lauser
33c5b79d98 fix the pre-build hook logic
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.
2019-01-21 12:59:47 +01:00
Arne Morten Kvarving
7790fe743e initialize variable to quell compiler warning 2019-01-21 12:36:20 +01:00
Arne Morten Kvarving
40a2e848cb fixed: signed/unsigned comparison warning 2019-01-21 12:21:32 +01:00
Joakim Hove
7f6fd34fd3 Merge pull request #585 from jalvestad/group-field-potentials
Add output of group and field phase potential injection and production rates to Summary file
2019-01-17 15:02:44 +01:00
Joakim Hove
586f296de0 The matching wells are compined with && or || 2019-01-17 11:33:57 +01:00
Joakim Hove
8a2c2304e7 Merge pull request #608 from joakim-hove/wlist
Add WList implementation
2019-01-17 11:33:44 +01:00
Joakim Hove
9df659370c Merge pull request #605 from andlaus/add_jenkins_pre-build_hook
jenkins: allow modules to specify a pre-build check
2019-01-15 19:47:27 +01:00
Joakim Hove
66650a20fb Add WLIST implentation to Schedule 2019-01-14 23:26:02 +01:00
Joakim Hove
eae4a080cd Add WList manager 2019-01-14 11:30:29 +01:00
Joakim Hove
eb5454aeaf Add WList implementation 2019-01-14 11:30:28 +01:00
Atgeirr Flø Rasmussen
dc0ccc010a Merge pull request #607 from joakim-hove/errguard-dump-format
Format the ErrorGuard::dump() nicer
2019-01-14 09:20:00 +01:00
Joakim Hove
aa63d772d7 Merge pull request #593 from GitPaean/fixing_history_mode_part_2
fixing the BHP limit for the history matching wells
2019-01-11 18:04:45 +01:00
Joakim Hove
91afb0b656 Format the ErrorGuard::dump() nicer 2019-01-11 18:00:17 +01:00
Kai Bao
666cc9210b fxing some reviewing comments. 2019-01-11 14:27:49 +01:00
Jostein Alvestad
bdd82445d2 changed name of function for calculation of potential rates 2019-01-11 09:56:41 +01:00
Jostein Alvestad
bf9a142b6d Added corrections to tests/parser/SummaryConfigTests.cpp for list of ALL summary vectors
Removed comments from  Summary.cpp
2019-01-11 09:56:39 +01:00
Jostein Alvestad
9bbacfe710 Final changes to add unit tests for the well, group and field production / injection potential rates 2019-01-11 09:56:38 +01:00
Jostein Alvestad
982b221753 Initial changes to add unit tests for well potential rates 2019-01-11 09:56:36 +01:00
Jostein Alvestad
a4d0bb685b Additional changes to accomodate for loop over several wells beloning to
either a group or the field in generation of the group or field production or
injection potential rates
2019-01-11 09:56:35 +01:00
Jostein Alvestad
3429db8fc1 Initial changes to allow for writing group and field production / injection potential rates to
the summary file
2019-01-11 09:56:33 +01:00
Joakim Hove
fc0e61518b Merge pull request #566 from joakim-hove/capture-wells
Add functionality to capture matching wells when evaluating ACTIONX
2019-01-09 18:05:56 +01:00
Andreas Lauser
b7eefe8b18 jenkins: allow modules to specify a pre-build check
this is purely optional. opm-material will use this to make sure that
auto-generated code does not get manually modified.
2019-01-09 15:09:12 +01:00
Joakim Hove
0d5b3a5285 Merge pull request #604 from atgeirr/silence-warnings
Silence various warnings discovered with new version of clang.
2019-01-09 07:51:42 +01:00
Joakim Hove
3eef43b904 Merge pull request #589 from totto82/sort_multregt
Make the ordering of MULTREGT arbitary
2019-01-08 21:55:44 +01:00
Atgeirr Flø Rasmussen
db90ecd88c Silence various warnings discovered with new version of clang. 2019-01-08 14:51:20 +01:00
Tor Harald Sandve
68769e5b1d Make the ordering of MULTREGT arbitary
With this fix

MULTREGT
1 2 1 /
2 1 2 /
/

will multiply transmissibilities between region 1 and 2 with 2.
2019-01-08 08:35:15 +01:00
Joakim Hove
85949d44ac Merge pull request #602 from joakim-hove/error-list
Add small class ErrorGuard to store errors from parsing
2019-01-08 07:46:57 +01:00
Joakim Hove
690e00a079 Merge pull request #601 from joakim-hove/summary-state-wells
Add method wells() to the SummaryState class
2019-01-08 07:44:56 +01:00
Joakim Hove
cf42146d84 Add error mode DELAYED_EXIT1 to collect all errors 2019-01-07 12:38:05 +01:00
Joakim Hove
23cbe9035b Add separate - non BOOST - test program to test exit(1) 2019-01-04 16:52:10 +01:00
Joakim Hove
2cd6fa2f49 Add overloads without ParseContext and ErrorGuard - update all tests 2019-01-04 13:59:28 +01:00
Kai Bao
1b1f7b807d re-organizing the handleWCONINH from Schedule 2019-01-03 13:26:29 +01:00
Joakim Hove
bf52e6d123 Added ErrorGuard& arguments to library 2019-01-03 13:14:40 +01:00
Kai Bao
c6bbe5d24b re-organizing the history() for WellProductionProperties 2019-01-03 12:21:25 +01:00
Joakim Hove
ad001df804 Add small class ErrorGuard to manage errors from parsing 2019-01-03 11:54:48 +01:00
Joakim Hove
69e921b33a Merge pull request #603 from joakim-hove/rm-parsecontext
Rm parsecontext
2019-01-03 11:54:37 +01:00
Kai Bao
875626b738 handling the transition between injector and producer 2019-01-03 09:47:11 +01:00
Kai Bao
7e05d51e6f handle the WELTARG with WCONINJH 2019-01-03 09:47:11 +01:00
Kai Bao
0dc80689c0 assigning BHP limit for WCONHIST and WCONINJH keywords 2019-01-03 09:47:11 +01:00
Joakim Hove
ae8b81c7ae Changed EclipseState constructor to use const ParseContext& 2019-01-02 18:52:54 +01:00
Joakim Hove
ba0675997a Remove unused ParseContext member in EclipseState 2019-01-02 18:52:54 +01:00
Joakim Hove
15c473e3bb Implement support for well capture when evaluating ACTIONX 2019-01-02 14:03:25 +01:00
Joakim Hove
6465b5b23c Add small class ActionValue to hold action eval result 2019-01-02 14:03:25 +01:00
Joakim Hove
9e93dc5af2 Add method wells() to ActionContext class 2019-01-02 11:30:56 +01:00
Joakim Hove
481123ed25 Add method wells() to the SummaryState class 2019-01-02 11:22:07 +01:00
Joakim Hove
4968c35ad8 Add method wells() to the SummaryState class 2019-01-02 11:13:49 +01:00
Joakim Hove
f6136e69fe Merge pull request #599 from joakim-hove/parsecontext-RPT
Fix mismerge of broken formatting
2018-12-20 18:19:55 +01:00
Joakim Hove
6832788eef Fix mismerge of broken formatting 2018-12-20 16:40:03 +01:00
Joakim Hove
4c0776e3d2 Merge pull request #598 from joakim-hove/parsecontext-RPT
Parsecontext rpt
2018-12-20 15:21:09 +01:00
Joakim Hove
00d1607347 Add error modes RPT_MIXED_STYLE and RPT_UNKNOWN_MNEONIC 2018-12-20 13:47:31 +01:00
Atgeirr Flø Rasmussen
142c0a12c3 Merge pull request #597 from atgeirr/workaround-liq
Workaround: LIQ preferred phase treated as OIL.
2018-12-20 13:25:59 +01:00
Joakim Hove
25fbff2632 Add ParseContext argument to the RPTxxx parsing 2018-12-20 12:27:49 +01:00
Atgeirr Flø Rasmussen
1833ee2c43 Workaround: LIQ preferred phase treated as OIL. 2018-12-20 12:10:14 +01:00
Atgeirr Flø Rasmussen
f5851bcb92 Merge pull request #596 from blattms/fix-pr-578
[bugfix] Fix influence of logging on return of getWriteRestartFile
2018-12-20 00:21:39 +01:00
Markus Blatt
5632fc6662 [bugfix] Fix influence of logging on return of getWriteRestartFile
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.
2018-12-19 23:05:17 +01:00
Joakim Hove
8375516c82 Merge pull request #595 from joakim-hove/region2region
Region2region
2018-12-19 15:40:52 +01:00
Joakim Hove
bf6732559f Add ParseContext error mode SUMMARY_UNHANDLED_KEWORD 2018-12-19 10:09:02 +01:00
Joakim Hove
3b951985ec Initial support for region 2 region keywords 2018-12-19 10:01:38 +01:00
Joakim Hove
9c98b5ceb4 Merge pull request #590 from joakim-hove/rptrst-bug
Handle space in the 'BASIC = ?' RPT mnemonics
2018-12-18 14:00:28 +01:00
Joakim Hove
161f555bc0 Handle space in the 'BASIC = ?' RPT mnemonics 2018-12-18 08:48:59 +01:00
Atgeirr Flø Rasmussen
39a6871b1d Merge pull request #588 from atgeirr/add-last-test-time
Add function WellTestState::lastTestTime().
2018-12-17 11:47:40 +01:00
Atgeirr Flø Rasmussen
175da3d436 Add function WellTestState::lastTestTime(). 2018-12-14 11:38:28 +01:00
Joakim Hove
cf61068ad1 Merge pull request #587 from bska/compare-ecl-ignoreextra
Make Summary Comparison Able to Ignore Different Number of Keywords
2018-12-13 21:31:28 +01:00
Joakim Hove
bf7b2697ee Merge pull request #586 from joakim-hove/remove-compare-summary
Removed unused file compareSummary.cpp
2018-12-13 21:10:37 +01:00
Bård Skaflestad
9098316775 Make Summary Comparison Able to Ignore Different Number of Keywords
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.
2018-12-13 20:10:34 +01:00
Joakim Hove
1249ef0dd2 Removed unused file compareSummary.cpp 2018-12-13 19:16:05 +01:00
Bård Skaflestad
2b2d4901d1 Merge pull request #584 from bska/fix-open-conn-logic-for-output
Check Size Inconsistencies Only for Open Connections
2018-12-12 14:00:42 +01:00
Bård Skaflestad
d4740ae249 Check Size Inconsistencies Only for Open Connections
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.
2018-12-12 12:40:18 +01:00
Atgeirr Flø Rasmussen
49eda9fc72 Merge pull request #580 from bska/restore-gcc49
Restore Build on GCC 4.9
2018-12-11 19:11:40 +01:00
Bård Skaflestad
3ea522d7ba Restore Build on GCC 4.9
Commit 334dbe4e broke GCC 4.9 (invoking explicit constructor with an
empty initializer_list).  Restore build by using the actual type.
2018-12-11 17:30:43 +01:00
Atgeirr Flø Rasmussen
70172f5771 Merge pull request #579 from atgeirr/silence-warnings
Silence various warnings
2018-12-11 12:52:38 +01:00
Bård Skaflestad
91306c12f4 Merge pull request #549 from jalvestad/segment-summary
Improve eclipse-restart file for multi segment wells
2018-12-10 17:03:03 +01:00
Atgeirr Flø Rasmussen
67f96f4996 Fix: add required include and std:: qualification. 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
39bb94c2c8 Silence unused argument warnings. 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
7955805dd5 Do not return by const value (no effect). 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
74c06ea703 Silence various warnings in libECLRestart.cpp.
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.
2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
71b0c2883f Avoid shadowing of variables. 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
334dbe4e1f Initialize all struct elements. 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
53252e6694 Use struct for MULTREGTRecord, match order of variables to usage. 2018-12-10 16:10:25 +01:00
Atgeirr Flø Rasmussen
e27df951f6 Merge pull request #578 from blattms/allow-silent-getWriteRestartFile-call
Allow to switch of logging during getWriteRestartFile call.
2018-12-07 18:53:41 +01:00
Markus Blatt
1062fb836b Allow to switch of logging during getWriteRestartFile call.
This needed for parallel runs as otherwise all processes will
do logging.
2018-12-07 15:52:53 +01:00
Jostein Alvestad
343d060118 changed CMakeLists_files.cmake to account for unit tests which are not finished and ready for use yet
The changes and additions in this version have been extensively tested on various input data
sets and proved to work properly and correctly
2018-12-07 12:38:33 +01:00
Jostein Alvestad
b15fab221b Corrected tests to be consistent with changes / corrections made to the various parameters 2018-12-07 12:38:31 +01:00
Jostein Alvestad
88b16f981c Removed test/debug comments 2018-12-07 12:38:30 +01:00
Jostein Alvestad
dc3f1cbf40 Added improvements to handle more general recompletion strategies
to eclipse compatible restart file
2018-12-07 12:38:29 +01:00
Jostein Alvestad
01e3aa377c Corrections to Summary.cpp for sicontinuities in rates/cumulatives
Improved messages from AggregateMSWData
2018-12-07 12:38:27 +01:00
Jostein Alvestad
44102f83a0 one more minor correction to test_AggregateMSWData.cpp 2018-12-07 12:38:26 +01:00
Jostein Alvestad
2c13cdfa18 Added minor correction to test_AggregateMSWData.cpp 2018-12-07 12:38:24 +01:00
Jostein Alvestad
1d22e3b0ed Reset change to complump for output to Restart file 2018-12-07 12:38:23 +01:00
Jostein Alvestad
2add79d122 Added corrections / improvements - generalisations for Eclipse compatible restartfiles 2018-12-07 12:38:22 +01:00
Jostein Alvestad
0cfbfb9957 Added ZGRP data to the eclipse restart file 2018-12-07 12:38:20 +01:00
Jostein Alvestad
92f65b7958 Additional changes to handle --use-multisegment-well=false 2018-12-07 12:38:19 +01:00
Jostein Alvestad
79037f93b2 Initial changes to allow for eclipse restart when using option --enable-opm-rst-file=false 2018-12-07 12:38:17 +01:00
Jostein Alvestad
633a5883f7 Added changes to prepare for unit testing of AggregateMSWdata 2018-12-07 12:38:15 +01:00
Jostein Alvestad
63590f95b0 Added initial changes to enable unit testing for AggregateMSWData 2018-12-07 12:38:14 +01:00
Jostein Alvestad
e783eaafc0 Added unit test for AggregateMSWdata 2018-12-07 12:38:13 +01:00
Atgeirr Flø Rasmussen
e341bd1c08 Merge pull request #577 from GitPaean/updating_liquid_rate_for_wconhist
updating liquid rate for WCONHIST
2018-12-07 09:58:18 +01:00
Atgeirr Flø Rasmussen
f9ce82547c Merge pull request #559 from kel85uk/fix_influx_coeff
Fix for aquifer making connection
2018-12-07 09:56:40 +01:00
Kai Bao
b349b3b217 updating liquid rate for WCONHIST 2018-12-03 16:40:42 +01:00
Joakim Hove
983ed5fcb8 Merge pull request #575 from joakim-hove/smspec-c++
Adapt to C++ changes in libecl
2018-11-30 08:09:31 +01:00
Joakim Hove
f414f5b8ad Adapt to C++ changes in libecl 2018-11-26 17:30:09 +01:00
Joakim Hove
7c52f6f5a8 Merge pull request #560 from blattms/edit-nnc-2nd-try
Represent EDITNNC in the deck representation.
2018-11-26 16:57:18 +01:00
Joakim Hove
188eb23911 Merge pull request #574 from joakim-hove/parsecontext-exit1
Parsecontext exit1
2018-11-26 14:25:34 +01:00
Joakim Hove
72ad2eaa7f Merge pull request #562 from trinemykk/addtracer
Added missing support for tracers in the parser
2018-11-26 13:02:19 +01:00
Joakim Hove
92870dc1e9 Merge pull request #576 from akva2/janitoring
Some SCA error janitoring
2018-11-26 11:56:38 +01:00
Arne Morten Kvarving
2d43ccaf8f fixed: initialize members 2018-11-26 10:41:29 +01:00
Arne Morten Kvarving
b2e0eb2507 fixed: remove unnecessary variable initialization 2018-11-26 10:41:29 +01:00
Trine S Mykkeltvedt
5085fb35c0 removed WTRACER from RPTRST_DECK.DATA to make tests pass 2018-11-26 09:44:31 +01:00
Joakim Hove
8d33ec55bd Add ParseContext error handler EXIT1 for user error 2018-11-25 11:53:34 +01:00
Joakim Hove
d70b86484d White space 2018-11-25 08:56:20 +01:00
Joakim Hove
0089fa9287 Merge pull request #572 from nairr/fix_influx_mult
fix default value influx_mult
2018-11-24 00:14:32 +01:00
6b80dd10e6 fix default value influx_mult 2018-11-23 17:42:48 +01:00
Joakim Hove
f4a9298cf4 Merge pull request #569 from joakim-hove/OPERATER
Add support for OPERATER keyword
2018-11-23 13:05:08 +01:00
Atgeirr Flø Rasmussen
7de217b8fb Merge pull request #567 from joakim-hove/normalize-case
Force UPPER_CASE when input deck has MixeDCase basename
2018-11-23 11:08:54 +01:00
Joakim Hove
039fdb70de Merge pull request #520 from GitPaean/adding_injectivity_keywords_june
Adding injectivity keywords
2018-11-23 10:56:18 +01:00
Bård Skaflestad
2f7a0bc532 Merge pull request #570 from bska/fix-rsconst-kw
Correct RSCONST and RSCONSTT Specifications
2018-11-22 14:38:16 +01:00
Bård Skaflestad
fda1719eab Correct RSCONST and RSCONSTT Specifications
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.
2018-11-22 13:28:39 +01:00
Joakim Hove
c0e9b71eec Add postAddKeyword() overload for initializable properties 2018-11-22 12:06:12 +01:00
kel85uk
d93bd35b8e Change influx_coeff to double. Remove test of influx_coeff as it is difficult to check for equal collections of pointers. Change from false to nullptr when making AquiferCTTests. 2018-11-22 09:35:01 +01:00
kel85uk
afab0103e3 Fix memory leak due to pointer errors for influx_coeff. 2018-11-22 09:34:59 +01:00
kel85uk
62f39dacce Fixes the data type to shared_ptr for the working_buffer vector 2018-11-22 09:34:57 +01:00
kel85uk
1d7a12442e Fixes the default behaviour for the influx_coeff and default aquifer pressure with AQUCT by providing nullptr instead of values. 2018-11-22 09:34:55 +01:00
Markus Blatt
d69bf47a28 Added test for parsing EDITNNC 2018-11-21 22:14:27 +01:00
Markus Blatt
7064b96260 Test for next neighbour without using abs.
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.
2018-11-21 22:14:27 +01:00
Joakim Hove
e0d5711f8e Add support for OPERATER keyword 2018-11-21 16:56:28 +01:00
Joakim Hove
3677f470fb Force UPPER_CASE when input deck has MixeDCase basename 2018-11-21 13:07:33 +01:00
Joakim Hove
44409c7a30 Merge pull request #565 from joakim-hove/schedule-eval-actions
Add method Schedule::evalActions() to evaluate ACTIONX
2018-11-21 08:21:08 +01:00
Markus Blatt
7c1e868973 Store EDITNNC in the EclipseState for latter usage by the simulator.
Only the simulator is able to determine all NNCs and therefore it needs
to apply the multiplicators itself.
2018-11-20 13:58:08 +01:00
Markus Blatt
0768c5a8b3 Revert "Merge pull request #535 from blattms/support-editnnc"
This reverts commit 7ebadbb055, reversing
changes made to 0f485c7801.
2018-11-20 13:58:08 +01:00
Trine Solberg Mykkeltvedt
ea7cb8d2c6 adding support for WTRACER keyword in EclipseState 2018-11-19 13:10:02 +01:00
Kai Bao
6858bd4578 adding the ScheduleTests for the following keywords
WPMITAB and WSKPTAB
2018-11-19 12:27:52 +01:00
Kai Bao
1b8680df7d implmentation of the polymer injectivity tables in one file
Moving PlymwinjTable.cpp PolyInjTable.cpp SkprpolyTable.cpp
SkprwatTable.cpp into one single file PolyInjTables.cpp

for better organization
2018-11-19 12:08:04 +01:00
Kai Bao
316324a78e renaming Simple2DTable to PolyInjTable
make it more clear that it is a talbe introduced for the polymer
injectivity study, not intended for general usage.
2018-11-19 12:08:04 +01:00
Kai Bao
2bf33c30d8 some cleaning up and sanity checks. 2018-11-19 12:08:04 +01:00
Kai Bao
862b3450d3 adding test for the following three keywords
SKPRWAT, SKPRPOLY and PLYMWINJ .
2018-11-19 12:08:04 +01:00
Kai Bao
082476f840 fixing errors from rebasing. 2018-11-19 12:08:04 +01:00
Kai Bao
49655b464c adding support for the few skin pressure related keywords
SKPRWAT SKPRPOLY WSKPTAB
2018-11-19 12:08:04 +01:00
Kai Bao
1432367e07 adding a few keywords related to skin pressure
SKPRPOLY, SKPRWAT, WSKPTAB
2018-11-19 12:08:04 +01:00
Kai Bao
e4912d4fcf adding keyword WPMITAB 2018-11-19 12:08:04 +01:00
Kai Bao
d0e5f8f470 beginning working on PlymwinjTable
it will go to Tables.cpp later.
2018-11-19 12:08:04 +01:00
Kai Bao
65ef90f471 removing NPLYVMH from PINTDIMS
from now on, the number of NPLYVMH will depend on the number of polymer
mixing regions, which is defined with NPLMIX from REGDIMS.
2018-11-19 12:08:04 +01:00
Kai Bao
bcb852e8f2 adding keyword PLYMWINJ 2018-11-19 12:08:04 +01:00
Trine Solberg Mykkeltvedt
927bf09688 added TBLK keyword 2018-11-19 10:25:42 +01:00
Joakim Hove
6921801eec Add method Schedule::evalActions() to evaluate ACTIONX 2018-11-19 09:57:06 +01:00
Joakim Hove
f21e2035c4 Merge pull request #563 from joakim-hove/msim-functions
Add functions for well rates and solutions to mock simulator
2018-11-16 12:43:56 +01:00
Joakim Hove
c1ffeeef53 Merge pull request #557 from joakim-hove/actioncontext-summary-state
Actioncontext summary state
2018-11-16 11:31:20 +01:00
Joakim Hove
e27abdd1a0 Merge pull request #561 from joakim-hove/dynamicstate-update-equal
Add method update_equal() to DynamicState
2018-11-16 09:43:25 +01:00
Joakim Hove
8b8285ae2b Merge pull request #556 from joakim-hove/summarystate-well-api
Summarystate well api
2018-11-16 09:42:01 +01:00
Joakim Hove
bdcb227a53 Add functions for well rates and solutions to mock simulator 2018-11-15 15:45:29 +01:00
Joakim Hove
88f043645a Removed two unused includes 2018-11-14 09:38:43 +01:00
Joakim Hove
ad55655a08 Add method update_equal() to DynamicState 2018-11-14 09:34:13 +01:00
Atgeirr Flø Rasmussen
6af3194c6c Merge pull request #554 from totto82/addPP
Add output of well phase potential
2018-11-13 14:30:17 +01:00
Joakim Hove
bb96eb9b70 Merge pull request #558 from bska/enable-stone2-kw
Recognise Requests for Stone's Second Model of 3-Phase Oil Relperm
2018-11-12 16:41:35 +01:00
Bård Skaflestad
baae4a3faf Recognise Requests for Stone's Second Model of 3-Phase Oil Relperm
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.
2018-11-12 11:50:45 +01:00
Joakim Hove
36c3080f85 ActionContext internalizes a SummaryState object 2018-11-09 21:58:36 +01:00
Joakim Hove
c35832b155 Changed exception to std::out_of_range 2018-11-09 21:14:03 +01:00
Joakim Hove
ca9da29c53 Add well_var methods to SummaryState 2018-11-09 20:45:20 +01:00
Joakim Hove
1ba51534ae Move SummaryState implementation to EclipseState/Schedule/ 2018-11-09 20:44:37 +01:00
Joakim Hove
01abada947 Merge pull request #542 from joakim-hove/actionx-parse
Actionx parse
2018-11-09 20:20:26 +01:00
Joakim Hove
212a1fde5f Parse condition part in ACTIONX 2018-11-09 20:19:34 +01:00
Joakim Hove
0b8adcbee3 Merge pull request #555 from joakim-hove/minor
Minor
2018-11-08 12:25:17 +01:00
Joakim Hove
1d755859a6 Update msim after upstream changes 2018-11-07 15:45:25 +01:00
Tor Harald Sandve
5d3125c532 Add output of well phase potential 2018-11-07 15:38:23 +01:00
Joakim Hove
971d300243 Merge pull request #553 from akva2/fix_test_macro
Fix test macro
2018-11-07 14:14:27 +01:00
Arne Morten Kvarving
199b7d710a fixed: set property for correct test name 2018-11-07 11:33:31 +01:00
Arne Morten Kvarving
d60787188e fixed: simplify boost_dyn_test code and add to opm_add_test as well 2018-11-07 11:33:31 +01:00
Joakim Hove
819ad1bf9e Merge pull request #551 from akva2/janitoring
Some small cleanups
2018-11-07 10:59:34 +01:00
Arne Morten Kvarving
3cbc40bd4d remove unused variable 2018-11-07 09:46:10 +01:00
Arne Morten Kvarving
8e92a84c09 fix indent 2018-11-07 09:46:05 +01:00
Arne Morten Kvarving
ff8ab1c1dc changed: mark constructor explicit 2018-11-07 09:43:14 +01:00
Joakim Hove
9d45632628 Make Eclipse month indices available for use outside TimeMap 2018-11-07 09:25:02 +01:00
Joakim Hove
e3e67874dd Merge pull request #91 from joakim-hove/version-0.1.2
Set __version__ to 0.1.2
2018-11-06 11:49:50 +01:00
Joakim Hove
b7fc40078b Set __version__ to 0.1.2 2018-11-06 11:18:00 +01:00
Joakim Hove
089b58f101 Merge pull request #547 from totto82/productivity_index
Add support for output of well productivity index
2018-11-06 09:38:55 +01:00
Joakim Hove
967e3ad3af Merge pull request #526 from totto82/addDRSDTR
Add DRSDTR and DRVDTR
2018-11-06 08:21:32 +01:00
Tor Harald Sandve
e2d748906e Fix failure in actionx test after rebase 2018-11-05 13:48:36 +01:00
Tor Harald Sandve
95179f393c Fix vappars and dr[sv]dt logic
The simulator should either use VAPPERS or dr[sv]dt, both the
combination drsdt and drvdt is allowed.
2018-11-05 13:38:42 +01:00
Tor Harald Sandve
6fee172f16 Add DRSDTR and DRVDTR 2018-11-05 13:37:22 +01:00
Joakim Hove
a241a1bd07 Merge pull request #545 from bska/summary-ensure-inc-elapsed
Summary: Ensure that we don't step backwards during simulation
2018-11-05 13:35:38 +01:00
Bård Skaflestad
4348438044 Summary: Ensure that we don't step backwards during simulation
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.
2018-11-04 21:48:35 +01:00
Joakim Hove
70cb7f0084 Merge pull request #90 from joakim-hove/find-boos
Use find_package(Boost ...) to find and link with Boost
2018-11-04 09:18:31 +01:00
Joakim Hove
8e801a1fae Merge pull request #546 from bska/detect-thermal-run
Simulation Config: Add Predicate for Thermal Simulations
2018-11-03 19:28:32 +01:00
Tor Harald Sandve
2d5d0953ee Add support for output of well productivity index 2018-11-02 15:57:21 +01:00
Bård Skaflestad
9df3bea857 Simulation Config: Add Predicate for Thermal Simulations
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.
2018-11-02 13:45:50 +01:00
Joakim Hove
056d6bccb4 Merge pull request #539 from joakim-hove/actionx-whitelist
ACTIONX container
2018-11-02 12:19:26 +01:00
Joakim Hove
68e6926355 Add Actions container and ActionContext for eval 2018-11-02 10:55:29 +01:00
Atgeirr Flø Rasmussen
2df9779a62 Merge pull request #544 from joakim-hove/parser-error-msg
Add a better error message for parse errors
2018-11-02 07:59:25 +01:00
Joakim Hove
cf7c2ee537 Use find_package(Boost ...) to find and link with Boost 2018-11-02 07:14:46 +01:00
Joakim Hove
60fb68d3fc Add a better error message for parse errors 2018-11-01 20:59:49 +01:00
Joakim Hove
ae9d5e97c7 Merge pull request #541 from lars-petter-hauge/include_wpimult_ctfac
Include WPIMULT for CTFAC output
2018-10-29 11:29:38 +01:00
Lars Petter Øren Hauge
d958da6542 Include WPIMULT for CTFAC output 2018-10-29 09:12:50 +01:00
Joakim Hove
b8c5d8c129 Add whitelist of keywords allowed in ACTIONX block 2018-10-27 15:59:32 +02:00
Joakim Hove
e7660b0613 White space change 2018-10-27 15:59:32 +02:00
Joakim Hove
7ebadbb055 Merge pull request #535 from blattms/support-editnnc
Added support for honoring keyword EDITNNC during deck parsing.
2018-10-25 15:49:06 +02:00
Joakim Hove
0f485c7801 Merge pull request #514 from bska/segment-summary
Serialization: Add Initial Support for Segment Information
2018-10-25 15:19:22 +02:00
Markus Blatt
a6ec18cd4e Use an approach for processing nncs without lambda. 2018-10-25 09:13:35 +02:00
Bård Skaflestad
af8f8c6bfd Segment Summary Vectors: Use Explict Keyword Whitelisting
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()'.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
258bcbc186 Restart_Segment/Vectors_Present: Include SOFR Existence
We were checking "SGFR" twice due to copy-paste...

Pointy Hat: bska
2018-10-25 09:09:32 +02:00
Bård Skaflestad
2260efaad9 RSEG: Alert Reader that 'stringSegNum' is 1 .. #Segments Inclusive
Suggested by: [at]joakim-hove
2018-10-25 09:09:32 +02:00
Bård Skaflestad
624dec542a {I,R}SEG: Don't Copy Segment or Connection Sets
We only read from these objects so they can be reference-to-const.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
7ca8b46167 SummaryConfig: Consider All Timesteps for MS Well Predicate
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.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
8fbb93497a Summary: Include <map> in Public Interface
Needed to honour requirements of class Summary in isolation.  While
here, also move <unordered_map> to implementation file.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
ef5465dcfc MSWData/RSEG: Use SummaryState Values Directly
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().
2018-10-25 09:09:32 +02:00
Bård Skaflestad
f9eb32a235 Segment Summary: Test Read/Write Support
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.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
f275fd6089 Summary: Transmit Segment Values to "prev_state"
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).
2018-10-25 09:09:32 +02:00
Bård Skaflestad
decd0b10a9 SummaryConfig: Expand Segment Vector Record Processing
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.
2018-10-25 09:09:32 +02:00
Bård Skaflestad
10c9da1a36 Summary: Guarantee Existence of Segment-Related Restart Vectors
This commit extends the set of summary vectors needed for restart to
include those needed for RSEG[8 .. 11] in the case of
multi-segmented wells.
2018-10-25 09:09:31 +02:00
Bård Skaflestad
47141dfabf data::Wells: Remove a few blank lines
Suggested by: [at]joakim-hove
2018-10-25 09:09:31 +02:00
Jostein Alvestad
613aafe4ae Changes in AggregateMSW data to write segment data to restart file
Changes in RestartIO to avoid writing of well and MSW data when wells not present
2018-10-25 09:09:31 +02:00
Bård Skaflestad
f867d7f82c SummaryConfig: Recognise Subset of Segment Vectors
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).
2018-10-25 09:09:31 +02:00
Jostein Alvestad
fe060c7f48 Changes to contribute to write segment data to summary file 2018-10-25 09:09:31 +02:00
Bård Skaflestad
80154e8f5f Serialization: Add Initial Support for Segment Information
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.
2018-10-25 09:09:31 +02:00
Joakim Hove
ae0cb3e5ad Merge pull request #528 from totto82/minpvv
Add support for minpvv
2018-10-25 09:04:32 +02:00
Joakim Hove
133f89198f Merge pull request #507 from WesselDeZeeuw/aquifet
Aquifet parser implementation
2018-10-25 09:01:29 +02:00
Markus Blatt
03bb4da004 Added warning about ignored EDITNNC entries 2018-10-25 08:04:38 +02:00
Joakim Hove
e356a16ab2 Merge pull request #462 from joakim-hove/tranx-modifier
Add deckAssigned() method to GridProperty + default construct TRAN
2018-10-24 10:36:19 +02:00
Joakim Hove
eea23abedd Merge pull request #533 from joakim-hove/GDFILE-location
Update GDFILE hadling to parse DATA outside cwd
2018-10-22 13:45:27 +02:00
Markus Blatt
5f620f7451 Added support for honoring keyword EDITNNC during deck parsing.
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.
2018-10-18 15:26:31 +02:00
Joakim Hove
c76ee877aa Update GDFILE handling to account for out-of-cwd
Make sure path to GDFILE is correct
2018-10-18 10:47:38 +02:00
Joakim Hove
fd36bf88fb Add function Deck::makeDeckPath() 2018-10-18 10:47:37 +02:00
Joakim Hove
24bd410313 Merge pull request #521 from joakim-hove/input-sim
Add skeleton for input simulator
2018-10-17 17:28:25 +02:00
Joakim Hove
984a308e24 Add skeleton for mock simulator 2018-10-17 17:21:11 +02:00
Joakim Hove
6ea7a1796d Merge pull request #530 from joakim-hove/GDFILE
Gdfile
2018-10-17 15:01:57 +02:00
Joakim Hove
ee0d256a12 Add method seconds() to Schedule and TimeMap 2018-10-17 12:09:45 +02:00
Joakim Hove
42d7587e1b Add size() method to the Schedule class 2018-10-17 06:47:57 +02:00
Joakim Hove
c75a50796b White space change 2018-10-16 00:21:49 +02:00
Joakim Hove
1190260d7d Add support for GDFILE keyword 2018-10-16 00:21:35 +02:00
Joakim Hove
5b8882d6f0 Add methods save() and addNNC() to EclipseGrid 2018-10-16 00:20:09 +02:00
Joakim Hove
f8e711246f GridDims class can initialize from binary file 2018-10-16 00:14:33 +02:00
Joakim Hove
5283611695 Add static method for conversion between unit system enums 2018-10-16 00:12:53 +02:00
Tor Harald Sandve
ca8e2f279b Add support for minpvv 2018-10-15 13:35:04 +02:00
Joakim Hove
c49b51ab23 Add test to prevent using ADD on TRANX 2018-10-15 10:50:58 +02:00
Joakim Hove
7c65850894 Merge pull request #525 from joakim-hove/find-alberta-fixup
Fixed ALBERTA_FOUND to OFF when not found
2018-10-15 10:44:29 +02:00
Joakim Hove
7279fd5ea8 Add deckAssigned() method to GridProperty + default construct TRAN
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.
2018-10-15 10:29:01 +02:00
Joakim Hove
f279c7e374 Fixed ALBERTA_FOUND to OFF when not found 2018-10-15 09:42:13 +02:00
WesselZ
7b1595d0b2 Modification of the Aquifetp header and class files for the handling the default value of p0.
Small Changes to unit test of Aquifetp
2018-10-15 09:28:39 +02:00
Joakim Hove
8c8290f614 Merge pull request #505 from blattms/fix-alberta-linker-issues
Also search for Alberta (Fixes ebos compile issue with g++-8.2)
2018-10-11 16:32:44 +02:00
WesselZ
3819910396 Modification of AquifetpTests.cpp -- 100% test passing
Added nempty Aquifetp container -- Null object -- No parsing, succesfull
2018-10-10 12:00:15 +02:00
Joakim Hove
72b39e513a Merge pull request #515 from joakim-hove/parsecontext-ignore-kw
Ability to ignore named keywords in ParseContext
2018-10-09 17:06:33 +02:00
WesselZ
04a9e710d5 Added Improved Header Files and Class files, without the ecl dependency.
Added Testfile for fetkovich implementation
2018-10-09 16:42:39 +02:00
Bård Skaflestad
1c771a66fc Merge pull request #516 from atgeirr/fix-const-map-types
Use non-const string type in map.
2018-10-08 18:32:30 +02:00
Joakim Hove
c938765224 Ability to ignore named keywords in ParseContext 2018-10-08 18:07:21 +02:00
Atgeirr Flø Rasmussen
a37625b2cf Use non-const string type in map.
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.
2018-10-08 11:02:22 +02:00
Joakim Hove
83331033b5 Merge pull request #511 from bska/wellconnections-ctor
WellConnections: Initialise Head in Copy Constructor
2018-10-02 21:02:53 +02:00
Bård Skaflestad
58a5a4e371 WellConnections: Initialise Head in Copy Constructor
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()
2018-10-02 15:59:04 +02:00
Joakim Hove
3655213c40 Merge pull request #513 from joakim-hove/bump-versions-master
Bump versions
2018-10-02 15:50:50 +02:00
Joakim Hove
2844aa4468 Bump versions 2018-10-02 15:43:01 +02:00
Markus Blatt
22b38f1031 Also search for Alberta
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.
2018-09-27 15:05:04 +02:00
Joakim Hove
c4b9378245 Merge pull request #89 from joakim-hove/komodo-build
Deteect DEST_PREFIX when adding lib dependencies
2018-09-21 14:17:49 +02:00
Joakim Hove
55eeb620ac Deteect DEST_PREFIX when adding lib dependencies 2018-09-21 14:16:38 +02:00
Joakim Hove
dcb4528e71 Merge pull request #88 from joakim-hove/connection-updates
Update sunbeam to use opm-common/2018.09
2018-09-19 15:12:56 +02:00
Joakim Hove
0a378bd49d Update sunbeam to use opm-common/2018.09 2018-09-17 21:34:39 +02:00
Joakim Hove
6d2a4b5daa Merge pull request #86 from Statoil/joakim-hove-patch-1
Update README.md
2018-08-25 07:25:17 +02:00
Joakim Hove
e46f3bf48a Update README.md 2018-08-25 07:24:48 +02:00
Joakim Hove
f3f702e503 Merge pull request #85 from joakim-hove/use-opm-common
Use opm-common
2018-08-09 10:41:27 +02:00
Joakim Hove
eed1309b7a Adapt to api changes in opm-common 2018-08-09 08:13:35 +02:00
Joakim Hove
d6147c386f Use opm-common
fixup! WIP: Use opm-common
2018-08-09 08:13:35 +02:00
Joakim Hove
514df9c289 Merge pull request #84 from joakim-hove/delete-bug
Fix bug with TimeVector.delet()
2018-06-15 09:53:02 +02:00
Joakim Hove
b50da115b9 Fix bug with TimeVector.delet() 2018-06-14 16:03:42 +02:00
Joakim Hove
d22ba5b19a Merge pull request #83 from joakim-hove/drop-dates
Implement functionality to delete dates from TimeVector
2018-06-12 10:11:48 +02:00
Joakim Hove
7ab73165be Implement functionality to delete dates from TimeVector 2018-06-11 17:12:32 +02:00
Joakim Hove
800a4221ec Merge pull request #82 from joakim-hove/issues
Verify that first keyword in TimeVector is not dates
2018-06-11 16:56:33 +02:00
Joakim Hove
ef2384baf7 Verify that first keyword in TimeVector is not dates 2018-06-11 16:36:20 +02:00
Joakim Hove
ca4400224f Merge pull request #76 from joakim-hove/time-vector-bug
Time vector bug??
2018-05-31 21:34:13 +02:00
Joakim Hove
7dc82a43e3 Fix bug with DATES with no interleaved data 2018-05-31 21:24:37 +02:00
Joakim Hove
9f802a30ee Add utils.py with testing utilities 2018-05-31 20:48:39 +02:00
Joakim Hove
1f9de9be02 Add decorator as required module 2018-05-31 20:48:38 +02:00
Joakim Hove
4591353f68 Merge pull request #72 from joakim-hove/time-vector-reorg
Changed time_vector to start with DATES. Ignore TSTEP
2018-03-23 13:50:37 +01:00
Joakim Hove
2252a7bd33 Changed time_vector to start with DATES. Ignore TSTEP 2018-03-22 10:17:45 +01:00
Joakim Hove
23153f32ab Merge pull request #71 from joakim-hove/version-0.0.6
Set version to 0.0.6
2018-03-21 12:41:08 +01:00
Joakim Hove
83428bd716 Set version to 0.0.6 2018-03-21 12:40:41 +01:00
Joakim Hove
0ae305fc5d Merge pull request #70 from joakim-hove/version-0.0.5
Raised version to 0.0.5
2018-03-21 12:36:34 +01:00
Joakim Hove
cc82c1241e Raised version to 0.0.5 2018-03-21 12:35:48 +01:00
Joakim Hove
86625ee014 Merge pull request #69 from joakim-hove/sched-tool
Schedule merge functionality.
2018-03-20 22:16:10 +01:00
Joakim Hove
d33a5a39b6 Added class TimeVector to be used as basis for Schedule merging. 2018-03-15 10:10:01 +01:00
Kristian Reed
371f8fe59e Merge pull request #66 from ReedOnly/groupnet_v2
Add VFP table to Group
2018-02-27 14:29:53 +01:00
ReedMe
60f1ac8c67 Add vfp_table_nr to Group
VFP table nr  is added from GRUPNET for further use
related to GroupTree in Webportalen
2018-02-27 10:49:01 +01:00
Joakim Hove
baa4524a56 Merge pull request #62 from joakim-hove/opm-parser-masterII
Opm parser master ii
2018-02-23 15:54:03 +01:00
Joakim Hove
66cf592e8d Added package sunbeam.deck and function sunbeam.deck.parse() 2018-02-23 13:50:02 +01:00
Joakim Hove
83f2714766 Have create SunbeamState object for access to four top level objects. 2018-02-22 20:54:23 +01:00
Joakim Hove
c61218c496 Removed test which used to work due to side-effect 2018-02-22 15:15:28 +01:00
Joakim Hove
f22e884eb4 Merge pull request #64 from ReedOnly/python3
Python3 support
2018-02-22 10:30:15 +01:00
Kristian Reed
491c1461f2 add python 3 support and travis test 2018-02-22 10:19:32 +01:00
Joakim Hove
4f26da6e20 Merge pull request #61 from Statoil/0.0.4
Raised version number to 0.0.4
2018-02-14 21:21:03 +01:00
Joakim Hove
ee0bbb70bb Raised version number to 0.0.4 2018-02-14 21:19:15 +01:00
Pål Grønås Drange
86215b69a1 Merge pull request #58 from joakim-hove/use-pybind11
Use pybind11
2018-02-09 12:18:09 +01:00
Joakim Hove
c708381f52 Update travis to use pyenv 2018-02-08 18:53:15 +01:00
Joakim Hove
5eed642924 Fix testing of times:
- 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.
2018-02-08 18:53:15 +01:00
Joakim Hove
67b30fe715 Use pybind11 as binding framework
This commit changes the api for the Schedule class, the various time related
methods now return datetime.datetime instances instead of datetime.data.
2018-02-08 18:53:15 +01:00
Joakim Hove
1566cd4e37 Change to pointer semantics in return value.
This change has been necessary to avoid premature destruction of the EclipseState
object.
2018-02-08 18:53:15 +01:00
Joakim Hove
2318c7cea4 Add pybind11 as git submodule 2018-02-08 18:35:53 +01:00
Joakim Hove
b5336fb128 Add if __name__ == "__main__" to all tests. 2018-02-08 18:35:47 +01:00
Joakim Hove
54f66af2bd Merge pull request #57 from joakim-hove/test-callable
Added if __name__ == "__main__" to test module.
2017-12-11 13:53:53 +01:00
Joakim Hove
6f6cdbc1dc Added if __name__ == "__main__" to test module. 2017-12-11 12:57:22 +01:00
Pål Grønås Drange
ffe2babdd9 Merge pull request #55 from joakim-hove/class-setup
Class setup
2017-12-06 18:01:27 +01:00
Joakim Hove
5d13eddfc8 Use setUpClass() method instead of class member variable. 2017-12-06 17:31:57 +01:00
Joakim Hove
e2a66f2bfe Using per test instance of EclipseState 2017-12-06 17:11:24 +01:00
Jens Gåsemyr Magnus
524af0dcf0 Extend Completion class implementation (#54)
* 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
2017-12-05 17:48:07 +01:00
abramb
69f74c858a Update the address of the submodule
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)
2017-11-10 17:58:44 +01:00
Andrea Brambilla
d89412e238 Workaround for missing import in Equil.hpp in opm-parser 2017.10/final 2017-11-06 15:25:34 +01:00
Andrea Brambilla
c5fc5a0120 Make sunbeam compatible with opm-parser 2017.10 2017-11-06 15:25:34 +01:00
Joakim Hove
02f41b0524 Merge pull request #49 from pgdr/minor-cleanup
Remove redundant parameter
2017-10-18 08:29:26 +02:00
Pål Grønås Drange
2b9691e62c Remove redundant parameter 2017-10-17 22:15:44 +02:00
Pål Grønås Drange
800a06c253 Merge pull request #48 from joakim-hove/opm-parser-tag
Added tag instructions to Sunbeam readme.
2017-10-16 14:59:23 +02:00
Joakim Hove
490a0ac15c Use tag sunbeam-2017.10 when building opm-parser. 2017-10-16 12:12:29 +02:00
JensGM
2823c0672a Merge pull request #44 from JensGM/pydoc
Pydoc for user facing parse functions and rename action to recovery in user facing parse functions
2017-10-09 10:16:21 +02:00
Jens Gåsemyr Magnus
a1424cc2fa Pydoc for user facing parse functions
Rename action to recovery

Changed the name of actions to recoveries in the user facing parse
functions. Updated tests to reflect this.
2017-10-09 10:07:26 +02:00
Pål Grønås Drange
b21d3e84c4 Expose grouptree ultimate (#47) 2017-10-03 20:18:29 +02:00
Pål Grønås Drange
501235485f Merge pull request #46 from ReedOnly/update_ecl_conf
Build sunbeam with previous commit of OPM-parser
2017-10-03 18:24:54 +02:00
ReedMe
b15ab2dd01 Build sunbeam with previous commit of OPM-parser
8d202adefd
2017-10-03 17:06:33 +02:00
Joakim Hove
eaee5429df Merge pull request #42 from JensGM/expose-deck-data
Added support for reading Deck data
2017-09-22 09:04:58 +02:00
Jens Gåsemyr Magnus
2cfdfc8b98 Added support for reading Deck data 2017-09-21 10:30:14 +02:00
JensGM
56f326eec8 Merge pull request #43 from JensGM/forward-cpp-docstrings
Forward docstrings from C++
2017-09-15 14:34:36 +02:00
Jens Gåsemyr Magnus
fc594faaa4 Forward docstrings from C++
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.
2017-09-14 16:56:38 +02:00
Joakim Hove
4be3d3ccd2 Merge pull request #39 from JensGM/expose-deck
WIP: Expose deck features
2017-09-11 14:50:49 +02:00
Jens Gåsemyr Magnus
0ab722902d Combined header files to a single header file 2017-09-07 14:41:31 +02:00
Jens Gåsemyr Magnus
e1d860506a Started exposing deck 2017-09-07 12:36:10 +02:00
Jens Gåsemyr Magnus
11fe32df4f Add support for dynamic parser extensions
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
2017-09-05 13:24:06 +02:00
Joakim Hove
9acb937361 Merge pull request #38 from ReedOnly/split-sunbeam-cpp
Split sunbeam cpp
2017-09-04 17:33:34 +02:00
Jens Gåsemyr Magnus
8f89b598f4 Split sunbeam.cpp
Split file in order to enhance c++ source file structure
2017-09-04 15:40:22 +02:00
Joakim Hove
79b9f66609 Merge pull request #35 from JensGM/separate-cpp-and-python
Separated C++ and python source files
2017-09-01 18:36:47 +02:00
Jens Gåsemyr Magnus
e92bd4bd36 Separated C++ and python source files
Separating the C++ and python source files to make the repository more
structures as we will create additional C++ source files.
2017-09-01 10:17:57 +02:00
Joakim Hove
4f2a8f8651 Merge pull request #33 from joakim-hove/use-rpath
Optionally enable RPATH in top level cmake file.
2017-08-30 13:51:08 +02:00
Joakim Hove
132ed34fa3 Travis will install and test using RPATH. 2017-08-29 09:42:15 +02:00
Joakim Hove
287834134c Using CMAKE_PREFIX:PATH in .travis.yml 2017-08-29 09:40:54 +02:00
Joakim Hove
4982f0fd61 Optionally enable RPATH in top level cmake file. 2017-08-28 23:15:19 +02:00
Pål Grønås Drange
4607224642 Merge pull request #32 from pgdr/parser-timemap-api-change
Adapt to change in schedule.getTimeMap in opm-parser
2017-08-18 09:44:46 +02:00
Pål Grønås Drange
163af49d18 Fix readme & travis with libecl, remove opm-common 2017-08-18 09:33:36 +02:00
Pål Grønås Drange
d5efa529ab Adapt to change in schedule.getTimeMap in opm-parser 2017-08-11 12:48:49 +02:00
Pål Grønås Drange
1959bce335 Merge pull request #31 from pgdr/add-norne
Add norne
2017-05-16 15:44:05 +02:00
Pål Grønås Drange
875c4efa8c added figures in examples 2017-05-16 13:54:04 +02:00
Pål Grønås Drange
1615417bd6 added norne integration-style test 2017-05-16 13:54:04 +02:00
Pål Grønås Drange
0e5fb1e0e0 added norne data files 2017-05-16 09:36:12 +02:00
Pål Grønås Drange
836098e6a8 Merge pull request #30 from pgdr/cell_vol
added getCellVolume on sunbeam.grid
2017-03-31 12:36:49 +02:00
Pål Grønås Drange
dd56505825 added getCellVolume on sunbeam.grid 2017-03-31 12:19:39 +02:00
Pål Grønås Drange
68a3df64c2 Merge pull request #29 from pgdr/table_lookup
Table lookup
2017-02-17 18:05:17 +01:00
Pål Grønås Drange
a4ff0e1114 parser changed default behaviour, update test 2017-02-17 16:09:24 +01:00
Pål Grønås Drange
c66cf7e159 added matplotlib example 2017-02-17 15:53:52 +01:00
Pål Grønås Drange
e1f64e83e0 table lookup in norne example 2017-02-17 15:15:05 +01:00
Pål Grønås Drange
1ed4517d65 implemented table lookup for eclipse_state 2017-02-17 15:07:09 +01:00
Pål Grønås Drange
d966376562 added basic tables support, and cornerpoint test data (#27)
* added basic tables support, and cornerpoint test data
2017-02-16 15:43:59 +01:00
Pål Grønås Drange
7a6fff51ca Update README.md 2017-02-09 14:46:21 +01:00
Pål Grønås Drange
0d8610ad04 JFunc now returns dict (#25)
made jfunc return dict
2017-02-05 10:41:28 +01:00
Joakim Hove
a30de369f9 Merge pull request #26 from joakim-hove/sunbeam-install
Add install( ) of libsunbeam.
2017-02-05 08:32:56 +01:00
Joakim Hove
8e5d3149c0 Add install( ) of libsunbeam. 2017-02-04 13:43:07 +01:00
Pål Grønås Drange
e2485b0c22 Jfunc (#24)
jfunc support
2017-02-03 11:31:22 +01:00
Pål Grønås Drange
af518e8908 Merge pull request #23 from pgdr/fault-example
added faults example
2017-01-14 13:06:21 +01:00
Pål Grønås Drange
7bdb0c7250 added faults example 2017-01-14 13:05:28 +01:00
Pål Grønås Drange
62de76c8f3 Merge pull request #22 from pgdr/faults
added faults
2017-01-13 14:50:15 +01:00
Pål Grønås Drange
d52da78ecc added faults test 2017-01-13 14:40:25 +01:00
Pål Grønås Drange
42fc9b27d1 added faults 2017-01-13 14:30:07 +01:00
Pål Grønås Drange
70a9ef173e Merge pull request #20 from pgdr/permx-test
added permx and globIdx test
2017-01-13 13:25:02 +01:00
Pål Grønås Drange
38e483fa5f Merge pull request #21 from pgdr/completion-support
added basic completions support
2017-01-13 13:08:52 +01:00
Pål Grønås Drange
39fa96b02f added some config classes, refactored out files 2017-01-13 12:52:50 +01:00
Pål Grønås Drange
afb28c00c2 added basic completions support 2017-01-12 17:17:01 +01:00
Pål Grønås Drange
cd75e134d5 added permx and globIdx test, test darcy conversion 2017-01-12 16:24:33 +01:00
Pål Grønås Drange
c606a2cc6e Merge pull request #19 from pgdr/spe3case1-whitespace
whitespace changes in SPE3CASE1.DATA
2017-01-12 15:31:53 +01:00
Pål Grønås Drange
1a419c88b6 whitespace changes in SPE3CASE1.DATA 2017-01-12 13:56:10 +01:00
Pål Grønås Drange
4f89ed02af Merge pull request #18 from pgdr/parseData
Added parseData and test
2017-01-12 13:41:34 +01:00
Pål Grønås Drange
2d1b96d908 added es.grid() to example 2017-01-12 13:12:00 +01:00
Pål Grønås Drange
dc293f9ec6 Made EclipseGrid type with tests 2017-01-12 12:54:21 +01:00
Pål Grønås Drange
bdb579b8db added parseData and test 2017-01-12 12:54:21 +01:00
Pål Grønås Drange
f6a6afa998 Merge pull request #17 from pgdr/griddims
added griddims accessors
2017-01-11 19:05:40 +01:00
Pål Grønås Drange
f26bc01f54 added griddims accessors 2017-01-11 16:53:52 +01:00
Pål Grønås Drange
82e18c5147 Merge pull request #16 from pgdr/e3dprops
Added  Eclipse3DProperties and NNC support
2017-01-11 13:18:34 +01:00
Pål Grønås Drange
2408611fb8 Added tests for props and state, refactor test setup 2017-01-11 12:43:35 +01:00
Pål Grønås Drange
f70793129d Added e3Dprops w regs, state.nnc and fixed comment 2017-01-11 12:42:38 +01:00
Pål Grønås Drange
2eab759227 Merge pull request #13 from pgdr/travis-build-and-test
added build and ctest
2017-01-10 12:41:32 +01:00
Pål Grønås Drange
a4d61d3493 deleted run_tests file no longer in use 2017-01-10 12:31:58 +01:00
Pål Grønås Drange
435d0d3a2e added build and ctest 2017-01-10 12:23:28 +01:00
Pål Grønås Drange
8ac3570255 Merge pull request #12 from pgdr/example
added small example
2017-01-10 08:57:08 +01:00
Pål Grønås Drange
60f1c983c6 add norne example, needs opm-data 2017-01-09 21:22:43 +01:00
Pål Grønås Drange
1903790bbe added example file 2017-01-09 20:01:51 +01:00
Pål Grønås Drange
0edb093b41 Merge pull request #11 from pgdr/repr-state-well-schedule
repr for state, schedule, well
2017-01-09 15:48:13 +01:00
Pål Grønås Drange
15362a145e repr for state, schedule, well 2017-01-09 15:41:52 +01:00
jokva
793f0b7be7 Merge pull request #10 from jokva/groups
Early group support
2016-12-19 09:31:37 +01:00
Jørgen Kvalsvik
c2d4372a1e Well status functions 2016-12-18 10:51:17 +01:00
Jørgen Kvalsvik
3876d67a96 Schedule.groups support 2016-12-18 10:30:57 +01:00
Jørgen Kvalsvik
a96a1317b0 Group disambiguations and massagers in namespaces 2016-12-17 13:04:10 +01:00
Jørgen Kvalsvik
c1bfade15f Split out converters in separate file. 2016-12-17 12:46:25 +01:00
Jørgen Kvalsvik
d3618225f0 KeyError exception translator; schedule.getitem 2016-12-17 12:10:14 +01:00
Jørgen Kvalsvik
b655f2d178 Get groups 2016-12-16 16:38:24 +01:00
Jørgen Kvalsvik
0f59ab1755 Allow delegate-decorated class constructors 2016-12-16 16:38:09 +01:00
jokva
bd5fa1e335 Merge pull request #9 from jokva/schedule.__contains__
Schedule.  contains
2016-12-16 12:44:03 +01:00
Jørgen Kvalsvik
b33190d30c Schedule.timesteps 2016-12-11 16:11:50 +01:00
Jørgen Kvalsvik
6426407d9b Schedule.start and Schedule.end 2016-12-11 13:00:00 +01:00
Jørgen Kvalsvik
9110164aa1 Preferred phase, group control+name, guide rate 2016-12-11 12:09:20 +01:00
Jørgen Kvalsvik
d669187eea Well.status 2016-12-11 11:45:36 +01:00
Jørgen Kvalsvik
bd3fae1b83 Richer Schedule; name property for Well. 2016-12-11 01:18:51 +01:00
Jørgen Kvalsvik
b2b5c471c1 Free functions on Well for filtering purposes 2016-12-11 01:16:55 +01:00
Jørgen Kvalsvik
f82990404f Schedule.contains and file for Schedule tests 2016-12-09 15:51:29 +01:00
Jørgen Kvalsvik
25bd997ffd Remove broken well test 2016-12-09 15:51:07 +01:00
Pål Grønås Drange
19fcb1f6b8 Merge pull request #8 from pgdr/travis-opm
added travis for opm-common and -parser
2016-12-09 13:11:12 +01:00
Pål Grønås Drange
b2748596ca build parser wo test 2016-12-08 15:58:03 +01:00
Pål Grønås Drange
a324a008fd added travis for opm-common and -parser 2016-12-08 15:46:29 +01:00
jokva
96892ec07a Merge pull request #7 from jokva/wells.py
Rudimentary Wells support.
2016-12-05 20:03:03 +01:00
Jørgen Kvalsvik
463659047e Primitive well support; delegate decorator
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.
2016-12-05 09:55:13 +01:00
Pål Grønås Drange
fa7a3029d3 Merge pull request #6 from jokva/sunbeam.parse
Sunbeam.parse
2016-12-02 10:27:43 +01:00
Jørgen Kvalsvik
321ef1d194 Support for parsecontext config 2016-12-01 16:11:47 +01:00
Jørgen Kvalsvik
25a3007a1e Move C++ source to python/, trivial bindings 2016-12-01 16:11:47 +01:00
Pål Grønås Drange
a9b537f5e8 Merge pull request #5 from jokva/python-sunbeam-makefile
Python sunbeam makefile
2016-12-01 15:56:56 +01:00
Jørgen Kvalsvik
c156eea300 Module for python cmake files; test template
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.
2016-12-01 15:52:09 +01:00
Jørgen Kvalsvik
ba06217321 Dummy C++ target - makefile improvements 2016-11-25 15:11:45 +01:00
Pål Grønås Drange
79a61ac3c7 Merge pull request #3 from pgdr/travis-build-status
added travis build status icon
2016-11-24 10:13:34 +01:00
Pål Grønås Drange
76ae686880 added travis build status icon 2016-11-24 10:12:43 +01:00
Pål Grønås Drange
848978c155 Merge pull request #2 from pgdr/init-travis-support
initial travis support
2016-11-24 10:05:42 +01:00
Pål Grønås Drange
c4c8eaf887 initial travis support 2016-11-24 10:04:50 +01:00
Pål Grønås Drange
0186739c13 Merge pull request #1 from pgdr/pycmake
Added FindPythonModule (pycmake) and init cmake
2016-11-23 16:25:24 +01:00
Pål Grønås Drange
769a0eef8a Added FindPythonModule (pycmake) and init cmake 2016-11-21 12:04:27 +01:00
Pål Grønås Drange
823b4e4faf Initial commit 2016-11-21 11:32:23 +01:00
1389 changed files with 666672 additions and 26581 deletions

20
.clang-format Normal file
View File

@@ -0,0 +1,20 @@
{
BasedOnStyle: WebKit,
AlignAfterOpenBracket: AlwaysBreak,
AlignConsecutiveAssignments: false,
AlignConsecutiveDeclarations: false,
AlignAfterOpenBracket: Align,
AllowShortBlocksOnASingleLine: false,
AllowShortFunctionsOnASingleLine: None,
AlwaysBreakAfterReturnType: TopLevelDefinitions,
AlwaysBreakTemplateDeclarations: Yes,
BinPackArguments: false,
BinPackParameters: false,
BreakBeforeBraces: Linux,
BreakConstructorInitializers: BeforeComma,
ColumnLimit: 120,
Cpp11BracedListStyle: true,
FixNamespaceComments: true,
MaxEmptyLinesToKeep: 5,
NamespaceIndentation: Inner,
}

4
.gitignore vendored
View File

@@ -69,3 +69,7 @@ install
# emacs directory setting:
.dir-locals.el
*.pyc
*.eggs
*.egg-info

0
.gitmodules vendored Normal file
View File

View File

@@ -7,6 +7,10 @@ set(OPM_MACROS_ROOT ${PROJECT_SOURCE_DIR})
option(ENABLE_ECL_INPUT "Enable eclipse input support?" ON)
option(ENABLE_ECL_OUTPUT "Enable eclipse output support?" ON)
option(ENABLE_MOCKSIM "Build the mock simulator for io testing" ON)
option(OPM_ENABLE_PYTHON "Enable python bindings?" OFF)
option(OPM_ENABLE_EMBEDDED_PYTHON "Enable python bindings?" OFF)
# Output implies input
if(ENABLE_ECL_OUTPUT)
@@ -18,6 +22,7 @@ if(NOT ENABLE_ECL_INPUT)
set(ENABLE_ECL_OUTPUT OFF)
endif()
# not the same location as most of the other projects; this hook overrides
macro (dir_hook)
endmacro (dir_hook)
@@ -107,6 +112,8 @@ macro (sources_hook)
# Append generated sources
list(APPEND opm-common_SOURCES ${PROJECT_BINARY_DIR}/ParserKeywords.cpp)
endif()
set_source_files_properties(src/opm/parser/eclipse/Python/Python.cpp
PROPERTIES COMPILE_FLAGS -Wno-shadow)
endmacro (sources_hook)
macro (fortran_hook)
@@ -130,33 +137,75 @@ endmacro (install_hook)
# all setup common to the OPM library modules is done here
include (OpmLibMain)
if (ENABLE_MOCKSIM)
add_library(mocksim
msim/src/msim.cpp)
target_link_libraries(mocksim opmcommon)
target_include_directories(mocksim PUBLIC msim/include)
add_executable(msim examples/msim.cpp)
target_link_libraries(msim mocksim)
set(_libs mocksim opmcommon
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
foreach( test test_msim test_msim_ACTIONX )
opm_add_test(${test} SOURCES tests/msim/${test}.cpp
LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach()
endif()
# Build the compare utilities
if(ENABLE_ECL_INPUT)
add_library(testutil STATIC
examples/test_util/EclFilesComparator.cpp
examples/test_util/EclIntegrationTest.cpp
examples/test_util/EclRegressionTest.cpp
examples/test_util/summaryComparator.cpp
examples/test_util/summaryIntegrationTest.cpp
examples/test_util/summaryRegressionTest.cpp)
target_link_libraries(testutil ecl)
add_executable(compareECL examples/test_util/compareECL.cpp)
target_link_libraries(compareECL testutil opmcommon)
add_executable(compareECL
test_util/EclFilesComparator.cpp
test_util/EclRegressionTest.cpp
test_util/compareECL.cpp
)
add_executable(convertECL
test_util/convertECL.cpp
)
foreach(target compareECL convertECL)
target_link_libraries(${target} opmcommon)
install(TARGETS ${target} DESTINATION bin)
endforeach()
# Add the tests
set(_libs testutil opmcommon
set(_libs opmcommon
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
opm_add_test(test_compareSummary CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs})
opm_add_test(test_EclFilesComparator CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs})
if(HAVE_DYNAMIC_BOOST_TEST)
set_target_properties(test_compareSummary PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
set_target_properties(test_EclFilesComparator PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
endif()
install(TARGETS compareECL DESTINATION bin)
opm_add_test(test_EclFilesComparator
CONDITION
ENABLE_ECL_INPUT
SOURCES
tests/test_EclFilesComparator.cpp
test_util/EclFilesComparator.cpp
LIBRARIES
${_libs}
WORKING_DIRECTORY
${PROJECT_BINARY_DIR}/tests
)
opm_add_test(test_EclRegressionTest
CONDITION
ENABLE_ECL_INPUT
SOURCES
tests/test_EclRegressionTest.cpp
test_util/EclFilesComparator.cpp
test_util/EclRegressionTest.cpp
LIBRARIES
${_libs}
WORKING_DIRECTORY
${PROJECT_BINARY_DIR}/tests
)
foreach(test test_EclIO test_EGrid test_ERft test_ERst test_ESmry)
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach()
endif()
# Install build system files
@@ -164,3 +213,90 @@ install(DIRECTORY cmake DESTINATION share/opm)
# Install tab completion skeleton
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
if (OPM_ENABLE_PYTHON)
# -------------------------------------------------------------------------
# 1: Wrap C++ functionality in Python
find_package(PythonInterp REQUIRED)
include(FindPythonInterp)
make_directory(${CMAKE_BINARY_DIR}/python)
set(PYTHON_PACKAGE_PATH "site-packages")
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
get_target_property(_opmcommon_include_dirs opmcommon INCLUDE_DIRECTORIES)
list(APPEND _opmcommon_include_dirs ${_ecl_include_dirs})
string(REPLACE ";" ":" _setup_include_dirs "${_opmcommon_include_dirs}")
set(_opmcommon_lib_dirs ${CMAKE_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/lib)
string(REPLACE ";" ":" _setup_lib_dirs "${_opmcommon_lib_dirs}")
add_custom_command(OUTPUT python/python/opm/libopmcommon_python.so
DEPENDS
python/cxx/connection.cpp
python/cxx/converters.hpp
python/cxx/deck.cpp
python/cxx/deck_keyword.cpp
python/cxx/eclipse_3d_properties.cpp
python/cxx/eclipse_config.cpp
python/cxx/eclipse_grid.cpp
python/cxx/eclipse_state.cpp
python/cxx/group.cpp
python/cxx/log.cpp
python/cxx/parsecontext.cpp
python/cxx/parser.cpp
python/cxx/schedule.cpp
python/cxx/export.cpp
python/cxx/export.hpp
python/cxx/common_state.cpp
python/cxx/common_state.hpp
python/cxx/table_manager.cpp
python/cxx/well.cpp
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/python/ ${CMAKE_BINARY_DIR}/python
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python/setup.py
build
build_ext
--build-lib=${CMAKE_BINARY_DIR}/python/python/opm
--library-dirs=${_setup_lib_dirs}
--include-dirs=${_setup_include_dirs}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python
COMMENT "Building python bindings")
add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/libopmcommon_python.so)
add_dependencies(opmcommon_python opmcommon)
install( CODE "execute_process(COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} )" )
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} python/setup.py build_ext --dry-run install --prefix=${CMAKE_INSTALL_PREFIX} )" )
add_test(NAME python_tests
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python
COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${CMAKE_BINARY_DIR}/python/python/opm test
)
set_target_properties(opmcommon PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/python/python)
# -------------------------------------------------------------------------
# Let cmake configure some small shell scripts which can be used to simplify
# building and testing of the Python extensions.
configure_file(python/setup-build.sh.in tmp/setup-build.sh)
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-build.sh
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
configure_file(python/setup-test.sh.in tmp/setup-test.sh)
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-test.sh
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
configure_file(python/enable-python.sh.in enable-python.sh)
# -------------------------------------------------------------------------
# 2: Embed the Python interpreter for keywords like PYACTION and PYINPUT
if (OPM_ENABLE_EMBEDDED_PYTHON)
add_subdirectory(python/pybind11)
target_include_directories(opmcommon PRIVATE "python/pybind11/include;${PYTHON_INCLUDE_DIRS}")
target_link_libraries(opmcommon PUBLIC ${PYTHON_LIBRARY})
add_definitions(-DEMBEDDED_PYTHON)
endif()
endif()

View File

@@ -1,5 +1,5 @@
# This file sets up five lists:
# MAIN_SOURCE_FILES List of compilation units which will be included in
# MAIN_SOURCE_FILES List of compilation units which will be included in
# the library. If it isn't on this list, it won't be
# part of the library. Please try to keep it sorted to
# maintain sanity.
@@ -35,23 +35,29 @@ list (APPEND MAIN_SOURCE_FILES
src/opm/common/utility/parameters/ParameterGroup.cpp
src/opm/common/utility/parameters/ParameterTools.cpp
src/opm/common/utility/numeric/calculateCellVol.cpp
src/opm/common/utility/TimeService.cpp
)
if(ENABLE_ECL_INPUT)
list(APPEND MAIN_SOURCE_FILES
src/opm/json/JsonObject.cpp
src/opm/parser/eclipse/Deck/Deck.cpp
src/opm/parser/eclipse/Deck/DeckItem.cpp
src/opm/parser/eclipse/Deck/DeckValue.cpp
src/opm/parser/eclipse/Deck/DeckKeyword.cpp
src/opm/parser/eclipse/Deck/DeckRecord.cpp
src/opm/parser/eclipse/Deck/DeckOutput.cpp
src/opm/parser/eclipse/Deck/Section.cpp
src/opm/parser/eclipse/Deck/UDAValue.cpp
src/opm/parser/eclipse/Python/Python.cpp
src/opm/parser/eclipse/EclipseState/AquiferCT.cpp
src/opm/parser/eclipse/EclipseState/Aquifetp.cpp
src/opm/parser/eclipse/EclipseState/Aquancon.cpp
src/opm/parser/eclipse/EclipseState/checkDeck.cpp
src/opm/parser/eclipse/EclipseState/Eclipse3DProperties.cpp
src/opm/parser/eclipse/EclipseState/EclipseConfig.cpp
src/opm/parser/eclipse/EclipseState/EclipseState.cpp
src/opm/parser/eclipse/EclipseState/EndpointScaling.cpp
src/opm/parser/eclipse/EclipseState/Edit/EDITNNC.cpp
src/opm/parser/eclipse/EclipseState/Grid/Box.cpp
src/opm/parser/eclipse/EclipseState/Grid/BoxManager.cpp
src/opm/parser/eclipse/EclipseState/Grid/EclipseGrid.cpp
@@ -69,33 +75,54 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Grid/setKeywordBox.cpp
src/opm/parser/eclipse/EclipseState/Grid/TransMult.cpp
src/opm/parser/eclipse/EclipseState/InitConfig/Equil.cpp
src/opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.cpp
src/opm/parser/eclipse/EclipseState/InitConfig/InitConfig.cpp
src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp
src/opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.cpp
src/opm/parser/eclipse/EclipseState/Runspec.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ActionX.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Connection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellConnections.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actions.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionParser.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/Condition.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group.cpp
src/opm/parser/eclipse/EclipseState/Schedule/GroupTree.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.cpp
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp
src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp
src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Tuning.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/WellTestState.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WList.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp
src/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp
src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp
src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp
@@ -103,60 +130,109 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Tables/JFunc.cpp
src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp
src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp
src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp
src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp
src/opm/parser/eclipse/EclipseState/Tables/TableSchema.cpp
src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp
src/opm/parser/eclipse/EclipseState/UDQConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQExpression.cpp
src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParser.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.cpp
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.cpp
src/opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.cpp
src/opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.cpp
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
src/opm/parser/eclipse/Parser/ParseContext.cpp
src/opm/parser/eclipse/Parser/Parser.cpp
src/opm/parser/eclipse/Parser/ParserEnums.cpp
src/opm/parser/eclipse/Parser/ParserItem.cpp
src/opm/parser/eclipse/Parser/ParserKeyword.cpp
src/opm/parser/eclipse/Parser/ParserRecord.cpp
src/opm/parser/eclipse/RawDeck/RawKeyword.cpp
src/opm/parser/eclipse/RawDeck/RawRecord.cpp
src/opm/parser/eclipse/RawDeck/StarToken.cpp
src/opm/parser/eclipse/Parser/raw/RawKeyword.cpp
src/opm/parser/eclipse/Parser/raw/RawRecord.cpp
src/opm/parser/eclipse/Parser/raw/StarToken.cpp
src/opm/parser/eclipse/Units/Dimension.cpp
src/opm/parser/eclipse/Units/UnitSystem.cpp
src/opm/parser/eclipse/Utility/Functional.cpp
src/opm/parser/eclipse/Utility/Stringview.cpp
)
if (OPM_ENABLE_EMBEDDED_PYTHON)
list( APPEND PYTHON_SOURCE_FILES
src/opm/parser/eclipse/Python/PythonInterp.cpp
python/cxx/connection.cpp
python/cxx/deck.cpp
python/cxx/deck_keyword.cpp
python/cxx/eclipse_3d_properties.cpp
python/cxx/eclipse_config.cpp
python/cxx/eclipse_grid.cpp
python/cxx/eclipse_state.cpp
python/cxx/group.cpp
python/cxx/parsecontext.cpp
python/cxx/parser.cpp
python/cxx/schedule.cpp
python/cxx/export.cpp
python/cxx/common_state.cpp
python/cxx/table_manager.cpp
python/cxx/well.cpp
python/cxx/log.cpp
)
set_source_files_properties(${PYTHON_SOURCE_FILES} PROPERTIES COMPILE_FLAGS -Wno-shadow)
list( APPEND MAIN_SOURCE_FILES ${PYTHON_SOURCE_FILES})
endif()
if(NOT cjson_FOUND)
list(APPEND MAIN_SOURCE_FILES external/cjson/cJSON.c)
endif()
endif()
if(ENABLE_ECL_OUTPUT)
list( APPEND MAIN_SOURCE_FILES
src/opm/io/eclipse/EclFile.cpp
src/opm/io/eclipse/EclOutput.cpp
src/opm/io/eclipse/EclUtil.cpp
src/opm/io/eclipse/EGrid.cpp
src/opm/io/eclipse/ERft.cpp
src/opm/io/eclipse/ERst.cpp
src/opm/io/eclipse/ESmry.cpp
src/opm/io/eclipse/OutputStream.cpp
src/opm/output/eclipse/AggregateConnectionData.cpp
src/opm/output/eclipse/AggregateGroupData.cpp
src/opm/output/eclipse/AggregateMSWData.cpp
src/opm/output/eclipse/AggregateUDQData.cpp
src/opm/output/eclipse/AggregateWellData.cpp
src/opm/output/eclipse/CreateDoubHead.cpp
src/opm/output/eclipse/CreateInteHead.cpp
src/opm/output/eclipse/CreateLogiHead.cpp
src/opm/output/eclipse/WellDataSerializers.cpp
src/opm/output/eclipse/CreateUdqDims.cpp
src/opm/output/eclipse/DoubHEAD.cpp
src/opm/output/eclipse/EclipseGridInspector.cpp
src/opm/output/eclipse/EclipseIO.cpp
src/opm/output/eclipse/InteHEAD.cpp
src/opm/output/eclipse/libECLRestart.cpp
src/opm/output/eclipse/LinearisedOutputTable.cpp
src/opm/output/eclipse/LoadRestart.cpp
src/opm/output/eclipse/LogiHEAD.cpp
src/opm/output/eclipse/RestartIO.cpp
src/opm/output/eclipse/Summary.cpp
src/opm/output/eclipse/SummaryState.cpp
src/opm/output/eclipse/Tables.cpp
src/opm/output/eclipse/RegionCache.cpp
src/opm/output/eclipse/RestartValue.cpp
src/opm/output/eclipse/WriteInit.cpp
src/opm/output/eclipse/WriteRFT.cpp
src/opm/output/data/Solution.cpp
)
endif()
@@ -178,6 +254,7 @@ if(ENABLE_ECL_INPUT)
tests/parser/ACTIONX.cpp
tests/parser/ADDREGTests.cpp
tests/parser/AquiferCTTests.cpp
tests/parser/AquifetpTests.cpp
tests/parser/AqudimsTests.cpp
tests/parser/AquanconTests.cpp
tests/parser/BoxTests.cpp
@@ -185,15 +262,18 @@ if(ENABLE_ECL_INPUT)
tests/parser/ConnectionTests.cpp
tests/parser/COMPSEGUnits.cpp
tests/parser/CopyRegTests.cpp
tests/parser/DeckValueTests.cpp
tests/parser/DeckTests.cpp
tests/parser/DynamicStateTests.cpp
tests/parser/DynamicVectorTests.cpp
tests/parser/Eclipse3DPropertiesTests.cpp
tests/parser/EclipseGridTests.cpp
tests/parser/EmbeddedPython.cpp
tests/parser/EqualRegTests.cpp
tests/parser/EventTests.cpp
tests/parser/FaceDirTests.cpp
tests/parser/FaultTests.cpp
tests/parser/FoamTests.cpp
tests/parser/FunctionalTests.cpp
tests/parser/GeomodifierTests.cpp
tests/parser/GridPropertyTests.cpp
@@ -206,9 +286,14 @@ if(ENABLE_ECL_INPUT)
tests/parser/MULTREGTScannerTests.cpp
tests/parser/OrderedMapTests.cpp
tests/parser/ParseContextTests.cpp
tests/parser/ParseContext_EXIT1.cpp
tests/parser/ParseDATAWithDefault.cpp
tests/parser/PYACTION.cpp
tests/parser/PORVTests.cpp
tests/parser/RawKeywordTests.cpp
tests/parser/ResinsightTest.cpp
tests/parser/RestartConfigTests.cpp
tests/parser/RockTableTests.cpp
tests/parser/RunspecTests.cpp
tests/parser/SatfuncPropertyInitializersTests.cpp
tests/parser/ScheduleTests.cpp
@@ -231,19 +316,27 @@ if(ENABLE_ECL_INPUT)
tests/parser/UnitTests.cpp
tests/parser/ValueTests.cpp
tests/parser/WellSolventTests.cpp
tests/parser/WellTracerTests.cpp
tests/parser/WellTests.cpp
tests/parser/WLIST.cpp
tests/parser/WTEST.cpp)
endif()
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_SOURCE_FILES
tests/test_AggregateWellData.cpp
tests/test_CharArrayNullTerm.cpp
tests/test_AggregateGroupData.cpp
tests/test_AggregateMSWData.cpp
tests/test_AggregateConnectionData.cpp
tests/test_AggregateUDQData.cpp
tests/test_ArrayDimChecker.cpp
tests/test_EclipseIO.cpp
tests/test_DoubHEAD.cpp
tests/test_InteHEAD.cpp
tests/test_LinearisedOutputTable.cpp
tests/test_LogiHEAD.cpp
tests/test_OutputStream.cpp
tests/test_regionCache.cpp
tests/test_PaddedOutputString.cpp
tests/test_Restart.cpp
tests/test_RFT.cpp
tests/test_Solution.cpp
@@ -251,9 +344,7 @@ if(ENABLE_ECL_OUTPUT)
tests/test_Tables.cpp
tests/test_Wells.cpp
tests/test_WindowedArray.cpp
tests/test_writenumwells.cpp
tests/test_serialize_ICON.cpp
tests/test_serialize_SCON.cpp
tests/test_restartwellinfo.cpp
)
endif()
@@ -262,6 +353,8 @@ list (APPEND TEST_DATA_FILES
)
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
tests/expect-wdims.chldg.err.out
tests/expect-wdims.err.out
tests/FIRST_SIM.DATA
tests/FIRST_SIM_THPRES.DATA
tests/summary_deck.DATA
@@ -272,16 +365,35 @@ if(ENABLE_ECL_OUTPUT)
tests/summary_deck_non_constant_porosity.DATA
tests/SUMMARY_EFF_FAC.DATA
tests/SPE1CASE1.DATA
tests/SPE1CASE1.SMSPEC
tests/SPE1CASE1A.SMSPEC
tests/SPE9_CP_PACKED.DATA
tests/SOFR_TEST.DATA
tests/UDQ_TEST_WCONPROD_IUAD-2.DATA
)
endif()
list (APPEND EXAMPLE_SOURCE_FILES
)
if(ENABLE_ECL_INPUT)
list (APPEND TEST_DATA_FILES
tests/ECLFILE.INIT
tests/ECLFILE.FINIT
tests/SPE1CASE1.EGRID
tests/SPE1CASE1.RFT
tests/SPE1_TESTCASE.UNRST
tests/SPE1_TESTCASE.FUNRST
tests/SPE1_TESTCASE.F0025
tests/SPE1_TESTCASE.X0025
tests/SPE1CASE1.UNSMRY
tests/SPE1CASE1A.UNSMRY
tests/SPE1CASE1_RST60.SMSPEC
tests/SPE1CASE1_RST60.UNSMRY
)
list (APPEND EXAMPLE_SOURCE_FILES
examples/opmi.cpp
examples/opmpack.cpp
examples/opmhash.cpp
)
endif()
@@ -293,6 +405,7 @@ if(ENABLE_ECL_INPUT)
list (APPEND PROGRAM_SOURCE_FILES
examples/opmi.cpp
examples/opmpack.cpp
examples/opmhash.cpp
)
endif()
@@ -329,6 +442,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/common/utility/parameters/ParameterStrings.hpp
opm/common/utility/parameters/ParameterTools.hpp
opm/common/utility/numeric/calculateCellVol.hpp
opm/common/utility/TimeService.hpp
)
if(ENABLE_ECL_INPUT)
list(APPEND PUBLIC_HEADER_FILES
@@ -342,6 +456,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/Units/UnitSystem.hpp
opm/parser/eclipse/Units/Units.hpp
opm/parser/eclipse/Units/Dimension.hpp
opm/parser/eclipse/Parser/ErrorGuard.hpp
opm/parser/eclipse/Parser/ParserItem.hpp
opm/parser/eclipse/Parser/Parser.hpp
opm/parser/eclipse/Parser/ParserRecord.hpp
@@ -352,9 +467,12 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/Parser/ParserConst.hpp
opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp
opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp
opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp
opm/parser/eclipse/EclipseState/Util/Value.hpp
opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp
opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp
opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
opm/parser/eclipse/EclipseState/Grid/GridDims.hpp
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp
@@ -374,6 +492,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp
opm/parser/eclipse/EclipseState/EndpointScaling.hpp
opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp
opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp
opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp
opm/parser/eclipse/EclipseState/Tables/TlpmixpaTable.hpp
opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp
@@ -383,8 +502,11 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp
opm/parser/eclipse/EclipseState/Tables/SpecrockTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp
opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp
opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp
opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp
opm/parser/eclipse/EclipseState/Tables/SpecheatTable.hpp
opm/parser/eclipse/EclipseState/Tables/SgcwmisTable.hpp
opm/parser/eclipse/EclipseState/Tables/Sof2Table.hpp
@@ -409,6 +531,8 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp
opm/parser/eclipse/EclipseState/Tables/AqutabTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlyadsTable.hpp
opm/parser/eclipse/EclipseState/Tables/FoamadsTable.hpp
opm/parser/eclipse/EclipseState/Tables/FoammobTable.hpp
opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp
opm/parser/eclipse/EclipseState/Tables/SorwmisTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlymaxTable.hpp
@@ -422,6 +546,10 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Tables/SgwfnTable.hpp
opm/parser/eclipse/EclipseState/Tables/PvdsTable.hpp
opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp
opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp
opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp
opm/parser/eclipse/EclipseState/Tables/RockwnodTable.hpp
opm/parser/eclipse/EclipseState/Tables/OverburdTable.hpp
opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp
opm/parser/eclipse/EclipseState/Tables/PmiscTable.hpp
opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp
@@ -434,81 +562,119 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/EclipseConfig.hpp
opm/parser/eclipse/EclipseState/Aquancon.hpp
opm/parser/eclipse/EclipseState/AquiferCT.hpp
opm/parser/eclipse/EclipseState/Schedule/ActionX.hpp
opm/parser/eclipse/EclipseState/Aquifetp.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Condition.hpp
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp
opm/parser/eclipse/EclipseState/Schedule/Well.hpp
opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp
opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp
opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp
opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp
opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp
opm/parser/eclipse/EclipseState/Schedule/Group.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/Events.hpp
opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp
opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp
opm/parser/eclipse/EclipseState/Schedule/Connection.hpp
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp
opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/WellTestState.hpp
opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp
opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp
opm/parser/eclipse/EclipseState/checkDeck.hpp
opm/parser/eclipse/EclipseState/Runspec.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp
opm/parser/eclipse/EclipseState/UDQConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQExpression.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp
opm/parser/eclipse/Deck/DeckItem.hpp
opm/parser/eclipse/Deck/Deck.hpp
opm/parser/eclipse/Deck/Section.hpp
opm/parser/eclipse/Deck/DeckOutput.hpp
opm/parser/eclipse/Deck/DeckValue.hpp
opm/parser/eclipse/Deck/DeckKeyword.hpp
opm/parser/eclipse/Deck/DeckRecord.hpp
opm/parser/eclipse/RawDeck/StarToken.hpp
opm/parser/eclipse/RawDeck/RawEnums.hpp
opm/parser/eclipse/RawDeck/RawRecord.hpp
opm/parser/eclipse/RawDeck/RawKeyword.hpp
opm/parser/eclipse/RawDeck/RawConsts.hpp)
opm/parser/eclipse/Deck/UDAValue.hpp
opm/parser/eclipse/Python/Python.hpp)
endif()
if(ENABLE_ECL_OUTPUT)
list(APPEND PUBLIC_HEADER_FILES
opm/io/eclipse/EclFile.hpp
opm/io/eclipse/EclIOdata.hpp
opm/io/eclipse/EclOutput.hpp
opm/io/eclipse/EclUtil.hpp
opm/io/eclipse/EGrid.hpp
opm/io/eclipse/ERft.hpp
opm/io/eclipse/ERst.hpp
opm/io/eclipse/ESmry.hpp
opm/io/eclipse/PaddedOutputString.hpp
opm/io/eclipse/OutputStream.hpp
opm/output/data/Cells.hpp
opm/output/data/Solution.hpp
opm/output/data/Wells.hpp
opm/output/eclipse/VectorItems/connection.hpp
opm/output/eclipse/VectorItems/group.hpp
opm/output/eclipse/VectorItems/intehead.hpp
opm/output/eclipse/VectorItems/logihead.hpp
opm/output/eclipse/VectorItems/msw.hpp
opm/output/eclipse/VectorItems/tabdims.hpp
opm/output/eclipse/VectorItems/well.hpp
opm/output/eclipse/AggregateGroupData.hpp
opm/output/eclipse/AggregateConnectionData.hpp
opm/output/eclipse/AggregateMSWData.hpp
opm/output/eclipse/AggregateUDQData.hpp
opm/output/eclipse/AggregateWellData.hpp
opm/output/eclipse/CharArrayNullTerm.hpp
opm/output/eclipse/DoubHEAD.hpp
opm/output/eclipse/EclipseGridInspector.hpp
opm/output/eclipse/EclipseIO.hpp
opm/output/eclipse/EclipseIOUtil.hpp
opm/output/eclipse/InteHEAD.hpp
opm/output/eclipse/libECLRestart.hpp
opm/output/eclipse/LinearisedOutputTable.hpp
opm/output/eclipse/LogiHEAD.hpp
opm/output/eclipse/RegionCache.hpp
opm/output/eclipse/RestartIO.hpp
opm/output/eclipse/RestartValue.hpp
opm/output/eclipse/Summary.hpp
opm/output/eclipse/SummaryState.hpp
opm/output/eclipse/Tables.hpp
opm/output/eclipse/WindowedArray.hpp
opm/output/eclipse/WriteInit.hpp
opm/output/eclipse/WriteRFT.hpp
opm/output/eclipse/WriteRestartHelpers.hpp
opm/output/OutputWriter.hpp
)

View File

@@ -1,5 +1,5 @@
# Libs to link tests against
set(TEST_LIBS opmcommon ecl Boost::unit_test_framework)
set(TEST_LIBS opmcommon Boost::unit_test_framework)
set(EXTRA_TESTS)
# Generated source, needs to be here
@@ -49,14 +49,13 @@ list(APPEND EXTRA_TESTS EclipseStateTests)
foreach (test BoxTest
CheckDeckValidity
EclipseGridCreateFromDeck
EDITNNCTests
IncludeTest
IntegrationTests
IOConfigIntegrationTest
NNCTests
ParseKEYWORD
ParseDATAWithDefault
Polymer
ResinsightTest
ScheduleCreateFromDeck
TransMultIntegrationTests)
@@ -86,6 +85,8 @@ if(HAVE_OPM_TESTS)
${OPM_TESTS_ROOT}/spe3/SPE3CASE2.DATA
${OPM_TESTS_ROOT}/spe9/SPE9_CP.DATA
${OPM_TESTS_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_TESTS_ROOT}/spe9/SPE9_CP_SHORT.DATA
${OPM_TESTS_ROOT}/spe9/SPE9_CP_SHORT_RESTART.DATA
${OPM_TESTS_ROOT}/spe9/SPE9.DATA
${OPM_TESTS_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_TESTS_ROOT}/spe10model2/SPE10_MODEL2.DATA
@@ -95,6 +96,7 @@ if(HAVE_OPM_TESTS)
EXE_NAME parse_write
TEST_ARGS ${deck})
endforeach()
opm_add_test("SPE9_CP_GROUP2" NO_COMPILE EXE_NAME parse_write TEST_ARGS "${OPM_TESTS_ROOT}/spe9group/SPE9_CP_GROUP.DATA")
set_property(TEST NORNE_ATW2013
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")
endif()

View File

@@ -1,5 +1,7 @@
set(genkw_SOURCES src/opm/json/JsonObject.cpp
src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp
src/opm/parser/eclipse/Deck/UDAValue.cpp
src/opm/parser/eclipse/Deck/DeckValue.cpp
src/opm/parser/eclipse/Deck/Deck.cpp
src/opm/parser/eclipse/Deck/DeckItem.cpp
src/opm/parser/eclipse/Deck/DeckKeyword.cpp
@@ -7,14 +9,15 @@ set(genkw_SOURCES src/opm/json/JsonObject.cpp
src/opm/parser/eclipse/Deck/DeckOutput.cpp
src/opm/parser/eclipse/Generator/KeywordGenerator.cpp
src/opm/parser/eclipse/Generator/KeywordLoader.cpp
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
src/opm/parser/eclipse/Parser/ParseContext.cpp
src/opm/parser/eclipse/Parser/ParserEnums.cpp
src/opm/parser/eclipse/Parser/ParserItem.cpp
src/opm/parser/eclipse/Parser/ParserKeyword.cpp
src/opm/parser/eclipse/Parser/ParserRecord.cpp
src/opm/parser/eclipse/RawDeck/RawKeyword.cpp
src/opm/parser/eclipse/RawDeck/RawRecord.cpp
src/opm/parser/eclipse/RawDeck/StarToken.cpp
src/opm/parser/eclipse/Parser/raw/RawKeyword.cpp
src/opm/parser/eclipse/Parser/raw/RawRecord.cpp
src/opm/parser/eclipse/Parser/raw/StarToken.cpp
src/opm/parser/eclipse/Units/Dimension.cpp
src/opm/parser/eclipse/Units/UnitSystem.cpp
src/opm/parser/eclipse/Utility/Stringview.cpp
@@ -29,7 +32,7 @@ if(NOT cjson_FOUND)
endif()
add_executable(genkw ${genkw_SOURCES})
target_link_libraries(genkw ecl Boost::regex Boost::filesystem Boost::system)
target_link_libraries(genkw Boost::regex Boost::filesystem Boost::system)
# Generate keyword list
include(src/opm/parser/eclipse/share/keywords/keyword_list.cmake)

View File

@@ -3,6 +3,24 @@
A short month-by-month synopsis of change highlights. Most bugfixes won't make
it in here, only the bigger features and interface changes.
# Important changes between release 2019.04 and 2019.10
* opm-common and the rest of OPM does not use libecl anymore and
supports reading and writing Eclipse files directly
* Improved Eclipse compatible restart, support for unified and non unified
files, and formatted and unformatted files
* Support for reading and checking various additional keywords was introduced (those
starting with A - M, R, T, V, W, Z).
* ACTIONX support implemented
* NUPCOL support implemented
* UDA, UDQ support implemented
* Implemented writing saturation function scaled end-point arrays (e.g., SWL, SGU,
SOWCR, KRORW, PCG) to INIT file
* Fixes concerning interaction of WELOPEN and WCON* with WECON and
WTEST
* Added support for FOAM keywords (FOAMMOB, FOAMROCK, WFOAM)
* Refactored and reimplemented Well representation in deck
# 2016.12
* ZCORN adjustments improved, considers cell-cell relations
* Slightly more robust compilation - won't crash if locales are broken

View File

@@ -0,0 +1,46 @@
find_library(ALBERTA_LTDL_LIB
NAMES ltdl
PATH_SUFFIXES lib lib32 lib64
)
find_path(ALBERTA_INCLUDE_DIR
NAMES alberta/alberta.h
PATHS ${ALBERTA_ROOT}
PATH_SUFFIXES alberta include NO_DEFAULT_PATH
DOC "Include path of Alberta")
find_path(ALBERTA_INCLUDE_DIR
NAMES
alberta/alberta.h
PATHS /usr/local /opt
PATH_SUFFIXES alberta)
#look for libraries
find_library(ALBERTA_UTIL_LIB
NAMES alberta_util alberta_utilities
PATHS ${ALBERTA_ROOT}
PATH_SUFFIXES lib lib32 lib64
NO_DEFAULT_PATH)
find_library(ALBERTA_UTIL_LIB
NAMES alberta_util alberta_utilities
PATH_SUFFIXES lib lib32 lib64)
foreach(dim RANGE 1 9)
find_library(ALBERTA_${dim}D_LIB alberta_${dim}d
PATHS ${ALBERTA_ROOT}
PATH_SUFFIXES lib lib32 lib64
Cache FILEPATH DOC "Alberta lib for ${dim}D" NO_DEFAULT_PATH)
find_library(ALBERTA_${dim}D_LIB alberta_${dim}d PATH_SUFFIXES lib lib32 lib64)
if(ALBERTA_${dim}D_LIB)
set(ALBERTA_LIBRARIES ${ALBERTA_LIBRARIES} ${ALBERTA_${dim}D_LIB})
endif()
endforeach(dim RANGE 1 9)
if(ALBERTA_LIBRARIES AND ALBERTA_INCLUDE_DIR)
set(ALBERTA_INCLUDE_DIRS ${ALBERTA_INCLUDE_DIR})
set(ALBERTA_LIBRARIES ${ALBERTA_LIBRARIES} ${ALBERTA_UTIL_LIB} ${ALBERTA_LTDL_LIB})
set(ALBERTA_FOUND ON)
set(Alberta_FOUND ON)
set(HAVE_ALBERTA 1)
set(DUNE_ALBERTA_VERSION 0x300)
else()
set(ALBERTA_FOUND OFF)
set(Alberta_FOUND OFF)
endif()

View File

@@ -1,287 +0,0 @@
# - Find the Ensemble-based Reservoir Tool (ERT)
#
# Set the cache variable ERT_ROOT to the install location of the ERT
# libraries and header files.
#
# If found, it sets these variables:
#
# ERT_INCLUDE_DIRS Header file directories
# ERT_LIBRARIES Archives and shared objects
# ERT_CONFIG_VARS Definitions that goes in config.h
# ERT_LINKER_FLAGS Options that must be passed to linker
#
# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to
# link with the ERT libraries.
# variables to pass on to other packages
if (FIND_QUIETLY)
set (ERT_QUIET "QUIET")
else (FIND_QUIETLY)
set (ERT_QUIET "")
endif (FIND_QUIETLY)
# if a directory has been specified by the user, then don't go look
# in the system directories as well
if (ERT_ROOT)
set (_no_default_path "NO_DEFAULT_PATH")
else (ERT_ROOT)
set (_no_default_path "")
endif (ERT_ROOT)
# ERT doesn't have any config-mode file, so we need to specify the root
# directory in its own variable
find_path (ERT_ECL_INCLUDE_DIR
NAMES "ert/ecl/ecl_util.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libecl/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
)
find_path (ERT_ECL_WELL_INCLUDE_DIR
NAMES "ert/ecl_well/well_const.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libecl_well/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
)
find_path (ERT_ECLXX_INCLUDE_DIR
NAMES "ert/ecl/EclKW.hpp"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libeclxx/include/" "include"
DOC "Path to ERT Eclipse C++ library header files"
${_no_default_path}
)
find_path (ERT_UTIL_INCLUDE_DIR
NAMES "ert/util/stringlist.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_util/include/" "include"
DOC "Path to ERT Eclipse library header files"
${_no_default_path}
)
find_path (ERT_UTILXX_INCLUDE_DIR
NAMES "ert/util/ert_unique_ptr.hpp"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_utilxx/include/" "include"
DOC "Path to ERT Eclipse C++ library header files"
${_no_default_path}
)
find_path (ERT_GEN_INCLUDE_DIR
NAMES "ert/util/int_vector.h"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
PATH_SUFFIXES "libert_util/include"
"include" "build/libert_util/include" "build/libert_util/include"
DOC "Path to ERT generated library header files"
${_no_default_path}
)
# need all of these libraries
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P)
find_library (ERT_LIBRARY_ECL
NAMES "ecl"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_ECLXX
NAMES "eclxx"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse C++ library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_ECL_WELL
NAMES "ecl_well"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Eclipse library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_GEOMETRY
NAMES "ert_geometry"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Geometry library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_UTIL
NAMES "ert_util"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Utilities library archive/shared object files"
${_no_default_path}
)
find_library (ERT_LIBRARY_UTILXX
NAMES "ert_utilxx"
HINTS "${ERT_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../libecl"
"${PROJECT_SOURCE_DIR}/../libecl/build"
"${PROJECT_BINARY_DIR}/../libecl-build"
"${PROJECT_BINARY_DIR}/../ert"
"${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build"
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
DOC "Path to ERT Utilities library archive/shared object files"
${_no_default_path}
)
# the "library" found here is actually a list of several files
list (APPEND ERT_INCLUDE_DIR
${ERT_ECL_INCLUDE_DIR}
${ERT_ECL_WELL_INCLUDE_DIR}
${ERT_ECLXX_INCLUDE_DIR}
${ERT_UTIL_INCLUDE_DIR}
${ERT_UTILXX_INCLUDE_DIR}
${ERT_GEN_INCLUDE_DIR}
)
list (APPEND ERT_LIBRARY
${ERT_LIBRARY_ECL}
${ERT_LIBRARY_ECLXX}
${ERT_LIBRARY_ECL_WELL}
${ERT_LIBRARY_GEOMETRY}
${ERT_LIBRARY_UTIL}
${ERT_LIBRARY_UTILXX}
)
list (APPEND ERT_LIBRARIES ${ERT_LIBRARY})
list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR})
# if we didn't find any files, then don't proceed through the entire dependency list
include (FindPackageHandleStandardArgs)
if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
find_package_handle_standard_args (ERT
DEFAULT_MSG
ERT_INCLUDE_DIR ERT_LIBRARY
)
# clear the cache so the find probe is attempted again if files becomes
# available (only upon a unsuccessful *compile* should we disable further
# probing)
set (HAVE_ERT)
unset (HAVE_ERT CACHE)
return ()
endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
# dependencies
# parallel programming
include (UseOpenMP)
find_openmp (ERT)
# compression library
find_package (ZLIB ${ERT_QUIET})
if (ZLIB_FOUND)
list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES})
endif (ZLIB_FOUND)
# numerics
find_package (BLAS ${ERT_QUIET})
if (BLAS_FOUND)
list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES})
list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
endif (BLAS_FOUND)
find_package (LAPACK ${ERT_QUIET})
if (LAPACK_FOUND)
list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES})
list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS})
endif (LAPACK_FOUND)
# math library (should exist on all unices; automatically linked on Windows)
if (UNIX)
find_library (MATH_LIBRARY
NAMES "m"
)
list (APPEND ERT_LIBRARIES ${MATH_LIBRARY})
endif (UNIX)
# if shared libraries are disabled on linux, explcitly linking to the
# pthreads library is required by ERT
find_package(Threads ${ERT_QUIET})
if (CMAKE_THREAD_LIBS_INIT)
list (APPEND ERT_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif()
# Platform specific library where dlopen with friends lives
list (APPEND ERT_LIBRARIES ${CMAKE_DL_LIBS})
# since OpenMP often implies pthreads, we need to tidy up
# (last instance of library must be left standing, thus reversing that
# list before removing duplicates)
include (Duplicates)
remove_dup_deps (ERT)
# see if we can compile a minimum example
# CMake logical test doesn't handle lists (sic)
if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
include (CMakePushCheckState)
include (CheckCSourceCompiles)
cmake_push_check_state ()
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
check_cxx_source_compiles (
"#include <ert/ecl/ecl_grid.h>
int main ( ) {
ecl_grid_type * grid = ecl_grid_alloc_rectangular( 10,10,10,1,1,1, NULL);
ecl_grid_free( grid );
return 0;
}" HAVE_ERT)
cmake_pop_check_state ()
else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
# clear the cache so the find probe is attempted again if files becomes
# available (only upon a unsuccessful *compile* should we disable further
# probing)
set (HAVE_ERT)
unset (HAVE_ERT CACHE)
endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
# if the test program didn't compile, but was required to do so, bail
# out now and display an error; otherwise limp on
find_package_handle_standard_args (ERT
DEFAULT_MSG
ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT
)

View File

@@ -1,53 +0,0 @@
# - Find the Python wrappers for Ensemble-based Reservoir Tool (ERT)
#
# Set the cache variable ERT_PYTHON_PATH to the install location of
# the root ert package.
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
# We try to find the ert Python distribution. This is done by running
# Python code which tries to 'import ert' and prints out the path to
# the module if the import succeeds.
#
# The normal Python import machinery is employed, so if you have
# installed ert python in a default location, or alternatively set the
# PYTHONPATH variable the ert Python distribution will eventually be
# found there, independently of the alternatives which are tested with
# the ${PATH_LIST} variable.
if (EXISTS "/etc/debian_version")
set( PYTHON_PACKAGE_PATH "dist-packages")
else()
set( PYTHON_PACKAGE_PATH "site-packages")
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
set(PATH_LIST)
if (ERT_ROOT)
list(APPEND PATH_LIST ${ERT_ROOT})
endif()
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
# Add various popular sibling alternatives.
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
"${PROJECT_BINARY_DIR}/../ert-build")
foreach( PATH ${PATH_LIST})
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import ert; print os.path.dirname(os.path.dirname(inspect.getfile(ert))); from ert.ecl import EclSum")
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
RESULT_VARIABLE import_result
OUTPUT_VARIABLE stdout_output
ERROR_VARIABLE stderr_output
OUTPUT_STRIP_TRAILING_WHITESPACE )
if (${import_result} EQUAL 0)
set( ERT_PYTHON_PATH ${stdout_output} CACHE PATH "Python path for ERT Python" )
break()
endif()
endforeach()
endif()
find_package_handle_standard_args("ERTPython" DEFAULT_MSG ERT_PYTHON_PATH)

View File

@@ -27,7 +27,8 @@ find_opm_package (
dune-geometry REQUIRED;
dune-uggrid;
MPI;
UG
UG;
Alberta
"
# header to search for
"dune/grid/onedgrid.hh"
@@ -55,7 +56,8 @@ int main (void) {
HAVE_AMIRAMESH;
HAVE_ALBERTA;
HAVE_STDINT_H;
DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS;
DUNE_ALBERTA_VERSION
")
#debug_find_vars ("dune-grid")

View File

@@ -66,10 +66,6 @@ set (_opm_proj_exemptions
dune-fem
)
# although a DUNE module, it is delivered in the OPM suite
set (opm-core_SUITE "opm")
set (ewoms_SUITE "opm")
# insert this boilerplate whenever we are going to find a new package
macro (find_and_append_package_to prefix name)
# special handling for Boost to avoid inadvertedly picking up system
@@ -156,25 +152,7 @@ macro (find_and_append_package_to prefix name)
if ( (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND )
OR _search_components GREATER -1)
string(REGEX MATCH "(dune|opm)-.*" _is_opm ${name})
if(NOT _is_opm)
string(REGEX MATCH "ewoms" _is_opm ${name})
endif()
if(${name} STREQUAL "ecl")
# Give us a chance to find ecl installed to CMAKE_INSTALL_PREFIX.
# We need to deactivate the package registry for this.
create_module_dir_var(ecl)
set(ARGN_NO_REQUIRED ${ARGN})
if(ARGN)
list(REMOVE_ITEM ARGN_NO_REQUIRED "REQUIRED")
endif()
find_package (${name} ${ARGN_NO_REQUIRED} NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_PACKAGE_REGISTRY)
if(TARGET ecl)
# Need to grab from target to enable transitional depends
#get_target_property(ecl_INCLUDE_DIRS ecl INTERFACE_INCLUDE_DIRECTORIES)
set(ecl_LIBRARIES ecl)
set(HAVE_ERT 1)
endif()
elseif(_${name}_exempted LESS 0 AND NOT _is_opm)
if(_${name}_exempted LESS 0 AND NOT _is_opm)
find_package (${name} ${ARGN})
elseif(_${name}_exempted GREATER -1)
find_package (${name} ${ARGN})

View File

@@ -20,6 +20,7 @@
# - CMP0026 to allow access to the LOCATION target property
# - CMP0048 to indicate that we want to deal with the *VERSION*
# variables ourselves
# - CMP0064 to indicate that we want TEST if conditions to be evaluated
if (POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif()
@@ -28,6 +29,10 @@ if (POLICY CMP0048)
cmake_policy(SET CMP0048 OLD)
endif()
if(POLICY CMP0064)
cmake_policy(SET CMP0064 NEW)
endif()
# set the behavior of the policy 0054 to NEW. (i.e. do not implicitly
# expand variables in if statements)
if (POLICY CMP0054)
@@ -256,9 +261,13 @@ macro (cond_disable_test name)
endif ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name}))
endmacro (cond_disable_test name)
# use this target to run all tests
# use this target to run all tests, with parallel execution
cmake_host_system_information(RESULT TESTJOBS QUERY NUMBER_OF_PHYSICAL_CORES)
if(TESTJOBS EQUAL 0)
set(TESTJOBS 1)
endif()
add_custom_target (check
COMMAND ${CMAKE_CTEST_COMMAND}
COMMAND ${CMAKE_CTEST_COMMAND} -j${TESTJOBS}
DEPENDS test-suite
COMMENT "Checking if library is functional"
VERBATIM

View File

@@ -162,7 +162,7 @@ macro (find_package_deps module)
# (i.e. if an optional package requests a package to be required,
# the build will fail if it's not found)
string (REPLACE "REQUIRED" "${_${module}_required}" _args_req "${_${module}_args}")
if(_dep MATCHES "opm-" OR _dep MATCHES "ewoms")
if(_dep MATCHES "opm-")
set(deplist ${_dep})
string(STRIP "${_dep}" _dep)
string(REPLACE " " ";" deplist "${_dep}")

View File

@@ -1,8 +1,5 @@
# - 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
@@ -11,144 +8,136 @@ mark_as_advanced(ADD_DISABLED_CTESTS)
# The following suffices must be defined for the opm prefix passed as
# parameter:
#
# _LINKER_FLAGS Necessary flags to link with this library
# _TARGET CMake target which creates the library
# _LIBRARIES Other dependencies that must also be linked
# _LINKER_FLAGS Necessary flags to link with this library
# _TARGET CMake target which creates the library
# _LIBRARIES Other dependencies that must also be linked
# Synopsis:
# opm_compile_satellites (opm satellite excl_all test_regexp)
# opm_compile_satellites (opm satellite excl_all test_regexp)
#
# Parameters:
# opm Prefix of the variable which contain information
# about the library these satellites depends on, e.g.
# pass "opm-core" if opm-core_TARGET is the name of
# the target the builds this library. Variables with
# suffixes _TARGET and _LIBRARIES must exist.
# opm Prefix of the variable which contain information
# about the library these satellites depends on, e.g.
# pass "opm-core" if opm-core_TARGET is the name of
# the target the builds this library. Variables with
# suffixes _TARGET and _LIBRARIES must exist.
#
# satellite Prefix of variable which contain the names of the
# files, e.g. pass "tests" if the files are in the
# variable tests_SOURCES. Variables with suffixes
# _DATAFILES, _SOURCES and _DIR should exist. This
# name is also used as name of the target that builds
# all these files.
# satellite Prefix of variable which contain the names of the
# files, e.g. pass "tests" if the files are in the
# variable tests_SOURCES. Variables with suffixes
# _DATAFILES, _SOURCES and _DIR should exist. This
# name is also used as name of the target that builds
# all these files.
#
# excl_all EXCLUDE_FROM_ALL if these targets should not be built by
# default, otherwise empty string.
# excl_all EXCLUDE_FROM_ALL if these targets should not be built by
# default, otherwise empty string.
#
# test_regexp Regular expression which picks the name of a test
# out of the filename, or blank if no test should be
# setup.
# test_regexp Regular expression which picks the name of a test
# out of the filename, or blank if no test should be
# setup.
#
# Example:
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
#
macro (opm_compile_satellites opm satellite excl_all test_regexp)
# if we are going to build the tests always, then make sure that
# the datafiles are present too
if (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
set (_incl_all "ALL")
set (_incl_all "ALL")
else (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
set (_incl_all "")
set (_incl_all "")
endif (NOT (${excl_all} MATCHES "EXCLUDE_FROM_ALL"))
# if a set of datafiles has been setup, pull those in
add_custom_target (${satellite} ${_incl_all})
if (${satellite}_DATAFILES)
add_dependencies (${satellite} ${${satellite}_DATAFILES})
add_dependencies (${satellite} ${${satellite}_DATAFILES})
endif (${satellite}_DATAFILES)
# compile each of these separately
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
add_dependencies (${satellite} ${_sat_NAME})
set_target_properties (${_sat_NAME} PROPERTIES
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
)
if(HAVE_DYNAMIC_BOOST_TEST AND NOT (${opm} STREQUAL "opm-parser" AND NOT BUILD_SHARED_LIBS))
set_target_properties (${_sat_NAME} PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK
)
endif()
# are we building a test? luckily, the testing framework doesn't
# require anything else, so we don't have to figure out where it
# should go in the library list
if (NOT "${test_regexp}" STREQUAL "")
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
else (NOT "${test_regexp}" STREQUAL "")
set (_test_lib "")
add_static_analysis_tests(_sat_FILE ${opm}_INCLUDE_DIRS)
endif (NOT "${test_regexp}" STREQUAL "")
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
if (STRIP_DEBUGGING_SYMBOLS)
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
add_dependencies (${satellite} ${_sat_NAME})
set_target_properties (${_sat_NAME} PROPERTIES
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}")
if(HAVE_DYNAMIC_BOOST_TEST)
set_target_properties (${_sat_NAME} PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
endif()
# are we building a test? luckily, the testing framework doesn't
# require anything else, so we don't have to figure out where it
# should go in the library list
if (NOT "${test_regexp}" STREQUAL "")
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
else (NOT "${test_regexp}" STREQUAL "")
set (_test_lib "")
add_static_analysis_tests(_sat_FILE ${opm}_INCLUDE_DIRS)
endif (NOT "${test_regexp}" STREQUAL "")
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
if (STRIP_DEBUGGING_SYMBOLS)
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
endif()
# variable with regular expression doubles as a flag for
# whether tests should be setup or not
set(_sat_FANCY)
if (NOT "${test_regexp}" STREQUAL "")
foreach (_regexp IN ITEMS ${test_regexp})
if ("${_sat_NAME}" MATCHES "${_regexp}")
string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
elseif(NOT _sat_FANCY)
set(_sat_FANCY ${_sat_NAME})
endif()
endforeach (_regexp)
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
# Run tests through mpi-run. Ubuntu 14.04 provided mpi libs will crash
# in the MPI_Finalize() call otherwise.
if(MPI_FOUND)
set(_sat_LOC ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${_sat_LOC})
endif()
if (CMAKE_VERSION VERSION_LESS "2.8.4")
add_test (NAME ${_sat_FANCY}
COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC})
else (CMAKE_VERSION VERSION_LESS "2.8.4")
add_test (${_sat_FANCY} ${_sat_LOC})
# run the test in the directory where the data files are
set_tests_properties (${_sat_FANCY} PROPERTIES
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR})
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
add_dependencies(test-suite "${_sat_NAME}")
endif(NOT "${test_regexp}" STREQUAL "")
# variable with regular expression doubles as a flag for
# whether tests should be setup or not
set(_sat_FANCY)
if (NOT "${test_regexp}" STREQUAL "")
foreach (_regexp IN ITEMS ${test_regexp})
if ("${_sat_NAME}" MATCHES "${_regexp}")
string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
elseif(NOT _sat_FANCY)
set(_sat_FANCY ${_sat_NAME})
endif()
endforeach (_regexp)
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
# Run tests through mpi-run. Ubuntu 14.04 provided mpi libs will crash
# in the MPI_Finalize() call otherwise.
if(MPI_FOUND)
set(_sat_LOC ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${_sat_LOC})
endif()
if (CMAKE_VERSION VERSION_LESS "2.8.4")
add_test (
NAME ${_sat_FANCY}
COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC}
)
else (CMAKE_VERSION VERSION_LESS "2.8.4")
add_test (${_sat_FANCY} ${_sat_LOC})
# run the test in the directory where the data files are
set_tests_properties (${_sat_FANCY} PROPERTIES
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
)
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
add_dependencies(test-suite "${_sat_NAME}")
endif(NOT "${test_regexp}" STREQUAL "")
# if this program on the list of files that should be distributed?
# we check by the name of the source file
list (FIND ${satellite}_SOURCES_DIST "${_sat_FILE}" _is_util)
if (NOT (_is_util EQUAL -1))
install (TARGETS ${_sat_NAME} RUNTIME
DESTINATION bin${${opm}_VER_DIR}/
)
endif (NOT (_is_util EQUAL -1))
# if this program on the list of files that should be distributed?
# we check by the name of the source file
list (FIND ${satellite}_SOURCES_DIST "${_sat_FILE}" _is_util)
if (NOT (_is_util EQUAL -1))
install (TARGETS ${_sat_NAME} RUNTIME
DESTINATION bin${${opm}_VER_DIR}/)
endif (NOT (_is_util EQUAL -1))
endforeach (_sat_FILE)
endmacro (opm_compile_satellites opm prefix)
# Synopsis:
# opm_data (satellite target dirname files)
# opm_data (satellite target dirname files)
#
# provides these output variables:
#
# ${satellite}_INPUT_FILES List of all files that are copied
# ${satellite}_DATAFILES Name of target which copies these files
# ${satellite}_INPUT_FILES List of all files that are copied
# ${satellite}_DATAFILES Name of target which copies these files
#
# Example:
#
# opm_data (tests datafiles "tests/")
# opm_data (tests datafiles "tests/")
#
macro (opm_data satellite target dirname)
# even if there are no datafiles, create the directory so the
# satellite programs have a homedir to run in
execute_process (
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${dirname}
)
execute_process (COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${dirname})
# if ever huge test datafiles are necessary, then change this
# into "create_symlink" (on UNIX only, apparently)
@@ -158,26 +147,27 @@ macro (opm_data satellite target dirname)
# to a tests/ directory in the output tree (if different)
set (${satellite}_INPUT_FILES)
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
foreach (input_datafile IN LISTS ${satellite}_DATA)
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
set (output_datafile "${PROJECT_BINARY_DIR}/${rel_datafile}")
add_custom_command (
OUTPUT ${output_datafile}
COMMAND ${CMAKE_COMMAND}
ARGS -E ${make_avail} ${input_datafile} ${output_datafile}
DEPENDS ${input_datafile}
VERBATIM
)
list (APPEND ${satellite}_INPUT_FILES "${output_datafile}")
endforeach (input_datafile)
foreach (input_datafile IN LISTS ${satellite}_DATA)
if (IS_ABSOLUTE ${input_datafile})
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
else()
set(rel_datafile ${input_datafile})
endif()
set (output_datafile "${PROJECT_BINARY_DIR}/${rel_datafile}")
add_custom_command (OUTPUT ${output_datafile}
COMMAND ${CMAKE_COMMAND}
ARGS -E ${make_avail} ${input_datafile} ${output_datafile}
DEPENDS ${input_datafile}
VERBATIM)
list (APPEND ${satellite}_INPUT_FILES "${output_datafile}")
endforeach (input_datafile)
endif(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
# setup a target which does all the copying
set (${satellite}_DATAFILES "${target}")
add_custom_target (${${satellite}_DATAFILES}
DEPENDS ${${satellite}_INPUT_FILES}
COMMENT "Making \"${satellite}\" data available in output tree"
)
DEPENDS ${${satellite}_INPUT_FILES}
COMMENT "Making \"${satellite}\" data available in output tree")
if(NOT TARGET test-suite)
add_custom_target(test-suite)
endif()
@@ -192,6 +182,7 @@ endmacro (opm_data satellite target dirname files)
# Parameters:
# TestName Name of test
# ONLY_COMPILE Only build test but do not run it (optional)
# DEFAULT_ENABLE_IF Only enable by default if a given condition is true (optional)
# ALWAYS_ENABLE Force enabling test even if -DBUILD_TESTING=OFF was set (optional)
# EXE_NAME Name of test executable (optional, default: ./bin/${TestName})
# CONDITION Condition to enable test (optional, cmake code)
@@ -218,7 +209,7 @@ macro(opm_add_test TestName)
cmake_parse_arguments(CURTEST
"NO_COMPILE;ONLY_COMPILE;ALWAYS_ENABLE" # flags
"EXE_NAME;PROCESSORS;WORKING_DIRECTORY" # one value args
"CONDITION;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
"CONDITION;DEFAULT_ENABLE_IF;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
${ARGN})
set(BUILD_TESTING "${BUILD_TESTING}")
@@ -266,6 +257,11 @@ macro(opm_add_test TestName)
# case. They can still be build using 'make test-suite' and they can
# be build and run using 'make check'
set(CURTEST_EXCLUDE_FROM_ALL "")
if (NOT "AND OR ${CURTEST_DEFAULT_ENABLE_IF}" STREQUAL "AND OR ")
if (NOT ${CURTEST_DEFAULT_ENABLE_IF})
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()
endif()
if (NOT BUILD_TESTING AND NOT CURTEST_ALWAYS_ENABLE)
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()
@@ -303,6 +299,8 @@ macro(opm_add_test TestName)
# only compile the binary but do not run it as a test
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
add_static_analysis_tests(CURTEST_SOURCES dirs)
if(TARGET ${project}_prepare)
add_dependencies("${CURTEST_EXE_NAME}" ${project}_prepare)
@@ -316,7 +314,13 @@ macro(opm_add_test TestName)
# run-only case occurs if the binary is already compiled by an
# earlier test.)
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
if(HAVE_DYNAMIC_BOOST_TEST)
set_target_properties (${CURTEST_EXE_NAME} PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
endif()
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
add_static_analysis_tests(CURTEST_SOURCES dirs)
if(CURTEST_DEPENDS)
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
@@ -344,12 +348,12 @@ macro(opm_add_test TestName)
# specify the dependencies between the tests
if (CURTEST_TEST_DEPENDS)
set_tests_properties(${TestName} PROPERTIES DEPENDS "${CURTEST_TEST_DEPENDS}")
set_tests_properties(${_FANCY} PROPERTIES DEPENDS "${CURTEST_TEST_DEPENDS}")
endif()
# tell ctest how many cores it should reserve to run the test
if (CURTEST_PROCESSORS)
set_tests_properties(${TestName} PROPERTIES PROCESSORS "${CURTEST_PROCESSORS}")
set_tests_properties(${_FANCY} PROPERTIES PROCESSORS "${CURTEST_PROCESSORS}")
endif()
endif()
@@ -359,15 +363,6 @@ macro(opm_add_test TestName)
endif()
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
endif()
else() # test is skipped
# the following causes the test to appear as 'skipped' in the
# CDash dashboard. it this is removed, the test is just silently
# ignored.
if (NOT CURTEST_ONLY_COMPILE AND ADD_DISABLED_CTESTS)
add_test(${_FANCY} skip_test_dummy)
endif()
endif()
endmacro()

View File

@@ -9,12 +9,7 @@ macro(create_module_dir_var module)
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
#Try if <module-name>/<build-dir> is used
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
if ("${module}" STREQUAL "ecl")
#use clone directory libecl
set(_clone_dir "libecl")
else()
set(_clone_dir "${module}")
endif()
set(_clone_dir "${module}")
if(IS_DIRECTORY ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
set(${module}_DIR ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
else()
@@ -23,7 +18,8 @@ macro(create_module_dir_var module)
AND IS_DIRECTORY ${_parent_full_dir}/${_module_leaf})
# We are using build directories named <prefix><module-name><postfix>
set(${module}_DIR ${_parent_full_dir}/${_module_leaf})
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir})
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir} AND
EXISTS ${_parent_full_dir}/${_clone_dir}/CMakeCache.txt)
# All modules are in a common build dir
set(${module}_DIR "${_parent_full_dir}/${_clone_dir}")
endif()

View File

@@ -34,16 +34,29 @@ function(add_static_analysis_tests sources includes)
list(APPEND IPATHS -I ${dep})
endforeach()
foreach(src ${${sources}})
file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
if(src MATCHES "TARGET_OBJECTS:")
string(REGEX REPLACE "\\$<TARGET_OBJECTS:(.*)>" "\\1" TGT ${src})
get_target_property(src ${TGT} SOURCES)
endif()
if(IS_ABSOLUTE ${src})
file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
else()
set(name ${src})
set(src ${PROJECT_SOURCE_DIR}/${src})
endif()
if(CPPCHECK_FOUND)
add_test(NAME cppcheck+${name}
COMMAND bin/cppcheck-test.sh ${CPPCHECK_PROGRAM} ${src} ${IPATHS}
CONFIGURATIONS analyze cppcheck)
if(NOT TEST cppcheck+${name})
add_test(NAME cppcheck+${name}
COMMAND bin/cppcheck-test.sh ${CPPCHECK_PROGRAM} ${src} ${IPATHS}
CONFIGURATIONS analyze cppcheck)
endif()
endif()
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
add_test(NAME clang-check+${name}
COMMAND bin/clang-check-test.sh ${CLANGCHECK_PROGRAM} ${src}
CONFIGURATIONS analyze clang-check)
if(NOT TEST clang-check+${name})
add_test(NAME clang-check+${name}
COMMAND bin/clang-check-test.sh ${CLANGCHECK_PROGRAM} ${src}
CONFIGURATIONS analyze clang-check)
endif()
endif()
endforeach()
endif()

View File

@@ -6,7 +6,7 @@ is_compiler_gcc_compatible ()
if (CXX_COMPAT_GCC)
# default warnings flags, if not set by user
set_default_option (CXX _warn_flag "-Wall" "(^|\ )-W")
set_default_option (CXX _warn_flag "-Wall -Wextra -Wshadow" "(^|\ )-W")
if (_warn_flag)
message (STATUS "All warnings enabled: ${_warn_flag}")
add_options (ALL_LANGUAGES ALL_BUILDS "${_warn_flag}")

View File

@@ -31,30 +31,15 @@ if(NOT check_target)
endif()
# Build threads
include(ProcessorCount)
set(build_threads $ENV{CHECK_THREADS})
if(NOT build_threads)
if(UNIX)
if(APPLE)
execute_process(COMMAND sysctl hw.ncpu
OUTPUT_VARIABLE build_threads)
string(REPLACE " " ";" build_threads_list ${build_threads)
list(GET build_threads_list 1 build_threads)
else()
find_program(NPROC_COMMAND nproc)
if(NPROC_COMMAND)
execute_process(COMMAND ${NPROC_COMMAND}
OUTPUT_VARIABLE build_threads)
string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}")
endif()
endif()
ProcessorCount(build_threads)
if(build_threads EQUAL 0)
set(build_threads 1)
endif()
endif()
# If for some reason we could not find the info - e.g. centos5 where nproc is missing
if(NOT build_threads)
set(build_threads 1)
endif()
# Record current HEAD
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE current_branch

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
opm-common (2018.10-rfinal-2~xenial) xenial; urgency=medium
opm-common (2019.10-rc2-1~xenial) xenial; urgency=medium
* New release

2
debian/control vendored
View File

@@ -5,7 +5,7 @@ Build-Depends: build-essential, debhelper (>= 9),
pkg-config, cmake, git, libtool, doxygen,
texlive-latex-extra, texlive-latex-recommended,
ghostscript, libboost-system-dev, libboost-test-dev,
libecl-dev, libboost-regex-dev, libboost-filesystem-dev,
libboost-regex-dev, libboost-filesystem-dev,
zlib1g-dev
Standards-Version: 3.9.2
Section: libs

View File

@@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2018.10
Label: 2018.10
Version: 2019.10-rc3
Label: 2019.10-rc3
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@@ -11,7 +11,7 @@ _ewoms_parameter_completor()
cmd="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
fullcmd="$(which "$cmd")"
fullcmd="$(which "$cmd" 2> /dev/null)"
ALL_OPTS=$("$fullcmd" --help 2> /dev/null | grep '^ *--' | sed 's/ *\(--[a-zA-Z0-9\-]*\)=.*/\1=/')
ALL_OPTS=$(echo "$ALL_OPTS" | sed 's/^ *--help.*/--help/')
COMPREPLY=( $(compgen -A file -W "$ALL_OPTS" -- "${cur}") )
@@ -32,7 +32,7 @@ _ewoms_generic_parameter_completor()
cmd="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
fullcmd="$(which "$cmd")"
fullcmd="$(which "$cmd" 2> /dev/null)"
if test -z "$fullcmd" || \
! test -x "$fullcmd" || \
(! test -f "$fullcmd" && ! test -h "$fullcmd" ) || \

53
examples/msim.cpp Normal file
View File

@@ -0,0 +1,53 @@
/*
Copyright 2013 Statoil ASA.
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/output/eclipse/EclipseIO.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/msim/msim.hpp>
int main(int /* argc */, char** argv) {
std::string deck_file = argv[1];
Opm::Parser parser;
Opm::ParseContext parse_context;
Opm::ErrorGuard error_guard;
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
Opm::EclipseState state(deck, parse_context, error_guard);
Opm::Schedule schedule(deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parse_context, error_guard);
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), parse_context, error_guard);
if (error_guard) {
error_guard.dump();
error_guard.terminate();
}
Opm::msim msim(state);
Opm::EclipseIO io(state, state.getInputGrid(), schedule, summary_config);
msim.run(schedule, io, false);
}

158
examples/opmhash.cpp Normal file
View File

@@ -0,0 +1,158 @@
/*
Copyright 2019 Equinor ASA.
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 <getopt.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
struct keyword {
keyword(const std::string& name_arg, const std::string& filename_arg,
std::size_t line_number_arg, std::size_t content_hash_arg) :
name(name_arg),
filename(filename_arg),
line_number(line_number_arg),
content_hash(content_hash_arg)
{}
std::string name;
std::string filename;
std::size_t line_number;
std::size_t content_hash;
};
std::vector<keyword> load_deck(const char * deck_file) {
Opm::ParseContext parseContext;
Opm::ErrorGuard errors;
Opm::Parser parser;
std::vector<keyword> keywords;
/* Use the same default ParseContext as flow. */
parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE);
parseContext.update(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN);
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN);
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN);
auto deck = parser.parseFile(deck_file, parseContext, errors);
for (const auto& kw : deck) {
std::stringstream ss;
ss << kw;
keywords.emplace_back(kw.name(), kw.getFileName(), kw.getLineNumber(), std::hash<std::string>{}(ss.str()));
}
return keywords;
}
std::size_t deck_hash(const std::vector<keyword>& keywords) {
std::stringstream ss;
for (const auto& kw : keywords)
ss << kw.content_hash;
return std::hash<std::string>{}(ss.str());
}
void print_keywords(const std::vector<keyword>& keywords, bool location_info) {
for (const auto& kw : keywords) {
if (location_info)
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.filename << ":" << kw.line_number << " " << kw.content_hash << std::endl;
else
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.content_hash << std::endl;
}
std::cout << std::endl;
std::cout << std::setw(8) << std::left << "Total" << " : " << deck_hash(keywords) << std::endl;
}
void print_help_and_exit() {
const char * help_text = R"(The purpose of the opmhash program is to load a deck and create a summary, by
diffing two such summaries it is simple to determine if two decks are similar.
For each keyword a hash of the normalized content is calculated. The output of
the program will look like this:
RUNSPEC : 13167205945009276792
TITLE : 16047371705964514902
DIMENS : 1264233216877515756
NONNC : 10052807539267647959
OIL : 6013609912232720008
WATER : 14106203893673265964
Total : 7362809723723482303
Where the 'random' integer following each keyword is the hash of the content of
that keyword. The hashing is insensitive to changes in white-space and comments
and file location. At the bottom comes a total hash of the complete content. The
hash of each keyword is insensitive to shuffling of keywords, but the total hash
depends on the keyword order.
Options:
-l : Add filename and linenumber information to each keyword.
-s : Short form - only print the hash of the complete deck.
)";
std::cerr << help_text << std::endl;
exit(1);
}
int main(int argc, char** argv) {
int arg_offset = 1;
bool location_info = false;
bool short_form = false;
while (true) {
int c;
c = getopt(argc, argv, "ls");
if (c == -1)
break;
switch(c) {
case 'l':
location_info = true;
break;
case 's':
short_form = true;
break;
}
}
arg_offset = optind;
if (arg_offset >= argc)
print_help_and_exit();
auto keywords = load_deck(argv[arg_offset]);
if (short_form)
std::cout << deck_hash(keywords) << std::endl;
else
print_keywords(keywords, location_info);
}

View File

@@ -21,29 +21,40 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/StreamLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
void initLogging() {
std::shared_ptr<Opm::StreamLog> cout_log = std::make_shared<Opm::StreamLog>(std::cout, Opm::Log::DefaultMessageTypes);
Opm::OpmLog::addBackend( "COUT" , cout_log);
}
inline void loadDeck( const char * deck_file) {
Opm::ParseContext parseContext;
Opm::ErrorGuard errors;
Opm::Parser parser;
std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
auto deck = parser.parseFile(deck_file, parseContext);
auto deck = parser.parseFile(deck_file, parseContext, errors);
std::cout << "parse complete - creating EclipseState .... "; std::cout.flush();
Opm::EclipseState state( deck, parseContext );
Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec().phases(), parseContext);
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext );
Opm::EclipseState state( deck, parseContext, errors );
Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parseContext, errors);
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext, errors );
std::cout << "complete." << std::endl;
}
int main(int argc, char** argv) {
initLogging();
for (int iarg = 1; iarg < argc; iarg++)
loadDeck( argv[iarg] );
}

View File

@@ -22,6 +22,7 @@
#include <boost/filesystem.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@@ -29,9 +30,10 @@
inline void pack_deck( const char * deck_file, std::ostream& os) {
Opm::ParseContext parseContext(Opm::InputError::WARN);
Opm::ErrorGuard errors;
Opm::Parser parser;
auto deck = parser.parseFile(deck_file, parseContext);
auto deck = parser.parseFile(deck_file, parseContext, errors);
os << deck;
}

View File

@@ -1,300 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "EclFilesComparator.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <opm/common/utility/numeric/calculateCellVol.hpp>
#include <stdio.h>
#include <set>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <ert/ecl/ecl_file.h>
#include <ert/ecl/ecl_grid.h>
#include <ert/ecl/ecl_type.h>
#include <ert/ecl_well/well_info.h>
// helper macro to handle error throws or not
#define HANDLE_ERROR(type, message) \
{ \
if (throwOnError) \
OPM_THROW(type, message); \
else { \
std::cerr << message << std::endl; \
++num_errors; \
} \
}
namespace {
/*
This is just a basic survival test; we verify that the ERT well
loader which is used in Resinsight can load the well description
from the restart file.
*/
void loadWells( const ecl_grid_type * grid , ecl_file_type * rst_file ) {
well_info_type * well_info = well_info_alloc( grid );
well_info_add_UNRST_wells2( well_info , ecl_file_get_global_view( rst_file ), true );
well_info_free( well_info );
}
}
void ECLFilesComparator::keywordValidForComparing(const std::string& keyword) const {
auto it = std::find(keywords1.begin(), keywords1.end(), keyword);
if (it == keywords1.end()) {
OPM_THROW(std::runtime_error, "Keyword " << keyword << " does not exist in first file.");
}
it = find(keywords2.begin(), keywords2.end(), keyword);
if (it == keywords2.end()) {
OPM_THROW(std::runtime_error, "Keyword " << keyword << " does not exist in second file.");
}
}
unsigned int ECLFilesComparator::getEclKeywordData(ecl_kw_type*& ecl_kw1, ecl_kw_type*& ecl_kw2, const std::string& keyword, int occurrence1, int occurrence2) const {
ecl_kw1 = ecl_file_iget_named_kw(ecl_file1, keyword.c_str(), occurrence1);
ecl_kw2 = ecl_file_iget_named_kw(ecl_file2, keyword.c_str(), occurrence2);
const unsigned int numCells1 = ecl_kw_get_size(ecl_kw1);
const unsigned int numCells2 = ecl_kw_get_size(ecl_kw2);
if (numCells1 != numCells2) {
OPM_THROW(std::runtime_error, "For keyword " << keyword << ":"
<< "\nOccurrence in first file " << occurrence1
<< "\nOccurrence in second file " << occurrence2
<< "\nCells in first file: " << numCells1
<< "\nCells in second file: " << numCells2
<< "\nThe number of cells differ.");
}
return numCells1;
}
template <typename T>
void ECLFilesComparator::printValuesForCell(const std::string& /*keyword*/, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const T& value1, const T& value2) const {
if (kw_size == static_cast<size_t>(ecl_grid_get_active_size(ecl_grid1))) {
int i, j, k;
ecl_grid_get_ijk1A(ecl_grid1, cell, &i, &j, &k);
// Coordinates from this function are zero-based, hence incrementing
i++, j++, k++;
std::cout << std::endl
<< "Occurrence in first file = " << occurrence1 << "\n"
<< "Occurrence in second file = " << occurrence2 << "\n"
<< "Value index = " << cell << "\n"
<< "Grid coordinate = (" << i << ", " << j << ", " << k << ")" << "\n"
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
return;
}
if (kw_size == static_cast<size_t>(ecl_grid_get_global_size(ecl_grid1))) {
int i, j, k;
ecl_grid_get_ijk1(ecl_grid1, cell, &i, &j, &k);
// Coordinates from this function are zero-based, hence incrementing
i++, j++, k++;
std::cout << std::endl
<< "Occurrence in first file = " << occurrence1 << "\n"
<< "Occurrence in second file = " << occurrence2 << "\n"
<< "Value index = " << cell << "\n"
<< "Grid coordinate = (" << i << ", " << j << ", " << k << ")" << "\n"
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
return;
}
std::cout << std::endl
<< "Occurrence in first file = " << occurrence1 << "\n"
<< "Occurrence in second file = " << occurrence2 << "\n"
<< "Value index = " << cell << "\n"
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
}
template void ECLFilesComparator::printValuesForCell<bool> (const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const bool& value1, const bool& value2) const;
template void ECLFilesComparator::printValuesForCell<int> (const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const int& value1, const int& value2) const;
template void ECLFilesComparator::printValuesForCell<double> (const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const double& value1, const double& value2) const;
template void ECLFilesComparator::printValuesForCell<std::string>(const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const std::string& value1, const std::string& value2) const;
ECLFilesComparator::ECLFilesComparator(int file_type_arg, const std::string& basename1,
const std::string& basename2,
double absToleranceArg, double relToleranceArg) :
file_type(file_type_arg), absTolerance(absToleranceArg), relTolerance(relToleranceArg) {
std::string file1, file2;
if (file_type == ECL_UNIFIED_RESTART_FILE) {
file1 = basename1 + ".UNRST";
file2 = basename2 + ".UNRST";
}
else if (file_type == ECL_INIT_FILE) {
file1 = basename1 + ".INIT";
file2 = basename2 + ".INIT";
}
else if (file_type == ECL_RFT_FILE) {
file1 = basename1 + ".RFT";
file2 = basename2 + ".RFT";
}
else {
OPM_THROW(std::invalid_argument, "Unsupported filetype sent to ECLFilesComparator's constructor."
<< "Only unified restart (.UNRST), initial (.INIT) and .RFT files are supported.");
}
ecl_file1 = ecl_file_open(file1.c_str(), 0);
ecl_file2 = ecl_file_open(file2.c_str(), 0);
ecl_grid1 = ecl_grid_load_case(basename1.c_str());
ecl_grid2 = ecl_grid_load_case(basename2.c_str());
if (ecl_file1 == nullptr) {
OPM_THROW(std::invalid_argument, "Error opening first file: " << file1);
}
if (ecl_file2 == nullptr) {
OPM_THROW(std::invalid_argument, "Error opening second file: " << file2);
}
if (ecl_grid1 == nullptr) {
OPM_THROW(std::invalid_argument, "Error opening first grid file: " << basename1);
}
if (ecl_grid2 == nullptr) {
OPM_THROW(std::invalid_argument, "Error opening second grid file. " << basename2);
}
unsigned int numKeywords1 = ecl_file_get_num_distinct_kw(ecl_file1);
unsigned int numKeywords2 = ecl_file_get_num_distinct_kw(ecl_file2);
keywords1.reserve(numKeywords1);
keywords2.reserve(numKeywords2);
for (unsigned int i = 0; i < numKeywords1; ++i) {
std::string keyword(ecl_file_iget_distinct_kw(ecl_file1, i));
keywords1.push_back(keyword);
}
for (unsigned int i = 0; i < numKeywords2; ++i) {
std::string keyword(ecl_file_iget_distinct_kw(ecl_file2, i));
keywords2.push_back(keyword);
}
if (file_type == ECL_UNIFIED_RESTART_FILE) {
loadWells( ecl_grid1 , ecl_file1 );
loadWells( ecl_grid2 , ecl_file2 );
}
}
ECLFilesComparator::~ECLFilesComparator() {
ecl_file_close(ecl_file1);
ecl_file_close(ecl_file2);
ecl_grid_free(ecl_grid1);
ecl_grid_free(ecl_grid2);
}
void ECLFilesComparator::printKeywords() const {
std::cout << "\nKeywords in the first file:\n";
for (const auto& it : keywords1) {
std::cout << std::setw(15) << std::left << it << " of type " << ecl_type_get_name( ecl_file_iget_named_data_type(ecl_file1, it.c_str(), 0)) << std::endl;
}
std::cout << "\nKeywords in second file:\n";
for (const auto& it : keywords2) {
std::cout << std::setw(15) << std::left << it << " of type " << ecl_type_get_name( ecl_file_iget_named_data_type(ecl_file2, it.c_str(), 0)) << std::endl;
}
}
void ECLFilesComparator::printKeywordsDifference() const {
std::vector<std::string> common;
std::vector<std::string> uncommon;
const std::vector<std::string>* keywordsShort = &keywords1;
const std::vector<std::string>* keywordsLong = &keywords2;
if (keywords1.size() > keywords2.size()) {
keywordsLong = &keywords1;
keywordsShort = &keywords2;
}
for (const auto& it : *keywordsLong) {
const auto position = std::find(keywordsShort->begin(), keywordsShort->end(), it);
if (position != keywordsShort->end()) {
common.push_back(*position);
}
else {
uncommon.push_back(it);
}
}
std::cout << "\nCommon keywords for the two cases:\n";
for (const auto& it : common) std::cout << it << std::endl;
std::cout << "\nUncommon keywords for the two cases:\n";
for (const auto& it : uncommon) std::cout << it << std::endl;
}
Deviation ECLFilesComparator::calculateDeviations(double val1, double val2) {
val1 = std::abs(val1);
val2 = std::abs(val2);
Deviation deviation;
if (val1 != 0 || val2 != 0) {
deviation.abs = std::abs(val1 - val2);
if (val1 != 0 && val2 != 0) {
deviation.rel = deviation.abs/(std::max(val1, val2));
}
}
return deviation;
}
double ECLFilesComparator::median(std::vector<double> vec) {
if (vec.empty()) {
return 0;
}
else {
size_t n = vec.size()/2;
nth_element(vec.begin(), vec.begin() + n, vec.end());
if (vec.size() % 2 == 0) {
return 0.5*(vec[n-1]+vec[n]);
}
else {
return vec[n];
}
}
}
double ECLFilesComparator::average(const std::vector<double>& vec) {
if (vec.empty()) {
return 0;
}
double sum = std::accumulate(vec.begin(), vec.end(), 0.0);
return sum/vec.size();
}
double ECLFilesComparator::getCellVolume(const ecl_grid_type* ecl_grid,
const int globalIndex) {
std::vector<double> x(8, 0.0);
std::vector<double> y(8, 0.0);
std::vector<double> z(8, 0.0);
for (int i = 0; i < 8; i++) {
ecl_grid_get_cell_corner_xyz1(ecl_grid, globalIndex, i, &x.data()[i], &y.data()[i], &z.data()[i]);
}
return calculateCellVol(x,y,z);
}

View File

@@ -1,127 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef ECLFILESCOMPARATOR_HPP
#define ECLFILESCOMPARATOR_HPP
#include "Deviation.hpp"
#include <map>
#include <vector>
#include <string>
struct ecl_file_struct; //!< Prototype for eclipse file struct, from ERT library.
typedef struct ecl_file_struct ecl_file_type;
struct ecl_grid_struct; //!< Prototype for eclipse grid struct, from ERT library.
typedef struct ecl_grid_struct ecl_grid_type;
struct ecl_kw_struct; //!< Prototype for eclipse keyword struct, from ERT library.
typedef struct ecl_kw_struct ecl_kw_type;
/*! \brief A class for comparing ECLIPSE files.
\details ECLFilesComparator opens ECLIPSE files
(unified restart, initial and RFT in addition to grid file)
from two simulations. This class has only the functions
printKeywords() and printKeywordsDifference(), in addition to a
couple of get-functions: the comparison logic is implemented in
the subclasses RegressionTest and IntegrationTest. */
class ECLFilesComparator {
private:
int file_type;
double absTolerance = 0;
double relTolerance = 0;
protected:
ecl_file_type* ecl_file1 = nullptr;
ecl_grid_type* ecl_grid1 = nullptr;
ecl_file_type* ecl_file2 = nullptr;
ecl_grid_type* ecl_grid2 = nullptr;
std::vector<std::string> keywords1, keywords2;
bool throwOnError = true; //!< Throw on first error
bool analysis = false; //!< Perform full error analysis
std::map<std::string, std::vector<Deviation>> deviations;
mutable size_t num_errors = 0;
//! \brief Checks if the keyword exists in both cases.
//! \param[in] keyword Keyword to check.
//! \details If the keyword does not exist in one of the cases, the function throws an exception.
void keywordValidForComparing(const std::string& keyword) const;
//! \brief Stores keyword data for a given occurrence
//! \param[out] ecl_kw1 Pointer to a ecl_kw_type, which stores keyword data for first case given the occurrence.
//! \param[out] ecl_kw2 Pointer to a ecl_kw_type, which stores keyword data for second case given the occurrence.
//! \param[in] keyword Which keyword to consider.
//! \param[in] occurrence Which keyword occurrence to consider.
//! \details This function stores keyword data for the given keyword and occurrence in #ecl_kw1 and #ecl_kw2, and returns the number of cells (for which the keyword has a value at the occurrence). If the number of cells differ for the two cases, an exception is thrown.
unsigned int getEclKeywordData(ecl_kw_type*& ecl_kw1, ecl_kw_type*& ecl_kw2, const std::string& keyword, int occurrence1, int occurrence2) const;
//! \brief Prints values for a given keyword, occurrence and cell
//! \param[in] keyword Which keyword to consider.
//! \param[in] occurrence Which keyword occurrence to consider.
//! \param[in] cell Which cell occurrence to consider (numbered by global index).
//! \param[in] value1 Value for first file, the data type can be bool, int, double or std::string.
//! \param[in] value2 Value for second file, the data type can be bool, int, double or std::string.
//! \details Templatefunction for printing values when exceptions are thrown. The function is defined for bool, int, double and std::string.
template <typename T>
void printValuesForCell(const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, const T& value1, const T& value2) const;
public:
//! \brief Open ECLIPSE files and set tolerances and keywords.
//! \param[in] file_type Specifies which filetype to be compared, possible inputs are UNRSTFILE, INITFILE and RFTFILE.
//! \param[in] basename1 Full path without file extension to the first case.
//! \param[in] basename2 Full path without file extension to the second case.
//! \param[in] absTolerance Tolerance for absolute deviation.
//! \param[in] relTolerance Tolerance for relative deviation.
//! \details The content of the ECLIPSE files specified in the input is stored in the ecl_file_type and ecl_grid_type member variables. In addition the keywords and absolute and relative tolerances (member variables) are set. If the constructor is unable to open one of the ECLIPSE files, an exception will be thrown.
ECLFilesComparator(int file_type, const std::string& basename1, const std::string& basename2, double absTolerance, double relTolerance);
//! \brief Closing the ECLIPSE files.
~ECLFilesComparator();
//! \brief Set whether to throw on errors or not.
void throwOnErrors(bool dothrow) { throwOnError = dothrow; }
//! \brief Set whether to perform a full error analysis.
void doAnalysis(bool analize) { analysis = analize; }
//! \brief Returns the number of errors encountered in the performed comparisons.
size_t getNoErrors() const { return num_errors; }
//! \brief Returns the ECLIPSE filetype of this
int getFileType() const {return file_type;}
//! \brief Returns the absolute tolerance stored as a private member variable in the class
double getAbsTolerance() const {return absTolerance;}
//! \brief Returns the relative tolerance stored as a private member variable in the class
double getRelTolerance() const {return relTolerance;}
//! \brief Print all keywords and their respective Eclipse type for the two input cases.
void printKeywords() const;
//! \brief Print common and uncommon keywords for the two input cases.
void printKeywordsDifference() const;
//! \brief Calculate deviations for two values.
//! \details Using absolute values of the input arguments: If one of the values are non-zero, the Deviation::abs returned is the difference between the two input values. In addition, if both values are non-zero, the Deviation::rel returned is the absolute deviation divided by the largest value.
static Deviation calculateDeviations(double val1, double val2);
//! \brief Calculate median of a vector.
//! \details Returning the median of the input vector, i.e. the middle value of the sorted vector if the number of elements is odd or the mean of the two middle values if the number of elements are even.
static double median(std::vector<double> vec);
//! \brief Calculate average of a vector.
//! \details Returning the average of the input vector, i.e. the sum of all values divided by the number of elements.
static double average(const std::vector<double>& vec);
//! \brief Obtain the volume of a cell.
static double getCellVolume(const ecl_grid_type* ecl_grid, const int globalIndex);
};
#endif

View File

@@ -1,199 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "EclIntegrationTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <ert/ecl/ecl_file.h>
#include <ert/ecl/ecl_grid.h>
#include <ert/ecl/ecl_type.h>
#include <ert/ecl_well/well_info.h>
// helper macro to handle error throws or not
#define HANDLE_ERROR(type, message) \
{ \
if (throwOnError) \
OPM_THROW(type, message); \
else { \
std::cerr << message << std::endl; \
++num_errors; \
} \
}
void ECLIntegrationTest::setCellVolumes() {
double absTolerance = getAbsTolerance();
double relTolerance = getRelTolerance();
const unsigned int globalGridCount1 = ecl_grid_get_global_size(ecl_grid1);
const unsigned int activeGridCount1 = ecl_grid_get_active_size(ecl_grid1);
const unsigned int globalGridCount2 = ecl_grid_get_global_size(ecl_grid2);
const unsigned int activeGridCount2 = ecl_grid_get_active_size(ecl_grid2);
if (globalGridCount1 != globalGridCount2) {
OPM_THROW(std::runtime_error, "In grid file:"
<< "\nCells in first file: " << globalGridCount1
<< "\nCells in second file: " << globalGridCount2
<< "\nThe number of global cells differ.");
}
if (activeGridCount1 != activeGridCount2) {
OPM_THROW(std::runtime_error, "In grid file:"
<< "\nCells in first file: " << activeGridCount1
<< "\nCells in second file: " << activeGridCount2
<< "\nThe number of active cells differ.");
}
for (unsigned int cell = 0; cell < globalGridCount1; ++cell) {
const double cellVolume1 = getCellVolume(ecl_grid1, cell);
const double cellVolume2 = getCellVolume(ecl_grid2, cell);
Deviation dev = calculateDeviations(cellVolume1, cellVolume2);
if (dev.abs > absTolerance && dev.rel > relTolerance) {
int i, j, k;
ecl_grid_get_ijk1(ecl_grid1, cell, &i, &j, &k);
// Coordinates from this function are zero-based, hence incrementing
i++, j++, k++;
OPM_THROW(std::runtime_error, "In grid file: Deviations of cell volume exceed tolerances. "
<< "\nFor cell with coordinate (" << i << ", " << j << ", " << k << "):"
<< "\nCell volume in first file: " << cellVolume1
<< "\nCell volume in second file: " << cellVolume2
<< "\nThe absolute deviation is " << dev.abs << ", and the tolerance limit is " << absTolerance << "."
<< "\nThe relative deviation is " << dev.rel << ", and the tolerance limit is " << relTolerance << ".");
} // The second input case is used as reference.
cellVolumes.push_back(cellVolume2);
}
}
void ECLIntegrationTest::initialOccurrenceCompare(const std::string& keyword) {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, 0, 0);
std::vector<double> values1(numCells);
initialCellValues.resize(numCells);
ecl_kw_get_data_as_double(ecl_kw1, values1.data());
ecl_kw_get_data_as_double(ecl_kw2, initialCellValues.data());
// This variable sums up the difference between the keyword value for the first case and the keyword value for the second case, for each cell. The sum is weighted with respect to the cell volume of each cell.
double weightedDifference = 0;
// This variable sums up the keyword value for the first case for each cell. The sum is weighted with respect to the cell volume of each cell.
double weightedTotal = 0;
for (size_t cell = 0; cell < initialCellValues.size(); ++cell) {
weightedTotal += initialCellValues[cell]*cellVolumes[cell];
weightedDifference += std::abs(values1[cell] - initialCellValues[cell])*cellVolumes[cell];
}
if (weightedTotal != 0) {
double ratioValue = weightedDifference/weightedTotal;
if ((ratioValue) > getRelTolerance()) {
OPM_THROW(std::runtime_error, "\nFor keyword " << keyword << " and occurrence 0:"
<< "\nThe ratio of the deviation and the total value is " << ratioValue
<< ", which exceeds the relative tolerance of " << getRelTolerance() << "."
<< "\nSee the docs for more information about how the ratio is computed.");
}
}
}
void ECLIntegrationTest::occurrenceCompare(const std::string& keyword, int occurrence) const {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, occurrence, occurrence);
std::vector<double> values1(numCells), values2(numCells);
ecl_kw_get_data_as_double(ecl_kw1, values1.data());
ecl_kw_get_data_as_double(ecl_kw2, values2.data());
// This variable sums up the difference between the keyword value for the first case and the keyword value for the second case, for each cell. The sum is weighted with respect to the cell volume of each cell.
double weightedDifference = 0;
// This variable sums up the difference between the keyword value for the occurrence and the initial keyword value for each cell. The sum is weighted with respect to the cell volume of each cell.
double relativeWeightedTotal = 0;
for (size_t cell = 0; cell < values1.size(); ++cell) {
relativeWeightedTotal += std::abs(values1[cell] - initialCellValues[cell])*cellVolumes[cell];
weightedDifference += std::abs(values1[cell] - values2[cell])*cellVolumes[cell];
}
if (relativeWeightedTotal != 0) {
double ratioValue = weightedDifference/relativeWeightedTotal;
if ((ratioValue) > getRelTolerance()) {
OPM_THROW(std::runtime_error, "\nFor keyword " << keyword << " and occurrence " << occurrence << ":"
<< "\nThe ratio of the deviation and the total value is " << ratioValue
<< ", which exceeds the relative tolerance of " << getRelTolerance() << "."
<< "\nSee the docs for more information about how the ratio is computed.");
}
}
}
ECLIntegrationTest::ECLIntegrationTest(const std::string& basename1,
const std::string& basename2,
double absTolerance, double relTolerance) :
ECLFilesComparator(ECL_UNIFIED_RESTART_FILE, basename1, basename2, absTolerance, relTolerance) {
std::cout << "\nUsing cell volumes and keyword values from case " << basename2
<< " as reference." << std::endl << std::endl;
setCellVolumes();
}
bool ECLIntegrationTest::elementInWhitelist(const std::string& keyword) const {
auto it = std::find(keywordWhitelist.begin(), keywordWhitelist.end(), keyword);
return it != keywordWhitelist.end();
}
void ECLIntegrationTest::equalNumKeywords() const {
if (keywords1.size() != keywords2.size()) {
OPM_THROW(std::runtime_error, "\nKeywords in first file: " << keywords1.size()
<< "\nKeywords in second file: " << keywords2.size()
<< "\nThe number of keywords differ.");
}
}
void ECLIntegrationTest::results() {
for (const auto& it : keywordWhitelist)
resultsForKeyword(it);
}
void ECLIntegrationTest::resultsForKeyword(const std::string& keyword) {
std::cout << "Comparing " << keyword << "...";
keywordValidForComparing(keyword);
const unsigned int occurrences1 = ecl_file_get_num_named_kw(ecl_file1, keyword.c_str());
const unsigned int occurrences2 = ecl_file_get_num_named_kw(ecl_file2, keyword.c_str());
if (occurrences1 != occurrences2) {
OPM_THROW(std::runtime_error, "For keyword " << keyword << ":"
<< "\nKeyword occurrences in first file: " << occurrences1
<< "\nKeyword occurrences in second file: " << occurrences2
<< "\nThe number of occurrences differ.");
}
initialOccurrenceCompare(keyword);
for (unsigned int occurrence = 1; occurrence < occurrences1; ++occurrence) {
occurrenceCompare(keyword, occurrence);
}
std::cout << "done." << std::endl;
}

View File

@@ -1,78 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef ECLINTEGRATIONTEST_HPP
#define ECLINTEGRATIONTEST_HPP
#include "EclFilesComparator.hpp"
/*! \brief A class for executing a integration test for two ECLIPSE files.
\details This class inherits from ECLFilesComparator, which opens and closes
the input cases and stores keywordnames. The three public functions
equalNumKeywords(), results() and resultsForKeyword() can be invoked
to compare griddata or keyworddata for all keywords or a given
keyword (resultsForKeyword()).
*/
class ECLIntegrationTest: public ECLFilesComparator {
private:
std::vector<double> cellVolumes; //!< Vector of cell volumes in second input case (indexed by global index)
std::vector<double> initialCellValues; //!< Keyword values for all cells at first occurrence (index by global index)
// These are the only keywords which are compared, since SWAT should be "1 - SOIL - SGAS", this keyword is omitted.
const std::vector<std::string> keywordWhitelist = {"SGAS", "SWAT", "PRESSURE"};
void setCellVolumes();
void initialOccurrenceCompare(const std::string& keyword);
void occurrenceCompare(const std::string& keyword, int occurrence) const;
public:
//! \brief Sets up the integration test.
//! \param[in] basename1 Full path without file extension to the first case.
//! \param[in] basename2 Full path without file extension to the second case.
//! \param[in] absTolerance Tolerance for absolute deviation.
//! \param[in] relTolerance Tolerance for relative deviation.
//! \details This constructor calls the constructor of the superclass, with input filetype unified restart. See the docs for ECLFilesComparator for more information.
ECLIntegrationTest(const std::string& basename1, const std::string& basename2, double absTolerance, double relTolerance);
//! \brief Checks if a keyword is supported for comparison.
//! \param[in] keyword Keyword to check.
bool elementInWhitelist(const std::string& keyword) const;
//! \brief Checks if the number of keywords equal in the two input cases.
//! \param[in] keyword Keyword to check.
void equalNumKeywords() const;
//! \brief Finds deviations for all supported keywords.
//! \details results() loops through all supported keywords for integration test (defined in keywordWhitelist -- this is SGAS, SWAT and PRESSURE) and calls resultsForKeyword() for each keyword.
void results();
//! \brief Finds deviations for a specific keyword.
//! \param[in] keyword Keyword to check.
/*! \details First, resultsForKeyword() checks if the keyword exits in both cases, and if the number of keyword occurrences in the two cases differ. If these tests fail, an exception is thrown. Then deviaitons are calculated as described below for each occurrence, and an exception is thrown if the relative error ratio \f$E\f$ is larger than the relative tolerance.
* Calculation:\n
* Let the keyword values for occurrence \f$n\f$ and cell \f$i\f$ be \f$p_{n,i}\f$ and \f$q_{n,i}\f$ for input case 1 and 2, respectively.
* Consider first the initial occurrence (\f$n=0\f$). The function uses the second cases as reference, and calculates the volume weighted sum of \f$q_{0,i}\f$ over all cells \f$i\f$:
* \f[ S_0 = \sum_{i} q_{0,i} v_i \f]
* where \f$v_{i}\f$ is the volume of cell \f$i\f$ in case 2. Then, the deviations between the cases for each cell are calculated:
* \f[ \Delta = \sum_{i} |p_{0,i} - q_{0,i}| v_i.\f]
* The error ratio is then \f$E = \Delta/S_0\f$.\n
* For all other occurrences \f$n\f$, the deviation value \f$\Delta\f$ is calculated the same way, but the total value \f$S\f$ is calculated relative to the initial occurrence total \f$S_0\f$:
* \f[ S = \sum_{i} |q_{n,i} - q_{0,i}| v_i. \f]
* The error ratio is \f$ E = \Delta/S\f$. */
void resultsForKeyword(const std::string& keyword);
};
#endif

View File

@@ -1,352 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "EclRegressionTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <ert/ecl/ecl_file.h>
#include <ert/ecl/ecl_grid.h>
#include <ert/ecl/ecl_type.h>
#include <ert/ecl_well/well_info.h>
// helper macro to handle error throws or not
#define HANDLE_ERROR(type, message) \
{ \
if (throwOnError) \
OPM_THROW(type, message); \
else { \
std::cerr << message << std::endl; \
++num_errors; \
} \
}
void ECLRegressionTest::printResultsForKeyword(const std::string& keyword) const {
std::cout << "Deviation results for keyword " << keyword << " of type "
<< ecl_type_get_name(ecl_file_iget_named_data_type(ecl_file1, keyword.c_str(), 0))
<< ":\n";
const double absDeviationAverage = average(absDeviation);
const double relDeviationAverage = average(relDeviation);
std::cout << "Average absolute deviation = " << absDeviationAverage << std::endl;
std::cout << "Median absolute deviation = " << median(absDeviation) << std::endl;
std::cout << "Average relative deviation = " << relDeviationAverage << std::endl;
std::cout << "Median relative deviation = " << median(relDeviation) << "\n\n";
}
void ECLRegressionTest::boolComparisonForOccurrence(const std::string& keyword,
int occurrence1, int occurrence2) const {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, occurrence1, occurrence2);
for (size_t cell = 0; cell < numCells; cell++) {
bool data1 = ecl_kw_iget_bool(ecl_kw1, cell);
bool data2 = ecl_kw_iget_bool(ecl_kw2, cell);
if (data1 != data2) {
printValuesForCell(keyword, occurrence1, occurrence2, numCells, cell, data1, data2);
HANDLE_ERROR(std::runtime_error, "Values of bool type differ.");
}
}
}
void ECLRegressionTest::charComparisonForOccurrence(const std::string& keyword,
int occurrence1, int occurrence2) const {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, occurrence1, occurrence2);
for (size_t cell = 0; cell < numCells; cell++) {
std::string data1(ecl_kw_iget_char_ptr(ecl_kw1, cell));
std::string data2(ecl_kw_iget_char_ptr(ecl_kw2, cell));
if (data1.compare(data2) != 0) {
printValuesForCell(keyword, occurrence1, occurrence2, numCells, cell, data1, data2);
HANDLE_ERROR(std::runtime_error, "Values of char type differ.");
}
}
}
void ECLRegressionTest::intComparisonForOccurrence(const std::string& keyword,
int occurrence1, int occurrence2) const {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, occurrence1, occurrence2);
std::vector<int> values1(numCells), values2(numCells);
ecl_kw_get_memcpy_int_data(ecl_kw1, values1.data());
ecl_kw_get_memcpy_int_data(ecl_kw2, values2.data());
for (size_t cell = 0; cell < values1.size(); cell++) {
if (values1[cell] != values2[cell]) {
printValuesForCell(keyword, occurrence1, occurrence2, values1.size(), cell, values1[cell], values2[cell]);
HANDLE_ERROR(std::runtime_error, "Values of int type differ.");
}
}
}
void ECLRegressionTest::doubleComparisonForOccurrence(const std::string& keyword,
int occurrence1, int occurrence2) {
ecl_kw_type* ecl_kw1 = nullptr;
ecl_kw_type* ecl_kw2 = nullptr;
const unsigned int numCells = getEclKeywordData(ecl_kw1, ecl_kw2, keyword, occurrence1, occurrence2);
std::vector<double> values1(numCells), values2(numCells);
ecl_kw_get_data_as_double(ecl_kw1, values1.data());
ecl_kw_get_data_as_double(ecl_kw2, values2.data());
auto it = std::find(keywordDisallowNegatives.begin(), keywordDisallowNegatives.end(), keyword);
for (size_t cell = 0; cell < values1.size(); cell++) {
deviationsForCell(values1[cell], values2[cell], keyword, occurrence1, occurrence2, cell, it == keywordDisallowNegatives.end());
}
}
void ECLRegressionTest::deviationsForCell(double val1, double val2,
const std::string& keyword,
int occurrence1, int occurrence2,
size_t kw_size, size_t cell,
bool allowNegativeValues) {
double absTolerance = getAbsTolerance();
double relTolerance = getRelTolerance();
if (!allowNegativeValues) {
if (val1 < 0) {
if (std::abs(val1) > absTolerance) {
printValuesForCell(keyword, occurrence1, occurrence2, kw_size, cell, val1, val2);
HANDLE_ERROR(std::runtime_error, "Negative value in first file, "
<< "which in absolute value exceeds the absolute tolerance of " << absTolerance << ".");
}
val1 = 0;
}
if (val2 < 0) {
if (std::abs(val2) > absTolerance) {
printValuesForCell(keyword, occurrence1, occurrence2, kw_size, cell, val1, val2);
HANDLE_ERROR(std::runtime_error, "Negative value in second file, "
<< "which in absolute value exceeds the absolute tolerance of " << absTolerance << ".");
}
val2 = 0;
}
}
Deviation dev = calculateDeviations(val1, val2);
if (dev.abs > absTolerance && dev.rel > relTolerance) {
if (analysis) {
deviations[keyword].push_back(dev);
} else {
printValuesForCell(keyword, occurrence1, occurrence2, kw_size, cell, val1, val2);
HANDLE_ERROR(std::runtime_error, "Deviations exceed tolerances."
<< "\nThe absolute deviation is " << dev.abs << ", and the tolerance limit is " << absTolerance << "."
<< "\nThe relative deviation is " << dev.rel << ", and the tolerance limit is " << relTolerance << ".");
}
}
if (dev.abs != -1) {
absDeviation.push_back(dev.abs);
}
if (dev.rel != -1) {
relDeviation.push_back(dev.rel);
}
}
void ECLRegressionTest::gridCompare(const bool volumecheck) const {
double absTolerance = getAbsTolerance();
double relTolerance = getRelTolerance();
const unsigned int globalGridCount1 = ecl_grid_get_global_size(ecl_grid1);
const unsigned int activeGridCount1 = ecl_grid_get_active_size(ecl_grid1);
const unsigned int globalGridCount2 = ecl_grid_get_global_size(ecl_grid2);
const unsigned int activeGridCount2 = ecl_grid_get_active_size(ecl_grid2);
if (globalGridCount1 != globalGridCount2) {
OPM_THROW(std::runtime_error, "In grid file:"
<< "\nCells in first file: " << globalGridCount1
<< "\nCells in second file: " << globalGridCount2
<< "\nThe number of global cells differ.");
}
if (activeGridCount1 != activeGridCount2) {
OPM_THROW(std::runtime_error, "In grid file:"
<< "\nCells in first file: " << activeGridCount1
<< "\nCells in second file: " << activeGridCount2
<< "\nThe number of active cells differ.");
}
if (!volumecheck) {
return;
}
for (unsigned int cell = 0; cell < globalGridCount1; ++cell) {
const bool active1 = ecl_grid_cell_active1(ecl_grid1, cell);
const bool active2 = ecl_grid_cell_active1(ecl_grid2, cell);
if (active1 != active2) {
int i, j, k;
ecl_grid_get_ijk1(ecl_grid1, cell, &i, &j, &k);
// Coordinates from this function are zero-based, hence incrementing
i++, j++, k++;
HANDLE_ERROR(std::runtime_error, "Grid cell with one-based indices ( "
<< i << ", " << j << ", " << k << " ) is "
<< (active1 ? "active" : "inactive") << " in first grid, but "
<< (active2 ? "active" : "inactive") << " in second grid.");
}
const double cellVolume1 = getCellVolume(ecl_grid1, cell);
const double cellVolume2 = getCellVolume(ecl_grid2, cell);
Deviation dev = calculateDeviations(cellVolume1, cellVolume2);
if (dev.abs > absTolerance && dev.rel > relTolerance) {
int i, j, k;
ecl_grid_get_ijk1(ecl_grid1, cell, &i, &j, &k);
// Coordinates from this function are zero-based, hence incrementing
i++, j++, k++;
HANDLE_ERROR(std::runtime_error, "In grid file: Deviations of cell volume exceed tolerances. "
<< "\nFor cell with one-based indices (" << i << ", " << j << ", " << k << "):"
<< "\nCell volume in first file: " << cellVolume1
<< "\nCell volume in second file: " << cellVolume2
<< "\nThe absolute deviation is " << dev.abs << ", and the tolerance limit is " << absTolerance << "."
<< "\nThe relative deviation is " << dev.rel << ", and the tolerance limit is " << relTolerance << "."
<< "\nCell 1 active: " << active1
<< "\nCell 2 active: " << active2);
}
}
}
void ECLRegressionTest::results() {
if (!this->acceptExtraKeywords) {
if (keywords1.size() != keywords2.size()) {
std::set<std::string> keys(keywords1.begin() , keywords1.end());
for (const auto& key2: keywords2)
keys.insert( key2 );
for (const auto& key : keys)
fprintf(stderr," %8s:%3d %8s:%3d \n",key.c_str() , ecl_file_get_num_named_kw( ecl_file1 , key.c_str()),
key.c_str() , ecl_file_get_num_named_kw( ecl_file2 , key.c_str()));
OPM_THROW(std::runtime_error, "\nKeywords in first file: " << keywords1.size()
<< "\nKeywords in second file: " << keywords2.size()
<< "\nThe number of keywords differ.");
}
}
for (const auto& it : keywords1)
resultsForKeyword(it);
if (analysis) {
std::cout << deviations.size() << " keyword"
<< (deviations.size() > 1 ? "s":"") << " exhibit failures" << std::endl;
for (const auto& iter : deviations) {
std::cout << "\t" << iter.first << std::endl;
std::cout << "\t\tFails for " << iter.second.size() << " entries" << std::endl;
std::cout.precision(7);
double absErr = std::max_element(iter.second.begin(), iter.second.end(),
[](const Deviation& a, const Deviation& b)
{
return a.abs < b.abs;
})->abs;
double relErr = std::max_element(iter.second.begin(), iter.second.end(),
[](const Deviation& a, const Deviation& b)
{
return a.rel < b.rel;
})->rel;
std::cout << "\t\tLargest absolute error: "
<< std::scientific << absErr << std::endl;
std::cout << "\t\tLargest relative error: "
<< std::scientific << relErr << std::endl;
}
}
}
void ECLRegressionTest::resultsForKeyword(const std::string& keyword) {
keywordValidForComparing(keyword);
const unsigned int occurrences1 = ecl_file_get_num_named_kw(ecl_file1, keyword.c_str());
const unsigned int occurrences2 = ecl_file_get_num_named_kw(ecl_file2, keyword.c_str());
if (!onlyLastOccurrence && occurrences1 != occurrences2) {
OPM_THROW(std::runtime_error, "For keyword " << keyword << ":"
<< "\nKeyword occurrences in first file: " << occurrences1
<< "\nKeyword occurrences in second file: " << occurrences2
<< "\nThe number of occurrences differ.");
}
// Assuming keyword type is constant for every occurrence:
const ecl_type_enum kw_type = ecl_type_get_type( ecl_file_iget_named_data_type(ecl_file1, keyword.c_str(), 0) );
switch(kw_type) {
case ECL_DOUBLE_TYPE:
case ECL_FLOAT_TYPE:
std::cout << "Comparing " << keyword << "...";
if (onlyLastOccurrence) {
doubleComparisonForOccurrence(keyword, occurrences1 - 1, occurrences2 - 1);
}
else {
for (unsigned int occurrence = 0; occurrence < occurrences1; ++occurrence) {
doubleComparisonForOccurrence(keyword, occurrence, occurrence);
}
}
std::cout << "done." << std::endl;
printResultsForKeyword(keyword);
absDeviation.clear();
relDeviation.clear();
return;
case ECL_INT_TYPE:
std::cout << "Comparing " << keyword << "...";
if (onlyLastOccurrence) {
intComparisonForOccurrence(keyword, occurrences1 - 1, occurrences2 - 1);
}
else {
for (unsigned int occurrence = 0; occurrence < occurrences1; ++occurrence) {
intComparisonForOccurrence(keyword, occurrence, occurrence);
}
}
break;
case ECL_CHAR_TYPE:
std::cout << "Comparing " << keyword << "...";
if (onlyLastOccurrence) {
charComparisonForOccurrence(keyword, occurrences1 - 1, occurrences2 - 1);
}
else {
for (unsigned int occurrence = 0; occurrence < occurrences1; ++occurrence) {
charComparisonForOccurrence(keyword, occurrence, occurrence);
}
}
break;
case ECL_BOOL_TYPE:
std::cout << "Comparing " << keyword << "...";
if (onlyLastOccurrence) {
boolComparisonForOccurrence(keyword, occurrences1 - 1, occurrences2 - 1);
}
else {
for (unsigned int occurrence = 0; occurrence < occurrences1; ++occurrence) {
boolComparisonForOccurrence(keyword, occurrence, occurrence);
}
}
break;
case ECL_MESS_TYPE:
std::cout << "\nKeyword " << keyword << " is of type MESS"
<< ", which is not supported in regression test." << "\n\n";
return;
default:
std::cout << "\nKeyword " << keyword << "has undefined type." << std::endl;
return;
}
std::cout << "done." << std::endl;
}

View File

@@ -1,93 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef ECLREGRESSIONTEST_HPP
#define ECLREGRESSIONTEST_HPP
#include "EclFilesComparator.hpp"
/*! \brief A class for executing a regression test for two ECLIPSE files.
\details This class inherits from ECLFilesComparator, which opens and
closes the input cases and stores keywordnames.
The three public functions gridCompare(), results() and
resultsForKeyword() can be invoked to compare griddata
or keyworddata for all keywords or a given keyword (resultsForKeyword()).
*/
class ECLRegressionTest: public ECLFilesComparator {
private:
// These vectors store absolute and relative deviations, respecively. Note that they are whiped clean for every new keyword comparison.
std::vector<double> absDeviation, relDeviation;
// Keywords which should not contain negative values, i.e. uses allowNegativeValues = false in deviationsForCell():
const std::vector<std::string> keywordDisallowNegatives = {"SGAS", "SWAT", "PRESSURE"};
// Only compare last occurrence
bool onlyLastOccurrence = false;
// Accept extra keywords in the restart file of the 'new' simulation.
bool acceptExtraKeywords = false;
// Prints results stored in absDeviation and relDeviation.
void printResultsForKeyword(const std::string& keyword) const;
// Function which compares data at specific occurrences and for a specific keyword type. The functions takes two occurrence inputs to also be able to
// compare keywords which are shifted relative to each other in the two files. This is for instance handy when running flow with restart from different timesteps,
// and comparing the last timestep from the two runs.
void boolComparisonForOccurrence(const std::string& keyword, int occurrence1, int occurrence2) const;
void charComparisonForOccurrence(const std::string& keyword, int occurrence1, int occurrence2) const;
void intComparisonForOccurrence(const std::string& keyword, int occurrence1, int occurrence2) const;
void doubleComparisonForOccurrence(const std::string& keyword, int occurrence1, int occurrence2);
// deviationsForCell throws an exception if both the absolute deviation AND the relative deviation
// are larger than absTolerance and relTolerance, respectively. In addition,
// if allowNegativeValues is passed as false, an exception will be thrown when the absolute value
// of a negative value exceeds absTolerance. If no exceptions are thrown, the absolute and relative deviations are added to absDeviation and relDeviation.
void deviationsForCell(double val1, double val2, const std::string& keyword, int occurrence1, int occurrence2, size_t kw_size, size_t cell, bool allowNegativeValues = true);
public:
//! \brief Sets up the regression test.
//! \param[in] file_type Specifies which filetype to be compared, possible inputs are UNRSTFILE, INITFILE and RFTFILE.
//! \param[in] basename1 Full path without file extension to the first case.
//! \param[in] basename2 Full path without file extension to the second case.
//! \param[in] absTolerance Tolerance for absolute deviation.
//! \param[in] relTolerance Tolerance for relative deviation.
//! \details This constructor only calls the constructor of the superclass, see the docs for ECLFilesComparator for more information.
ECLRegressionTest(int file_type, const std::string& basename1, const std::string& basename2, double absTolerance, double relTolerance):
ECLFilesComparator(file_type, basename1, basename2, absTolerance, relTolerance) {}
//! \brief Option to only compare last occurrence
void setOnlyLastOccurrence(bool onlyLastOccurrenceArg) {this->onlyLastOccurrence = onlyLastOccurrenceArg;}
// Accept extra keywords: If this switch is set to true the comparison
// of restart files will ignore extra keywords which are only present
// in the new simulation.
void setAcceptExtraKeywords(bool acceptExtraKeywords) { this->acceptExtraKeywords = acceptExtraKeywords; }
//! \brief Compares grid properties of the two cases.
// gridCompare() checks if both the number of active and global cells in the two cases are the same. If they are, and volumecheck is true, all cells are looped over to calculate the cell volume deviation for the two cases. If the both the relative and absolute deviation exceeds the tolerances, an exception is thrown.
void gridCompare(const bool volumecheck) const;
//! \brief Calculates deviations for all keywords.
// This function checks if the number of keywords of the two cases are equal, and if it is, resultsForKeyword() is called for every keyword. If not, an exception is thrown.
void results();
//! \brief Calculates deviations for a specific keyword.
//! \param[in] keyword Keyword which should be compared, if this keyword is absent in one of the cases, an exception will be thrown.
//! \details This function loops through every report step and every cell and compares the values for the given keyword from the two input cases. If the absolute or relative deviation between the two values for each step exceeds both the absolute tolerance and the relative tolerance (stored in ECLFilesComparator), an exception is thrown. In addition, some keywords are marked for "disallow negative values" -- these are SGAS, SWAT and PRESSURE. An exception is thrown if a value of one of these keywords is both negative and has an absolute value larger than the absolute tolerance. If no exceptions are thrown, resultsForKeyword() uses the private member funtion printResultsForKeyword to print the average and median deviations.
void resultsForKeyword(const std::string& keyword);
};
#endif

View File

@@ -1,380 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "EclIntegrationTest.hpp"
#include "EclRegressionTest.hpp"
#include "summaryIntegrationTest.hpp"
#include "summaryRegressionTest.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>
static void printHelp() {
std::cout << "\ncompareECL compares ECLIPSE files (restart (.RST), unified restart (.UNRST), initial (.INIT), summary (.SMRY), unified summary (.UNSMRY) 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"
<< "-a Run a full analysis of errors.\n"
<< "-g Will print the vector with the greatest error ratio.\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"
<< "-K Will not allow different amount of keywords in the two files. Throws an exception if the amount are different.\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"
<< "-m mainVar. Will calculate the error ratio for one main variable. Valid input is WOPR, WWPR, WGPR or WBHP.\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"
<< "-R Will allow comparison between a restarted simulation and a normal simulation for summary regression tests. The files must end at the same time.\n"
<< "-s int Sets the number of spikes that are allowed for each keyword in summary integration tests.\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 SMRY \t Compare two cases consistent of (unified) summary files.\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"
<< "-v For the rate keywords WOPR, WGPR, WWPR and WBHP. Calculates the error volume of the two summary files. This is printed to screen.\n"
<< "\nExample 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";
}
void splitBasename(const std::string& basename, std::string& path, std::string& filename) {
const size_t lastSlashIndex = basename.find_last_of("/\\");
path = basename.substr(0,lastSlashIndex);
filename = basename.substr(lastSlashIndex+1);
}
// Inspired by the ecl_pack application in the ERT library
void concatenateRestart(const std::string& basename) {
std::string inputPath, inputBase;
splitBasename(basename, inputPath, inputBase);
stringlist_type* inputFiles = stringlist_alloc_new();
const int numFiles = ecl_util_select_filelist(inputPath.c_str(), inputBase.c_str(), ECL_RESTART_FILE, false, inputFiles);
const char* target_file_name = ecl_util_alloc_filename(inputPath.c_str(), inputBase.c_str(), ECL_UNIFIED_RESTART_FILE, false, -1);
fortio_type* target = fortio_open_writer(target_file_name, false, ECL_ENDIAN_FLIP);
int dummy;
ecl_kw_type* seqnum_kw = ecl_kw_alloc_new("SEQNUM", 1, ECL_INT, &dummy);
int reportStep = 0;
for (int i = 0; i < numFiles; ++i) {
ecl_util_get_file_type(stringlist_iget(inputFiles, i), nullptr, &reportStep);
ecl_file_type* src_file = ecl_file_open(stringlist_iget(inputFiles, i), 0);
ecl_kw_iset_int(seqnum_kw, 0, reportStep);
ecl_kw_fwrite(seqnum_kw, target);
ecl_file_fwrite_fortio(src_file, target, 0);
ecl_file_close(src_file);
}
fortio_fclose(target);
stringlist_free(inputFiles);
}
//------------------------------------------------//
int main(int argc, char** argv) {
// Restart is default
ecl_file_enum file_type = ECL_UNIFIED_RESTART_FILE;
// RegressionTest is default
bool integrationTest = false;
bool allowDifferentAmount = true;
bool checkNumKeywords = false;
bool findGreatestErrorRatio = false;
bool findVolumeError = false;
bool onlyLastOccurrence = false;
bool printKeywords = false;
bool printKeywordsDifference = false;
bool restartFile = false;
bool specificKeyword = false;
bool specificFileType = false;
bool allowSpikes = false;
bool throwOnError = true;
bool throwTooGreatErrorRatio = true;
bool acceptExtraKeywords = false;
bool analysis = false;
bool volumecheck = true;
char* keyword = nullptr;
char* fileTypeCstr = nullptr;
const char* mainVariable = nullptr;
int c = 0;
int spikeLimit = -1;
while ((c = getopt(argc, argv, "hiIk:alnpPt:VRgs:m:vKx")) != -1) {
switch (c) {
case 'a':
analysis = true;
break;
case 'g':
findGreatestErrorRatio = true;
throwTooGreatErrorRatio = false;
break;
case 'h':
printHelp();
return 0;
case 'i':
integrationTest = true;
break;
case 'I':
integrationTest = true;
checkNumKeywords = true;
break;
case 'k':
specificKeyword = true;
keyword = optarg;
break;
case 'K':
allowDifferentAmount = false;
break;
case 'l':
onlyLastOccurrence = true;
break;
case 'm':
mainVariable = optarg;
break;
case 'n':
throwOnError = false;
break;
case 'p':
printKeywords = true;
break;
case 'P':
printKeywordsDifference = true;
break;
case 'R':
restartFile = true;
break;
case 's':
allowSpikes = true;
spikeLimit = atof(optarg);
break;
case 't':
specificFileType = true;
fileTypeCstr = optarg;
break;
case 'v':
findVolumeError = true;
break;
case 'V':
volumecheck = false;
break;
case 'x':
acceptExtraKeywords = true;
break;
case '?':
if (optopt == 'k' || optopt == 'm' || optopt == 's') {
std::cerr << "Option " << optopt << " requires a keyword as argument, see manual (-h) for more information." << std::endl;
return EXIT_FAILURE;
}
else if (optopt == 't') {
std::cerr << "Option t requires an ECLIPSE filetype as argument, see manual (-h) for more information." << std::endl;
return EXIT_FAILURE;
}
else {
std::cerr << "Unknown option." << std::endl;
return EXIT_FAILURE;
}
default:
return EXIT_FAILURE;
}
}
int argOffset = optind;
if ((printKeywords && printKeywordsDifference) ||
(integrationTest && specificFileType) ||
(integrationTest && onlyLastOccurrence)) {
std::cerr << "Error: Options given which can not be combined. "
<< "Please see the manual (-h) for more information." << std::endl;
return EXIT_FAILURE;
}
if (argc != argOffset + 4) {
std::cerr << "Error: The number of options and arguments given is not correct. "
<< "Please run compareECL -h to see manual." << std::endl;
return EXIT_FAILURE;
}
std::string basename1 = argv[argOffset];
std::string basename2 = argv[argOffset + 1];
double absTolerance = strtod(argv[argOffset + 2], nullptr);
double relTolerance = strtod(argv[argOffset + 3], nullptr);
if (specificFileType) {
std::string fileTypeString(fileTypeCstr);
for (auto& ch: fileTypeString) ch = toupper(ch);
if (fileTypeString== "UNRST") {} //Do nothing
else if (fileTypeString == "RST") {
concatenateRestart(basename1);
concatenateRestart(basename2);
}
else if (fileTypeString == "RST1") {
concatenateRestart(basename1);
}
else if (fileTypeString == "RST2") {
concatenateRestart(basename2);
}
else if (fileTypeString == "INIT") {
file_type = ECL_INIT_FILE;
}
else if (fileTypeString == "RFT") {
file_type = ECL_RFT_FILE;
}
else if (fileTypeString == "SMRY")
file_type = ECL_SUMMARY_FILE;
else {
std::cerr << "Unknown ECLIPSE filetype specified with option -t. Please run compareECL -h to see manual." << std::endl;
return EXIT_FAILURE;
}
}
if (restartFile && (file_type != ECL_SUMMARY_FILE || integrationTest)) {
std::cerr << "Error: -R can only be used in for summary regression tests." << std::endl;
return EXIT_FAILURE;
}
std::cout << "Comparing '" << basename1 << "' to '" << basename2 << "'." << std::endl;
try {
if (file_type == ECL_SUMMARY_FILE) {
if(!integrationTest){
SummaryRegressionTest compare(basename1,basename2,absTolerance,relTolerance);
compare.throwOnErrors(throwOnError);
compare.doAnalysis(analysis);
compare.setPrintKeywords(printKeywords);
compare.setIsRestartFile(restartFile);
if(specificKeyword){
compare.getRegressionTest(keyword);
}
else{
compare.setPrintKeywords(printKeywords);
compare.getRegressionTest();
}
} else {
SummaryIntegrationTest compare(basename1,basename2,absTolerance,relTolerance);
compare.throwOnErrors(throwOnError);
compare.setFindVectorWithGreatestErrorRatio(findGreatestErrorRatio);
compare.setAllowSpikes(allowSpikes);
if (mainVariable) {
compare.setOneOfTheMainVariables(true);
std::string str(mainVariable);
std::transform(str.begin(), str.end(),str.begin(), ::toupper);
if(str == "WOPR" ||str=="WWPR" ||str=="WGPR" || str == "WBHP"){
compare.setMainVariable(str);
}else{
throw std::invalid_argument("The input is not a main variable. -m option requires a valid main variable.");
}
}
compare.setFindVolumeError(findVolumeError);
if (spikeLimit != -1) {
compare.setSpikeLimit(spikeLimit);
}
compare.setAllowDifferentAmountOfKeywords(allowDifferentAmount);
compare.setPrintKeywords(printKeywords);
compare.setThrowExceptionForTooGreatErrorRatio(throwTooGreatErrorRatio);
if(specificKeyword){
compare.setPrintSpecificKeyword(specificKeyword);
compare.getIntegrationTest(keyword);
return 0;
}
compare.getIntegrationTest();
}
}
else if (integrationTest) {
ECLIntegrationTest comparator(basename1, basename2, absTolerance, relTolerance);
if (printKeywords) {
comparator.printKeywords();
return 0;
}
if (printKeywordsDifference) {
comparator.printKeywordsDifference();
return 0;
}
if (checkNumKeywords) {
comparator.equalNumKeywords();
}
if (specificKeyword) {
if (comparator.elementInWhitelist(keyword)) {
comparator.resultsForKeyword(keyword);
}
else {
std::cerr << "Keyword " << keyword << " is not supported for the integration test. Use SGAS, SWAT or PRESSURE." << std::endl;
return EXIT_FAILURE;
}
}
else {
comparator.results();
}
}
else {
ECLRegressionTest comparator(file_type, basename1, basename2, absTolerance, relTolerance);
comparator.throwOnErrors(throwOnError);
comparator.doAnalysis(analysis);
comparator.setAcceptExtraKeywords(acceptExtraKeywords);
if (printKeywords) {
comparator.printKeywords();
return 0;
}
if (printKeywordsDifference) {
comparator.printKeywordsDifference();
return 0;
}
if (onlyLastOccurrence) {
comparator.setOnlyLastOccurrence(true);
}
if (specificKeyword) {
comparator.gridCompare(volumecheck);
comparator.resultsForKeyword(keyword);
}
else {
comparator.gridCompare(volumecheck);
comparator.results();
}
if (comparator.getNoErrors() > 0)
OPM_THROW(std::runtime_error, comparator.getNoErrors() << " errors encountered in comparisons.");
}
}
catch (const std::exception& e) {
std::cerr << "Program threw an exception: " << e.what() << std::endl;
return EXIT_FAILURE;
}
return 0;
}

View File

@@ -1,229 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "summaryRegressionTest.hpp"
#include "summaryIntegrationTest.hpp"
#include <string>
#include <algorithm>
#include <stdexcept>
#include <getopt.h>
void printHelp(){
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 << "-a \tRun a full analysis of errors." << 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 << "-i \t\tChoosing 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;
}
//---------------------------------------------------
int main (int argc, char ** argv){
//------------------------------------------------
//Defines some constants
bool specificKeyword = false;
bool allowSpikes = false;
bool findVolumeError = false;
bool integrationTest = false;
bool regressionTest = true;
bool allowDifferentAmountOfKeywords = true;
bool printKeywords = false;
bool printSpecificKeyword = false;
bool findVectorWithGreatestErrorRatio = false;
bool oneOfTheMainVariables = false;
bool throwExceptionForTooGreatErrorRatio = true;
bool isRestartFile = false;
bool throwOnError = true;
bool analysis = false;
const char* keyword = nullptr;
const char* mainVariable = nullptr;
int c = 0;
int limit = -1;
//------------------------------------------------
//------------------------------------------------
//For setting the options selected
while ((c = getopt(argc, argv, "dghik:Km:napP:rRs:vV:")) != -1) {
switch (c) {
case 'a':
analysis = true;
break;
case 'd':
throwExceptionForTooGreatErrorRatio = false;
break;
case 'g':
findVectorWithGreatestErrorRatio = true;
throwExceptionForTooGreatErrorRatio = false;
break;
case 'h':
printHelp();
return 0;
case 'i':
integrationTest = true;
regressionTest = false;
break;
case 'k':
specificKeyword = true;
keyword = optarg;
break;
case 'K':
allowDifferentAmountOfKeywords = false;
break;
case 'm':
oneOfTheMainVariables = true;
mainVariable = optarg;
break;
case 'n':
throwOnError = false;
break;
case 'p':
printKeywords = true;
break;
case 'P':
specificKeyword = true;
printSpecificKeyword = true;
keyword = optarg;
break;
case 'r':
integrationTest = false;
regressionTest = true;
break;
case 'R':
isRestartFile = true;
break;
case 's':
allowSpikes = true;
limit = atof(optarg);
break;
case 'v':
findVolumeError = true;
break;
case 'V':
findVolumeError = true;
specificKeyword = true;
keyword = optarg;
break;
case '?':
if (optopt == 'k' || optopt == 'm' || optopt == 'P'
|| optopt == 's' || optopt == 'V') {
std::cout << "Option -"<<optopt<<" requires an keyword." << std::endl;
return EXIT_FAILURE;
}
else {
std::cout << "Unknown option." << std::endl;
return EXIT_FAILURE;
}
default:
return EXIT_FAILURE;
}
}
//------------------------------------------------
int argOffset = optind;
if (argc != argOffset + 4) {
printHelp();
return EXIT_FAILURE;
}
const char * basename1 = argv[argOffset];
const char * basename2 = argv[argOffset+1];
double absoluteTolerance = strtod(argv[argOffset+2], nullptr);
double relativeTolerance = strtod(argv[argOffset+3], nullptr);
std::cout << "Comparing '" << basename1 << "' to '" << basename2 << "'." << std::endl;
try {
if(regressionTest){
SummaryRegressionTest compare(basename1,basename2, absoluteTolerance, relativeTolerance);
compare.throwOnErrors(throwOnError);
compare.doAnalysis(analysis);
if(printKeywords){compare.setPrintKeywords(true);}
if(isRestartFile){compare.setIsRestartFile(true);}
if(specificKeyword){
compare.getRegressionTest(keyword);
}
else{
if(printKeywords){compare.setPrintKeywords(true);}
compare.getRegressionTest();
}
}
if(integrationTest){
SummaryIntegrationTest compare(basename1,basename2, absoluteTolerance, relativeTolerance);
compare.throwOnErrors(throwOnError);
if(findVectorWithGreatestErrorRatio){compare.setFindVectorWithGreatestErrorRatio(true);}
if(allowSpikes){compare.setAllowSpikes(true);}
if(oneOfTheMainVariables){
compare.setOneOfTheMainVariables(true);
std::string str(mainVariable);
std::transform(str.begin(), str.end(),str.begin(), ::toupper);
if(str == "WOPR" ||str=="WWPR" ||str=="WGPR" || str == "WBHP"){
compare.setMainVariable(str);
}else{
throw std::invalid_argument("The input is not a main variable. -m option requires a valid main variable.");
}
}
if(findVolumeError){compare.setFindVolumeError(true);}
if(limit != -1){compare.setSpikeLimit(limit);}
if(!allowDifferentAmountOfKeywords){compare.setAllowDifferentAmountOfKeywords(false);}
if(printKeywords){compare.setPrintKeywords(true);}
if(!throwExceptionForTooGreatErrorRatio){compare.setThrowExceptionForTooGreatErrorRatio(false);}
if(specificKeyword){
if(printSpecificKeyword){compare.setPrintSpecificKeyword(true);}
compare.getIntegrationTest(keyword);
return 0;
}
compare.getIntegrationTest();
}
}
catch(const std::exception& e) {
std::cerr << "Program threw an exception: " << e.what() << std::endl;
return EXIT_FAILURE;
}
return 0;
}

View File

@@ -1,240 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "summaryComparator.hpp"
#include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h>
#include <ert/util/int_vector.h>
#include <ert/util/bool_vector.h>
#include <opm/common/ErrorMacros.hpp>
#include <cmath>
#include <numeric>
SummaryComparator::SummaryComparator(const std::string& basename1,
const std::string& basename2,
double absoluteTol, double relativeTol){
ecl_sum1 = ecl_sum_fread_alloc_case(basename1.c_str(), ":");
ecl_sum2 = ecl_sum_fread_alloc_case(basename2.c_str(), ":");
if (ecl_sum1 == nullptr || ecl_sum2 == nullptr) {
OPM_THROW(std::runtime_error, "Not able to open files");
}
absoluteTolerance = absoluteTol;
relativeTolerance = relativeTol;
keys1 = stringlist_alloc_new();
keys2 = stringlist_alloc_new();
ecl_sum_select_matching_general_var_list( ecl_sum1 , "*" , this->keys1);
stringlist_sort(this->keys1 , nullptr );
ecl_sum_select_matching_general_var_list( ecl_sum2 , "*" , this->keys2);
stringlist_sort(this->keys2 , nullptr );
if(stringlist_get_size(keys1) <= stringlist_get_size(keys2)){
this->keysShort = this->keys1;
this->keysLong = this->keys2;
}else{
this->keysShort = this->keys2;
this->keysLong = this->keys1;
}
}
SummaryComparator::~SummaryComparator(){
ecl_sum_free(ecl_sum1);
ecl_sum_free(ecl_sum2);
stringlist_free(keys1);
stringlist_free(keys2);
}
Deviation SummaryComparator::calculateDeviations(double val1, double val2){
double absDev;
Deviation deviation;
absDev = std::abs(val1 - val2);
deviation.abs = absDev;
if (val1 != 0 || val2 != 0) {
deviation.rel = absDev/double(std::max(std::abs(val1), std::abs(val2)));
}
return deviation;
}
void SummaryComparator::setTimeVecs(std::vector<double> &timeVec1,
std::vector<double> &timeVec2){
timeVec1.reserve(ecl_sum_get_data_length(ecl_sum1));
for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum1); time_index++){
timeVec1.push_back(ecl_sum_iget_sim_days(ecl_sum1 , time_index ));
}
timeVec2.reserve(ecl_sum_get_data_length(ecl_sum2));
for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum2); time_index++){
timeVec2.push_back(ecl_sum_iget_sim_days(ecl_sum2 , time_index ));
}
}
void SummaryComparator::getDataVecs(std::vector<double> &dataVec1,
std::vector<double> &dataVec2,
const char* keyword){
dataVec1.reserve(ecl_sum_get_data_length(ecl_sum1));
for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum1); time_index++){
dataVec1.push_back(ecl_sum_iget(ecl_sum1, time_index, ecl_sum_get_general_var_params_index( ecl_sum1 , keyword )));
}
dataVec2.reserve(ecl_sum_get_data_length(ecl_sum2));
for (int time_index = 0; time_index < ecl_sum_get_data_length(ecl_sum2); time_index++){
dataVec2.push_back(ecl_sum_iget(ecl_sum2, time_index, ecl_sum_get_general_var_params_index( ecl_sum2 , keyword )));
}
}
void SummaryComparator::setDataSets(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2){
if(timeVec1.size() < timeVec2.size()){
ecl_sum_fileShort = this->ecl_sum1;
ecl_sum_fileLong = this->ecl_sum2;
}
else{
ecl_sum_fileShort = this->ecl_sum2;
ecl_sum_fileLong = this->ecl_sum1;
}
}
void SummaryComparator::chooseReference(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const std::vector<double>& dataVec1,
const std::vector<double>& dataVec2){
if(timeVec1.size() <= timeVec2.size()){
referenceVec = &timeVec1; // time vector
referenceDataVec = &dataVec1; //data vector
checkVec = &timeVec2;
checkDataVec = &dataVec2;
}
else{
referenceVec = &timeVec2;
referenceDataVec = &dataVec2;
checkVec = &timeVec1;
checkDataVec = &dataVec1;
}
}
void SummaryComparator::getDeviation(size_t refIndex, size_t &checkIndex, Deviation &dev){
if((*referenceVec)[refIndex] == (*checkVec)[checkIndex]){
dev = SummaryComparator::calculateDeviations((*referenceDataVec)[refIndex], (*checkDataVec)[checkIndex]);
checkIndex++;
return;
}
else if((*referenceVec)[refIndex]<(*checkVec)[checkIndex]){
double value = SummaryComparator::unitStep((*checkDataVec)[checkIndex]);
/*Must be a little careful here. Flow writes out old value first,
than changes value. Say there should be a change in production rate from A to B at timestep 300.
Then the data of time step 300 is A and the next timestep will have value B. Must use the upper limit. */
dev = SummaryComparator::calculateDeviations((*referenceDataVec)[refIndex], value);
checkIndex++;
return;
}
else{
checkIndex++;
getDeviation(refIndex, checkIndex , dev);
}
if(checkIndex == checkVec->size() -1 ){
return;
}
}
void SummaryComparator::printUnits(){
std::vector<double> timeVec1, timeVec2;
setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
setDataSets(timeVec1, timeVec2);
for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){
std::cout << stringlist_iget(keysLong, jvar) << " unit: " << ecl_sum_get_unit(ecl_sum_fileShort, stringlist_iget(keysLong, jvar)) << std::endl;
}
}
//Called only when the keywords are equal in the getDeviations()-function
const char* SummaryComparator::getUnit(const char* keyword){
return ecl_sum_get_unit(ecl_sum_fileShort, keyword);
}
void SummaryComparator::printKeywords(){
int ivar = 0;
std::vector<std::string> noMatchString;
std::cout << "Keywords that are common for the files:" << std::endl;
while(ivar < stringlist_get_size(keysLong)){
const char* keyword = stringlist_iget(keysLong, ivar);
if (stringlist_contains(keysLong, keyword) && stringlist_contains(keysShort, keyword)){
std::cout << keyword << std::endl;
ivar++;
}
else{
noMatchString.push_back(keyword);
ivar++;
}
}
if(noMatchString.size() == 0){
std::cout << "No keywords were different" << std::endl;
return;
}
std::cout << "Keywords that are different: " << std::endl;
for (const auto& it : noMatchString) std::cout << it << std::endl;
std::cout << "\nOf the " << stringlist_get_size(keysLong) << " keywords " << stringlist_get_size(keysLong)-noMatchString.size() << " were equal and " << noMatchString.size() << " were different" << std::endl;
}
void SummaryComparator::printDataOfSpecificKeyword(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const char* keyword){
std::vector<double> dataVec1, dataVec2;
getDataVecs(dataVec1,dataVec2,keyword);
chooseReference(timeVec1, timeVec2,dataVec1,dataVec2);
size_t ivar = 0;
size_t jvar = 0;
const char separator = ' ';
const int numWidth = 14;
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << "Time";
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << "Ref data";
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << "Check data" << std::endl;
while(ivar < referenceVec->size()){
if(ivar == referenceVec->size() || jvar == checkVec->size() ){
break;
}
if((*referenceVec)[ivar] == (*checkVec)[jvar]){
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*referenceVec)[ivar];
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*referenceDataVec)[ivar];
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*checkDataVec)[jvar] << std::endl;
ivar++;
jvar++;
}else if((*referenceVec)[ivar] < (*checkVec)[jvar]){
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*referenceVec)[ivar];
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*referenceDataVec)[ivar];
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << "" << std::endl;
ivar++;
}
else{
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*checkVec)[jvar];
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << "";
std::cout << std::left << std::setw(numWidth) << std::setfill(separator) << (*checkDataVec)[jvar] << std::endl;
jvar++;
}
}
}

View File

@@ -1,182 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef SUMMARYCOMPARATOR_HPP
#define SUMMARYCOMPARATOR_HPP
#include "Deviation.hpp"
#include <iostream>
#include <iomanip>
#include <map>
#include <vector>
#include <algorithm>
#include <string>
// helper macro to handle error throws or not
#define HANDLE_ERROR(type, message) \
{ \
if (throwOnError) \
OPM_THROW(type, message); \
else \
std::cerr << message << std::endl; \
}
//! \brief Prototyping struct, encapsuling the stringlist libraries.
struct stringlist_struct;
typedef struct stringlist_struct stringlist_type;
//! \brief Prototyping struct, encapsuling the ert libraries.
struct ecl_sum_struct;
typedef struct ecl_sum_struct ecl_sum_type;
class SummaryComparator {
private:
double absoluteTolerance = 0; //!< The maximum absolute deviation that is allowed between two values.
double relativeTolerance = 0; //!< The maximum relative deviation that is allowed between twi values.
protected:
ecl_sum_type * ecl_sum1 = nullptr; //!< Struct that contains file1
ecl_sum_type * ecl_sum2 = nullptr; //!< Struct that contains file2
ecl_sum_type * ecl_sum_fileShort = nullptr; //!< For keeping track of the file with most/fewest timesteps
ecl_sum_type * ecl_sum_fileLong = nullptr; //!< For keeping track of the file with most/fewest timesteps
stringlist_type* keys1 = nullptr; //!< For storing all the keywords of file1
stringlist_type* keys2 = nullptr; //!< For storing all the keywords of file2
stringlist_type * keysShort = nullptr; //!< For keeping track of the file with most/fewest keywords
stringlist_type * keysLong = nullptr; //!< For keeping track of the file with most/fewest keywords
const std::vector<double> * referenceVec = nullptr; //!< For storing the values of each time step for the file containing the fewer time steps.
const std::vector<double> * referenceDataVec = nullptr; //!< For storing the data corresponding to each time step for the file containing the fewer time steps.
const std::vector<double> * checkVec = nullptr; //!< For storing the values of each time step for the file containing the more time steps.
const std::vector<double> * checkDataVec = nullptr; //!< For storing the data values corresponding to each time step for the file containing the more time steps.
bool printKeyword = false; //!< Boolean value for choosing whether to print the keywords or not
bool printSpecificKeyword = false; //!< Boolean value for choosing whether to print the vectors of a keyword or not
bool throwOnError = true; //!< Throw on first error
bool analysis = false; //!< Perform error analysis
std::map<std::string, std::vector<Deviation>> deviations;
//! \brief Calculate deviation between two data values and stores it in a Deviation struct.
//! \param[in] refIndex Index in reference data
//! \param[in] checkindex Index in data to be checked.
//! \param[out] dev Holds the result from the comparison on return.
//! \details Uses the #referenceVec as basis, and checks its values against the values in #checkDataVec. The function is reccursive, and will update the iterative index j of the #checkVec until #checkVec[j] >= #referenceVec[i]. \n When #referenceVec and #checkVec have the same time value (i.e. #referenceVec[i] == #checkVec[j]) a direct comparison is used, \n when this is not the case, when #referenceVec[i] do not excist as an element in #checkVec, a value is generated, either by the principle of unit step or by interpolation.
void getDeviation(size_t refIndex, size_t &checkIndex, Deviation &dev);
//! \brief Figure out which data file contains the most / less timesteps and assign member variable pointers accordingly.
//! \param[in] timeVec1 Data from first file
//! \param[in] timeVec2 Data from second file
//! \details Figure out which data file that contains the more/fewer time steps and assigns the private member variable pointers #ecl_sum_fileShort / #ecl_sum_fileLong to the correct data sets #ecl_sum1 / #ecl_sum2.
void setDataSets(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2);
//! \brief Reads in the time values of each time step.
//! \param[in] timeVec1 Vector for storing the time steps from file1
//! \param[in] timeVec2 Vector for storing the time steps from file2
void setTimeVecs(std::vector<double> &timeVec1,std::vector<double> &timeVec2);
//! \brief Read the data for one specific keyword into two separate vectors.
//! \param[in] dataVec1 Vector for storing the data for one specific keyword from file1
//! \param[in] dataVec2 Vector for storing the data for one specific keyword from file2
//! \details The two data files do not necessarily have the same amount of data values, but the values must correspond to the same interval in time. Thus possible to interpolate values.
void getDataVecs(std::vector<double> &dataVec1,
std::vector<double> &dataVec2, const char* keyword);
//! \brief Sets one data set as a basis and the other as values to check against.
//! \param[in] timeVec1 Used to figure out which dataset that have the more/fewer time steps.
//! \param[in] timeVec2 Used to figure out which dataset that have the more/fewer time steps.
//! \param[in] dataVec1 For assiging the the correct pointer to the data vector.
//! \param[in] dataVec2 For assiging the the correct pointer to the data vector.
//! \details Figures out which time vector that contains the fewer elements. Sets this as #referenceVec and its corresponding data as #referenceDataVec. \n The remaining data set is set as #checkVec (the time vector) and #checkDataVec.
void chooseReference(const std::vector<double> &timeVec1,
const std::vector<double> &timeVec2,
const std::vector<double> &dataVec1,
const std::vector<double> &dataVec2);
//! \brief Returns the relative tolerance.
double getRelTolerance(){return this->relativeTolerance;}
//! \brief Returns the absolute tolerance.
double getAbsTolerance(){return this->absoluteTolerance;}
//! \brief Returns the unit of the values of a keyword
//! \param[in] keyword The keyword of interest.
//! \param[out] ret The unit of the keyword as a const char*.
const char* getUnit(const char* keyword);
//! \brief Prints the units of the files.
void printUnits();
//! \brief Prints the keywords of the files.
//! \details The function prints first the common keywords, than the keywords that are different.
void printKeywords();
//! \brief Prints the summary vectors from the two files.
//! \details The function requires that the summary vectors of the specific file have been read into the member variables referenceVec etc.
void printDataOfSpecificKeyword(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const char* keyword);
public:
//! \brief Creates an SummaryComparator class object
//! \param[in] basename1 Path to file1 without extension.
//! \param[in] basename1 Path to file2 without extension.
//! \param[in] absoluteTolerance The absolute tolerance which is to be used in the test.
//! \param[in] relativeTolerance The relative tolerance which is to be used in the test.
//! \details The constructor creates an object of the class, and openes the files, an exception is thrown if the opening of the files fails. \n It creates stringlists, in which keywords are to be stored, and figures out which keylist that contains the more/less keywords. \n Also the private member variables aboluteTolerance and relativeTolerance are set.
SummaryComparator(const std::string& basename1,
const std::string& basename2,
double absoluteTolerance, double relativeTolerance);
//! \brief Destructor
//! \details The destructor takes care of the allocated memory in which data has been stored.
~SummaryComparator();
//! \brief Calculates the deviation between two values
//! \param[in] val1 The first value of interest.
//! \param[in] val2 The second value if interest.
//! \param[out] ret Returns a Deviation struct.
//! \details The function takes two values, calculates the absolute and relative deviation and returns the result as a Deviation struct.
static Deviation calculateDeviations( double val1, double val2);
//! \brief Sets the private member variable printKeywords
//! \param[in] boolean Boolean value
//! \details The function sets the private member variable printKeywords. When it is true the function printKeywords will be called.
void setPrintKeywords(bool boolean){this->printKeyword = boolean;}
//! \brief Sets the private member variable printSpecificKeyword
//! \param[in] boolean Boolean value
//! \details The function sets the private member variable printSpecificKeyword. When true, the summary vector of the keyword for both files will be printed.
void setPrintSpecificKeyword(bool boolean){this->printSpecificKeyword = boolean;}
//! \brief Unit step function
//! \param[in] value The input value should be the last know value
//! \param[out] ret Return the unit-step-function value.
//! \details In this case: The unit step function is used when the data from the two data set, which is to be compared, don't match in time. \n The unit step function is then to be called on the #checkDataVec 's value at the last time step which is before the time of comparison.
//! \brief Returns a value based on the unit step principle.
static double unitStep(double value){return value;}
//! \brief Set whether to throw on errors or not.
void throwOnErrors(bool dothrow) { throwOnError = dothrow; }
//! \brief Set whether or not to perform error analysis.
void doAnalysis(bool analyse) { analysis = analyse; }
};
#endif

View File

@@ -1,389 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "summaryIntegrationTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h>
#include <cmath>
void SummaryIntegrationTest::getIntegrationTest(){
std::vector<double> timeVec1, timeVec2;
setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
setDataSets(timeVec1, timeVec2);
int ivar = 0;
if(!allowDifferentAmountOfKeywords){
if(stringlist_get_size(keysShort) != stringlist_get_size(keysLong)){
OPM_THROW(std::invalid_argument, "Different ammont of keywords in the two summary files.");
}
}
if(printKeyword){
printKeywords();
return;
}
std::string keywordWithGreatestErrorRatio;
double greatestRatio = 0;
//Iterates over all keywords from the restricted file, use iterator "ivar". Searches for a match in the file with more keywords, use the itarator "jvar".
while(ivar < stringlist_get_size(keysShort)){
const char* keyword = stringlist_iget(keysShort, ivar);
if(oneOfTheMainVariables){
std::string keywordString(keyword);
std::string substr = keywordString.substr(0,4);
if(substr!= mainVariable){
ivar++;
continue;
}
}
for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){
if (strcmp(keyword, stringlist_iget(keysLong, jvar)) == 0){ //When the keywords are equal, proceed in comparing summary files.
/* if(!checkUnits(keyword)){
OPM_THROW(std::runtime_error, "For keyword " << keyword << " the unit of the two files is not equal. Not possible to compare.");
} //Comparing the unit of the two vectors.*/
checkForKeyword(timeVec1, timeVec2, keyword);
if(findVectorWithGreatestErrorRatio){
WellProductionVolume volume = getSpecificWellVolume(timeVec1,timeVec2, keyword);
findGreatestErrorRatio(volume,greatestRatio, keyword, keywordWithGreatestErrorRatio);
}
break;
}
//will only enter here if no keyword match
if(jvar == stringlist_get_size(keysLong)-1){
if(!allowDifferentAmountOfKeywords){
OPM_THROW(std::invalid_argument, "No match on keyword");
}
}
}
ivar++;
}
if(findVectorWithGreatestErrorRatio){
std::cout << "The keyword " << keywordWithGreatestErrorRatio << " had the greatest error ratio, which was " << greatestRatio << std::endl;
}
if((findVolumeError || oneOfTheMainVariables) && !findVectorWithGreatestErrorRatio){
evaluateWellProductionVolume();
}
if(allowSpikes){
std::cout << "checkWithSpikes succeeded." << std::endl;
}
}
void SummaryIntegrationTest::getIntegrationTest(const char* keyword){
if(stringlist_contains(keysShort,keyword) && stringlist_contains(keysLong, keyword)){
std::vector<double> timeVec1, timeVec2;
setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
setDataSets(timeVec1, timeVec2);
if(printSpecificKeyword){
printDataOfSpecificKeyword(timeVec1, timeVec2, keyword);
}
if(findVolumeError){
WellProductionVolume volume = getSpecificWellVolume(timeVec1, timeVec2, keyword);
if(volume.error == 0){
std::cout << "For keyword " << keyword << " the total production volume is 0" << std::endl;
}
else{
std::cout << "For keyword " << keyword << " the total production volume is "<< volume.total;
std::cout << ", the error volume is " << volume.error << " the error ratio is " << volume.error/volume.total << std::endl;
}
}
checkForKeyword(timeVec1, timeVec2, keyword);
return;
}
OPM_THROW(std::invalid_argument, "The keyword used is not common for the two files.");
}
void SummaryIntegrationTest::checkForKeyword(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const char* keyword){
std::vector<double> dataVec1, dataVec2;
getDataVecs(dataVec1,dataVec2,keyword);
chooseReference(timeVec1, timeVec2,dataVec1,dataVec2);
if(allowSpikes){
checkWithSpikes(keyword);
}
if(findVolumeError ||oneOfTheMainVariables ){
volumeErrorCheck(keyword);
}
}
int SummaryIntegrationTest::checkDeviation(const Deviation& deviation){
double absTol = getAbsTolerance();
double relTol = getRelTolerance();
if (deviation.rel> relTol && deviation.abs > absTol){
return 1;
}
return 0;
}
void SummaryIntegrationTest::findGreatestErrorRatio(const WellProductionVolume& volume,
double &greatestRatio,
const char* currentKeyword,
std::string &greatestErrorRatio){
if (volume.total != 0 && (volume.total - volume.error > getAbsTolerance()) ){
if(volume.error/volume.total > greatestRatio){
greatestRatio = volume.error/volume.total;
std::string currentKeywordStr(currentKeyword);
greatestErrorRatio = currentKeywordStr;
}
}
}
void SummaryIntegrationTest::volumeErrorCheck(const char* keyword){
const smspec_node_type * node = ecl_sum_get_general_var_node (ecl_sum_fileShort ,keyword);//doesn't matter which ecl_sum_file one uses, the kewyord SHOULD be equal in terms of smspec data.
bool hist = smspec_node_is_historical(node);
/* returns true if the keyword corresponds to a summary vector "history".
E.g. WOPRH, where the last character, 'H', indicates that it is a HISTORY vector.*/
if(hist){
return;//To make sure we do not include history vectors.
}
if (!mainVariable.empty()){
std::string keywordString(keyword);
std::string firstFour = keywordString.substr(0,4);
if(mainVariable == firstFour && firstFour == "WOPR"){
if(firstFour == "WOPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WOP += result;
return;
}
}
if(mainVariable == firstFour && firstFour == "WWPR"){
if(firstFour == "WWPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WWP += result;
return;
}
}
if(mainVariable == firstFour && firstFour == "WGPR"){
if(firstFour == "WGPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WGP += result;
return;
}
}
if(mainVariable == firstFour && firstFour == "WBHP"){
if(firstFour == "WBHP"){
WellProductionVolume result = getWellProductionVolume(keyword);
WBHP += result;
return;
}
}
}
updateVolumeError(keyword);
}
void SummaryIntegrationTest::updateVolumeError(const char* keyword){
std::string keywordString(keyword);
std::string firstFour = keywordString.substr(0,4);
if(firstFour == "WOPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WOP += result;
}
if(firstFour == "WWPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WWP += result;
}
if(firstFour == "WGPR"){
WellProductionVolume result = getWellProductionVolume(keyword);
WGP += result;
}
if(firstFour == "WBHP"){
WellProductionVolume result = getWellProductionVolume(keyword);
WBHP += result;
}
}
WellProductionVolume SummaryIntegrationTest::getWellProductionVolume(const char * keyword){
double total = integrate(*referenceVec, *referenceDataVec);
double error = integrateError(*referenceVec, *referenceDataVec,
*checkVec, *checkDataVec);
WellProductionVolume wPV;
wPV.total = total;
wPV.error = error;
if(wPV.total != 0 && wPV.total-wPV.error > getAbsTolerance()){
if( (wPV.error/wPV.total > getRelTolerance()) && throwExceptionForTooGreatErrorRatio){
OPM_THROW(std::runtime_error, "For the keyword "<< keyword << " the error ratio was " << wPV.error/wPV.total << " which is greater than the tolerance " << getRelTolerance());
}
}
return wPV;
}
void SummaryIntegrationTest::evaluateWellProductionVolume(){
if(mainVariable.empty()){
double ratioWOP, ratioWWP, ratioWGP, ratioWBHP;
ratioWOP = WOP.error/WOP.total;
ratioWWP = WWP.error/WWP.total;
ratioWGP = WGP.error/WGP.total;
ratioWBHP = WBHP.error/WBHP.total;
std::cout << "\n The total oil volume is " << WOP.total << ". The error volume is "<< WOP.error << ". The error ratio is " << ratioWOP << std::endl;
std::cout << "\n The total water volume is " << WWP.total << ". The error volume is "<< WWP.error << ". The error ratio is " << ratioWWP << std::endl;
std::cout << "\n The total gas volume is " << WGP.total <<". The error volume is "<< WGP.error << ". The error ratio is " << ratioWGP << std::endl;
std::cout << "\n The total area under the WBHP curve is " << WBHP.total << ". The area under the error curve is "<< WBHP.error << ". The error ratio is " << ratioWBHP << std::endl << std::endl;
}
if(mainVariable == "WOPR"){
std::cout << "\nThe total oil volume is " << WOP.total << ". The error volume is "<< WOP.error << ". The error ratio is " << WOP.error/WOP.total << std::endl<< std::endl;
}
if(mainVariable == "WWPR"){
std::cout << "\nThe total water volume is " << WWP.total << ". The error volume is "<< WWP.error << ". The error ratio is " << WWP.error/WWP.total << std::endl<< std::endl;
}
if(mainVariable == "WGPR"){
std::cout << "\nThe total gas volume is " << WGP.total <<". The error volume is "<< WGP.error << ". The error ratio is " << WGP.error/WGP.total << std::endl<< std::endl;
}
if(mainVariable == "WBHP"){
std::cout << "\nThe total area under the WBHP curve " << WBHP.total << ". The area under the error curve is "<< WBHP.error << ". The error ratio is " << WBHP.error/WBHP.total << std::endl << std::endl;
}
}
void SummaryIntegrationTest::checkWithSpikes(const char* keyword){
int errorOccurrences = 0;
size_t jvar = 0 ;
bool spikeCurrent = false;
Deviation deviation;
for (size_t ivar = 0; ivar < referenceVec->size(); ivar++){
int errorOccurrencesPrev = errorOccurrences;
bool spikePrev = spikeCurrent;
getDeviation(ivar,jvar, deviation);
errorOccurrences += checkDeviation(deviation);
if (errorOccurrences != errorOccurrencesPrev){
spikeCurrent = true;
} else{
spikeCurrent = false;
}
if(spikePrev&&spikeCurrent){
std::cout << "For keyword " << keyword << " at time step " << (*referenceVec)[ivar] <<std::endl;
OPM_THROW(std::invalid_argument, "For keyword " << keyword << " at time step " << (*referenceVec)[ivar] << ", wwo deviations in a row exceed the limit. Not a spike value. Integration test fails." );
}
if(errorOccurrences > this->spikeLimit){
std::cout << "For keyword " << keyword << std::endl;
OPM_THROW(std::invalid_argument, "For keyword " << keyword << " too many spikes in the vector. Integration test fails.");
}
}
}
WellProductionVolume
SummaryIntegrationTest::getSpecificWellVolume(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const char* keyword){
std::vector<double> dataVec1, dataVec2;
getDataVecs(dataVec1,dataVec2,keyword);
chooseReference(timeVec1, timeVec2,dataVec1,dataVec2);
return getWellProductionVolume(keyword);
}
double SummaryIntegrationTest::integrate(const std::vector<double>& timeVec,
const std::vector<double>& dataVec){
double totalSum = 0;
if(timeVec.size() != dataVec.size()){
OPM_THROW(std::runtime_error, "The size of the time vector does not match the size of the data vector.");
}
for(size_t i = 0; i < timeVec.size()-1; i++){
double width = timeVec[i+1] - timeVec[i];
double height = dataVec[i+1];
totalSum += getRectangleArea(height, width);
}
return totalSum;
}
double SummaryIntegrationTest::integrateError(const std::vector<double>& timeVec1,
const std::vector<double>& dataVec1,
const std::vector<double>& timeVec2,
const std::vector<double>& dataVec2){
// When the data corresponds to a rate the integration will become a Riemann
// sum. This function calculates the Riemann sum of the error. The reason why
// a Riemann sum is used is because of the way the data is written to file.
// When a change occur (e.g. change of a rate), the data (value and time) is
// written to file, THEN the change happens in the simulator, i.e., we will
// notice the change at the next step.
//
// Keep in mind that the summary vector is NOT a continuous curve, only points
// of data (time, value). We have to guess what happens between the data
// points, we do this by saying: "There are no change, the only change happens
// at the data points." As stated above, the value of this constant "height" of
// the rectangle corresponds to the value of the last time step. Thus we have
// to use the "right hand side value of the rectangle as height
//
// someDataVector[ivar] instead of someDataVector[ivar-1]
//
// (which intuition is saying is the correct value to use).
if(timeVec1.size() != dataVec1.size() || timeVec2.size() != dataVec2.size() ){
OPM_THROW(std::runtime_error, "The size of the time vector does not match the size of the data vector.");
}
double errorSum = 0;
double rightEdge, leftEdge, width;
size_t i = 1;
size_t j = 1;
leftEdge = timeVec1[0];
while(i < timeVec1.size()){
if(j == timeVec2.size() ){
break;
}
if(timeVec1[i] == timeVec2[j]){
rightEdge = timeVec1[i];
width = rightEdge - leftEdge;
double dev = std::fabs(dataVec1[i] - dataVec2[j]);
errorSum += getRectangleArea(dev, width);
leftEdge = rightEdge;
i++;
j++;
continue;
}
if(timeVec1[i] < timeVec2[j]){
rightEdge = timeVec1[i];
width = rightEdge - leftEdge;
double value = unitStep(dataVec2[j]);
double dev = std::fabs(dataVec1[i]-value);
errorSum += getRectangleArea(dev, width);
leftEdge = rightEdge;
i++;
continue;
}
if(timeVec2[j] < timeVec1[i]){
rightEdge = timeVec2[j];
width = rightEdge - leftEdge;
double value = unitStep(dataVec1[i]);
double dev = std::fabs(dataVec2[j]-value);
errorSum += getRectangleArea(dev, width);
leftEdge = rightEdge;
j++;
continue;
}
}
return errorSum;
}

View File

@@ -1,217 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "summaryComparator.hpp"
//! \brief Struct for storing the total area under a graph.
//! \details Used when plotting summary vector against time. In most cases this represents a volume.
struct WellProductionVolume{
double total=0; //!< The total area under the graph when plotting the summary vector against time. In most cases the total production volume.
double error=0; //!< The total area under the graph when plotting the deviation vector against time. In most cases the total error volume.
//! \brief Overloaded operator
//! \param[in] rhs WellProductionVolume struct
WellProductionVolume& operator+=(const WellProductionVolume& rhs){
this->total += rhs.total;
this->error += rhs.error;
return *this;
}
};
//! \details The class inherits from the SummaryComparator class, which takes care of all file reading. \n The IntegrationTest class compares values from the two different files and throws exceptions when the deviation is unsatisfying.
class SummaryIntegrationTest: public SummaryComparator {
private:
bool allowSpikes = false; //!< Boolean value, when true checkForSpikes is included as a sub test in the integration test. By default: false.
bool findVolumeError = false; //!< Boolean value, when true volumeErrorCheck() is included as a sub test in the integration test. By default: false.
bool allowDifferentAmountOfKeywords = true; //!< Boolean value, when false the integration test will check wheter the two files have the same amount of keywords. \nIf they don't, an exception will be thrown. By default: true.
bool findVectorWithGreatestErrorRatio = false; //!< Boolean value, when true the integration test will find the vector that has the greatest error ratio. By default: false.
bool oneOfTheMainVariables = false; //!< Boolean value, when true the integration test will only check for one of the primary variables (WOPR, WGPR, WWPR. WBHP), which will be specified by user. By default: false.
bool throwExceptionForTooGreatErrorRatio = true; //!< Boolean value, when true any volume error ratio that exceeds the relativeTolerance will cause an exception to be thrown. By default: true.
std::string mainVariable; //!< String variable, where the name of the main variable of interest (one of WOPR, WBHP, WWPR, WGPR) is stored. Can be empty.
int spikeLimit = 13370; //!< The limit for how many spikes to allow in the data set of a certain keyword. By default: Set to a high number, \n should not trig the (if spikeOccurrences > spikeLimit){ // throw exception }.
WellProductionVolume WOP; //!< WellProductionVolume struct for storing the total production volume and total error volume of all the keywords which start with WOPR
WellProductionVolume WWP; //!< WellProductionVolume struct for storing the total production volume and total error volume of all the keywords which start with WWPR
WellProductionVolume WGP;//!< WellProductionVolume struct for storing the total production volume and total error volume of all the keywords which start with WGPR
WellProductionVolume WBHP; //!< WellProductionVolume struct for storing the value of the area under the graph when plotting summary vector/deviation vector against time.This is for keywords starting with WBHP. \nNote: the name of the struct may be misleading, this is not an actual volume.
//! \brief The function gathers the correct data for comparison for a specific keyword
//! \param[in] timeVec1 A std::vector<double> that contains the time steps of file 1.
//! \param[in] timeVec2 A std::vector<double> that contains the time steps of file 2.
//! \param[in] keyword The keyword of interest
//! \details The function requires an outer loop which iterates over the keywords of the files. It prepares an integration test by gathering the data, stroing it into two vectors, \n deciding which is to be used as a reference/basis and calling the test function.
void checkForKeyword(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2, const char* keyword);
//! \brief The function compares the volume error to the total production volume of a certain type of keyword.
//! param[in] keyword The keyword of interest.
//! \details The function takes in a keyword and checks if it is of interest. Only keywords which say something about the well oil production, well water production, \n well gas production and the well BHP are of interest. The function sums up the total production in the cases where it is possible, \n and sums up the error volumes by a trapezoid integration method. The resulting values are stored in member variable structs of type WellProductionVolume, and double variables. For proper use of the function all the keywords of the file should be checked. This is satisfied if it is called by checkForKeyword.
void volumeErrorCheck(const char* keyword);
//! \brief The function calculates the total production volume and total error volume of a specific keyword
//! \param[in] timeVec1 A std::vector<double> that contains the time steps of file 1.
//! \param[in] timeVec2 A std::vector<double> that contains the time steps of file 2.
//! \param[in] keyword The keyword of interest
//! \param[out] ret Returns a WellProductionWolume struct
//! \details The function reads the data from the two files into the member variable vectors (of the super class). It returns a WellProductionVolume struct calculated from the vectors corresponding to the keyword.
WellProductionVolume getSpecificWellVolume(const std::vector<double>& timeVec1,
const std::vector<double>& timeVec2,
const char* keyword);
//! \brief The function is a regression test which allows spikes.
//! \param[in] keyword The keyword of interest, the keyword the summary vectors "belong" to.
//! \details The function requires the protected member variables referenceVec, referenceDataVec, checkVec and checkDataVec to be stored with data, which is staisfied if it is called by checkForKeyword. \n It compares the two vectors value by value, and if the deviation is unsatisfying, the errorOccurrenceCounter is incremented. If the errorOccurrenceCounter becomes greater than the errorOccurrenceLimit, \n a exception is thrown. The function will allow spike values, however, if two values in a row exceed the deviation limit, they are no longer spikes, and an exception is thrown.
void checkWithSpikes(const char* keyword);
//! \brief Caluculates a deviation, throws exceptions and writes and error message.
//! \param[in] deviation Deviation struct
//! \param[out] int Returns 0/1, depending on wheter the deviation exceeded the limit or not.
//! \details The function checks the values of the Deviation struct against the absolute and relative tolerance, which are private member values of the super class. \n When comparing against the relative tolerance an additional term is added, the absolute deviation has to be greater than 1e-6 for the function to throw an exception. \n When the deviations are too great, the function returns 1.
int checkDeviation(const Deviation& deviation);
//! \brief Calculates the keyword's total production volume and error volume
//! \param[in] keyword The keyword of interest.
//! \param[out] wellProductionVolume A struct containing the total production volume and the total error volume.
//! \details The function calculates the total production volume and total error volume of a keyword, by the trapezoid integral method. \n The function throws and exception if the total error volume is negative. The function returns the results as a struct.
WellProductionVolume getWellProductionVolume(const char* keyword);
//! \brief The function function works properly when the private member variables are set (after running the integration test which findVolumeError = true). \n It prints out the total production volume, the total error volume and the error ratio.
void evaluateWellProductionVolume();
//! \brief The function calculates the total production volume and total error volume
//! \param keyword The keyword of interest
//! \details The function uses the data that is stored in the member variable vectors. It calculates the total production volume \n and the total error volume of the specified keyword, and adds the result to the private member WellProductionVolume variables of the class.
void updateVolumeError(const char* keyword);
//! \brief Finds the keyword which has the greates error volume ratio
//! \param[in] volume WellProductionVolume struct which contains the data used for comparison
//! \param[in] greatestRatio Double value taken in by reference. Stores the greatest error ratio value.
//! \param[in] currentKeyword The keyword that is under evaluation
//! \param[in] greatestErrorRatio String which contains the name of the keyword which has the greatest error ratio
//! \details The function requires an outer loop which iterates over the keywords in the files, and calls the function for each keyword. \nThe valiables double greatestRatio and std::string keywordWithTheGreatestErrorRatio must be declared outside the loop. \nWhen the current error ratio is greater than the value stored in greatestRatio, the gratestRatio value is updated with the current error ratio.
void findGreatestErrorRatio(const WellProductionVolume& volume,
double &greatestRatio,
const char* currentKeyword,
std::string &greatestErrorRatio);
#if 0
//! \brief Checks whether the unit of the two data vectors is the same
//! \param[in] keyword The keyword of interest
//! \param[out] boolean True/false, depending on whether the units are equal or not
bool checkUnits(const char* keyword);
#endif
public:
//! \brief Constructor, creates an object of IntegrationTest class.
//! \param[in] basename1 Path to file1 without extension.
//! \param[in] basename1 Path to file2 without extension.
//! \param[in] atol The absolute tolerance which is to be used in the test.
//! \param[in] rtol The relative tolerance which is to be used in the test.
//! \details The constructor calls the constructor of the super class.
SummaryIntegrationTest(const std::string& basename1,
const std::string& basename2,
double atol, double rtol) :
SummaryComparator(basename1, basename2, atol, rtol) {}
//! \brief This function sets the private member variable allowSpikes.
//! \param[in] allowSpikes Boolean value
//! \details When allowSpikes is true, the integration test checkWithSpikes is excecuted.
void setAllowSpikes(bool allowSpikesArg){this->allowSpikes = allowSpikesArg;}
//! \brief This function sets the private member variable findVolumeError.
//! \param[in] findVolumeError Boolean value
//! \details When findVolumeError is true, the integration test volumeErrorCheck and the function evaluateWellProductionVolume are excecuted.
void setFindVolumeError(bool findVolumeErrorArg){this->findVolumeError = findVolumeErrorArg;}
//! \brief This function sets the private member variable oneOfTheMainVariables
//! \param[in] oneOfTheMainVariables Boolean value
//! \details When oneOfTheMainVariables is true, the integration test runs the substest volumeErrorCheckForOneSpecificVariable.
void setOneOfTheMainVariables(bool oneOfTheMainVariablesArg){this->oneOfTheMainVariables = oneOfTheMainVariablesArg;}
//! \brief This function sets the member variable string #mainVariable
//! \param[in] mainVar This is the string should contain one of the main variables. e.g. WOPR
void setMainVariable(std::string mainVar){this->mainVariable = mainVar;}
//! \brief This function sets the private member variable spikeLimit.
//! \param[in] lim The value which the spike limit is to be given.
void setSpikeLimit(int lim){this->spikeLimit = lim;}
//! \brief This function sets the private member variable findVectorWithGreatestErrorRatio
//! \param[in] findVolumeError Boolean value
//! \details When findVectorWithGreatestErrorRatio is true, the integration test will print the vector with the greatest error ratio.
void setFindVectorWithGreatestErrorRatio(bool boolean){this->findVectorWithGreatestErrorRatio = boolean;}
//! \brief This function sets the private member variable allowDifferentAmountsOfKeywords
//! \param[in] boolean Boolean value
//! \details When allowDifferentAmountOfKeywords is false, the amount of kewyord in the two files will be compared. \nIf the number of keywords are different an exception will be thrown.
void setAllowDifferentAmountOfKeywords(bool boolean){this->allowDifferentAmountOfKeywords = boolean;}
//! \brief This function sets the private member variable throwExceptionForTooGreatErrorRatio
//! \param[in] boolean Boolean value
//! \details When throwExceptionForTooGreatErrorRatio is false, the function getWellProductionVolume will throw an exception.
void setThrowExceptionForTooGreatErrorRatio(bool boolean){this->throwExceptionForTooGreatErrorRatio = boolean;}
//! \brief This function executes a integration test for all the keywords. If the two files do not match in amount of keywords, an exception is thrown. \n Uses the boolean member variables to know which tests to execute.
void getIntegrationTest();
//! \brief This function executes a integration test for one specific keyword. If one or both of the files do not have the keyword, an exception is thorwn. \n Uses the boolean member variables to know which tests to execute.
void getIntegrationTest(const char* keyword);
//! \brief This function calculates the area of an rectangle of height height and width time-timePrev
//! \param[in] height The height of the rectangle. See important statement of use below.
//! \param[in] width The width of the rectangle
//! \param[out] area Returns the area of the rectangle
//! \details This function is simple. When using it on a summary vector (data values plotted againt time), calculating the area between the two points i and i+1 note this:\nThe width is time_of_i+1 - time_of_i, the height is data_of_i+1 NOT data_of_i. The upper limit must be used.
static double getRectangleArea(double height, double width){return height*width;}
//! \brief This function calculates the area under a graph by doing a Riemann sum
//! \param[in] timeVec Contains the time values
//! \param[in] dataVec Contains the data values
//! \details The function does a Riemann sum integration of the graph formed
//! by the points (timeVec[i] , dataVec[i]).
//! In the case of a summary vector, the summary vector of quantity
//! corresponding to a rate, is a piecewise continus function consisting
//! of unit step functions. Thus the Riemann sum will become an
//! exact expression for the integral of the graph.
//! Important: For the data values correspoding to time i and i-1,
//! the fixed value of the height of the rectangles in the Riemann sum
//! is set by the data value i. The upper limit must be used.
static double integrate(const std::vector<double>& timeVec,
const std::vector<double>& dataVec);
//! \brief This function calculates the Riemann sum of the error between two graphs.
//! \param[in] timeVec1 Contains the time values of graph 1
//! \param[in] dataVec1 Contains the data values of graph 1
//! \param[in] timeVec2 Contains the time values of graph 2
//! \param[in] dataVec2 Contains the data values of graph 2
//! \details This function takes in two graphs and returns the integrated error.
//! In case of ecl summary vectors: if the vectors correspond to a
//! quantity which is a rate, the vectors will be piecewise
//! continous unit step functions. In this case the error will also
//! be a piecewise continous unit step function. The function uses
//! a Riemann sum when calculating the integral. Thus the integral
//! will become exact. Important: For the data values corresponding
//! to time i and i-1, the fixed value of the height of the rectangles
//! in the Riemann sum is set by the data value i.
//! The upper limit must be used.
static double integrateError(const std::vector<double>& timeVec1,
const std::vector<double>& dataVec1,
const std::vector<double>& timeVec2,
const std::vector<double>& dataVec2);
};

View File

@@ -1,171 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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 "summaryRegressionTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h>
#include <string>
void SummaryRegressionTest::getRegressionTest(){
std::vector<double> timeVec1, timeVec2;
setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
setDataSets(timeVec1, timeVec2); //Figures which dataset that contains more/less values pr keyword vector.
std::cout << "Comparing " << timeVec1.size() << " steps." << std::endl;
int ivar = 0;
if(stringlist_get_size(keysShort) != stringlist_get_size(keysLong)){
int missing_count = 0;
std::cout << "Keywords missing from one case: " << std::endl;
for (int i=0; i < stringlist_get_size( keysLong); i++) {
const char * key = stringlist_iget( keysLong , i );
if (!stringlist_contains( keysShort , key)) {
std::cout << key << " ";
missing_count++;
if ((missing_count % 8) == 0)
std::cout << std::endl;
}
}
std::cout << std::endl;
HANDLE_ERROR(std::runtime_error, "Different amount of keywords in the two summary files.");
}
if(printKeyword){
printKeywords();
}
//Iterates over all keywords from the restricted file, use iterator "ivar". Searches for a match in the file with more keywords, use the iterator "jvar".
bool throwAtEnd = false;
while(ivar < stringlist_get_size(keysShort)){
const char* keyword = stringlist_iget(keysShort, ivar);
std::string keywordString(keyword);
for (int jvar = 0; jvar < stringlist_get_size(keysLong); jvar++){
if (strcmp(keyword, stringlist_iget(keysLong, jvar)) == 0){ //When the keywords are equal, proceed in comparing summary files.
if (isRestartFile && keywordString.substr(3,1)=="T"){
break;
}
throwAtEnd |= !checkForKeyword(timeVec1, timeVec2, keyword);
break;
}
//will only enter here if no keyword match
if(jvar == stringlist_get_size(keysLong)-1){
std::cout << "Could not find keyword: " << stringlist_iget(keysShort, ivar) << std::endl;
OPM_THROW(std::runtime_error, "No match on keyword");
}
}
ivar++;
}
if (analysis) {
std::cout << deviations.size() << " summary keyword"
<< (deviations.size() > 1 ? "s":"") << " exhibit failures" << std::endl;
size_t len = ecl_sum_get_data_length(ecl_sum1);
for (const auto& iter : deviations) {
std::cout << "\t" << iter.first << std::endl;
std::cout << "\t\tFails for " << iter.second.size() << " / " << len << " steps." << std::endl;
std::cout.precision(7);
double absErr = std::max_element(iter.second.begin(), iter.second.end(),
[](const Deviation& a, const Deviation& b)
{
return a.abs < b.abs;
})->abs;
double relErr = std::max_element(iter.second.begin(), iter.second.end(),
[](const Deviation& a, const Deviation& b)
{
return a.rel < b.rel;
})->rel;
std::cout << "\t\tLargest absolute error: "
<< std::scientific << absErr << std::endl;
std::cout << "\t\tLargest relative error: "
<< std::scientific << relErr << std::endl;
}
}
if (throwAtEnd)
OPM_THROW(std::runtime_error, "Regression test failed.");
else if (deviations.empty())
std::cout << "Regression test succeeded." << std::endl;
}
void SummaryRegressionTest::getRegressionTest(const char* keyword){
std::vector<double> timeVec1, timeVec2;
setTimeVecs(timeVec1, timeVec2); // Sets the time vectors, they are equal for all keywords (WPOR:PROD01 etc)
setDataSets(timeVec1, timeVec2); //Figures which dataset that contains more/less values pr keyword vector.
std::string keywordString(keyword);
if(stringlist_contains(keysShort,keyword) && stringlist_contains(keysLong, keyword)){
if (isRestartFile && keywordString.substr(3,1)=="T"){
return;
}
if (checkForKeyword(timeVec1, timeVec2, keyword))
std::cout << "Regression test succeeded." << std::endl;
else
OPM_THROW(std::runtime_error, "Regression test failed");
return;
}
std::cout << "The keyword suggested, " << keyword << ", is not supported by one or both of the summary files. Please use a different keyword." << std::endl;
OPM_THROW(std::runtime_error, "Input keyword from user does not exist in/is not common for the two summary files.");
}
bool SummaryRegressionTest::checkDeviation(Deviation deviation, const char* keyword, int refIndex, int checkIndex){
double absTol = getAbsTolerance();
double relTol = getRelTolerance();
if (deviation.rel > relTol && deviation.abs > absTol){
if (analysis) {
deviations[keyword].push_back(deviation);
} else {
std::cout << "For keyword " << keyword << std::endl;
std::cout << "(days, reference value) and (days, check value) = (" << (*referenceVec)[refIndex] << ", " << (*referenceDataVec)[refIndex]
<< ") and (" << (*checkVec)[checkIndex-1] << ", " << (*checkDataVec)[checkIndex-1] << ")\n";
// -1 in [checkIndex -1] because checkIndex is updated after leaving getDeviation function
std::cout << "The absolute deviation is " << deviation.abs << ". The tolerance limit is " << absTol << std::endl;
std::cout << "The relative deviation is " << deviation.rel << ". The tolerance limit is " << relTol << std::endl;
HANDLE_ERROR(std::runtime_error, "Deviation exceed the limit.");
}
return false;
}
return true;
}
bool SummaryRegressionTest::checkForKeyword(std::vector<double>& timeVec1, std::vector<double>& timeVec2, const char* keyword){
std::vector<double> dataVec1, dataVec2;
getDataVecs(dataVec1,dataVec2,keyword);
chooseReference(timeVec1, timeVec2,dataVec1,dataVec2);
return startTest(keyword);
}
bool SummaryRegressionTest::startTest(const char* keyword){
size_t jvar = 0;
Deviation deviation;
bool result = true;
for (size_t ivar = 0; ivar < referenceVec->size(); ivar++){
getDeviation(ivar, jvar, deviation);//Reads from the protected member variables in the super class.
result = checkDeviation(deviation, keyword,ivar, jvar);
}
return result;
}

View File

@@ -1,74 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef SUMMARYREGRESSIONTEST_HPP
#define SUMMARYREGRESSIONTEST_HPP
#include "summaryComparator.hpp"
//! \details The class inherits from the SummaryComparator class, which takes care of all file reading. \n The RegressionTest class compares the values from the two different files and throws exceptions when the deviation is unsatisfying.
class SummaryRegressionTest: public SummaryComparator {
private:
//! \brief Gathers the correct data for comparison for a specific keyword
//! \param[in] timeVec1 The time steps of file 1.
//! \param[in] timeVec2 The time steps of file 2.
//! \param[in] keyword The keyword of interest
//! \details The function prepares a regression test by gathering the data, stroing it into two vectors, \n deciding which is to be used as a reference/basis and calling the test function.
//! \return True if check passed, false otherwise.
bool checkForKeyword(std::vector<double>& timeVec1, std::vector<double>& timeVec2, const char* keyword);
//! \brief The regression test
//! \param[in] keyword The keyword common for both the files. The vectors associated with the keyword are used for comparison.
//! \details Start test uses the private member variables, pointers of std::vector<double> type, which are set to point to the correct vectors in SummaryComparison::chooseReference(...). \n The function iterates over the referenceVev/basis and for each iteration it calculates the deviation with SummaryComparison::getDeviation(..) and stors it in a Deviation struct. \n SummaryComparison::getDeviation takes the int jvar as an reference input, and using it as an iterative index for the values which are to be compared with the basis. \n Thus, by updating the jvar variable every time a deviation is calculated, one keep track jvar and do not have to iterate over already checked values.
bool startTest(const char* keyword);
//! \brief Caluculates a deviation, throws exceptions and writes and error message.
//! \param[in] deviation Deviation struct
//! \param[in] keyword The keyword that the data that are being compared belongs to.
//! \param[in] refIndex The report step of which the deviation originates from in #referenceDataVec.
//! \param[in] checkIndex The report step of which the deviation originates from in #checkDataVec.
//! \details The function checks the values of the Deviation struct against the absolute and relative tolerance, which are private member values of the super class. \n When comparing against the relative tolerance an additional term is added, the absolute deviation has to be greater than 1e-6 for the function to throw an exception. \n When the deviations are too great, the function writes out which keyword, and at what report step the deviation is too great before optionally throwing an exception.
//! \return True if check passed, false otherwise.
bool checkDeviation(Deviation deviation, const char* keyword, int refIndex, int checkIndex);
bool isRestartFile = false; //!< Private member variable, when true the files that are being compared is a restart file vs a normal file
public:
//! \brief Constructor, creates an object of RefressionTest class.
//! \param[in] basename1 Path to file1 without extension.
//! \param[in] basename1 Path to file2 without extension.
//! \param[in] relativeTol The relative tolerance which is to be used in the test.
//! \param[in] absoluteTol The absolute tolerance which is to be used in the test.
//! \details The constructor calls the constructor of the super class.
SummaryRegressionTest(const std::string& basename1,
const std::string& basename2,
double relativeTol, double absoluteTol) :
SummaryComparator(basename1, basename2, relativeTol, absoluteTol) {}
//! \details The function executes a regression test for all the keywords. If the two files do not match in amount of keywords, an exception is thrown.
void getRegressionTest();
//! \details The function executes a regression test for one specific keyword. If one or both of the files do not have the keyword, an exception is thrown.
void getRegressionTest(const char* keyword);///< Regression test for a certain keyword of the files.
//! \brief This function sets the private member variable isRestartFiles
//! \param[in] boolean Boolean value
void setIsRestartFile(bool boolean){this->isRestartFile = boolean;}
};
#endif

View File

@@ -1,4 +1,2 @@
This directory contains the cJSON package downloaded unchanged from:
http://sourceforge.net/projects/cjson/. The cJSON package is plain C,
the JsonObject class provides a minimal C++ wrapping of this.
This directory contains the the 1.7.10 version of the cJSON package from https://github.com/DaveGamble/cJSON

3177
external/cjson/cJSON.c vendored

File diff suppressed because it is too large Load Diff

290
external/cjson/cJSON.h vendored
View File

@@ -1,16 +1,16 @@
/*
Copyright (c) 2009 Dave Gamble
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -23,118 +23,260 @@
#ifndef cJSON__h
#define cJSON__h
#include <stdlib.h>
#ifdef __cplusplus
extern "C"
{
#endif
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
#define __WINDOWS__
#endif
#ifdef __WINDOWS__
/* 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 */
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
#define CJSON_EXPORT_SYMBOLS
#endif
#if defined(CJSON_HIDE_SYMBOLS)
#define CJSON_PUBLIC(type) type CJSON_STDCALL
#elif defined(CJSON_EXPORT_SYMBOLS)
#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: */
typedef struct cJSON {
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
typedef struct cJSON
{
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
struct cJSON *next;
struct cJSON *prev;
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
struct cJSON *child;
int type; /* The type of the item, as above. */
/* The type of the item, as above. */
int type;
char *valuestring; /* The item's string, if type==cJSON_String */
int valueint; /* The item's number, if type==cJSON_Number */
double valuedouble; /* 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 */
int valueint;
/* The item's number, if type==cJSON_Number */
double valuedouble;
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;
typedef struct cJSON_Hooks {
void *(*malloc_fn)(size_t sz);
void (*free_fn)(void *ptr);
typedef struct cJSON_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_t sz);
void (CJSON_CDECL *free_fn)(void *ptr);
} cJSON_Hooks;
typedef int cJSON_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(const char*) cJSON_Version(void);
/* Supply malloc, realloc and free functions to cJSON */
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
/* 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(const char *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(). */
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
extern cJSON *cJSON_Parse(const char *value);
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
extern char *cJSON_Print(cJSON *item);
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
extern char *cJSON_PrintUnformatted(cJSON *item);
/* Render a cJSON entity to text for transfer/storage. */
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
/* Render a cJSON entity to text for transfer/storage without any formatting. */
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
/* 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 */
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
/* Delete a cJSON entity and all subentities. */
extern void cJSON_Delete(cJSON *c);
CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
/* Returns the number of items in an array (or object). */
extern int cJSON_GetArraySize(cJSON *array);
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
/* Get item "string" from object. Case insensitive. */
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
/* 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. */
extern const char *cJSON_GetErrorPtr(void);
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
/* Check if the item is a string and return its valuestring */
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
/* These functions check the type of an item */
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
/* These calls create a cJSON item of the appropriate type. */
extern cJSON *cJSON_CreateNull(void);
extern cJSON *cJSON_CreateTrue(void);
extern cJSON *cJSON_CreateFalse(void);
extern cJSON *cJSON_CreateBool(int b);
extern cJSON *cJSON_CreateNumber(double num);
extern cJSON *cJSON_CreateString(const char *string);
extern cJSON *cJSON_CreateArray(void);
extern cJSON *cJSON_CreateObject(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
/* raw json */
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
/* Create a string where valuestring references a string so
* it will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
/* Create an object/arrray that only references it's elements so
* they will not be freed by cJSON_Delete */
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
/* These utilities create an Array of count items. */
extern cJSON *cJSON_CreateIntArray(int *numbers,int count);
extern cJSON *cJSON_CreateFloatArray(float *numbers,int count);
extern cJSON *cJSON_CreateDoubleArray(double *numbers,int count);
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
/* Append item to the specified array/object. */
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
* writing to `item->string` */
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
/* 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. */
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
/* Remove/Detatch items from Arrays/Objects. */
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
/* Update array items. */
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
/* Duplicate a cJSON item */
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
need to be released. With recurse!=0, it will duplicate any children connected to the item.
The item->next and ->prev pointers are always zero on return from Duplicate. */
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
/* Macros for creating things quickly. */
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
CJSON_PUBLIC(void) cJSON_Minify(char *json);
/* Helper functions for creating and adding items to an object at the same time.
* They return the added item or NULL on failure. */
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
/* helper for the cJSON_SetNumberValue macro */
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
/* Macro for iterating over an array or object */
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
CJSON_PUBLIC(void) cJSON_free(void *object);
#ifdef __cplusplus
}

View File

@@ -2,6 +2,10 @@
declare -A configurations
declare -A EXTRA_MODULE_FLAGS
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON"
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON"
# Parse revisions from trigger comment and setup arrays
# Depends on: 'upstreams', upstreamRev',
# 'downstreams', 'downstreamRev',
@@ -79,10 +83,26 @@ function printHeader {
# $2 = 0 to build and install module, 1 to build and test module
# $3 = Source root of module to build
function build_module {
cmake $3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$2 -DCMAKE_TOOLCHAIN_FILE=${configurations[$configuration]} $1
CMAKE_PARAMS="$1"
DO_TEST_FLAG="$2"
MOD_SRC_DIR="$3"
cmake "$MOD_SRC_DIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$DO_TEST_FLAG -DCMAKE_TOOLCHAIN_FILE=${configurations[$configuration]} $CMAKE_PARAMS
test $? -eq 0 || exit 1
if test $2 -eq 1
if test $DO_TEST_FLAG -eq 1
then
pushd "$CWD"
cd "$MOD_SRC_DIR"
if test -x "./jenkins/pre-build.sh"; then
echo "Running pre-build script"
if ! "./jenkins/pre-build.sh"; then
exit 1
fi
else
echo "No pre-build script detected"
fi
popd
if [ ! -z $BUILDTHREADS ]
then
cmake --build . -- -j$BUILDTHREADS
@@ -90,11 +110,12 @@ function build_module {
cmake --build .
fi
test $? -eq 0 || exit 2
TESTTHREADS=${TESTTHREADS:-1}
if test -z "$CTEST_CONFIGURATION"
then
ctest -T Test --no-compress-output
ctest -T Test --no-compress-output -j$TESTTHREADS
else
ctest -C $CTEST_CONFIGURATION --timeout 5000 -T Test --no-compress-output
ctest -j$TESTTHREADS -C $CTEST_CONFIGURATION --timeout 5000 -T Test --no-compress-output
fi
# Convert to junit format
@@ -125,12 +146,7 @@ function clone_module {
mkdir -p $WORKSPACE/deps/$1
cd $WORKSPACE/deps/$1
git init .
if [ "$1" == "libecl" ]
then
git remote add origin https://github.com/Statoil/$1
else
git remote add origin https://github.com/OPM/$1
fi
git remote add origin https://github.com/OPM/$1
git fetch --depth 1 origin $2:branch_to_build
git checkout branch_to_build
git log HEAD -1 | cat
@@ -164,7 +180,7 @@ function build_upstreams {
do
echo "Building upstream $upstream=${upstreamRev[$upstream]} configuration=$configuration"
# Build upstream and execute installation
clone_and_build_module $upstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install" ${upstreamRev[$upstream]} $WORKSPACE/$configuration
clone_and_build_module $upstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install ${EXTRA_MODULE_FLAGS[$upstream]}" ${upstreamRev[$upstream]} $WORKSPACE/$configuration
test $? -eq 0 || exit 1
done
test $? -eq 0 || exit 1
@@ -179,7 +195,7 @@ function build_downstreams {
do
echo "Building downstream $downstream=${downstreamRev[$downstream]} configuration=$configuration"
# Build downstream and execute installation
clone_and_build_module $downstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT" ${downstreamRev[$downstream]} $WORKSPACE/$configuration 1
clone_and_build_module $downstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT ${EXTRA_MODULE_FLAGS[$downstream]}" ${downstreamRev[$downstream]} $WORKSPACE/$configuration 1
test $? -eq 0 || exit 1
# Installation for downstream
@@ -216,7 +232,7 @@ function build_module_full {
mkdir -p $configuration/build-$1
cd $configuration/build-$1
echo "Building main module $1=$sha1 configuration=$configuration"
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT" 1 $WORKSPACE
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT ${EXTRA_MODULE_FLAGS[$1]}" 1 $WORKSPACE
test $? -eq 0 || exit 1
cmake --build . --target install
test $? -eq 0 || exit 1

View File

@@ -6,17 +6,15 @@ source `dirname $0`/build-opm-module.sh
mkdir deps
ln -sf $WORKSPACE deps/opm-common
# No upstreams
declare -a upstreams
upstreams=(libecl)
declare -A upstreamRev
upstreamRev[libecl]=master
# Downstreams and revisions
declare -a downstreams
downstreams=(opm-material
opm-grid
ewoms
opm-models
opm-simulators
opm-upscaling
)
@@ -24,7 +22,7 @@ downstreams=(opm-material
declare -A downstreamRev
downstreamRev[opm-material]=master
downstreamRev[opm-grid]=master
downstreamRev[ewoms]=master
downstreamRev[opm-models]=master
downstreamRev[opm-simulators]=master
downstreamRev[opm-upscaling]=master

View File

@@ -9,7 +9,7 @@ upstreams=(libecl
opm-common
opm-material
opm-grid
ewoms
opm-models
opm-simulators
opm-upscaling
)
@@ -19,7 +19,7 @@ upstreamRev[libecl]=master
upstreamRev[opm-common]=master
upstreamRev[opm-material]=master
upstreamRev[opm-grid]=master
upstreamRev[ewoms]=master
upstreamRev[opm-models]=master
upstreamRev[opm-simulators]=master
upstreamRev[opm-upscaling]=master

View File

@@ -0,0 +1,51 @@
#ifndef ISIM_MAIN_HPP
#define ISIM_MAIN_HPP
#include <functional>
#include <string>
#include <map>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
namespace Opm {
class EclipseIO;
class ParseContext;
class Parser;
class SummaryState;
class msim {
public:
using well_rate_function = double(const EclipseState&, const Schedule&, const SummaryState& st, const data::Solution&, size_t report_step, double seconds_elapsed);
using solution_function = void(const EclipseState&, const Schedule&, data::Solution&, size_t report_step, double seconds_elapsed);
msim(const EclipseState& state);
void well_rate(const std::string& well, data::Rates::opt rate, std::function<well_rate_function> func);
void solution(const std::string& field, std::function<solution_function> func);
void run(Schedule& schedule, EclipseIO& io, bool report_only);
void post_step(Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step) const;
private:
void run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
void run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const;
void output(SummaryState& st, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const;
void simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const;
EclipseState state;
std::map<std::string, std::map<data::Rates::opt, std::function<well_rate_function>>> well_rates;
std::map<std::string, std::function<solution_function>> solutions;
};
}
#endif

161
msim/src/msim.cpp Normal file
View File

@@ -0,0 +1,161 @@
/*
Copyright 2018 Equinor ASA.
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 <iostream>
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/msim/msim.hpp>
namespace Opm {
msim::msim(const EclipseState& state_arg) :
state(state_arg)
{}
void msim::run(Schedule& schedule, EclipseIO& io, bool report_only) {
const double week = 7 * 86400;
data::Solution sol;
data::Wells well_data;
SummaryState st(std::chrono::system_clock::from_time_t(schedule.getStartTime()));
io.writeInitial();
for (size_t report_step = 1; report_step < schedule.size(); report_step++) {
if (report_only)
run_step(schedule, st, sol, well_data, report_step, io);
else {
double time_step = std::min(week, 0.5*schedule.stepLength(report_step - 1));
run_step(schedule, st, sol, well_data, report_step, time_step, io);
}
post_step(schedule, st, sol, well_data, report_step);
}
}
void msim::post_step(Schedule& schedule, const SummaryState& st, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step) const {
const auto& actions = schedule.actions(report_step);
if (actions.empty())
return;
Action::Context context( st );
auto sim_time = schedule.simTime(report_step);
for (const auto& action : actions.pending(sim_time)) {
auto result = action->eval(sim_time, context);
if (result)
schedule.applyAction(report_step, *action, result);
}
}
void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
this->run_step(schedule, st, sol, well_data, report_step, schedule.stepLength(report_step - 1), io);
}
void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const {
double start_time = schedule.seconds(report_step - 1);
double end_time = schedule.seconds(report_step);
double seconds_elapsed = start_time;
while (seconds_elapsed < end_time) {
double time_step = dt;
if ((seconds_elapsed + time_step) > end_time)
time_step = end_time - seconds_elapsed;
this->simulate(schedule, st, sol, well_data, report_step, seconds_elapsed, time_step);
seconds_elapsed += time_step;
io.summary().eval(st,
report_step,
seconds_elapsed,
this->state,
schedule,
well_data,
{});
this->output(st,
report_step,
(seconds_elapsed < end_time),
seconds_elapsed,
sol,
well_data,
io);
}
}
void msim::output(SummaryState& st, size_t report_step, bool /* substep */, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
RestartValue value(sol, well_data);
io.writeTimeStep(st,
report_step,
false,
seconds_elapsed,
value);
}
void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const {
for (const auto& sol_pair : this->solutions) {
auto func = sol_pair.second;
func(this->state, schedule, sol, report_step, seconds_elapsed + time_step);
}
for (const auto& well_pair : this->well_rates) {
const std::string& well_name = well_pair.first;
data::Well& well = well_data[well_name];
for (const auto& rate_pair : well_pair.second) {
auto rate = rate_pair.first;
auto func = rate_pair.second;
well.rates.set(rate, func(this->state, schedule, st, sol, report_step, seconds_elapsed + time_step));
}
// This is complete bogus; a temporary fix to pass an assert() in the
// the restart output.
well.connections.resize(100);
}
}
void msim::well_rate(const std::string& well, data::Rates::opt rate, std::function<well_rate_function> func) {
this->well_rates[well][rate] = func;
}
void msim::solution(const std::string& field, std::function<solution_function> func) {
this->solutions[field] = func;
}
}

View File

@@ -15,7 +15,6 @@ set (opm-common_DEPS
if(ENABLE_ECL_INPUT)
list(APPEND opm-common_DEPS
"ecl REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS system filesystem unit_test_framework regex REQUIRED")

View File

@@ -0,0 +1,68 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_TIMESERVICE_HEADER_INCLUDED
#define OPM_TIMESERVICE_HEADER_INCLUDED
#include <ctime>
namespace Opm {
class TimeStampUTC
{
public:
struct YMD {
int year{0};
int month{0};
int day{0};
};
TimeStampUTC() = default;
explicit TimeStampUTC(const std::time_t tp);
explicit TimeStampUTC(const YMD& ymd);
TimeStampUTC& operator=(const std::time_t tp);
TimeStampUTC& hour(const int h);
TimeStampUTC& minutes(const int m);
TimeStampUTC& seconds(const int s);
TimeStampUTC& microseconds(const int us);
int year() const { return this->ymd_.year; }
int month() const { return this->ymd_.month; }
int day() const { return this->ymd_.day; }
int hour() const { return this->hour_; }
int minutes() const { return this->minutes_; }
int seconds() const { return this->seconds_; }
int microseconds() const { return this->usec_; }
private:
YMD ymd_{};
int hour_{0};
int minutes_{0};
int seconds_{0};
int usec_{0};
};
std::time_t asTimeT(const TimeStampUTC& tp);
} // namespace Opm
#endif // OPM_TIMESERVICE_HEADER_INCLUDED

View File

@@ -16,9 +16,10 @@
*/
#include <vector>
#include <array>
#include <math.h>
double calculateCellVol(const std::vector<double>& X, const std::vector<double>& Y, const std::vector<double>& Z);
double calculateCellVol(const std::array<double,8>& X, const std::array<double,8>& Y, const std::array<double,8>& Z);

65
opm/io/eclipse/EGrid.hpp Normal file
View File

@@ -0,0 +1,65 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_EGRID_HPP
#define OPM_IO_EGRID_HPP
#include <opm/io/eclipse/EclFile.hpp>
#include <array>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <ctime>
#include <map>
namespace Opm { namespace EclIO {
class EGrid : public EclFile
{
public:
explicit EGrid(const std::string& filename);
int global_index(int i, int j, int k) const;
int active_index(int i, int j, int k) const;
const std::array<int, 3>& dimension() const { return nijk; }
std::array<int, 3> ijk_from_active_index(int actInd) const;
std::array<int, 3> ijk_from_global_index(int globInd) const;
void getCellCorners(int globindex, std::array<double,8>& X, std::array<double,8>& Y, std::array<double,8>& Z) const;
void getCellCorners(const std::array<int, 3>& ijk, std::array<double,8>& X, std::array<double,8>& Y, std::array<double,8>& Z) const;
int activeCells() const { return nactive; }
int totalNumberOfCells() const { return nijk[0] * nijk[1] * nijk[2]; }
private:
std::array<int, 3> nijk;
int nactive;
std::vector<int> act_index;
std::vector<int> glob_index;
std::vector<float> coord_array;
std::vector<float> zcorn_array;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_EGRID_HPP

84
opm/io/eclipse/ERft.hpp Normal file
View File

@@ -0,0 +1,84 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ERFT_HPP
#define OPM_IO_ERFT_HPP
#include <opm/io/eclipse/EclFile.hpp>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
namespace Opm { namespace EclIO {
class ERft : public EclFile
{
public:
explicit ERft(const std::string &filename);
using RftDate = std::tuple<int,int,int>;
template <typename T>
const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
const RftDate& date) const;
template <typename T>
const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
int year, int month, int day) const;
std::vector<std::string> listOfWells() const;
std::vector<RftDate> listOfdates() const;
using RftReportList = std::vector<std::pair<std::string, RftDate>>;
const RftReportList& listOfRftReports() const { return rftReportList; }
bool hasRft(const std::string& wellName, const RftDate& date) const;
bool hasRft(const std::string& wellName, int year, int month, int day) const;
std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
const RftDate& date) const;
std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
int year, int month, int day) const;
bool hasArray(const std::string& arrayName, const std::string& wellName,
const RftDate& date) const;
private:
std::map<int, std::pair<int,int>> arrIndexRange;
int numReports;
std::vector<float> timeList;
std::set<std::string> wellList;
std::set<RftDate> dateList;
RftReportList rftReportList;
std::map<std::pair<std::string,RftDate>,int> reportIndex; // mapping report index to wellName and date (tupe)
int getReportIndex(const std::string& wellName, const RftDate& date) const;
int getArrayIndex(const std::string& name, const std::string& wellName,
const RftDate& date) const;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_ERFT_HPP

70
opm/io/eclipse/ERst.hpp Normal file
View File

@@ -0,0 +1,70 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ERST_HPP
#define OPM_IO_ERST_HPP
#include <opm/io/eclipse/EclFile.hpp>
#include <ios>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm { namespace EclIO { namespace OutputStream {
class Restart;
}}}
namespace Opm { namespace EclIO {
class ERst : public EclFile
{
public:
explicit ERst(const std::string& filename);
bool hasReportStepNumber(int number) const;
void loadReportStepNumber(int number);
template <typename T>
const std::vector<T>& getRst(const std::string& name, int reportStepNumber);
const std::vector<int>& listOfReportStepNumbers() const { return seqnum; }
std::vector<EclEntry> listOfRstArrays(int reportStepNumber);
friend class OutputStream::Restart;
private:
int nReports;
std::vector<int> seqnum; // report step numbers, from SEQNUM array in restart file
std::unordered_map<int,bool> reportLoaded;
std::map<int, std::pair<int,int>> arrIndexRange; // mapping report step number to array indeces (start and end)
void initUnified();
void initSeparate(const int number);
int getArrayIndex(const std::string& name, int seqnum) const;
std::streampos
restartStepWritePosition(const int seqnumValue) const;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_ERST_HPP

70
opm/io/eclipse/ESmry.hpp Normal file
View File

@@ -0,0 +1,70 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ESMRY_HPP
#define OPM_IO_ESMRY_HPP
#include <string>
#include <vector>
#include <boost/filesystem.hpp>
namespace Opm { namespace EclIO {
class ESmry
{
public:
// input is smspec (or fsmspec file)
explicit ESmry(const std::string& filename, bool loadBaseRunData=false);
int numberOfVectors() const { return nVect; }
bool hasKey(const std::string& key) const;
const std::vector<float>& get(const std::string& name) const;
std::vector<float> get_at_rstep(const std::string& name) const;
const std::vector<std::string>& keywordList() const { return keyword; }
int timestepIdxAtReportstepStart(const int reportStep) const;
private:
int nVect, nI, nJ, nK;
void ijk_from_global_index(int glob, int &i, int &j, int &k) const;
std::vector<std::vector<float>> param;
std::vector<std::string> keyword;
std::vector<int> seqIndex;
std::vector<float> seqTime;
std::vector<std::string> checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const;
void getRstString(const std::vector<std::string>& restartArray,
boost::filesystem::path& pathRst,
boost::filesystem::path& rootN) const;
void updatePathAndRootName(boost::filesystem::path& dir, boost::filesystem::path& rootN) const;
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num) const;
};
}} // namespace Opm::EclIO
#endif // OPM_IO_ESMRY_HPP

116
opm/io/eclipse/EclFile.hpp Normal file
View File

@@ -0,0 +1,116 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ECLFILE_HPP
#define OPM_IO_ECLFILE_HPP
#include <opm/common/ErrorMacros.hpp>
#include <opm/io/eclipse/EclIOdata.hpp>
#include <ios>
#include <string>
#include <stdexcept>
#include <tuple>
#include <unordered_map>
#include <vector>
namespace Opm { namespace EclIO {
class EclFile
{
public:
explicit EclFile(const std::string& filename);
bool formattedInput() { return formatted; }
void loadData(); // load all data
void loadData(const std::string& arrName); // load all arrays with array name equal to arrName
void loadData(int arrIndex); // load data based on array indices in vector arrIndex
void loadData(const std::vector<int>& arrIndex); // load data based on array indices in vector arrIndex
void clearData()
{
inte_array.clear();
real_array.clear();
doub_array.clear();
logi_array.clear();
char_array.clear();
}
using EclEntry = std::tuple<std::string, eclArrType, int>;
std::vector<EclEntry> getList() const;
template <typename T>
const std::vector<T>& get(int arrIndex);
template <typename T>
const std::vector<T>& get(const std::string& name);
bool hasKey(const std::string &name) const;
const std::vector<std::string>& arrayNames() const { return array_name; }
protected:
bool formatted;
std::string inputFilename;
std::unordered_map<int, std::vector<int>> inte_array;
std::unordered_map<int, std::vector<bool>> logi_array;
std::unordered_map<int, std::vector<double>> doub_array;
std::unordered_map<int, std::vector<float>> real_array;
std::unordered_map<int, std::vector<std::string>> char_array;
std::vector<std::string> array_name;
std::vector<eclArrType> array_type;
std::vector<int> array_size;
std::vector<unsigned long int> ifStreamPos;
std::map<std::string, int> array_index;
template<class T>
const std::vector<T>& getImpl(int arrIndex, eclArrType type,
const std::unordered_map<int, std::vector<T>>& array,
const std::string& typeStr)
{
if (array_type[arrIndex] != type) {
std::string message = "Array with index " + std::to_string(arrIndex) + " is not of type " + typeStr;
OPM_THROW(std::runtime_error, message);
}
if (!arrayLoaded[arrIndex]) {
loadData(arrIndex);
}
return array.at(arrIndex);
}
std::streampos
seekPosition(const std::vector<std::string>::size_type arrIndex) const;
private:
std::vector<bool> arrayLoaded;
void loadBinaryArray(std::fstream& fileH, std::size_t arrIndex);
void loadFormattedArray(const std::string& fileStr, std::size_t arrIndex, long int fromPos);
};
}} // namespace Opm::EclIO
#endif // OPM_IO_ECLFILE_HPP

View File

@@ -0,0 +1,69 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ECLIODATA_HPP
#define OPM_IO_ECLIODATA_HPP
#include <tuple>
namespace Opm { namespace EclIO {
// type MESS have no assisiated data
enum eclArrType {
INTE, REAL, DOUB, CHAR, LOGI, MESS
};
// named constants related to binary file format
const unsigned int true_value = 0xffffffff;
const unsigned int false_value = 0x00000000;
const int sizeOfInte = 4; // number of bytes pr integer (inte) element
const int sizeOfReal = 4; // number of bytes pr float (real) element
const int sizeOfDoub = 8; // number of bytes pr double (doub) element
const int sizeOfLogi = 4; // number of bytes pr bool (logi) element
const int sizeOfChar = 8; // number of bytes pr string (char) element
const int MaxBlockSizeInte = 4000; // Maximum block size for INTE arrays in binary files
const int MaxBlockSizeReal = 4000; // Maximum block size for REAL arrays in binary files
const int MaxBlockSizeDoub = 8000; // Maximum block size for DOUB arrays in binary files
const int MaxBlockSizeLogi = 4000; // Maximum block size for LOGI arrays in binary files
const int MaxBlockSizeChar = 840; // Maximum block size for CHAR arrays in binary files
// named constants related to formatted file file format
const int MaxNumBlockInte = 1000; // maximum number of Inte values in block => hard line shift
const int MaxNumBlockReal = 1000; // maximum number of Real values in block => hard line shift
const int MaxNumBlockDoub = 1000; // maximum number of Doub values in block => hard line shift
const int MaxNumBlockLogi = 1000; // maximum number of Logi values in block => hard line shift
const int MaxNumBlockChar = 105; // maximum number of Char values in block => hard line shift
const int numColumnsInte = 6; // number of columns for Inte values
const int numColumnsReal = 4; // number of columns for Real values
const int numColumnsDoub = 3; // number of columns for Doub values
const int numColumnsLogi = 25; // number of columns for Logi values
const int numColumnsChar = 7; // number of columns for Char values
const int columnWidthInte = 12; // number of characters fore each Inte Element
const int columnWidthReal = 17; // number of characters fore each Inte Element
const int columnWidthDoub = 23; // number of characters fore each Inte Element
const int columnWidthLogi = 3; // number of characters fore each Inte Element
const int columnWidthChar = 11; // number of characters fore each Inte Element
}} // namespace Opm::EclIO
#endif // OPM_IO_ECLIODATA_HPP

View File

@@ -0,0 +1,116 @@
/*
Copyright 2019 Statoil ASA.
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/>.
*/
#ifndef OPM_IO_ECLOUTPUT_HPP
#define OPM_IO_ECLOUTPUT_HPP
#include <fstream>
#include <ios>
#include <string>
#include <typeinfo>
#include <vector>
#include <opm/io/eclipse/EclIOdata.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
namespace Opm { namespace EclIO { namespace OutputStream {
class Restart;
class SummarySpecification;
}}}
namespace Opm { namespace EclIO {
class EclOutput
{
public:
EclOutput(const std::string& filename,
const bool formatted,
const std::ios_base::openmode mode = std::ios::out);
template<typename T>
void write(const std::string& name,
const std::vector<T>& data)
{
eclArrType arrType = MESS;
if (typeid(T) == typeid(int))
arrType = INTE;
else if (typeid(T) == typeid(float))
arrType = REAL;
else if (typeid(T) == typeid(double))
arrType = DOUB;
else if (typeid(T) == typeid(bool))
arrType = LOGI;
else if (typeid(T) == typeid(char))
arrType = MESS;
if (isFormatted)
{
writeFormattedHeader(name, data.size(), arrType);
if (arrType != MESS)
writeFormattedArray(data);
}
else
{
writeBinaryHeader(name, data.size(), arrType);
if (arrType != MESS)
writeBinaryArray(data);
}
}
void message(const std::string& msg);
void flushStream();
friend class OutputStream::Restart;
friend class OutputStream::SummarySpecification;
private:
void writeBinaryHeader(const std::string& arrName, int size, eclArrType arrType);
template <typename T>
void writeBinaryArray(const std::vector<T>& data);
void writeBinaryCharArray(const std::vector<std::string>& data);
void writeBinaryCharArray(const std::vector<PaddedOutputString<8>>& data);
void writeFormattedHeader(const std::string& arrName, int size, eclArrType arrType);
template <typename T>
void writeFormattedArray(const std::vector<T>& data);
void writeFormattedCharArray(const std::vector<std::string>& data);
void writeFormattedCharArray(const std::vector<PaddedOutputString<8>>& data);
std::string make_real_string(float value) const;
std::string make_doub_string(double value) const;
bool isFormatted;
std::ofstream ofileH;
};
template<>
void EclOutput::write<std::string>(const std::string& name,
const std::vector<std::string>& data);
template <>
void EclOutput::write<PaddedOutputString<8>>
(const std::string& name,
const std::vector<PaddedOutputString<8>>& data);
}} // namespace Opm::EclIO
#endif // OPM_IO_ECLOUTPUT_HPP

View File

@@ -0,0 +1,40 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef OPM_IO_ECLUTIL_HPP
#define OPM_IO_ECLUTIL_HPP
#include <opm/io/eclipse/EclIOdata.hpp>
#include <string>
#include <tuple>
namespace Opm { namespace EclIO {
int flipEndianInt(int num);
float flipEndianFloat(float num);
double flipEndianDouble(double num);
std::tuple<int, int> block_size_data_binary(eclArrType arrType);
std::tuple<int, int, int> block_size_data_formatted(eclArrType arrType);
std::string trimr(const std::string &str1);
}} // namespace Opm::EclIO
#endif // OPM_IO_ECLUTIL_HPP

View File

@@ -0,0 +1,455 @@
/*
Copyright (c) 2019 Equinor ASA
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/>.
*/
#ifndef OPM_IO_OUTPUTSTREAM_HPP_INCLUDED
#define OPM_IO_OUTPUTSTREAM_HPP_INCLUDED
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <array>
#include <chrono>
#include <ios>
#include <memory>
#include <string>
#include <vector>
namespace Opm { namespace EclIO {
class EclOutput;
}} // namespace Opm::EclIO
namespace Opm { namespace EclIO { namespace OutputStream {
struct Formatted { bool set; };
struct Unified { bool set; };
/// Abstract representation of an ECLIPSE-style result set.
struct ResultSet
{
/// Output directory. Commonly "." or location of run's .DATA file.
std::string outputDir;
/// Base name of simulation run.
std::string baseName;
};
/// File manager for "init" output streams.
class Init
{
public:
/// Constructor.
///
/// Opens file stream for writing.
///
/// \param[in] rset Output directory and base name of output stream.
///
/// \param[in] fmt Whether or not to create formatted output files.
explicit Init(const ResultSet& rset,
const Formatted& fmt);
~Init();
Init(const Init& rhs) = delete;
Init(Init&& rhs);
Init& operator=(const Init& rhs) = delete;
Init& operator=(Init&& rhs);
/// Write integer data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<int>& data);
/// Write boolean data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<bool>& data);
/// Write single precision floating point data to underlying
/// output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<float>& data);
/// Write double precision floating point data to underlying
/// output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<double>& data);
private:
/// Init file output stream.
std::unique_ptr<EclOutput> stream_;
/// Open output stream.
///
/// Writes to \c stream_.
///
/// \param[in] fname Filename of new output stream.
///
/// \param[in] formatted Whether or not to create a
/// formatted output file.
void open(const std::string& fname,
const bool formatted);
/// Access writable output stream.
EclOutput& stream();
/// Implementation function for public \c write overload set.
template <typename T>
void writeImpl(const std::string& kw,
const std::vector<T>& data);
};
/// File manager for restart output streams.
class Restart
{
public:
/// Constructor.
///
/// Opens file stream pertaining to restart of particular report
/// step and also outputs a SEQNUM record in the case of a unified
/// output stream.
///
/// Must be called before accessing the stream object through the
/// stream() member function.
///
/// \param[in] rset Output directory and base name of output stream.
///
/// \param[in] seqnum Sequence number of new report. One-based
/// report step ID.
///
/// \param[in] fmt Whether or not to create formatted output files.
///
/// \param[in] unif Whether or not to create unified output files.
explicit Restart(const ResultSet& rset,
const int seqnum,
const Formatted& fmt,
const Unified& unif);
~Restart();
Restart(const Restart& rhs) = delete;
Restart(Restart&& rhs);
Restart& operator=(const Restart& rhs) = delete;
Restart& operator=(Restart&& rhs);
/// Generate a message string (keyword type 'MESS') in underlying
/// output stream.
///
/// \param[in] msg Message string (e.g., "STARTSOL").
void message(const std::string& msg);
/// Write integer data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<int>& data);
/// Write boolean data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<bool>& data);
/// Write single precision floating point data to underlying
/// output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<float>& data);
/// Write double precision floating point data to underlying
/// output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<double>& data);
/// Write unpadded string data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<std::string>& data);
/// Write padded character data (8 characters per string)
/// to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<PaddedOutputString<8>>& data);
private:
/// Restart output stream.
std::unique_ptr<EclOutput> stream_;
/// Open unified output file and place stream's output indicator
/// in appropriate location.
///
/// Writes to \c stream_.
///
/// \param[in] fname Filename of output stream.
///
/// \param[in] formatted Whether or not to create a
/// formatted output file.
///
/// \param[in] seqnum Sequence number of new report. One-based
/// report step ID.
void openUnified(const std::string& fname,
const bool formatted,
const int seqnum);
/// Open new output stream.
///
/// Handles the case of separate output files or unified output file
/// that does not already exist. Writes to \c stream_.
///
/// \param[in] fname Filename of new output stream.
///
/// \param[in] formatted Whether or not to create a
/// formatted output file.
void openNew(const std::string& fname,
const bool formatted);
/// Open existing output file and place stream's output indicator
/// in appropriate location.
///
/// Writes to \c stream_.
///
/// \param[in] fname Filename of output stream.
///
/// \param[in] writePos Position at which to place stream's output
/// indicator. Use \code streampos{ streamoff{-1} } \endcode to
/// place output indicator at end of file (i.e, simple append).
void openExisting(const std::string& fname,
const bool formatted,
const std::streampos writePos);
/// Access writable output stream.
///
/// Must not be called prior to \c prepareStep.
EclOutput& stream();
/// Implementation function for public \c write overload set.
template <typename T>
void writeImpl(const std::string& kw,
const std::vector<T>& data);
};
/// File manager for RFT output streams
class RFT
{
public:
struct OpenExisting { bool set; };
/// Constructor.
///
/// Opens file stream for writing.
///
/// \param[in] rset Output directory and base name of output stream.
///
/// \param[in] fmt Whether or not to create formatted output files.
///
/// \param[in] existing Whether or not to open an existing output file.
explicit RFT(const ResultSet& rset,
const Formatted& fmt,
const OpenExisting& existing);
~RFT();
RFT(const RFT& rhs) = delete;
RFT(RFT&& rhs);
RFT& operator=(const RFT& rhs) = delete;
RFT& operator=(RFT&& rhs);
/// Write integer data to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<int>& data);
/// Write single precision floating point data to underlying
/// output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<float>& data);
/// Write padded character data (8 characters per string)
/// to underlying output stream.
///
/// \param[in] kw Name of output vector (keyword).
///
/// \param[in] data Output values.
void write(const std::string& kw,
const std::vector<PaddedOutputString<8>>& data);
private:
/// Init file output stream.
std::unique_ptr<EclOutput> stream_;
/// Open output stream.
///
/// Writes to \c stream_.
///
/// \param[in] fname Filename of new output stream.
///
/// \param[in] formatted Whether or not to create a
/// formatted output file.
///
/// \param[in] existing Whether or not to open an
/// existing output file (mode ios_base::app).
void open(const std::string& fname,
const bool formatted,
const bool existing);
/// Access writable output stream.
EclOutput& stream();
/// Implementation function for public \c write overload set.
template <typename T>
void writeImpl(const std::string& kw,
const std::vector<T>& data);
};
class SummarySpecification
{
public:
using StartTime = std::chrono::system_clock::time_point;
enum class UnitConvention
{
Metric = 1,
Field = 2,
Lab = 3,
Pvt_M = 4,
};
struct RestartSpecification
{
std::string root;
int step;
};
class Parameters
{
public:
void add(const std::string& keyword,
const std::string& wgname,
const int num,
const std::string& unit);
friend class SummarySpecification;
private:
std::vector<PaddedOutputString<8>> keywords{};
std::vector<PaddedOutputString<8>> wgnames{};
std::vector<int> nums{};
std::vector<PaddedOutputString<8>> units{};
};
explicit SummarySpecification(const ResultSet& rset,
const Formatted& fmt,
const UnitConvention uconv,
const std::array<int,3>& cartDims,
const RestartSpecification& restart,
const StartTime start);
~SummarySpecification();
SummarySpecification(const SummarySpecification& rhs) = delete;
SummarySpecification(SummarySpecification&& rhs);
SummarySpecification& operator=(const SummarySpecification& rhs) = delete;
SummarySpecification& operator=(SummarySpecification&& rhs);
void write(const Parameters& params);
private:
int unit_;
int restartStep_;
std::array<int,3> cartDims_;
StartTime startDate_;
std::vector<PaddedOutputString<8>> restart_;
/// Summary specification (SMSPEC) file output stream.
std::unique_ptr<EclOutput> stream_;
void rewindStream();
void flushStream();
EclOutput& stream();
};
std::unique_ptr<EclOutput>
createSummaryFile(const ResultSet& rset,
const int seqnum,
const Formatted& fmt,
const Unified& unif);
/// Derive filename corresponding to output stream of particular result
/// set, with user-specified file extension.
///
/// Low-level string concatenation routine that does not know specific
/// relations between base names and file extensions. Handles details
/// of base name ending in a period (full stop) or having a name that
/// might otherwise appear to contain a file extension (e.g., CASE.01).
///
/// \param[in] rsetDescriptor Output directory and base name of result set.
///
/// \param[in] ext Filename extension.
///
/// \return outputDir/baseName.ext
std::string outputFileName(const ResultSet& rsetDescriptor,
const std::string& ext);
}}} // namespace Opm::EclIO::OutputStream
#endif // OPM_IO_OUTPUTSTREAM_HPP_INCLUDED

View File

@@ -17,8 +17,8 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_CHARARRAY_HEADER_HPP
#define OPM_CHARARRAY_HEADER_HPP
#ifndef OPM_PADDEDOUTPUTSTRING_HEADER_HPP
#define OPM_PADDEDOUTPUTSTRING_HEADER_HPP
#include <algorithm>
#include <array>
@@ -26,7 +26,7 @@
#include <cstddef>
#include <string>
namespace Opm { namespace RestartIO { namespace Helpers {
namespace Opm { namespace EclIO {
/// Null-terminated, left adjusted, space padded array of N characters.
///
@@ -36,30 +36,30 @@ namespace Opm { namespace RestartIO { namespace Helpers {
///
/// \tparam N Number of characters.
template <std::size_t N>
class CharArrayNullTerm
class PaddedOutputString
{
public:
CharArrayNullTerm()
PaddedOutputString()
{
this->clear();
}
explicit CharArrayNullTerm(const std::string& s)
: CharArrayNullTerm()
explicit PaddedOutputString(const std::string& s)
: PaddedOutputString()
{
this->copy_in(s.c_str(), s.size());
}
~CharArrayNullTerm() = default;
~PaddedOutputString() = default;
CharArrayNullTerm(const CharArrayNullTerm& rhs) = default;
CharArrayNullTerm(CharArrayNullTerm&& rhs) = default;
PaddedOutputString(const PaddedOutputString& rhs) = default;
PaddedOutputString(PaddedOutputString&& rhs) = default;
CharArrayNullTerm& operator=(const CharArrayNullTerm& rhs) = default;
CharArrayNullTerm& operator=(CharArrayNullTerm&& rhs) = default;
PaddedOutputString& operator=(const PaddedOutputString& rhs) = default;
PaddedOutputString& operator=(PaddedOutputString&& rhs) = default;
/// Assign from \code std::string \endcode.
CharArrayNullTerm& operator=(const std::string& s)
PaddedOutputString& operator=(const std::string& s)
{
this->clear();
this->copy_in(s.data(), s.size());
@@ -99,5 +99,5 @@ namespace Opm { namespace RestartIO { namespace Helpers {
}
};
}}} // Opm::RestartIO::Helpers
#endif // CHARARRAY_HEADER
}} // Opm::EclIO
#endif // OPM_PADDEDOUTPUTSTRING_HEADER_HPP

View File

@@ -20,12 +20,14 @@
#ifndef OPM_OUTPUT_WELLS_HPP
#define OPM_OUTPUT_WELLS_HPP
#include <algorithm>
#include <cstddef>
#include <initializer_list>
#include <map>
#include <algorithm>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
namespace Opm {
@@ -56,6 +58,12 @@ namespace Opm {
reservoir_water = (1 << 8),
reservoir_oil = (1 << 9),
reservoir_gas = (1 << 10),
productivity_index_water = (1 << 11),
productivity_index_oil = (1 << 12),
productivity_index_gas = (1 << 13),
well_potential_water = (1 << 14),
well_potential_oil = (1 << 15),
well_potential_gas = (1 << 16),
};
using enum_size = std::underlying_type< opt >::type;
@@ -99,6 +107,12 @@ namespace Opm {
double reservoir_water = 0.0;
double reservoir_oil = 0.0;
double reservoir_gas = 0.0;
double productivity_index_water = 0.0;
double productivity_index_oil = 0.0;
double productivity_index_gas = 0.0;
double well_potential_water = 0.0;
double well_potential_oil = 0.0;
double well_potential_gas = 0.0;
};
struct Connection {
@@ -120,6 +134,18 @@ namespace Opm {
void read(MessageBufferType& buffer);
};
struct Segment {
Rates rates;
double pressure;
std::size_t segNumber;
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
template <class MessageBufferType>
void read(MessageBufferType& buffer);
};
struct Well {
Rates rates;
double bhp;
@@ -127,7 +153,7 @@ namespace Opm {
double temperature;
int control;
std::vector< Connection > connections;
std::unordered_map<std::size_t, Segment> segments;
inline bool flowing() const noexcept;
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
@@ -249,6 +275,12 @@ namespace Opm {
case opt::reservoir_water: return this->reservoir_water;
case opt::reservoir_oil: return this->reservoir_oil;
case opt::reservoir_gas: return this->reservoir_gas;
case opt::productivity_index_water: return this->productivity_index_water;
case opt::productivity_index_oil: return this->productivity_index_oil;
case opt::productivity_index_gas: return this->productivity_index_gas;
case opt::well_potential_water: return this->well_potential_water;
case opt::well_potential_oil: return this->well_potential_oil;
case opt::well_potential_gas: return this->well_potential_gas;
}
throw std::invalid_argument(
@@ -286,6 +318,12 @@ namespace Opm {
buffer.write(this->reservoir_water);
buffer.write(this->reservoir_oil);
buffer.write(this->reservoir_gas);
buffer.write(this->productivity_index_water);
buffer.write(this->productivity_index_oil);
buffer.write(this->productivity_index_gas);
buffer.write(this->well_potential_water);
buffer.write(this->well_potential_oil);
buffer.write(this->well_potential_gas);
}
template <class MessageBufferType>
@@ -300,6 +338,13 @@ namespace Opm {
buffer.write(this->effective_Kh);
}
template <class MessageBufferType>
void Segment::write(MessageBufferType& buffer) const {
buffer.write(this->segNumber);
this->rates.write(buffer);
buffer.write(this->pressure);
}
template <class MessageBufferType>
void Well::write(MessageBufferType& buffer) const {
this->rates.write(buffer);
@@ -311,6 +356,16 @@ namespace Opm {
buffer.write(size);
for (const Connection& comp : this->connections)
comp.write(buffer);
{
const auto nSeg =
static_cast<unsigned int>(this->segments.size());
buffer.write(nSeg);
for (const auto& seg : this->segments) {
seg.second.write(buffer);
}
}
}
template <class MessageBufferType>
@@ -327,6 +382,12 @@ namespace Opm {
buffer.read(this->reservoir_water);
buffer.read(this->reservoir_oil);
buffer.read(this->reservoir_gas);
buffer.read(this->productivity_index_water);
buffer.read(this->productivity_index_oil);
buffer.read(this->productivity_index_gas);
buffer.read(this->well_potential_water);
buffer.read(this->well_potential_oil);
buffer.read(this->well_potential_gas);
}
template <class MessageBufferType>
@@ -341,6 +402,13 @@ namespace Opm {
buffer.read(this->effective_Kh);
}
template <class MessageBufferType>
void Segment::read(MessageBufferType& buffer) {
buffer.read(this->segNumber);
this->rates.read(buffer);
buffer.read(this->pressure);
}
template <class MessageBufferType>
void Well::read(MessageBufferType& buffer) {
this->rates.read(buffer);
@@ -348,6 +416,8 @@ namespace Opm {
buffer.read(this->thp);
buffer.read(this->temperature);
buffer.read(this->control);
// Connection information
unsigned int size = 0.0; //this->connections.size();
buffer.read(size);
this->connections.resize(size);
@@ -356,9 +426,25 @@ namespace Opm {
auto& comp = this->connections[ i ];
comp.read(buffer);
}
// Segment information (if applicable)
const auto nSeg = [&buffer]() -> unsigned int
{
auto n = 0u;
buffer.read(n);
return n;
}();
for (auto segID = 0*nSeg; segID < nSeg; ++segID) {
auto seg = Segment{};
seg.read(buffer);
const auto segNumber = seg.segNumber;
this->segments.emplace(segNumber, std::move(seg));
}
}
}
}
}} // Opm::data
#endif //OPM_OUTPUT_WELLS_HPP

View File

@@ -20,140 +20,135 @@
#ifndef OPM_AGGREGATE_GROUP_DATA_HPP
#define OPM_AGGREGATE_GROUP_DATA_HPP
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <map>
namespace Opm {
class Schedule;
class SummaryState;
class Group;
class Schedule;
class SummaryState;
class Group2;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
class groupMaps {
public:
const std::map <size_t, const Opm::Group*>& indexGroupMap() const;
const std::map <const std::string, size_t>& groupNameIndexMap() const;
class AggregateGroupData
{
public:
explicit AggregateGroupData(const std::vector<int>& inteHead);
void currentGrpTreeNameSeqIndMap(const Opm::Schedule& sched,
const size_t simStep,
const std::map<const std::string , size_t>& GnIMap,
const std::map<size_t, const Opm::Group*>& IGMap);
void captureDeclaredGroupData(const Opm::Schedule& sched,
const std::size_t simStep,
const Opm::SummaryState& sumState,
const std::vector<int>& inteHead);
private:
std::map <size_t, const Opm::Group*> m_indexGroupMap;
std::map <const std::string, size_t> m_groupNameIndexMap;
};
class AggregateGroupData
const std::vector<int>& getIGroup() const
{
public:
explicit AggregateGroupData(const std::vector<int>& inteHead);
return this->iGroup_.data();
}
void captureDeclaredGroupData(const Opm::Schedule& sched,
const std::vector<std::string>& restart_group_keys,
const std::vector<std::string>& restart_field_keys,
const std::map<std::string, size_t>& groupKeyToIndex,
const std::map<std::string, size_t>& fieldKeyToIndex,
const bool ecl_compatible_rst,
const std::size_t simStep,
const Opm::SummaryState& sumState,
const std::vector<int>& inteHead);
const std::vector<float>& getSGroup() const
{
return this->sGroup_.data();
}
const std::vector<int>& getIGroup() const
{
return this->iGroup_.data();
}
const std::vector<double>& getXGroup() const
{
return this->xGroup_.data();
}
const std::vector<float>& getSGroup() const
{
return this->sGroup_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZGroup() const
{
return this->zGroup_.data();
}
const std::vector<double>& getXGroup() const
{
return this->xGroup_.data();
}
const std::vector<std::string> restart_group_keys = {"GOPP", "GWPP", "GOPR", "GWPR", "GGPR",
"GVPR", "GWIR", "GGIR", "GWCT", "GGOR",
"GOPT", "GWPT", "GGPT", "GVPT", "GWIT",
"GGIT",
"GOPTH", "GWPTH", "GGPTH",
"GWITH", "GGITH"};
const std::vector<CharArrayNullTerm<8>>& getZGroup() const
{
return this->zGroup_.data();
}
const std::vector<std::string> restart_field_keys = {"FOPP", "FWPP", "FOPR", "FWPR", "FGPR",
"FVPR", "FWIR", "FGIR", "FWCT", "FGOR",
"FOPT", "FWPT", "FGPT", "FVPT", "FWIT",
"FGIT",
"FOPTH", "FWPTH", "FGPTH",
"FWITH", "FGITH"};
const std::vector<std::string> restart_group_keys = {"GOPP", "GWPP", "GOPR", "GWPR", "GGPR",
"GVPR", "GWIR", "GGIR", "GWCT", "GGOR",
"GOPT", "GWPT", "GGPT", "GVPT", "GWIT",
"GGIT"};
const std::vector<std::string> restart_field_keys = {"FOPP", "FWPP", "FOPR", "FWPR", "FGPR",
"FVPR", "FWIR", "FGIR", "FWCT", "FGOR",
"FOPT", "FWPT", "FGPT", "FVPT", "FWIT",
"FGIT"};
const std::map<std::string, size_t> groupKeyToIndex = {
{"GOPR", 0},
{"GWPR", 1},
{"GGPR", 2},
{"GVPR", 3},
{"GWIR", 5},
{"GGIR", 6},
{"GWCT", 8},
{"GGOR", 9},
{"GOPT", 10},
{"GWPT", 11},
{"GGPT", 12},
{"GVPT", 13},
{"GWIT", 15},
{"GGIT", 16},
{"GOPP", 22},
{"GWPP", 23},
};
const std::map<std::string, size_t> fieldKeyToIndex = {
{"FOPR", 0},
{"FWPR", 1},
{"FGPR", 2},
{"FVPR", 3},
{"FWIR", 5},
{"FGIR", 6},
{"FWCT", 8},
{"FGOR", 9},
{"FOPT", 10},
{"FWPT", 11},
{"FGPT", 12},
{"FVPT", 13},
{"FWIT", 15},
{"FGIT", 16},
{"FOPP", 22},
{"FWPP", 23},
};
private:
/// Aggregate 'IWEL' array (Integer) for all wells.
WindowedArray<int> iGroup_;
/// Aggregate 'SWEL' array (Real) for all wells.
WindowedArray<float> sGroup_;
/// Aggregate 'XWEL' array (Double Precision) for all wells.
WindowedArray<double> xGroup_;
/// Aggregate 'ZWEL' array (Character) for all wells.
WindowedArray<CharArrayNullTerm<8>> zGroup_;
/// Maximum number of wells in a group.
int nWGMax_;
/// Maximum number of groups
int nGMaxz_;
const std::map<std::string, size_t> groupKeyToIndex = {
{"GOPR", 0},
{"GWPR", 1},
{"GGPR", 2},
{"GVPR", 3},
{"GWIR", 5},
{"GGIR", 6},
{"GWCT", 8},
{"GGOR", 9},
{"GOPT", 10},
{"GWPT", 11},
{"GGPT", 12},
{"GVPT", 13},
{"GWIT", 15},
{"GGIT", 16},
{"GOPP", 22},
{"GWPP", 23},
{"GOPTH", 135},
{"GWPTH", 139},
{"GWITH", 140},
{"GGPTH", 143},
{"GGITH", 144},
};
const std::map<std::string, size_t> fieldKeyToIndex = {
{"FOPR", 0},
{"FWPR", 1},
{"FGPR", 2},
{"FVPR", 3},
{"FWIR", 5},
{"FGIR", 6},
{"FWCT", 8},
{"FGOR", 9},
{"FOPT", 10},
{"FWPT", 11},
{"FGPT", 12},
{"FVPT", 13},
{"FWIT", 15},
{"FGIT", 16},
{"FOPP", 22},
{"FWPP", 23},
{"FOPTH", 135},
{"FWPTH", 139},
{"FWITH", 140},
{"FGPTH", 143},
{"FGITH", 144},
};
private:
/// Aggregate 'IWEL' array (Integer) for all wells.
WindowedArray<int> iGroup_;
/// Aggregate 'SWEL' array (Real) for all wells.
WindowedArray<float> sGroup_;
/// Aggregate 'XWEL' array (Double Precision) for all wells.
WindowedArray<double> xGroup_;
/// Aggregate 'ZWEL' array (Character) for all wells.
WindowedArray<EclIO::PaddedOutputString<8>> zGroup_;
/// Maximum number of wells in a group.
int nWGMax_;
/// Maximum number of groups
int nGMaxz_;
};
}}} // Opm::RestartIO::Helpers
#endif // OPM_AGGREGATE_WELL_DATA_HPP

View File

@@ -21,9 +21,6 @@
#define OPM_AGGREGATE_MSW_DATA_HPP
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
#include <string>
@@ -47,6 +44,18 @@ namespace Opm { namespace RestartIO { namespace Helpers {
int branch;
};
struct SegmentSetSourceSinkTerms {
std::vector<double> qosc;
std::vector<double> qwsc;
std::vector<double> qgsc;
};
struct SegmentSetFlowRates {
std::vector<double> sofr;
std::vector<double> swfr;
std::vector<double> sgfr;
};
class AggregateMSWData
{
public:
@@ -57,7 +66,8 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const Opm::UnitSystem& units,
const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid,
const ::Opm::SummaryState& smry
const Opm::SummaryState& smry,
const Opm::data::WellRates& wr
);
/// Retrieve Integer Multisegment well data Array.

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2018 Statoil ASA
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/>.
*/
#ifndef OPM_AGGREGATE_UDQ_DATA_HPP
#define OPM_AGGREGATE_UDQ_DATA_HPP
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <map>
namespace Opm {
class Schedule;
class UDQInput;
class UDQActive;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
class igphData {
public:
const std::vector<int> ig_phase(const Opm::Schedule& sched, const std::size_t simStep, const std::vector<int>& inteHead);
};
class AggregateUDQData
{
public:
explicit AggregateUDQData(const std::vector<int>& udqDims);
void captureDeclaredUDQData(const Opm::Schedule& sched,
const std::size_t simStep,
const Opm::SummaryState& st,
const std::vector<int>& inteHead);
const std::vector<int>& getIUDQ() const
{
return this->iUDQ_.data();
}
const std::vector<int>& getIUAD() const
{
return this->iUAD_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZUDN() const
{
return this->zUDN_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZUDL() const
{
return this->zUDL_.data();
}
const std::vector<int>& getIGPH() const
{
return this->iGPH_.data();
}
const std::vector<int>& getIUAP() const
{
return this->iUAP_.data();
}
const std::vector<double>& getDUDW() const
{
return this->dUDW_.data();
}
const std::vector<double>& getDUDG() const
{
return this->dUDG_.data();
}
const std::vector<double>& getDUDF() const
{
return this->dUDF_.data();
}
private:
/// Aggregate 'IUDQ' array (Integer) for all UDQ data (3 integers pr UDQ)
WindowedArray<int> iUDQ_;
/// Aggregate 'IUAD' array (Integer) for all UDQ data (5 integers pr UDQ that is used for various well and group controls)
WindowedArray<int> iUAD_;
/// Aggregate 'ZUDN' array (Character) for all UDQ data. (2 * 8 chars pr UDQ -> UNIT keyword)
WindowedArray<EclIO::PaddedOutputString<8>> zUDN_;
/// Aggregate 'ZUDL' array (Character) for all UDQ data. (16 * 8 chars pr UDQ DEFINE "Data for operation - Msth Expression)
WindowedArray<EclIO::PaddedOutputString<8>> zUDL_;
/// Aggregate 'IGPH' array (Integer) for all UDQ data (3 - zeroes - as of current understanding)
WindowedArray<int> iGPH_;
/// Aggregate 'IUAP' array (ICharArrayNullTermnteger) for all UDQ data (1 integer pr UDQ constraint used)
WindowedArray<int> iUAP_;
/// Aggregate 'DUDW' array (Double Precision) for all UDQ data. (Dimension = max no wells * noOfUDQ's)
WindowedArray<double> dUDW_;
/// Aggregate 'DUDG' array (Double Precision) for all UDQ data. (Dimension = (max no groups + 1) * noOfUDQ's)
WindowedArray<double> dUDG_;
/// Aggregate 'DUDF' array (Double Precision) for all UDQ data. (Dimension = Number of FU - UDQ's, with value equal to the actual constraint)
WindowedArray<double> dUDF_;
};
}}} // Opm::RestartIO::Helpers
#endif //OPM_AGGREGATE_WELL_DATA_HPP

View File

@@ -20,9 +20,10 @@
#ifndef OPM_AGGREGATE_WELL_DATA_HPP
#define OPM_AGGREGATE_WELL_DATA_HPP
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <cstddef>
#include <string>
#include <vector>
@@ -52,7 +53,6 @@ namespace Opm { namespace RestartIO { namespace Helpers {
void captureDynamicWellData(const Opm::Schedule& sched,
const std::size_t sim_step,
const bool ecl_compatible_rst,
const Opm::data::WellRates& xw,
const Opm::SummaryState& smry);
@@ -75,7 +75,7 @@ namespace Opm { namespace RestartIO { namespace Helpers {
}
/// Retrieve Character Well Data Array.
const std::vector<CharArrayNullTerm<8>>& getZWell() const
const std::vector<EclIO::PaddedOutputString<8>>& getZWell() const
{
return this->zWell_.data();
}
@@ -93,7 +93,7 @@ namespace Opm { namespace RestartIO { namespace Helpers {
WindowedArray<double> xWell_;
/// Aggregate 'ZWEL' array (Character) for all wells.
WindowedArray<CharArrayNullTerm<8>> zWell_;
WindowedArray<EclIO::PaddedOutputString<8>> zWell_;
/// Maximum number of groups in model.
int nWGMax_;

View File

@@ -27,6 +27,7 @@
namespace Opm {
class Tuning;
class Schedule;
class UDQParams;
}
namespace Opm { namespace RestartIO {
@@ -38,7 +39,7 @@ namespace Opm { namespace RestartIO {
std::chrono::time_point<std::chrono::system_clock> start;
std::chrono::duration<double, std::chrono::seconds::period> elapsed;
};
DoubHEAD();
~DoubHEAD() = default;
@@ -53,9 +54,13 @@ namespace Opm { namespace RestartIO {
const double cnvT);
DoubHEAD& timeStamp(const TimeStamp& ts);
DoubHEAD& nextStep(const double nextTimeStep);
DoubHEAD& drsdt(const Schedule& sched,
const std::size_t lookup_step);
const std::size_t lookup_step,
const double cnvT);
DoubHEAD& udq_param(const UDQParams& udqPar);
const std::vector<double>& data() const
{

View File

@@ -23,10 +23,9 @@
#define OPM_ECLIPSE_WRITER_HPP
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
@@ -35,13 +34,17 @@
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
namespace Opm { namespace out {
class Summary;
}} // namespace Opm::out
namespace Opm {
class EclipseState;
class SummaryConfig;
class Schedule;
class SummaryConfig;
class SummaryState;
/*!
* \brief A class to write the reservoir state and the well state of a
@@ -171,13 +174,11 @@ public:
* hardcoded static map misc_units in Summary.cpp.
*/
void writeTimeStep( int report_step,
void writeTimeStep( const SummaryState& st,
int report_step,
bool isSubstep,
double seconds_elapsed,
RestartValue value,
const std::map<std::string, double>& single_summary_values,
const std::map<std::string, std::vector<double>>& region_summary_values,
const std::map<std::pair<std::string, int>, double>& block_summary_values,
const bool write_double = false);
@@ -219,8 +220,8 @@ public:
missing, if the bool is false missing keywords will be ignored
(there will *not* be an empty vector in the return value).
*/
RestartValue loadRestart(const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
RestartValue loadRestart(SummaryState& summary_state, const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
const out::Summary& summary();
EclipseIO( const EclipseIO& ) = delete;
~EclipseIO();

View File

@@ -39,6 +39,7 @@ namespace Opm { namespace RestartIO {
int maxPerf;
int maxWellInGroup;
int maxGroupInField;
int maxWellsInField;
};
struct WellSegDims {
@@ -89,6 +90,10 @@ namespace Opm { namespace RestartIO {
struct Group {
int ngroups;
};
struct UdqParam {
int udqParam_1;
};
InteHEAD();
~InteHEAD() = default;
@@ -117,6 +122,7 @@ namespace Opm { namespace RestartIO {
InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
InteHEAD& regionDimensions(const RegDims& rdim);
InteHEAD& ngroups(const Group& gr);
InteHEAD& udqParam_1(const UdqParam& udqpar);
const std::vector<int>& data() const
{

View File

@@ -1,4 +1,5 @@
/*
Copyright 2019 Equinor.
Copyright 2017 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
@@ -35,6 +36,8 @@ namespace Opm {
public:
/// Constructor.
///
/// Padded table entries set to +1.0e+20.
///
/// \param[in] numTables Number of tables managed by internal
/// buffer. Typically corresponds to maximum value of a region
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
@@ -57,6 +60,33 @@ namespace Opm {
const std::size_t numRows,
const std::size_t numCols);
/// Constructor.
///
/// \param[in] numTables Number of tables managed by internal
/// buffer. Typically corresponds to maximum value of a region
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
///
/// \param[in] numPrimary Number of primary look-up keys for the
/// tabular data managed by the internal buffer. Mostly relevant
/// (i.e., greater than one) for miscible oil ("PVTO") or
/// miscible gas ("PVTG") tables and typically corresponds to the
/// number of Rs/Rv entries from the TABDIMS keyword.
///
/// \param[in] numRows Number of rows in each sub-table
/// corresponding to a single primary look-up key. Typically the
/// number of nodes (e.g., NSSFUN or NPPVT) of the corresponding
/// input keyword.
///
/// \param[in] numCols Number of columns in each sub-table (and main
/// table). Typically 5.
///
/// \param[in] fillValue Data element value for padded table entries.
LinearisedOutputTable(const std::size_t numTables,
const std::size_t numPrimary,
const std::size_t numRows,
const std::size_t numCols,
const double fillValue);
/// Retrieve iterator to start of \c numRows (contiguous) column
/// elements of a particular sub-table of a particular main table.
///

View File

@@ -1,4 +1,5 @@
/*
Copyright 2019 Equinor ASA.
Copyright 2016, 2017 Statoil ASA.
This file is part of the Open Porous Media Project (OPM).
@@ -27,6 +28,49 @@ namespace Opm { namespace RestartIO {
class LogiHEAD
{
public:
/// Key characteristics of simulation run's PVT model.
struct PVTModel
{
/// Whether or not simulation run uses a live oil model (with
/// dissolved gas).
bool isLiveOil { false };
/// Whether or not simulation run uses a wet gas model (with
/// vaporised oil).
bool isWetGas { false };
/// Whether or not simulation run uses a constant
/// compressibility oil model (keyword PVCDO).
bool constComprOil { false };
};
/// Key characteristics of simulation model's saturation functions.
struct SatfuncFlags
{
/// Whether or not simulation run uses directionally dependent
/// relative permeability.
bool useDirectionalRelPerm { false };
/// Whether or not simulation run uses reversible relative
/// permeability functions.
bool useReversibleRelPerm { true };
/// Whether or not simulation run uses end-point scaling.
bool useEndScale { false };
/// Whether or not simulation run uses directionally dependent
/// end-point scaling.
bool useDirectionalEPS { false };
/// Whether or not simulation run uses reversible end-point
/// scaling.
bool useReversibleEPS { true };
/// Whether or not simulation run activates the alternative
/// (three-point) end-point scaling feature.
bool useAlternateEPS { false };
};
LogiHEAD();
~LogiHEAD() = default;
@@ -38,7 +82,24 @@ namespace Opm { namespace RestartIO {
LogiHEAD& variousParam(const bool e300_radial,
const bool e100_radial,
const int nswlmx);
const int nswlmx,
const bool enableHyster
);
/// Assign PVT model characteristics.
///
/// \param[in] pvt Current run's PVT model characteristics.
///
/// \return \code *this \endcode.
LogiHEAD& pvtModel(const PVTModel& pvt);
/// Assign saturation function characteristics.
///
/// \param[in] satfunc Current run's saturation function
/// characteristics.
///
/// \return \code *this \endcode.
LogiHEAD& saturationFunction(const SatfuncFlags& satfunc);
const std::vector<bool>& data() const
{

View File

@@ -1,4 +1,5 @@
/*
Copyright (c) 2018 Equinor ASA
Copyright (c) 2016 Statoil ASA
Copyright (c) 2013-2015 Andreas Lauser
Copyright (c) 2013 SINTEF ICT, Applied Mathematics.
@@ -23,36 +24,30 @@
#ifndef RESTART_IO_HPP
#define RESTART_IO_HPP
#include <vector>
#include <map>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/output/data/Cells.hpp>
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/RestartValue.hpp>
#include <ert/ecl/EclKW.hpp>
#include <ert/ecl/ecl_rsthead.h>
#include <ert/ecl/ecl_rst_file.h>
#include <ert/util/util.h>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <string>
#include <utility>
#include <vector>
namespace Opm {
class EclipseGrid;
class EclipseState;
class Phases;
class Schedule;
class SummaryState;
class EclipseGrid;
class EclipseState;
class Schedule;
namespace RestartIO {
} // namespace Opm
namespace Opm { namespace EclIO { namespace OutputStream {
class Restart;
}}}
/*
The two loose functions RestartIO::save() and RestartIO::load() can
The two free functions RestartIO::save() and RestartIO::load() can
be used to save and load reservoir and well state from restart
files. Observe that these functions 'just do it', i.e. the checking
of which report step to load from, if output is enabled at all and
@@ -69,39 +64,31 @@ namespace RestartIO {
load("CASE.X0010" , 99 , ...)
save("CASE.X0010" , 99 , ...)
will read and write to the file "CASE.X0010" - completely ignoring
will read from and write to the file "CASE.X0010" - completely ignoring
the report step argument '99'.
*/
namespace Opm { namespace RestartIO {
/*void save(const std::string& filename,
int report_step,
double seconds_elapsed,
data::Solution cells,
data::Wells wells,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
std::map<std::string, std::vector<double>> extra_data = {},
bool write_double = false);
*/
void save(const std::string& filename,
int report_step,
double seconds_elapsed,
RestartValue value,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
const SummaryState& sumState,
bool write_double = false);
void save(EclIO::OutputStream::Restart& rstFile,
int report_step,
double seconds_elapsed,
RestartValue value,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
const SummaryState& sumState,
bool write_double = false);
RestartValue load( const std::string& filename,
int report_step,
const std::vector<RestartKey>& solution_keys,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
const std::vector<RestartKey>& extra_keys = {});
}
}
#endif
RestartValue load(const std::string& filename,
int report_step,
SummaryState& summary_state,
const std::vector<RestartKey>& solution_keys,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
const std::vector<RestartKey>& extra_keys = {});
}} // namespace Opm::RestartIO
#endif // RESTART_IO_HPP

View File

@@ -34,7 +34,9 @@ namespace Opm {
std::string key;
UnitSystem::measure dim;
bool required;
bool required = false;
RestartKey() = default;
RestartKey( const std::string& _key, UnitSystem::measure _dim)
: key(_key),

View File

@@ -20,61 +20,59 @@
#ifndef OPM_OUTPUT_SUMMARY_HPP
#define OPM_OUTPUT_SUMMARY_HPP
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <ert/ecl/ecl_sum.h>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/RegionCache.hpp>
namespace Opm {
class EclipseGrid;
class EclipseState;
class Schedule;
class SummaryConfig;
class EclipseGrid;
class Schedule;
class SummaryState;
} // namespace Opm
namespace out {
namespace Opm { namespace data {
class WellRates;
}} // namespace Opm::data
namespace Opm { namespace out {
class Summary {
public:
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule& );
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const std::string& );
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const char* basename );
public:
using GlobalProcessParameters = std::map<std::string, double>;
using RegionParameters = std::map<std::string, std::vector<double>>;
using BlockValues = std::map<std::pair<std::string, int>, double>;
void add_timestep(int report_step,
double secs_elapsed,
const EclipseState& es,
const Schedule& schedule,
const data::Wells&,
const std::map<std::string, double>& single_values,
const std::map<std::string, std::vector<double>>& region_values = {},
const std::map<std::pair<std::string, int>, double>& block_values = {});
Summary(const EclipseState& es,
const SummaryConfig& sumcfg,
const EclipseGrid& grid,
const Schedule& sched,
const std::string& basename = "");
void write();
~Summary();
~Summary();
void add_timestep(const SummaryState& st, const int report_step);
const SummaryState& get_restart_vectors() const;
void eval(SummaryState& summary_state,
const int report_step,
const double secs_elapsed,
const EclipseState& es,
const Schedule& schedule,
const data::WellRates& well_solution,
const GlobalProcessParameters& single_values,
const RegionParameters& region_values = {},
const BlockValues& block_values = {}) const;
private:
class keyword_handlers;
void write() const;
const EclipseGrid& grid;
out::RegionCache regionCache;
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
std::unique_ptr< keyword_handlers > handlers;
double prev_time_elapsed = 0;
SummaryState prev_state;
private:
class SummaryImplementation;
std::unique_ptr<SummaryImplementation> pImpl_;
};
}
}
}} // namespace Opm::out
#endif //OPM_OUTPUT_SUMMARY_HPP

View File

@@ -1,50 +0,0 @@
/*
Copyright 2016 Statoil ASA.
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/>.
*/
#ifndef SUMMARY_STATE_H
#define SUMMARY_STATE_H
#include <string>
#include <unordered_map>
namespace Opm{
/*
The purpose of this class is to serve as a small container object for
computed, ready to use summary values. The values will typically be used by
the UDQ, WTEST and ACTIONX calculations. Observe that all value *have been
converted to the correct output units*.
*/
class SummaryState {
public:
typedef std::unordered_map<std::string, double>::const_iterator const_iterator;
void add(const std::string& key, double value);
double get(const std::string&) const;
bool has(const std::string& key) const;
const_iterator begin() const;
const_iterator end() const;
private:
std::unordered_map<std::string,double> values;
};
}
#endif

View File

@@ -1,4 +1,6 @@
/*
Copyright 2019 Equinor.
Copyright 2017 Statoil ASA.
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
@@ -22,11 +24,6 @@
#include <vector>
#include <ert/ecl/FortIO.hpp>
#include <ert/ecl/EclKW.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
namespace Opm {
@@ -37,11 +34,17 @@ namespace Opm {
public:
explicit Tables( const UnitSystem& units);
void addPVTO(const std::vector<PvtoTable>& pvtoTables);
void addPVTG(const std::vector<PvtgTable>& pvtgTables);
void addPVTW(const PvtwTable& pvtwTable);
void addDensity(const DensityTable& density);
/// Add normalised PVT function tables to INIT file's TAB vector.
///
/// \param[in] es Valid \c EclipseState object with accurate RUNSPEC
/// information on active phases and table dimensions ("TABDIMS").
///
/// \param[in] logihead Flag specifications identifying which tables
/// to output.
void addPVTTables(const EclipseState& es);
/// Add normalised saturation function tables to INIT file's TAB
/// vector.
///
@@ -101,21 +104,31 @@ namespace Opm {
const bool gas,
const bool oil,
const bool wat);
};
/// Emit normalised tabular information (TABDIMS and TAB vectors) to
/// ECL-like result set file (typically INIT file).
///
/// \param[in] tables Collection of normalised tables. Its \code
/// tabdims() \endcode and \code tab() \endcode vectors will be
/// emitted to \p fortio as ECL keywords "TABDIMS" and "TAB",
/// respectively.
///
/// \param[in,out] fortio ECL-like result set file. Typically
/// corresponds to a preopened stream attached to the INIT file.
void fwrite(const Tables& tables,
ERT::FortIO& fortio);
/// Add gas PVT tables (keywords PVDG and PVTG) to the tabular data
/// (TABDIMS and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addGasPVTTables(const EclipseState& es);
/// Add oil PVT tables (keywords PVCDO, PVDO and PVTO) to the
/// tabular data (TABDIMS and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addOilPVTTables(const EclipseState& es);
/// Add water PVT tables (keyword PVTW) to the tabular data (TABDIMS
/// and TAB vectors).
///
/// \param[in] es Valid \c EclipseState object with accurate table
/// dimensions ("TABDIMS" keyword) and an initialised \c
/// TableManager sub-object.
void addWaterPVTTables(const EclipseState& es);
};
}
#endif
#endif // OUTPUT_TABLES_HPP

View File

@@ -50,7 +50,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
EffectiveKH = 3, // Effective Kh product of connection
item12 = 11, // Unknown
item12 = 11, // Connection transmissibility factor
SegDistEnd = 20, // Distance to end of connection in segment
SegDistStart = 21, // Distance to start of connection in segment
@@ -66,6 +66,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
WaterRate = 1, // Surface flow rate (water)
GasRate = 2, // Surface Flow rate (gas)
Pressure = 34, // Connection pressure value
ResVRate = 49, // Reservoir voidage rate
};
} // XConn

View File

@@ -0,0 +1,40 @@
/*
Copyright (c) 2018 Equinor ASA
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/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
// This is a subset of the items in src/opm/output/eclipse/DoubHEAD.cpp .
// Promote items from that list to this in order to make them public.
enum doubhead : std::vector<double>::size_type {
TsInit = 1, // Maximum Length of Next Timestep
TsMaxz = 2, // Maximum Length of Timestep After Next
TsMinz = 3, // Minumum Length of All Timesteps
UdqPar_2 = 212, // UDQPARAM item number 2 (Permitted range (+/-) of user-defined quantities)
UdqPar_3 = 213, // UDQPARAM item number 3 (Value given to undefined elements when outputting data)
UdqPar_4 = 214, // UDQPARAM item number 4 (fractional equality tolerance used in ==, <= etc. functions)
};
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP

View File

@@ -0,0 +1,67 @@
/*
Copyright (c) 2018 Equinor ASA
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/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace XGroup {
enum index : std::vector<double>::size_type {
OilPrRate = 0, // Group's oil production rate
WatPrRate = 1, // Group's water production rate
GasPrRate = 2, // Group's gas production rate
LiqPrRate = 3, // Group's liquid production rate
WatInjRate = 5, // Group's water injection rate
GasInjRate = 6, // Group's gas injection rate
WatCut = 8, // Group's producing water cut
GORatio = 9, // Group's producing gas/oil ratio
OilPrTotal = 10, // Group's total cumulative oil production
WatPrTotal = 11, // Group's total cumulative water production
GasPrTotal = 12, // Group's total cumulative gas production
VoidPrTotal = 13, // Group's total cumulative reservoir
// voidage production
WatInjTotal = 15, // Group's total cumulative water injection
GasInjTotal = 16, // Group's total cumulative gas injection
OilPrPot = 22, // Group's oil production potential
WatPrPot = 23, // Group's water production potential
HistOilPrTotal = 135, // Group's total cumulative oil
// production (observed/historical rates)
HistWatPrTotal = 139, // Group's total cumulative water
// production (observed/historical rates)
HistWatInjTotal = 140, // Group's total cumulative water
// injection (observed/historical rates)
HistGasPrTotal = 143, // Group's total cumulative gas
// production (observed/historical rates)
HistGasInjTotal = 144, // Group's total cumulative gas injection
// (observed/historical rates)
};
} // XGroup
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP

View File

@@ -76,6 +76,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
NSCAQZ = 46, // Number of data elements per aquifer connection in SCAQ array
NACAQZ = 47, // Number of data elements per aquifer connection in ACAQ array
NWMAXZ = 163, // Maximum number of wells in the model
NSEGWL = 174, // Number of multisegment wells defined with WELSEG
NSWLMX = 175, // Maximum number of segmented wells (item 1 ofWSEGDIMS)
NSEGMX = 176, // Maximum number of segments per well (item 2 of WSEGDIMS)
@@ -84,6 +86,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
NISEGZ = 178, // Number of entries per segment in ISEG array
NRSEGZ = 179, // Number of entries per segment in RSEG array
NILBRZ = 180, // Number of entries per segment in ILBR array
UDQPAR_1 = 267, // Integer seed value for the RAND /
};
}}}} // Opm::RestartIO::Helpers::VectorItems

View File

@@ -0,0 +1,48 @@
/*
Copyright (c) 2019 Equinor ASA
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/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_LOGIHEAD_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_LOGIHEAD_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
// This is a subset of the items in src/opm/output/eclipse/LogiHEAD.cpp .
// Promote items from that list to this in order to make them public.
enum logihead : std::vector<bool>::size_type {
IsLiveOil = 0, // Oil phase w/dissolved gas
IsWetGas = 1, // Gas phase w/vaporised oil
DirKr = 2, // Directional relative permeability
E100RevKr = 3, // Reversible rel. perm. (E100)
E100Radial = 4, // Radial model (E100)
E300Radial = 3, // Radial model (E300, others)
E300RevKr = 4, // Reversible rel. perm. (E300, others)
Hyster = 6, // Enable hysteresis
DualPoro = 14, // Enable dual porosity
EndScale = 16, // Enable end-point scaling
DirEPS = 17, // Directional end-point scaling
RevEPS = 18, // Reversible end-point scaling
AltEPS = 19, // Alternative (3-pt) end-point scaling
ConstCo = 38, // Constant oil compressibility (PVCDO)
HasMSWells = 75, // Whether or not model has MS Wells.
};
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_LOGIHEAD_HPP

View File

@@ -0,0 +1,64 @@
/*
Copyright (c) 2018 Equinor ASA
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/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace ISeg {
enum index : std::vector<int>::size_type {
SegNo = 0, // Segment number (one-based)
OutSeg = 1, // Outlet segment (one-based)
InSegCurBranch = 2, // Inflow segment current branch (one-based)
BranchNo = 3, // Branch number (one-based)
};
} // ISeg
namespace RSeg {
enum index : std::vector<double>::size_type {
DistOutlet = 0, // Segment's distance to outlet
OutletDepthDiff = 1, // Segment's depth differential to outlet
SegDiam = 2, // Internal diameter of segment
SegRough = 3, // Roughness parameter of segment
SegArea = 4, // Cross-sectional area of segment
SegVolume = 5, // Physical volume of segment
DistBHPRef = 6, // Segment's distance to BHP reference node
DepthBHPRef = 7, // Segment's depth differential to BHP ref. node
TotFlowRate = 8, // Normalised total segment flow rate
WatFlowFract = 9, // Normalised Water flow rate fraction
GasFlowFract = 10, // Normalised Gas flow rate fraction
Pressure = 11, // Segment pressure
item40 = 39, // Unknown
item106 = 105, // Unknown
item107 = 106, // Unknown
item108 = 107, // Unknown
item109 = 108, // Unknown
item110 = 109, // Unknown
item111 = 110, // Unknown
};
} // RSeg
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP

View File

@@ -0,0 +1,76 @@
/*
Copyright (c) 2019 Equinor ASA
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/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_TABDIMS_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_TABDIMS_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace TabDims {
enum index : std::vector<int>::size_type {
// Number of elements in 'TAB' array
TabSize = 0,
// Oil PVT table
PvtoMainStart = 6,
PvtoCompStart = 7,
NumPvtoCompNodes = 8,
NumPvtoPressNodes = 9,
NumPvtoTables = 10,
// Water PVT table
PvtwStart = 11,
NumPvtwTables = 12,
// Gas PVT tables
PvtgMainStart = 13,
PvtgPressStart = 14,
NumPvtgCompNodes = 15,
NumPvtgPressNodes = 16,
NumPvtgTables = 17,
// Density tables
DensityTableStart = 18,
DensityNumTables = 19,
// SWFN tables
SwfnTableStart = 20,
SwfnNumSatNodes = 21,
SwfnNumTables = 22,
// SGFN tables
SgfnTableStart = 23,
SgfnNumSatNodes = 24,
SgfnNumTables = 25,
// SOFN tables
SofnTableStart = 26,
SofnNumSatNodes = 28,
SofnNumTables = 29,
// Size of TABDIMS array
TabDimsNumElems = 100,
};
} // namespace TabDims
}}}} // namespace Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_TABDIMS_HPP

View File

@@ -26,25 +26,30 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
namespace IWell {
enum index : std::vector<int>::size_type {
IHead = 0, // I-location (one-based) of well head
JHead = 1, // J-location (one-based) of well head
FirstK = 2, // Layer ID (one-based) of top/first connection
LastK = 3, // Layer ID (one-based) of bottom/last connection
NConn = 4, // Number of active cells connected to well
Group = 5, // Index (one-based) of well's current group
WType = 6, // Well type
WCtrl = 7, // Well control
IHead = 0, // I-location (one-based) of well head
JHead = 1, // J-location (one-based) of well head
FirstK = 2, // Layer ID (one-based) of top/first connection
LastK = 3, // Layer ID (one-based) of bottom/last connection
NConn = 4, // Number of active cells connected to well
Group = 5, // Index (one-based) of well's current group
WType = 6, // Well type (producer vs. injector)
ActWCtrl = 7, // Well's active target control mode (constraint).
item9 = 8, // Unknown
item11 = 10, // Unknown
item9 = 8, // Unknown
item11 = 10, // Unknown
VFPTab = 11, // ID (one-based) of well's current VFP table.
VFPTab = 11, // ID (one-based) of well's current VFP table
PredReqWCtrl = 15, // Well's requested control mode from
// simulation deck (WCONINJE, WCONPROD).
item18 = 17, // Unknown
XFlow = 22,
item25 = 24, // Unknown
item32 = 31, // Unknown
item48 = 47, // Unknown
item50 = 49, // Unknown
HistReqWCtrl = 49, // Well's requested control mode from
// simulation deck (WCONHIST, WCONINJH)
MsWID = 70, // Multisegment well ID
// Value 0 for regular wells
@@ -115,6 +120,15 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
BHPTarget = 6, // Well's bottom hole pressure target
DatumDepth = 9, // Well's reference depth for BHP
HistLiqRateTarget = 33, // Well's historical/observed liquid
// rate target/limit
HistGasRateTarget = 54, // Well's historical/observed gas rate
// target/limit
HistBHPTarget = 55, // Well's historical/observed bottom
// hole pressure target/limit
};
} // SWell
@@ -141,13 +155,22 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
GasFVF = 34, // Well's producing gas formation volume factor.
item37 = 36, // Unknown
item38 = 37, // Unknown
item37 = 36, // Unknown
item38 = 37, // Unknown
BHPTarget = 41, // Well's current BHP Target/Limit
BHPTarget = 41, // Well's current BHP Target/Limit
item82 = 81, // Unknown
item83 = 82, // Unknown
HistOilPrTotal = 75, // Well's total cumulative oil production
// (observed/historical rates)
HistWatPrTotal = 76, // Well's total cumulative water
// production (observed/historical rates)
HistGasPrTotal = 77, // Well's total cumulative gas production
// (observed(historical rates)
HistWatInjTotal = 81, // Well's total cumulative water injection
// (observed/historical rates)
HistGasInjTotal = 82, // Well's total cumulative gas injection
// (observed/historical rates)
WatVoidPrRate = 122, // Well's voidage production rate
GasVoidPrRate = 123, // Well's voidage production rate

View File

@@ -21,7 +21,9 @@
#define OPM_WINDOWED_ARRAY_HPP
#include <cassert>
#include <exception>
#include <iterator>
#include <stdexcept>
#include <type_traits>
#include <vector>
@@ -72,7 +74,10 @@ namespace Opm { namespace RestartIO { namespace Helpers {
explicit WindowedArray(const NumWindows n, const WindowSize sz)
: x_ (n.value * sz.value)
, windowSize_(sz.value)
{}
{
if (sz.value == 0)
throw std::invalid_argument("Window array with windowsize==0 is not permitted");
}
/// Retrieve number of windows allocated for this array.
Idx numWindows() const
@@ -179,7 +184,10 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const WindowSize& sz)
: data_ (NumWindows{ nRows.value * nCols.value }, sz)
, numCols_(nCols.value)
{}
{
if (nCols.value == 0)
throw std::invalid_argument("Window matrix with columns==0 is not permitted");
}
/// Retrieve number of columns allocated for this matrix.
Idx numCols() const

View File

@@ -0,0 +1,60 @@
/*
Copyright (c) 2019 Equinor ASA
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/>.
*/
#ifndef OPM_WRITE_INIT_HPP
#define OPM_WRITE_INIT_HPP
#include <map>
#include <string>
#include <vector>
namespace Opm {
class EclipseGrid;
class EclipseState;
class NNC;
class Schedule;
} // namespace Opm
namespace Opm { namespace data {
class Solution;
}} // namespace Opm::data
namespace Opm { namespace EclIO { namespace OutputStream {
class Init;
}}} // namespace Opm::EclIO::OutputStream
namespace Opm { namespace InitIO {
void write(const ::Opm::EclipseState& es,
const ::Opm::EclipseGrid& grid,
const ::Opm::Schedule& schedule,
const ::Opm::data::Solution& simProps,
std::map<std::string, std::vector<int>> int_data,
const ::Opm::NNC& nnc,
::Opm::EclIO::OutputStream::Init& initFile);
}} // namespace Opm::InitIO
#endif // OPM_WRITE_INIT_HPP

View File

@@ -0,0 +1,89 @@
/*
Copyright (c) 2019 Equinor ASA
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/>.
*/
#ifndef OPM_WRITE_RFT_HPP
#define OPM_WRITE_RFT_HPP
namespace Opm {
class EclipseGrid;
class Schedule;
class UnitSystem;
} // namespace Opm
namespace Opm { namespace data {
class WellRates;
}} // namespace Opm::data
namespace Opm { namespace EclIO { namespace OutputStream {
class RFT;
}}} // namespace Opm::EclIO::OutputStream
namespace Opm { namespace RftIO {
/// Collect RFT data and output to pre-opened output stream.
///
/// RFT data is output for all affected wells at a given timestep,
/// and consists of
///
/// 1) Time stamp (elapsed and date)
/// 2) Metadata about the output (units of measure, well types,
/// data type identifier)
/// 3) Depth, pressure, Sw, Sg, (I,J,K), and hostgrid for each
/// reservoir connection of the affected well.
///
/// If no RFT output is requested at given timestep, then this
/// function returns with no output written to the RFT file.
///
/// \param[in] reportStep Report step time point for which to output
/// RFT data.
///
/// \param[in] elapsed Number of seconds of simulated time until
/// this report step (\p reportStep).
///
/// \param[in] usys Unit system conventions for output. Typically
/// corresponds to run's active unit system (i.e., \code
/// EclipseState::getUnits() \endcode).
///
/// \param[in] grid Run's active grid. Used to determine which
/// reservoir connections are in active grid cells.
///
/// \param[in] schedule Run's SCHEDULE section from which to access
/// the active wells and the RFT configuration.
///
/// \param[in,out] rftFile RFT output stream. On input, appropriately
/// positioned for new content (i.e., at end-of-file). On output,
/// containing new RFT output (if applicable) and positioned after
/// new contents.
void write(const int reportStep,
const double elapsed,
const ::Opm::UnitSystem& usys,
const ::Opm::EclipseGrid& grid,
const ::Opm::Schedule& schedule,
const ::Opm::data::WellRates& wellSol,
::Opm::EclIO::OutputStream::RFT& rftFile);
}} // namespace Opm::RftIO
#endif // OPM_WRITE_RFT_HPP

View File

@@ -36,6 +36,7 @@ namespace Opm {
class Schedule;
class Well;
class UnitSystem;
class UDQActive;
} // Opm
@@ -47,7 +48,8 @@ namespace Opm { namespace RestartIO { namespace Helpers {
createDoubHead(const EclipseState& es,
const Schedule& sched,
const std::size_t lookup_step,
const double simTime);
const double simTime,
const double nextTimeStep);
@@ -62,17 +64,11 @@ namespace Opm { namespace RestartIO { namespace Helpers {
std::vector<bool>
createLogiHead(const EclipseState& es);
std::vector<int>
createUdqDims(const Schedule& sched,
const std::size_t lookup_step,
const std::vector<int>& inteHead);
std::vector<int> serialize_ICON(int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
int ncwmax, // Max number of completions per well, should be entry 17 from createInteHead.
int niconz, // Number of elements per completion in ICON, should be entry 32 from createInteHead.
const std::vector<const Well*>& sched_wells);
std::vector<double> serialize_SCON(int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
int ncwmax, // Max number of completions per well, should be entry 17 from createInteHead.
int nsconz, // Number of elements per completion in SCON, should be entry 33 from createInteHead.
const std::vector<const Well*>& sched_wells,
const UnitSystem& units);
}}} // Opm::RestartIO::Helpers

File diff suppressed because it is too large Load Diff

View File

@@ -124,10 +124,6 @@ namespace Opm {
using iterator = std::vector< DeckKeyword >::iterator;
Deck();
// cppcheck-suppress noExplicitConstructor
Deck( std::initializer_list< DeckKeyword > );
// cppcheck-suppress noExplicitConstructor
Deck( std::initializer_list< std::string > );
Deck( const Deck& );
@@ -147,6 +143,7 @@ namespace Opm {
const std::string& getInputPath() const;
const std::string& getDataFile() const;
void setDataFile(const std::string& dataFile);
std::string makeDeckPath(const std::string& path) const;
iterator begin();
iterator end();

View File

@@ -27,6 +27,7 @@
#include <opm/parser/eclipse/Units/Dimension.hpp>
#include <opm/parser/eclipse/Utility/Typetools.hpp>
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
namespace Opm {
class DeckOutput;
@@ -34,11 +35,10 @@ namespace Opm {
class DeckItem {
public:
DeckItem() = default;
explicit DeckItem( const std::string& );
DeckItem( const std::string&, int, size_t size_hint = 8 );
DeckItem( const std::string&, double, size_t size_hint = 8 );
DeckItem( const std::string&, std::string, size_t size_hint = 8 );
DeckItem( const std::string&, int);
DeckItem( const std::string&, double);
DeckItem( const std::string&, std::string);
DeckItem( const std::string&, UDAValue);
const std::string& name() const;
@@ -58,19 +58,23 @@ namespace Opm {
size_t size() const;
size_t out_size() const;
template< typename T > const T& get( size_t ) const;
//template< typename T > T& get( size_t ) ;
template< typename T > T get( size_t ) const;
double getSIDouble( size_t ) const;
std::string getTrimmedString( size_t ) const;
template< typename T > const std::vector< T >& getData() const;
const std::vector< double >& getSIDoubleData() const;
void push_back( UDAValue );
void push_back( int );
void push_back( double );
void push_back( std::string );
void push_back( UDAValue, size_t );
void push_back( int, size_t );
void push_back( double, size_t );
void push_back( std::string, size_t );
void push_backDefault( UDAValue );
void push_backDefault( int );
void push_backDefault( double );
void push_backDefault( std::string );
@@ -105,19 +109,24 @@ namespace Opm {
*/
bool operator==(const DeckItem& other) const;
bool operator!=(const DeckItem& other) const;
static bool to_bool(std::string string_value);
private:
std::vector< double > dval;
mutable std::vector< double > dval;
std::vector< int > ival;
std::vector< std::string > sval;
std::vector< UDAValue > uval;
type_tag type = type_tag::unknown;
std::string item_name;
std::vector< bool > defaulted;
std::vector< Dimension > dimensions;
mutable std::vector< double > SIdata;
/*
To save space we mutate the dval object in place when asking for SI
data; the current state of of the dval member is tracked with the
raw_data bool member.
*/
mutable bool raw_data = true;
template< typename T > std::vector< T >& value_ref();
template< typename T > const std::vector< T >& value_ref() const;
template< typename T > void push( T );

View File

@@ -23,25 +23,36 @@
#include <string>
#include <vector>
#include <memory>
#include <utility>
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckValue.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
namespace Opm {
class ParserKeyword;
class DeckOutput;
class ParserKeyword;
class DeckKeyword {
public:
typedef std::vector< DeckRecord >::const_iterator const_iterator;
explicit DeckKeyword(const std::string& keywordName);
DeckKeyword(const std::string& keywordName, bool knownKeyword);
explicit DeckKeyword(const ParserKeyword& parserKeyword);
DeckKeyword(const ParserKeyword& parserKeyword, const std::string& keywordName);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<std::vector<DeckValue>>& record_list);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<int>& data);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<double>& data);
const std::string& name() const;
void setFixedSize();
void setLocation(const std::string& fileName, int lineNumber);
void setLocation(const std::pair<const std::string&, std::size_t>& location);
const std::string& getFileName() const;
int getLineNumber() const;
std::pair<std::string, std::size_t> location() const;
size_t size() const;
void addRecord(DeckRecord&& record);
@@ -49,13 +60,13 @@ namespace Opm {
DeckRecord& getRecord(size_t index);
const DeckRecord& getDataRecord() const;
void setDataKeyword(bool isDataKeyword = true);
bool isKnown() const;
bool isDataKeyword() const;
const std::vector<int>& getIntData() const;
const std::vector<double>& getRawDoubleData() const;
const std::vector<double>& getSIDoubleData() const;
const std::vector<std::string>& getStringData() const;
const ParserKeyword& parserKeyword() const;
size_t getDataSize() const;
void write( DeckOutput& output ) const;
void write_data( DeckOutput& output ) const;
@@ -83,9 +94,9 @@ namespace Opm {
int m_lineNumber;
std::vector< DeckRecord > m_recordList;
bool m_knownKeyword;
bool m_isDataKeyword;
bool m_slashTerminated;
ParserKeyword parser_keyword;
};
}

View File

@@ -0,0 +1,58 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef DECK_VALUE_HPP
#define DECK_VALUE_HPP
#include <string>
#include <opm/parser/eclipse/Utility/Typetools.hpp>
namespace Opm {
class DeckValue {
public:
DeckValue();
explicit DeckValue(int);
explicit DeckValue(double);
explicit DeckValue(const std::string&);
bool is_default() const;
template<typename T>
T get() const;
template<typename T>
bool is_compatible() const;
private:
bool default_value;
type_tag value_enum;
int int_value;
double double_value;
std::string string_value;
};
}
#endif

View File

@@ -0,0 +1,69 @@
/*
Copyright 2019 Equinor ASA.
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/>.
*/
#ifndef UDA_VALUE_HPP
#define UDA_VALUE_HPP
#include <stdexcept>
#include <vector>
#include <string>
#include <iosfwd>
#include <opm/parser/eclipse/Units/Dimension.hpp>
namespace Opm {
class UDAValue {
public:
UDAValue();
explicit UDAValue(double);
explicit UDAValue(const std::string&);
template<typename T>
T get() const;
template<typename T>
bool is() const;
void reset(double value);
void reset(const std::string& value);
void assert_numeric() const;
void assert_numeric(const std::string& error_msg) const;
void set_dim(const Dimension& dim) const;
const Dimension& get_dim() const;
bool operator==(const UDAValue& other) const;
bool operator!=(const UDAValue& other) const;
private:
bool numeric_value;
double double_value;
std::string string_value;
/* This 'mutable' modifier is a hack to avoid tampering with the overall
const-ness of the data in a deck item. */
mutable Dimension dim;
};
std::ostream& operator<<( std::ostream& stream, const UDAValue& uda_value );
}
#endif

View File

@@ -44,21 +44,22 @@ namespace Opm {
struct AquanconOutput{
int aquiferID;
std::vector<size_t> global_index;
std::vector<double> influx_coeff; // Size = size(global_index)
std::vector<std::shared_ptr<double>> influx_coeff; // Size = size(global_index)
std::vector<double> influx_multiplier; // Size = size(global_index)
std::vector<int> reservoir_face_dir; // Size = size(global_index)
std::vector<int> record_index;
};
Aquancon(const EclipseGrid& grid, const Deck& deck);
const std::vector<Aquancon::AquanconOutput>& getAquOutput() const;
private:
void logic_application(std::vector<Aquancon::AquanconOutput>& output_vector);
std::vector<Aquancon::AquanconOutput> logic_application(const std::vector<Aquancon::AquanconOutput>& original_vector);
void collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
std::vector<Opm::AquanconRecord>& m_aqurecord,
void collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
std::vector<Opm::AquanconRecord>& m_aqurecord,
std::vector<int> m_aquiferID_per_record, int m_maxAquID);
void convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id, int i,

View File

@@ -25,21 +25,22 @@
This includes the logic for parsing as well as the associated tables. It is meant to be used by opm-grid and opm-simulators in order to
implement the Carter Tracy analytical aquifer model in OPM Flow.
*/
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/AqutabTable.hpp>
#include <boost/concept_check.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace Opm {
class EclipseState;
class AquiferCT {
public:
@@ -58,10 +59,10 @@ namespace Opm {
k_a , //aquifer permeability
c1, // 0.008527 (METRIC, PVT-M); 0.006328 (FIELD); 3.6 (LAB)
h , //aquifer thickness
p0, //Initial aquifer pressure at datum depth, d0
theta , //angle subtended by the aquifer boundary
c2 ; //6.283 (METRIC, PVT-M); 1.1191 (FIELD); 6.283 (LAB).
std::shared_ptr<double> p0; //Initial aquifer pressure at datum depth, d0
std::vector<double> td, pi;
};
@@ -70,23 +71,23 @@ namespace Opm {
const std::vector<AquiferCT::AQUCT_data>& getAquifers() const;
int getAqInflTabID(size_t aquiferIndex);
int getAqPvtTabID(size_t aquiferIndex);
private:
std::vector<AquiferCT::AQUCT_data> m_aquct;
//Set the default Pd v/s Td tables (constant terminal rate case for an infinite aquifer) as described in
//Van Everdingen, A. & Hurst, W., December, 1949.The Application of the Laplace Transformation to Flow Problems in Reservoirs.
//Set the default Pd v/s Td tables (constant terminal rate case for an infinite aquifer) as described in
//Van Everdingen, A. & Hurst, W., December, 1949.The Application of the Laplace Transformation to Flow Problems in Reservoirs.
//Petroleum Transactions, AIME.
inline void set_default_tables(std::vector<double>& td, std::vector<double>& pi)
{
std::vector<double> default_pressure_ = { 0.112, 0.229, 0.315, 0.376, 0.424, 0.469, 0.503, 0.564, 0.616, 0.659, 0.702, 0.735,
0.772, 0.802, 0.927, 1.02, 1.101, 1.169, 1.275, 1.362, 1.436, 1.5, 1.556, 1.604,
1.651, 1.829, 1.96, 2.067, 2.147, 2.282, 2.388, 2.476, 2.55, 2.615, 2.672, 2.723,
{
std::vector<double> default_pressure_ = { 0.112, 0.229, 0.315, 0.376, 0.424, 0.469, 0.503, 0.564, 0.616, 0.659, 0.702, 0.735,
0.772, 0.802, 0.927, 1.02, 1.101, 1.169, 1.275, 1.362, 1.436, 1.5, 1.556, 1.604,
1.651, 1.829, 1.96, 2.067, 2.147, 2.282, 2.388, 2.476, 2.55, 2.615, 2.672, 2.723,
2.921, 3.064, 3.173, 3.263, 3.406, 3.516, 3.608, 3.684, 3.75, 3.809, 3.86 };
std::vector<double> default_time_ = { 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70,
std::vector<double> default_time_ = { 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70,
80, 90, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000 };
td = default_time_;

View File

@@ -0,0 +1,74 @@
/*
Copyright (C) 2017 TNO
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/>.
*/
#ifndef OPM_AQUIFERFETP_HPP
#define OPM_AQUIFERFETP_HPP
/*
The Aquiferfetp which stands for AquiferFetkovich is a data container object meant to hold the data for the fetkovich aquifer model.
This includes the logic for parsing as well as the associated tables. It is meant to be used by opm-grid and opm-simulators in order to
implement the Fetkovich analytical aquifer model in OPM Flow.
*/
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <boost/concept_check.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace Opm {
class Aquifetp {
public:
struct AQUFETP_data{
// Aquifer ID
int aquiferID;
// Table IDs
int inftableID, pvttableID;
std::vector<int> cell_id;
// Variables constants
double J, // Specified Productivity Index
rho, // water density in the aquifer
C_t, // total rock compressibility
V0, // initial volume of water in aquifer
d0; // aquifer datum depth
std::shared_ptr<double> p0; //Initial aquifer pressure at datum depth d0 - nullptr if the pressure has been defaulted.
};
Aquifetp(const Deck& deck);
const std::vector<Aquifetp::AQUFETP_data>& getAquifers() const;
int getAqPvtTabID(size_t aquiferIndex);
private:
std::vector<Aquifetp::AQUFETP_data> m_aqufetp;
};
}
#endif

View File

@@ -77,7 +77,8 @@ namespace Opm {
const EclipseGrid& eclipseGrid);
void scanSection(const Section& section,
const EclipseGrid& eclipseGrid);
const EclipseGrid& eclipseGrid,
bool edit_section);
void handleADDKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleBOXKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
@@ -93,9 +94,13 @@ namespace Opm {
void handleEQUALREGKeyword(const DeckKeyword& deckKeyword );
void handleMULTIREGKeyword(const DeckKeyword& deckKeyword );
void handleOPERATEKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleOPERATERKeyword( const DeckKeyword& deckKeyword);
void loadGridPropertyFromDeckKeyword(const Box& inputBox,
const DeckKeyword& deckKeyword);
const DeckKeyword& deckKeyword,
bool edity_section);
void adjustSOGCRwithSWL();
std::string m_defaultRegion;
UnitSystem m_deckUnitSystem;

Some files were not shown because too many files have changed in this diff Show More