Compare commits

..

657 Commits

Author SHA1 Message Date
Arne Morten Kvarving
8fa165c0d7 bump version to 2019.04 2019-05-08 08:29:45 +02:00
Arne Morten Kvarving
8ff950227f bump version to 2019.04-rc3 2019-05-03 10:42:48 +02:00
Joakim Hove
bc5aeaf4bf Internalize a global WHISTCTL setting in the Schedule object 2019-05-03 10:40:26 +02:00
Atgeirr Flø Rasmussen
0108437201 Bugfix: do not keep old control modes.
They will be treated as limits, and cause wrong behaviour.
2019-05-03 08:59:01 +02:00
Arne Morten Kvarving
828fe797f0 bump version to 2019.04 rc2 2019-04-29 08:50:42 +02:00
Jostein Alvestad
8f24032612 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-26 09:40:50 +02:00
Joakim Hove
ee6bfbd76f Add configuration for keyword FLUXTYPE 2019-04-25 12:33:57 +02:00
Markus Blatt
54ee583112 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-25 11:38:51 +02:00
Markus Blatt
b69010cfc9 reintroduce some const with elegance 2019-04-25 11:38:51 +02:00
Markus Blatt
2859980cb4 Removes nearly all warnings experienced with g++-8.3
Namely:
- unused parameter
- type qualifiers ignored ...
- catchinhg polymorphic type ... by value
2019-04-25 11:38:51 +02:00
Joakim Hove
3ffefd8098 Fix bug in WellSegments== 2019-04-25 08:31:32 +02:00
Joakim Hove
852fdd7ac4 Add "size" : 1 attribute to CARFIN keyword 2019-04-25 08:31:32 +02:00
Arne Morten Kvarving
47a43daeac bump versions to 2019.04-rc1 2019-04-12 10:29:12 +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
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
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
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
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
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
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
Joakim Hove
c81e5027c9 Merge pull request #510 from bska/difftime
TimeMap: Use difftime() for Time Deltas as double
2018-10-02 14:44:44 +02:00
Bård Skaflestad
23950403f1 TimeMap: Use difftime() for Time Deltas as double
Reduces the amount of explicit arithmetic on std::time_t values and
thereby, implicitly, the assumption of targeting Posix systems only.
2018-10-02 13:11:02 +02:00
Bård Skaflestad
33372a3337 Merge pull request #506 from jalvestad/flow-flow-restart
EclipseRestart-improvements
2018-10-02 13:05:43 +02:00
Jostein Alvestad
c067e48276 Additional improvement and correction for writing of eclipse compatible restart file 2018-09-28 15:39:25 +02:00
Jostein Alvestad
5d398565c2 Improved the code structure - current improvement 2018-09-28 11:23:42 +02:00
Jostein Alvestad
a9a82e3814 Minor correction to previous commit rseg [39] was not properly assigned 2018-09-28 09:56:03 +02:00
Jostein Alvestad
3f94b580a2 Added changes to improve treatment of multi segment wells in Eclipse Restart
Added flowing well bottom hole pressure to item[8] and [39] plus adjusted item[9]
2018-09-28 09:48:03 +02:00
Jostein Alvestad
cfc1b29c08 Added improvements and corrections to handle writing of eclipse compatible restart file
for more general well data
2018-09-27 16:23:34 +02:00
Jostein Alvestad
264d451d56 Added additional changes to handle repeated read of COMPDAT
for same grid i,j,k cell.
Corrections for handling wells with only 1 connection
Correction for XWEL - BG being NaN
2018-09-27 16:23:32 +02:00
Jostein Alvestad
21eddfbdf2 Added changes to handle repeated read of COMPDAT for same grid cells 2018-09-27 16:23:31 +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
34b9cbcaa4 Merge pull request #502 from GitPaean/alq_unit_wcon
not converting the unit of ALQ value in VFPPROD
2018-09-26 20:16:42 +02:00
Kai Bao
8721385104 not converting the unit of ALQ value in VFPPROD
since the ALQ value in WCON* keywords are not converted based on the
unit of ALQ in the VFPPROD keyword. Easiest fix is not to convert either
of them.
2018-09-26 13:01:29 +02:00
Arne Morten Kvarving
fa85844a9b Merge pull request #500 from akva2/bash_completion
added: cmake glue for adding bash tab completion for an installed product
2018-09-25 12:32:03 +02:00
Arne Morten Kvarving
e3bc8a6ad7 fixed: fail build in jenkins scripts if installation target fails 2018-09-25 12:31:11 +02:00
Arne Morten Kvarving
564f064392 added: cmake glue for adding bash tab completion for an installed product 2018-09-25 12:31:11 +02:00
Arne Morten Kvarving
5477711420 Merge pull request #504 from akva2/restart_fixups
Fixups after restart merge
2018-09-25 10:58:21 +02:00
Arne Morten Kvarving
23c1aa9308 changed: use memcpy to avoid aliasing warnings 2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
0e2dbf737e fixed: do not try to append size_t to string using + 2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
5a2eec25b2 fixed: change to signed loop counters
avoids signed/unsigned comparison warnings
2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
ae7c7fdf74 changed: flip comparison to avoid warnings
warning: assuming signed overflow does not occur when assuming that (X +
c) < X is always false [-Wstrict-overflow]
2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
ddf6f153f7 fixed: use constructor argument instead of (broken) init loop 2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
9f7b9be7f4 changed: make unsigned to avoid narrowing warnings/errors 2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
0b85652c35 remove unused symbols 2018-09-25 10:04:39 +02:00
Arne Morten Kvarving
4bb0ede6b4 Merge pull request #503 from rolk/503_warncompat
Do not warn if just def'ed HAVE_ vars are set to 1
2018-09-24 08:54:54 +02:00
Roland Kaufmann
d847e10d96 Do not warn if just def'ed HAVE_ vars are set to 1
Some configuration scripts probe and just set HAVE_FOO without any
values, whereas others set it explicitly to 1. If these two are mixed,
for instance that the same package is used by two of our prerequisites,
but in different manner, then we get compatibility warnings when we try
to run the configuration script, even though there is no real conflict.

dune-fem, dune-alugrid and dune-localfunctions have this problem (around
release 2018.04).

This patch special-code the test so if the old value was previously
either just defined or explicitly set to the value 1, a warning will not
be issued if then suddenly the other variant is used.
2018-09-21 13:49:39 +02:00
Atgeirr Flø Rasmussen
5fb0c91c05 Merge pull request #454 from jalvestad/restart-group+mswell
Restart group+mswell
2018-09-21 10:14:47 +02:00
Bård Skaflestad
ff53a2334c Merge pull request #499 from totto82/fix_save_keywords
BugFix size of save_keywords
2018-09-20 17:59:30 +02:00
Tor Harald Sandve
776d851b26 Fix size of save_keywords 2018-09-20 13:50:23 +02:00
Joakim Hove
2884d02a71 Merge pull request #501 from joakim-hove/komodo-fixup
Add quotes to ensure string evaluation
2018-09-20 13:18:13 +02:00
Joakim Hove
90459cac7e Add quotes to ensure string evaluation 2018-09-19 23:33:54 +02:00
Bård Skaflestad
b03ccdc6e1 SWEL/XWEL: Guard Against Missing Summary Vectors
Commit 36af2aad (PR #496) switched to not calculating the well's
summary vectors in the case of outputting the initial condition
(SEQNUM=0).  Account for this possibility when creating SWEL and
XWEL.
2018-09-19 16:02:17 +02:00
Jostein Alvestad
fa9275f1af Added correction to treatment of multisegment wells in preparation for writing of eclipse
compatible restart file
2018-09-19 16:02:17 +02:00
Jostein Alvestad
ef6e0b084d Corrected merge conflicts with upstream master
Write cumulative production / injection only in eclipse compatible mode
2018-09-19 16:02:17 +02:00
Bård Skaflestad
a3b37eee4f Support Retrieving Well Vectors from {I,X}{WEL,CON}
This commit extends function RestartIO::load() to retrieve most of
the well restart data (aggregate flow rates per well connection,
or per well) from the standard ECL restart vectors IWEL, XWEL, ICON,
and XCON.  We still prefer the dedicated OPM_* variants if
available, but this commit brings us closer to being able to retire
OPM_XWEL.

While here, also add WELLDIMS to FIRST_SIM_THPRES to restore the
STORE_THPRES unit test.
2018-09-19 16:02:16 +02:00
Bård Skaflestad
980f55271f Connection Data: Write Flow Rates to XCON
This commit adds a simple facility for outputting surface rates of
the oil, gas, and water components for each well connection, as well
as total reservoir voidage rate per well connection if available in
the data::Connection object.
2018-09-19 16:02:16 +02:00
Bård Skaflestad
335b070564 Aggregate Connection Data: Use Named Indices
This commit introduces a new set of named indices pertaining to the
*CON vectors (ICON, SCON, XCON).  Use these where appropriate in
ICON and SCON.
2018-09-19 16:02:15 +02:00
Bård Skaflestad
d42c98223c Refactor Implementation of RestartIO::save()
In particular, reimplement write_kw() in terms of vector<T> rather
than EclKW<T> to simplify callers.  While here, also move some file
handling operations out to separate helper functions to make control
flow more linear in the body of RestartIO::save(), and prune unused
arguments from other helper functions.
2018-09-19 16:02:15 +02:00
Bård Skaflestad
2f868a7325 Split RestartIO into Separate Load/Save Files
This is in preparation of introducing support for loading most
well-related solution items from the regular vectors IWEL, XWEL,
ICON, and XCON.
2018-09-19 16:02:14 +02:00
Jostein Alvestad
96f2528083 Added changes to CMakeLists_files.cmake to correct for rebase 2018-09-19 16:02:14 +02:00
Bård Skaflestad
38c4d07282 Aggregate Well Data: Miscellaneous Cleanup
Fix a few white-space issues and use 'atm' unit of measurement for
the default lower BHP limit of producers.
2018-09-19 16:02:14 +02:00
Bård Skaflestad
77904d6aab Aggregate Well Data: Fix SWEL UoM for Injectors
Unit of measurement for non-gas injectors must be liquid surface
rate for O/W injectors and 'rate' (reservoir voidage rate) for RESV
injectors.
2018-09-19 16:02:13 +02:00
Bård Skaflestad
6688a9286f Unit Tests: Fix Comparison Values 2018-09-19 16:02:13 +02:00
Bård Skaflestad
9637109ca8 Test Data: Add WELLDIMS for Restart Purposes
The new restart code depends on having WELLDIMS available in order
to allocate appropriately sized output vectors.
2018-09-19 16:02:13 +02:00
Bård Skaflestad
41d0a56967 Test Restart: Use Non-Default SummaryState Values
Needed by the new restart code.
2018-09-19 16:02:12 +02:00
Jostein Alvestad
9d32793796 Added improvements to connection data ICON (account for inactive cells) etc. 2018-09-19 16:02:12 +02:00
Jostein Alvestad
13e849140c Added changes to identify issues for improving ICON 2018-09-19 16:02:11 +02:00
Jostein Alvestad
0e1e4e08e7 Added changes to improve handling of ICON 2018-09-19 16:02:11 +02:00
Jostein Alvestad
3fb7149226 Added change to rseg item 11 2018-09-19 16:02:10 +02:00
Jostein Alvestad
2889a829f8 Additional corrections to restart file (iseg, rseg, icon and scon) 2018-09-19 16:02:10 +02:00
Jostein Alvestad
ccb223521f Added corrections to construction of ISEG for more general segmented well trajectories 2018-09-19 16:02:09 +02:00
Jostein Alvestad
409a497396 Added corrections to code to generate Eclipse compatible Restart file: i) two changes to intehead, [49] and [50] -> 1 (based on tests), ii) corrections to ISEG mainly for multisegmented wells and iii) change to ICON to allow for default saturation table implying ICON[6] and [9] = 0 2018-09-19 16:02:09 +02:00
Jostein Alvestad
5cf35e03c7 Added other correction to account for compatibility with Eclipse 2017 and not 2014 2018-09-19 16:02:08 +02:00
Jostein Alvestad
4f9f952e77 Added corrections to SWEL and ISEG plus InteHead[179] to 146 2018-09-19 16:02:08 +02:00
Jostein Alvestad
a41596004a Added correction for writing of unformatted restart 2018-09-19 16:02:07 +02:00
Jostein Alvestad
6ea83724d6 corrected code for write of unformatted restart 2018-09-19 16:02:07 +02:00
Jostein Alvestad
0a96fc012e Corrected code for differences in buffer size for read from restart files 2018-09-19 16:02:06 +02:00
Jostein Alvestad
5d860f8b03 corrected default injector and producer bhp pressures for restart file 2018-09-19 16:02:06 +02:00
Jostein Alvestad
9ea6c034e2 Disable extra flow restart output that Eclipse cannot handle in a Restart run
As of now we are able to run an ECL restart from a flow generated restart file for
a specific realistic model test case
2018-09-19 16:02:06 +02:00
Jostein Alvestad
17966d098b Added unit conversion for MSW data pluss correctin for complum 2018-09-19 16:02:05 +02:00
Jostein Alvestad
9d0604ad99 additions to handle segmented wells for ICON and SCON 2018-09-19 16:02:05 +02:00
Jostein Alvestad
36de4a4a31 Added changes needed to provide connection index for restart file 2018-09-19 16:02:04 +02:00
Jostein Alvestad
690fe11e58 Additional changes for restart writing og well and connection data 2018-09-19 16:02:03 +02:00
Jostein Alvestad
bce55f7087 Added changes to remove debug print plus some code comments 2018-09-19 16:02:03 +02:00
Jostein Alvestad
dc64b6eb86 Add correction due to non-resolved conflict during rebase operation 2018-09-19 16:02:02 +02:00
Jostein Alvestad
c720c48ba0 Added correction for IGRP array 2018-09-19 16:02:02 +02:00
Jostein Alvestad
5b1ec7b5b0 Added code to write restart data for groups and segmented wells to restart file - consistent with Eclipse 100 2018-09-19 16:02:02 +02:00
Jostein Alvestad
439bc30ea3 Final changes for first "beta" version of segmented well ++ for restart 2018-09-19 16:02:01 +02:00
Jostein Alvestad
888326b32c Initial changes to add group data to restart output plus adding changes to include no of groups in inteHEAD 2018-09-19 16:02:01 +02:00
Jostein Alvestad
6ed9c356a9 Final changes for first "beta" version of segmented well ++ for restart 2018-09-19 16:02:00 +02:00
Jostein Alvestad
d9adf7ccc2 Further changes to include iSeg and rSeg data to Restart file 2018-09-19 16:01:59 +02:00
Jostein Alvestad
c5a1b30dc1 Added code to finalize writing of group data to restart file 2018-09-19 16:01:59 +02:00
Jostein Alvestad
cedadaf649 Added code to implement writing XGRP to the restart file. 2018-09-19 16:01:58 +02:00
Jostein Alvestad
949fb3d944 Add summary vectors for group and field for restart 2018-09-19 16:01:58 +02:00
Jostein Alvestad
86ca704d75 Further changes to implement group output to the restart file.
Starting to use the SummaryState class to include summary data
2018-09-19 16:01:57 +02:00
Jostein Alvestad
53d19e8a44 Further changes to implement group data (IGRP and SGRP)
Plus updating source code to the latest github version of the rest of the OPM code
2018-09-19 16:01:57 +02:00
Jostein Alvestad
f7d975920b Added changes to serialize IGRP and SGRP and write to restart file 2018-09-19 16:01:56 +02:00
Jostein Alvestad
531581762f Further additions and changes to implement preparation and writing of group data to the restart file 2018-09-19 16:01:56 +02:00
Jostein Alvestad
402a5f0965 Initial changes to implement group data into writing of restart file 2018-09-19 16:01:55 +02:00
Jostein Alvestad
79d0081369 Added changes to include no of groups in InteHEAD 2018-09-19 16:01:55 +02:00
Jostein Alvestad
0f26e2e958 Initial changes to add group data to restart output
While here also add changes to include no of groups in InteHEAD
2018-09-19 16:01:55 +02:00
Jostein Alvestad
9cf9bf310d Added changes to serialize IGPR and SGRP and write to restart file
Well info at correct step for save & load RESTART

Retrieve number of wells and completions at the beginning of the
simulated step. Otherwise a well introduced at the same time step as the
report will be included - even though there doesn't exist any simulated
data yet.

This issue would trigger a throw if WRFTPLT was added at the same time
step as a well is introduced in the schedule section.

Removed one DATES item in FIRST_SIM.DATA. The
EclipseReadWriteWellStateData in test_Restart compared state at T1,
which did not include any well data as it was. No other tests were
affected.

Added new implementation of serialize_ICON

The new function has been added to the file WriteRestartHelpers, and
intended to take over for the local function 'serialize_ICON' in
`restartIO.cpp` when `restartIO::save()` is to be updated.  The purpose
of the new implementation is to be compatible with Eclipse.

Handle wildcard in group keywords

Added function getGroups(pattern) to allow records with wildcard.

Included the functionality for GCONPROD, GCONINJE and GEFAC - currently
the only group keywords that should accept wildcards.

Add key string to RestartKey

Pass dimension information for extra fields in restart

Verify that the extra container has THPRES
2018-09-19 16:01:54 +02:00
Jostein Alvestad
a284acc3ed Further additions and changes to implement preparation and writing of group data to the restart file 2018-09-19 16:01:54 +02:00
Jostein Alvestad
19bb0e0077 Additional changes to create restart group data in general and igrp data in particular 2018-09-19 16:01:53 +02:00
Jostein Alvestad
89b11dfd26 Further changes to write group data to restart file 2018-09-19 16:01:53 +02:00
Jostein Alvestad
2552750bed Initial changes to implement group data into writing of restart file 2018-09-19 16:01:52 +02:00
Jostein Alvestad
7b2c36bde5 Added changes to include no of groups in InteHEAD 2018-09-19 16:01:52 +02:00
Jostein Alvestad
b9bb0ae60a Initial changes to add group data to restart output plus adding changes to include no of groups in inteHEAD 2018-09-19 16:01:51 +02:00
Arne Morten Kvarving
4c6d4ee201 Merge pull request #498 from joakim-hove/komodo
Komodo: cmake config changes
2018-09-19 09:08:53 +02:00
Joakim Hove
906ff3f4b5 Add ability to CMAKE variable DIST_PREFIX before find_package(opm--) 2018-09-19 09:07:05 +02:00
Joakim Hove
238d3ddb58 Move CMAKE_MODULE_PATH manipulations before @OPM_PROJECT_EXTRA_CODE@ 2018-09-17 09:12:29 +02:00
Joakim Hove
42745e0bfc Merge pull request #493 from joakim-hove/default-ecl-compatible
Make ecl compatible restart files default
2018-09-15 11:09:44 +02:00
Bård Skaflestad
4e593da140 Merge pull request #497 from totto82/start2
Write restart when SAVE keyword is in the schedule file
2018-09-14 19:54:25 +02:00
Joakim Hove
662d673c44 Merge pull request #496 from joakim-hove/summary-start-at1
Summary start at1
2018-09-14 17:13:45 +02:00
Tor Harald Sandve
fdc4b0142e Write restart when SAVE keyword is in the schedule file 2018-09-14 13:36:22 +02:00
Arne Morten Kvarving
142994dde6 Merge pull request #491 from akva2/improve_lto
improve lto support
2018-09-14 12:30:16 +02:00
Arne Morten Kvarving
d58001f608 improve lto support
need to use the wrappers for ar and ranlib, or static
libraries are problematic.
2018-09-14 10:29:59 +02:00
Joakim Hove
7dccd13c50 Merge pull request #492 from totto82/minpvfil
fix unit of minpvfil
2018-09-13 19:08:45 +02:00
Joakim Hove
fb5e1229ef Merge pull request #495 from joakim-hove/remove-include
Remove include + use plain C api for test_area
2018-09-13 19:07:37 +02:00
Joakim Hove
d30fc975e3 Merge pull request #444 from lars-petter-hauge/support_ctfac
Support CTFAC
2018-09-13 18:21:24 +02:00
Joakim Hove
36af2aadb5 Will not write summary data for report step == 0 2018-09-13 18:08:57 +02:00
Joakim Hove
cf754c499d White space change 2018-09-13 18:07:37 +02:00
Joakim Hove
9d7ec59e9e Use plain C api for test area 2018-09-13 17:25:33 +02:00
Joakim Hove
eded8bacfc Remove unused include 2018-09-13 17:11:49 +02:00
Lars Petter Øren Hauge
87e3beb601 Support CTFAC in output 2018-09-13 10:23:47 +02:00
Joakim Hove
079d946723 Make ecl compatible restart files default 2018-09-12 18:02:47 +02:00
Joakim Hove
492a240f09 Merge pull request #488 from joakim-hove/opm-formatted-rst
Add opm_formatted property to the IOConfig
2018-09-12 12:57:26 +02:00
Tor Harald Sandve
e6c0ccb5bf fix unit of minpvfil 2018-09-12 11:44:33 +02:00
Joakim Hove
71d92c3dc8 Add opm_formatted property to the IOConfig 2018-09-12 11:34:57 +02:00
Bård Skaflestad
2ea1b7860f Merge pull request #490 from bska/fix-index-oob
Ensure Correctly Sized ACTNUM Vector
2018-09-12 10:09:24 +02:00
Bård Skaflestad
9fd5ce396b Ensure Correctly Sized ACTNUM Vector
Size must be equal to number of global (Cartesian) cells.
2018-09-12 09:46:53 +02:00
Arne Morten Kvarving
bff3c0bff1 Merge pull request #489 from joakim-hove/ignore-extra-kwII
Add option to ignore extra keywords in the regresstion testing
2018-09-11 16:09:53 +02:00
Joakim Hove
7cd29ea7d7 Add option to ignore extra keywords in the regresstion testing 2018-09-11 13:34:51 +02:00
Arne Morten Kvarving
a3c9943a5e Merge pull request #487 from joakim-hove/fix-shared-build
Fix build of tests when using shared library
2018-09-11 13:27:06 +02:00
Joakim Hove
552c390465 Merge pull request #464 from joakim-hove/peaceman-formula
Peaceman formula
2018-09-11 13:18:40 +02:00
Joakim Hove
9f9041dcae Fix build of tests when using shared library 2018-09-10 18:33:47 +02:00
Joakim Hove
c870172a30 Merge pull request #484 from joakim-hove/use-c-smspec
Using plain C api for smspec_nodes
2018-09-10 17:51:23 +02:00
Joakim Hove
4a5b71d8c1 Include Peaceman calculation in Connection class
- The calculation of well connection transmissibility CF and effective
   permeability is calculated.

 - The Connection objects are immutable; should never be updated.

 - The properties of the Connection class are just plain properties, have
   removed getter methods and the use of Value<double>.
2018-09-09 11:16:42 +02:00
Joakim Hove
ff939b44f2 Add testdecks SPE1 and SPE9 2018-09-09 11:16:42 +02:00
Joakim Hove
9e8110e67b Add Peaceman utility functions from opm-simulators 2018-09-09 11:16:42 +02:00
Joakim Hove
5aa0bfadf0 Use plain C api for smspec_nodes 2018-09-07 13:56:04 +02:00
Joakim Hove
e1948ccf99 Add operator[] to GridDims 2018-09-07 10:20:50 +02:00
438 changed files with 49003 additions and 6220 deletions

View File

@@ -7,6 +7,12 @@ 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(ENABLE_WELL_TEST "Enable testing of well code when building Schedule object" OFF)
if (ENABLE_WELL_TEST)
add_definitions(-DWELL_TEST)
endif()
# Output implies input
if(ENABLE_ECL_OUTPUT)
@@ -18,6 +24,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)
@@ -130,6 +137,24 @@ 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}
LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach()
endif()
# Build the compare utilities
if(ENABLE_ECL_INPUT)
add_library(testutil STATIC
@@ -146,18 +171,15 @@ if(ENABLE_ECL_INPUT)
# Add the tests
set(_libs testutil 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 AND NOT BUILD_SHARED_LIBS)
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()
foreach(test test_compareSummary test_EclFilesComparator)
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs})
endforeach()
install(TARGETS compareECL DESTINATION bin)
endif()
# Install build system files
install(DIRECTORY cmake DESTINATION share/opm)
# Install tab completion skeleton
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)

View File

@@ -21,6 +21,7 @@
# the library needs it.
list (APPEND MAIN_SOURCE_FILES
examples/test_util/EclFile.cpp
src/opm/common/data/SimulationDataContainer.cpp
src/opm/common/OpmLog/CounterLog.cpp
src/opm/common/OpmLog/EclipsePRTLog.cpp
@@ -46,12 +47,14 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/Deck/DeckOutput.cpp
src/opm/parser/eclipse/Deck/Section.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
@@ -73,29 +76,42 @@ if(ENABLE_ECL_INPUT)
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/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/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/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/Well/Well.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/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,17 +119,30 @@ 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/UDQWellSet.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/UDQInput.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/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
@@ -135,6 +164,9 @@ if(ENABLE_ECL_INPUT)
endif()
if(ENABLE_ECL_OUTPUT)
list( APPEND MAIN_SOURCE_FILES
src/opm/output/eclipse/AggregateConnectionData.cpp
src/opm/output/eclipse/AggregateGroupData.cpp
src/opm/output/eclipse/AggregateMSWData.cpp
src/opm/output/eclipse/AggregateWellData.cpp
src/opm/output/eclipse/CreateDoubHead.cpp
src/opm/output/eclipse/CreateInteHead.cpp
@@ -144,11 +176,12 @@ if(ENABLE_ECL_OUTPUT)
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
@@ -157,6 +190,7 @@ if(ENABLE_ECL_OUTPUT)
endif()
list (APPEND TEST_SOURCE_FILES
tests/test_EclFile.cpp
tests/test_calculateCellVol.cpp
tests/test_cmp.cpp
tests/test_cubic.cpp
@@ -173,6 +207,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
@@ -201,9 +236,11 @@ if(ENABLE_ECL_INPUT)
tests/parser/MULTREGTScannerTests.cpp
tests/parser/OrderedMapTests.cpp
tests/parser/ParseContextTests.cpp
tests/parser/ParseContext_EXIT1.cpp
tests/parser/PORVTests.cpp
tests/parser/RawKeywordTests.cpp
tests/parser/RestartConfigTests.cpp
tests/parser/RockTableTests.cpp
tests/parser/RunspecTests.cpp
tests/parser/SatfuncPropertyInitializersTests.cpp
tests/parser/ScheduleTests.cpp
@@ -226,12 +263,18 @@ 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_AggregateGroupData.cpp
tests/test_AggregateMSWData.cpp
tests/test_AggregateConnectionData.cpp
tests/test_ArrayDimChecker.cpp
tests/test_CharArrayNullTerm.cpp
tests/test_EclipseIO.cpp
tests/test_DoubHEAD.cpp
@@ -257,6 +300,7 @@ list (APPEND TEST_DATA_FILES
)
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
tests/expect-wdims.err.out
tests/FIRST_SIM.DATA
tests/FIRST_SIM_THPRES.DATA
tests/summary_deck.DATA
@@ -266,6 +310,10 @@ if(ENABLE_ECL_OUTPUT)
tests/table_deck.DATA
tests/summary_deck_non_constant_porosity.DATA
tests/SUMMARY_EFF_FAC.DATA
tests/SPE1CASE1.DATA
tests/SPE1CASE1.SMSPEC
tests/SPE9_CP_PACKED.DATA
tests/SOFR_TEST.DATA
)
endif()
@@ -275,6 +323,7 @@ if(ENABLE_ECL_INPUT)
list (APPEND EXAMPLE_SOURCE_FILES
examples/opmi.cpp
examples/opmpack.cpp
examples/opmhash.cpp
)
endif()
@@ -286,10 +335,13 @@ if(ENABLE_ECL_INPUT)
list (APPEND PROGRAM_SOURCE_FILES
examples/opmi.cpp
examples/opmpack.cpp
examples/opmhash.cpp
)
endif()
list( APPEND PUBLIC_HEADER_FILES
examples/test_util/EclFile.hpp
examples/test_util/data/EclIOdata.hpp
opm/common/ErrorMacros.hpp
opm/common/Exceptions.hpp
opm/common/data/SimulationDataContainer.hpp
@@ -335,6 +387,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
@@ -348,6 +401,7 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Util/Value.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
@@ -367,6 +421,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
@@ -376,8 +431,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
@@ -415,6 +473,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
@@ -427,16 +489,31 @@ 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/Actions.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.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/Well.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.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/WellPolymerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.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/MessageLimits.hpp
@@ -444,24 +521,27 @@ if(ENABLE_ECL_INPUT)
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/UDQInput.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/UDQWellSet.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
@@ -479,8 +559,14 @@ if(ENABLE_ECL_OUTPUT)
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/msw.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/AggregateWellData.hpp
opm/output/eclipse/CharArrayNullTerm.hpp
opm/output/eclipse/DoubHEAD.hpp
@@ -488,13 +574,13 @@ if(ENABLE_ECL_OUTPUT)
opm/output/eclipse/EclipseIO.hpp
opm/output/eclipse/EclipseIOUtil.hpp
opm/output/eclipse/InteHEAD.hpp
opm/output/eclipse/LogiHEAD.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/WriteRestartHelpers.hpp

View File

@@ -49,6 +49,7 @@ list(APPEND EXTRA_TESTS EclipseStateTests)
foreach (test BoxTest
CheckDeckValidity
EclipseGridCreateFromDeck
EDITNNCTests
IncludeTest
IntegrationTests
IOConfigIntegrationTest

View File

@@ -7,6 +7,7 @@ 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

View File

@@ -78,7 +78,17 @@ function (configure_vars obj syntax filename verb)
# write a CMake statements that warns if the value has changed
if ("${syntax}" STREQUAL "CMAKE")
set (_db "\${") # to avoid parsing problems
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT \"${_db}${_var}}\" STREQUAL \"${${_var}}\")\n")
# special case: if we have a truth variable HAVE_ and this is
# either just defined (as is), or set to 1 explicitly, then both
# of these count as "true", so put in a check that also accepts
# both of these values.
if (("${_var}" MATCHES "^HAVE_.*") AND
(("${${_var}}" STREQUAL "") OR ("${${_var}}" STREQUAL "1")))
set (_cond "(\"${_db}${_var}}\" STREQUAL \"\") OR (\"${_db}${_var}}\" STREQUAL \"1\")")
else ()
set (_cond "\"${_db}${_var}}\" STREQUAL \"${${_var}}\"")
endif ()
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT (${_cond}))\n")
file (APPEND "${filename}" "\tmessage (WARNING \"Incompatible value \\\"${_db}${_var}}\\\" of variable \\\"${_var}\\\"\")\n")
file (APPEND "${filename}" "endif ()\n")
endif ()

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

@@ -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

@@ -0,0 +1,6 @@
# Installs bash tab completion for a product
macro(opm_add_bash_completion binary)
set(PRODUCT ${binary})
configure_file(${OPM_MACROS_ROOT}/etc/opm_bash_completion.sh.in ${binary}_bash_completion.sh @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${binary}_bash_completion.sh DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d)
endmacro()

View File

@@ -65,7 +65,7 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
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))
if(HAVE_DYNAMIC_BOOST_TEST)
set_target_properties (${_sat_NAME} PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK
)
@@ -192,6 +192,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 +219,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 +267,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()
@@ -316,6 +322,11 @@ 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})
if(CURTEST_DEPENDS)
@@ -344,12 +355,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()

View File

@@ -21,10 +21,28 @@ if (CXX_COMPAT_GCC)
# disabled due to widespread bugs in the linker plugin
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" OFF)
if (WHOLE_PROG_OPTIM)
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
if (HAVE_LINK_OPTS)
list (APPEND _opt_flags "-flto")
endif (HAVE_LINK_OPTS)
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
check_cxx_accepts_flag ("-fuse-linker-plugin" HAVE_LINK_PLUGIN)
if (HAVE_LINK_OPTS)
list (APPEND _opt_flags "-flto")
endif (HAVE_LINK_OPTS)
if (HAVE_LINK_PLUGIN)
list (APPEND _opt_flags "-fuse-linker-plugin")
endif (HAVE_LINK_PLUGIN)
if(HAVE_LINK_OPTS AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}")
list(GET VERSION_LIST 0 VER_MAJOR)
find_program(LTO_AR_COMMAND NAMES ${CMAKE_C_COMPILER}-ar gcc-ar-${VER_MAJOR} gcc-ar)
find_program(LTO_RANLIB_COMMAND NAMES ${CMAKE_C_COMPILER}-ranlib gcc-ranlib-${VER_MAJOR} gcc-ranlib)
if(LTO_AR_COMMAND)
set(CMAKE_AR ${LTO_AR_COMMAND})
message(STATUS "Using LTO-enabled ar: ${CMAKE_AR}")
endif()
if(LTO_RANLIB_COMMAND)
set(CMAKE_RANLIB ${LTO_RANLIB_COMMAND})
message(STATUS "Using LTO-enabled ranlib: ${CMAKE_RANLIB}")
endif()
endif()
endif (WHOLE_PROG_OPTIM)
# native instruction set tuning

View File

@@ -29,11 +29,34 @@ if(NOT @opm-project_NAME@_FOUND)
set (@opm-project_NAME@_LIBRARY_DIRS "@opm-project_LIBRARY_DIRS@" "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
set (HAVE_@opm-project_NAME_UC@ 1)
# libraries come from the build tree where this file was generated
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
# The purpose of this string replacement operation is to enable use of the
# generated opm-project-config.cmake file also in the situation where 'make
# install' has been invoked with the DESTDIR option:
#
# opm-common/build> cmake .. -DCMAKE_INSTALL_PREFIX=/real/prefix
# opm-common/budil> make install DESTDIR=/tmp/prefix
#
# downstream/build> cmake .. -DDEST_PREFIX=/tmp/prefix -DCMAKE_PREFIX_PATH=/tmp/prefix
# downstream/build> make install
#
# That way the downstream dependency can still use find_package( opm-common )
# even though the opm-common-config.cmake file is not internally consistent
# with it's own location in the filesystem.
if(DEST_PREFIX)
set(DEST_PREFIX "${DEST_PREFIX}${@opm-project_NAME@_PREFIX}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_INCLUDE_DIRS "${@opm-project_NAME@_INCLUDE_DIRS}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY_DIRS "${@opm-project_NAME@_LIBRARY_DIRS}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY "${@opm-project_NAME@_LIBRARY}")
endif()
set (HAVE_@opm-project_NAME_UC@ 1)
mark_as_advanced (@opm-project_NAME@_LIBRARY)
# not all projects have targets; conditionally add this part
@@ -71,12 +94,17 @@ if(NOT @opm-project_NAME@_FOUND)
# this is the contents of config.h as far as our probes can tell:
# extra code from variable OPM_PROJECT_EXTRA_CODE
@OPM_PROJECT_EXTRA_CODE@
# end extra code
# This call is at the bottom as we need to include
# the OpmPackage Macros.
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" @PREREQ_LOCATION@)
include(@opm-project_NAME@-prereqs)
# The settings in this block do not mix well with the DEST_PREFIX
# setting.
if (NOT DEST_PREFIX)
# This is required to include OpmPackage
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" @PREREQ_LOCATION@)
# extra code from variable OPM_PROJECT_EXTRA_CODE
@OPM_PROJECT_EXTRA_CODE@
# end extra code
include(@opm-project_NAME@-prereqs)
endif()
endif()

2
debian/changelog vendored
View File

@@ -1,4 +1,4 @@
opm-common (2015.10-1~trusty) trusty; urgency=medium
opm-common (2019.04-rfinal-1~xenial) xenial; urgency=medium
* New release

View File

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

View File

@@ -0,0 +1,60 @@
# this snippet enables parameter completion via the tabulator key
# for bash for opm products.
# this is a bash readline completer for the case where a binary is
# already known to be an eWoms simulator.
_ewoms_parameter_completor()
{
if test "$COMP_WORDS" == ""; then
return 0
fi
cmd="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
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}") )
}
# this is a bash readline default completer which attempts to find out
# if a given binary is an eWoms simulation. this needs to be set as a
# default completer because the name of eWoms binaries cannot be known
# a-priori.
_ewoms_generic_parameter_completor()
{
if test "$COMP_WORDS" == ""; then
return 0
fi
COMPREPLY=()
local cmd cur ALL_OPTS
cmd="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
fullcmd="$(which "$cmd" 2> /dev/null)"
if test -z "$fullcmd" || \
! test -x "$fullcmd" || \
(! test -f "$fullcmd" && ! test -h "$fullcmd" ) || \
! test -r "$fullcmd" || \
! grep -q "Ewoms[a-zA-Z0-9]*Simulator[a-zA-Z0-0]" "$fullcmd"
then
if test -n "$DEFAULT_COMPLETION_LOADER"; then
"$DEFAULT_COMPLETION_LOADER" $@
elif type -t _completion_loader 2>&1 > /dev/null; then
# the default DEFAULT_COMPLETION_LOADER variable has not
# been set and the _completion_loader function exists, so
# we use _completion_loader as the default completer.
_completion_loader $@
else
return 1
fi
return $?
fi
_ewoms_parameter_completor $@
return 0
}
complete -o nospace -F _ewoms_parameter_completor @PRODUCT@

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);
}

157
examples/opmhash.cpp Normal file
View File

@@ -0,0 +1,157 @@
/*
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, const std::string& filename, std::size_t line_number, std::size_t content_hash) :
name(name),
filename(filename),
line_number(line_number),
content_hash(content_hash)
{}
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,6 +21,7 @@
#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>
@@ -30,16 +31,16 @@
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;
}

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

@@ -0,0 +1,505 @@
/*
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 <string>
#include <string.h>
#include <sstream>
#include <iterator>
#include <iomanip>
#include <algorithm>
#include "EclFile.hpp"
// anonymous namespace for EclFile
namespace {
bool isEOF(std::fstream *fileH){
/* try to read 4 byte (integer), if passed eof of, return true.
if not, seek back to current file possition */
int num;
long int pos=fileH->tellg();
fileH->read((char *)&num, sizeof(num));
if (fileH->eof()){
return true;
} else {
fileH->seekg (pos);
return false;
}
}
int flipEndianInt(const int &num) {
unsigned int tmp=__builtin_bswap32(num);
return (int)tmp;
}
float flipEndianFloat(const float &num) {
float value=num;
char *floatToConvert = reinterpret_cast<char*>(&value);
std::reverse(floatToConvert, floatToConvert+4);
return value;
}
double flipEndianDouble(const double &num) {
double value=num;
char *doubleToConvert = reinterpret_cast<char*>(&value);
std::reverse(doubleToConvert, doubleToConvert+8);
return value;
}
std::tuple<const int, const int> block_size_data(EIOD::eclArrType arrType){
switch(arrType) {
case EIOD::INTE : return std::make_tuple(EIOD::sizeOfInte,EIOD::MaxBlockSizeInte); break;
case EIOD::REAL : return std::make_tuple(EIOD::sizeOfReal,EIOD::MaxBlockSizeReal); break;
case EIOD::DOUB : return std::make_tuple(EIOD::sizeOfDoub,EIOD::MaxBlockSizeDoub); break;
case EIOD::LOGI : return std::make_tuple(EIOD::sizeOfLogi,EIOD::MaxBlockSizeLogi); break;
case EIOD::CHAR : return std::make_tuple(EIOD::sizeOfChar,EIOD::MaxBlockSizeChar); break;
case EIOD::MESS : throw std::invalid_argument("Type 'MESS' have not assosiated data") ; break;
default : throw std::invalid_argument("Unknown type"); break;
}
}
std::string trimr(const std::string &str1) {
std::string tmpStr=str1;
while (tmpStr.back()==' '){
tmpStr.pop_back();
}
return std::move(tmpStr);
}
void readBinaryHeader(std::fstream &fileH, std::string &arrName, int &size, EIOD::eclArrType &arrType){
int bhead;
std::string tmpStrName(8,' ');
std::string tmpStrType(4,' ');
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
fileH.read((char *)&bhead, sizeof(bhead));
bhead=flipEndianInt(bhead);
if (bhead!=16){
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
throw std::runtime_error(message);
}
fileH.read(&tmpStrName[0], 8);
fileH.read((char *)&size, sizeof(size));
size=flipEndianInt(size);
fileH.read(&tmpStrType[0], 4);
fileH.read((char *)&bhead, sizeof(bhead));
bhead=flipEndianInt(bhead);
if (bhead!=16){
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
throw std::runtime_error(message);
}
arrName=tmpStrName;
if (tmpStrType=="INTE")
arrType=EIOD::INTE;
else if (tmpStrType=="REAL")
arrType=EIOD::REAL;
else if (tmpStrType=="DOUB")
arrType=EIOD::DOUB;
else if (tmpStrType=="CHAR")
arrType=EIOD::CHAR;
else if (tmpStrType=="LOGI")
arrType=EIOD::LOGI;
else if (tmpStrType=="MESS")
arrType=EIOD::MESS;
else
throw std::runtime_error("Error, unknown array type '" + tmpStrType +"'");
}
unsigned long int sizeOnDisk(const int num, const EIOD::eclArrType &arrType){
unsigned long int size=0;
if (arrType==EIOD::MESS){
if (num>0) {
std::string message="In routine calcSizeOfArray, type MESS can not have size > 0";
throw std::invalid_argument(message);
}
} else {
auto sizeData = block_size_data(arrType);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
size=num*sizeOfElement;
size=size + ((num-1) / maxNumberOfElements)*2*EIOD::sizeOfInte; // 8 byte (two integers) every 1000 element
if (num>0){
size=size+2*EIOD::sizeOfInte;
}
}
return size;
}
std::vector<int> readBinaryInteArray(std::fstream &fileH, const int size){
std::vector<int> arr;
int rest=size;
auto sizeData = block_size_data(EIOD::INTE);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
arr.reserve(size);
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
while (rest > 0) {
int num,dhead,dtail;
fileH.read((char *)&dhead, sizeof(dhead));
dhead=flipEndianInt(dhead);
num=dhead/sizeOfElement;
if ((num > maxNumberOfElements) || (num < 0)){
std::string message="Error reading binary inte data, inconsistent header data or incorrect number of elements";
throw std::runtime_error(message);
}
for (int i=0;i<num;i++){
int value;
fileH.read((char *)&value, sizeOfElement);
value=flipEndianInt(value);
arr.push_back(value);
}
rest=rest-num;
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
std::string message="Error reading binary integer data, incorrect number of elements";
throw std::runtime_error(message);
}
fileH.read((char *)&dtail, sizeof(dtail));
dtail=flipEndianInt(dtail);
if (dhead!=dtail){
std::string message="Error reading binary real data, tail not matching header.";
throw std::runtime_error(message);
}
}
return arr;
}
std::vector<float> readBinaryRealArray(std::fstream &fileH, const int size){
std::vector<float> arr;
arr.reserve(size);
auto sizeData = block_size_data(EIOD::REAL);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
int rest=size;
while (rest > 0) {
int num,dhead,dtail;
fileH.read((char *)&dhead, sizeof(dhead));
dhead=flipEndianInt(dhead);
num=dhead/sizeOfElement;
if ((num > maxNumberOfElements) || (num < 0)){
std::string message="Error reading binary real data, inconsistent header data or incorrect number of elements";
throw std::runtime_error(message);
}
for (int i=0;i<num;i++){
float value;
fileH.read((char *)&value, sizeOfElement);
value=flipEndianFloat(value);
arr.push_back(value);
}
rest=rest-num;
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
std::string message="Error reading binary real data, incorrect number of elements";
throw std::runtime_error(message);
}
fileH.read((char *)&dtail, sizeof(dtail));
dtail=flipEndianInt(dtail);
if (dhead!=dtail){
std::string message="Error reading binary real data, tail not matching header.";
throw std::runtime_error(message);
}
}
return arr;
}
std::vector<double> readBinaryDoubArray(std::fstream &fileH, const int size){
std::vector<double> arr;
arr.reserve(size);
auto sizeData = block_size_data(EIOD::DOUB);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
int rest=size;
while (rest > 0) {
int num,dhead,dtail;
fileH.read((char *)&dhead, sizeof(dhead));
dhead=flipEndianInt(dhead);
num=dhead/sizeOfElement;
if ((num > maxNumberOfElements) || (num < 0)){
std::string message="Error reading binary doub data, inconsistent header data or incorrect number of elements";
throw std::runtime_error(message);
}
for (int i=0;i<num;i++){
double value;
fileH.read((char *)&value, sizeOfElement);
value=flipEndianDouble(value);
arr.push_back(value);
}
rest=rest-num;
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
std::string message="Error reading binary doub data, incorrect number of elements";
throw std::runtime_error(message);
}
fileH.read((char *)&dtail, sizeof(dtail));
dtail=flipEndianInt(dtail);
if (dhead!=dtail){
std::string message="Error reading binary doub data, tail not matching header.";
throw std::runtime_error(message);
}
}
return arr;
}
std::vector<bool> readBinaryLogiArray(std::fstream &fileH, const int size){
std::vector<bool> arr;
arr.reserve(size);
int rest=size;
auto sizeData = block_size_data(EIOD::LOGI);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
while (rest > 0) {
int num,dhead,dtail;
fileH.read((char *)&dhead, sizeof(dhead));
dhead=flipEndianInt(dhead);
num=dhead/sizeOfElement;
if ((num > maxNumberOfElements) || (num < 0)){
std::string message="This ?? Error reading binary logi data, inconsistent header data or incorrect number of elements";
throw std::runtime_error(message);
}
for (int i=0;i<num;i++){
bool value;
unsigned int intVal;
fileH.read((char *)&intVal, sizeOfElement);
if (intVal==EIOD::true_value){
value=true;
} else if (intVal==EIOD::false_value){
value=false;
} else {
std::string message="Error reading log value from element " + std::to_string(i);
throw std::runtime_error(message);
}
arr.push_back(value);
}
rest=rest-num;
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
std::string message="Error reading binary logi data, incorrect number of elements";
throw std::runtime_error(message);
}
fileH.read((char *)&dtail, sizeof(dtail));
dtail=flipEndianInt(dtail);
if (dhead!=dtail){
std::string message="Error reading binary logi data, tail not matching header.";
throw std::runtime_error(message);
}
}
return arr;
}
std::vector<std::string> readBinaryCharArray(std::fstream &fileH, const int size){
std::vector<std::string> arr;
arr.reserve(size);
int rest=size;
auto sizeData = block_size_data(EIOD::CHAR);
int sizeOfElement = std::get<0>(sizeData);
int maxBlockSize = std::get<1>(sizeData);
int maxNumberOfElements=maxBlockSize/sizeOfElement;
if (!fileH.is_open()){
std::string message="fstream fileH not open for reading";
throw std::runtime_error(message);
}
while (rest > 0) {
int num,dhead,dtail;
fileH.read((char *)&dhead, sizeof(dhead));
dhead=flipEndianInt(dhead);
num=dhead/sizeOfElement;
if ((num > maxNumberOfElements) || (num < 0)){
std::string message="Error reading binary char data, inconsistent header data or incorrect number of elements";
throw std::runtime_error(message);
}
for (int i=0;i<num;i++){
std::string str8(8,' ');
fileH.read(&str8[0], sizeOfElement);
arr.push_back(trimr(str8));
}
rest=rest-num;
if ((num < maxNumberOfElements) && (rest!=0)){
std::string message="Error reading binary char data, incorrect number of elements";
throw std::runtime_error(message);
}
fileH.read((char *)&dtail, sizeof(dtail));
dtail=flipEndianInt(dtail);
if (dhead!=dtail){
std::string message="Error reading binary char data, tail not matching header.";
throw std::runtime_error(message);
}
}
return arr;
}
} // anonymous namespace
EclFile::EclFile(const std::string& filename){
std::fstream fileH;
fileH.open(filename, std::ios::in | std::ios::binary);
if (!fileH.good()) {
std::string message="Could not open file";
throw std::runtime_error(message);
}
fileH.close();
}

View File

@@ -0,0 +1,41 @@
/*
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 "EclIO.hpp"
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <ctime>
#include <map>
#include <examples/test_util/data/EclIOdata.hpp>
namespace EIOD = Opm::ecl;
class EclFile
{
public:
explicit EclFile(const std::string& filename);
};

View File

@@ -231,20 +231,23 @@ void ECLRegressionTest::gridCompare(const bool volumecheck) const {
void ECLRegressionTest::results() {
if (keywords1.size() != keywords2.size()) {
std::set<std::string> keys(keywords1.begin() , keywords1.end());
for (const auto& key2: keywords2)
keys.insert( key2 );
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()));
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.");
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);

View File

@@ -40,6 +40,10 @@ class ECLRegressionTest: public ECLFilesComparator {
// 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;
@@ -69,6 +73,11 @@ class ECLRegressionTest: public ECLFilesComparator {
//! \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 acceptExtraKeywordsArg) { this->acceptExtraKeywords = acceptExtraKeywordsArg; }
//! \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;

View File

@@ -132,6 +132,7 @@ int main(int argc, char** argv) {
bool allowSpikes = false;
bool throwOnError = true;
bool throwTooGreatErrorRatio = true;
bool acceptExtraKeywords = false;
bool analysis = false;
bool volumecheck = true;
char* keyword = nullptr;
@@ -140,7 +141,7 @@ int main(int argc, char** argv) {
int c = 0;
int spikeLimit = -1;
while ((c = getopt(argc, argv, "hiIk:alnpPt:VRgs:m:vK")) != -1) {
while ((c = getopt(argc, argv, "hiIk:alnpPt:VRgs:m:vKx")) != -1) {
switch (c) {
case 'a':
analysis = true;
@@ -198,6 +199,9 @@ int main(int argc, char** argv) {
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;
@@ -277,6 +281,7 @@ int main(int argc, char** argv) {
compare.doAnalysis(analysis);
compare.setPrintKeywords(printKeywords);
compare.setIsRestartFile(restartFile);
compare.setAllowDifferentNumberOfKeywords(acceptExtraKeywords);
if(specificKeyword){
compare.getRegressionTest(keyword);
}
@@ -344,6 +349,7 @@ int main(int argc, char** argv) {
ECLRegressionTest comparator(file_type, basename1, basename2, absTolerance, relTolerance);
comparator.throwOnErrors(throwOnError);
comparator.doAnalysis(analysis);
comparator.setAcceptExtraKeywords(acceptExtraKeywords);
if (printKeywords) {
comparator.printKeywords();
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

@@ -0,0 +1,54 @@
/*
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_ECLIO_DATA_HPP
#define OPM_ECLIO_DATA_HPP
#include <tuple>
namespace Opm {
namespace ecl {
// type MESS have no assisiated data
enum eclArrType {
INTE, REAL, DOUB, CHAR, LOGI, MESS
};
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
} // ecl
} // Opm
#endif // OPM_ECLIO_DATA_HPP

View File

@@ -17,10 +17,10 @@
*/
#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 <ert/ecl/ecl_sum.hpp>
#include <ert/util/stringlist.hpp>
#include <ert/util/int_vector.hpp>
#include <ert/util/bool_vector.hpp>
#include <opm/common/ErrorMacros.hpp>
#include <cmath>
#include <numeric>

View File

@@ -19,8 +19,8 @@
#include "summaryIntegrationTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h>
#include <ert/ecl/ecl_sum.hpp>
#include <ert/util/stringlist.hpp>
#include <cmath>
@@ -155,13 +155,10 @@ void SummaryIntegrationTest::findGreatestErrorRatio(const WellProductionVolume&
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.
}
const ecl::smspec_node * 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.
if (node->is_historical())
return;
if (!mainVariable.empty()){
std::string keywordString(keyword);
std::string firstFour = keywordString.substr(0,4);

View File

@@ -18,7 +18,7 @@
#include "summaryRegressionTest.hpp"
#include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h>
#include <ert/ecl/ecl_sum.hpp>
#include <ert/util/stringlist.h>
#include <string>
@@ -28,7 +28,9 @@ void SummaryRegressionTest::getRegressionTest(){
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)){
if((! this->allowDifferentNumberOfKeywords) &&
(stringlist_get_size(keysShort) != stringlist_get_size(keysLong)))
{
int missing_count = 0;
std::cout << "Keywords missing from one case: " << std::endl;
@@ -169,3 +171,8 @@ bool SummaryRegressionTest::startTest(const char* keyword){
return result;
}
void SummaryRegressionTest::setAllowDifferentNumberOfKeywords(const bool allow)
{
this->allowDifferentNumberOfKeywords = allow;
}

View File

@@ -48,6 +48,12 @@ class SummaryRegressionTest: public SummaryComparator {
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
/// Whether or not to require that the two files have the same
/// number of keywords. Throw exception if not.
/// Default value: false (don't allow different number of keywords).
bool allowDifferentNumberOfKeywords = false;
public:
//! \brief Constructor, creates an object of RefressionTest class.
//! \param[in] basename1 Path to file1 without extension.
@@ -69,6 +75,13 @@ class SummaryRegressionTest: public SummaryComparator {
//! \brief This function sets the private member variable isRestartFiles
//! \param[in] boolean Boolean value
void setIsRestartFile(bool boolean){this->isRestartFile = boolean;}
/// \brief Dynamically control whether or not to require equal
/// number of keywords (vectors) in the two result sets.
///
/// \param[in] allow Whether or not to allow different number of
/// summary keywords in the two result sets.
void setAllowDifferentNumberOfKeywords(const bool allow);
};
#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-common]="-DENABLE_WELL_TEST=ON"
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=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
@@ -112,6 +132,7 @@ function build_module {
else
cmake --build . --target install
fi
test $? -eq 0 || exit 3
fi
}
@@ -163,7 +184,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
@@ -178,7 +199,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
@@ -215,7 +236,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

@@ -0,0 +1,52 @@
#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 msim {
public:
using well_rate_function = double(const EclipseState&, const Schedule&, 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);
void post_step(Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
private:
void run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
void run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const;
void output(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, 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

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

@@ -0,0 +1,148 @@
/*
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/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) :
state(state)
{}
void msim::run(Schedule& schedule, EclipseIO& io) {
const double week = 7 * 86400;
data::Solution sol;
data::Wells well_data;
io.writeInitial();
for (size_t report_step = 1; report_step < schedule.size(); report_step++) {
double time_step = std::min(week, 0.5*schedule.stepLength(report_step - 1));
run_step(schedule, sol, well_data, report_step, time_step, io);
post_step(schedule, sol, well_data, report_step, io);
}
}
void msim::post_step(Schedule& schedule, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step, EclipseIO& io) const {
const auto& actions = schedule.actions();
if (actions.empty())
return;
const SummaryState& summary_state = io.summaryState();
ActionContext context( summary_state );
std::vector<std::string> matching_wells;
auto sim_time = schedule.simTime(report_step);
for (const auto& action : actions.pending(sim_time)) {
if (action->eval(sim_time, context, matching_wells))
schedule.applyAction(report_step, *action, matching_wells);
}
}
void msim::run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
this->run_step(schedule, sol, well_data, report_step, schedule.stepLength(report_step - 1), io);
}
void msim::run_step(const Schedule& schedule, 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, sol, well_data, report_step, seconds_elapsed, time_step);
seconds_elapsed += time_step;
this->output(report_step,
(seconds_elapsed < end_time),
seconds_elapsed,
sol,
well_data,
io);
}
}
void msim::output(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(report_step,
false,
seconds_elapsed,
value,
{},
{},
{});
}
void msim::simulate(const Schedule& schedule, 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, 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

@@ -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

@@ -0,0 +1,75 @@
/*
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_AGGREGATE_CONNECTION_DATA_HPP
#define OPM_AGGREGATE_CONNECTION_DATA_HPP
#include <opm/output/eclipse/WindowedArray.hpp>
#include <cstddef>
#include <string>
#include <vector>
namespace Opm {
class EclipseGrid;
class Schedule;
class UnitSystem;
} // Opm
namespace Opm { namespace data {
class WellRates;
}}
namespace Opm { namespace RestartIO { namespace Helpers {
class AggregateConnectionData
{
public:
explicit AggregateConnectionData(const std::vector<int>& inteHead);
void captureDeclaredConnData(const Opm::Schedule& sched,
const Opm::EclipseGrid& grid,
const Opm::UnitSystem& units,
const Opm::data::WellRates& xw,
const std::size_t sim_step);
const std::vector<int>& getIConn() const
{
return this->iConn_.data();
}
const std::vector<float>& getSConn() const
{
return this->sConn_.data();
}
const std::vector<double>& getXConn() const
{
return this->xConn_.data();
}
private:
WindowedMatrix<int> iConn_;
WindowedMatrix<float> sConn_;
WindowedMatrix<double> xConn_;
};
}}} // Opm::RestartIO::Helpers
#endif // OPM_AGGREGATE_CONNECTION_DATA_HPP

View File

@@ -0,0 +1,173 @@
/*
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_GROUP_DATA_HPP
#define OPM_AGGREGATE_GROUP_DATA_HPP
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <map>
namespace Opm {
class Schedule;
class SummaryState;
class Group;
} // 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;
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);
private:
std::map <size_t, const Opm::Group*> m_indexGroupMap;
std::map <const std::string, size_t> m_groupNameIndexMap;
};
class AggregateGroupData
{
public:
explicit AggregateGroupData(const std::vector<int>& inteHead);
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<int>& getIGroup() const
{
return this->iGroup_.data();
}
const std::vector<float>& getSGroup() const
{
return this->sGroup_.data();
}
const std::vector<double>& getXGroup() const
{
return this->xGroup_.data();
}
const std::vector<CharArrayNullTerm<8>>& getZGroup() const
{
return this->zGroup_.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<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::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<CharArrayNullTerm<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

@@ -0,0 +1,116 @@
/*
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_MSW_DATA_HPP
#define OPM_AGGREGATE_MSW_DATA_HPP
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/CharArrayNullTerm.hpp>
#include <opm/output/eclipse/WindowedArray.hpp>
#include <string>
#include <vector>
namespace Opm {
class Phases;
class Schedule;
class EclipseGrid;
class UnitSystem;
class SummaryState;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
struct BranchSegmentPar {
int outletS;
int noSegInBranch;
int firstSeg;
int lastSeg;
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:
explicit AggregateMSWData(const std::vector<int>& inteHead);
void captureDeclaredMSWData(const Opm::Schedule& sched,
const std::size_t rptStep,
const Opm::UnitSystem& units,
const std::vector<int>& inteHead,
const Opm::EclipseGrid& grid,
const Opm::SummaryState& smry,
const Opm::data::WellRates& wr
);
/// Retrieve Integer Multisegment well data Array.
const std::vector<int>& getISeg() const
{
return this->iSeg_.data();
}
/// Retrieve Double precision segment data Array.
const std::vector<double>& getRSeg() const
{
return this->rSeg_.data();
}
/// Retrieve Integer multisegment well data Array for lateral branches (ILBS)
const std::vector<int>& getILBs() const
{
return this->iLBS_.data();
}
/// Retrieve Integer multisegment well data Array for lateral branches (ILBR)
const std::vector<int>& getILBr() const
{
return this->iLBR_.data();
}
private:
/// Aggregate 'ISEG' array (Integer) for all multisegment wells
WindowedArray<int> iSeg_;
/// Aggregate 'RSEG' array (Double) for all multisegment wells
WindowedArray<double> rSeg_;
/// Aggregate 'ILBS' array (Integer) for all multisegment wells
WindowedArray<int> iLBS_;
/// Aggregate 'ILBR' array (Integer) for all multisegment wells
WindowedArray<int> iLBR_;
};
}}} // Opm::RestartIO::Helpers
#endif // OPM_AGGREGATE_WELL_DATA_HPP

View File

@@ -44,12 +44,15 @@ namespace Opm { namespace RestartIO { namespace Helpers {
public:
explicit AggregateWellData(const std::vector<int>& inteHead);
void captureDeclaredWellData(const Opm::Schedule& sched,
const Opm::UnitSystem& units,
const std::size_t sim_step);
void captureDeclaredWellData(const Schedule& sched,
const UnitSystem& units,
const std::size_t sim_step,
const ::Opm::SummaryState& smry,
const std::vector<int>& inteHead);
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);
@@ -77,6 +80,8 @@ namespace Opm { namespace RestartIO { namespace Helpers {
return this->zWell_.data();
}
private:
/// Aggregate 'IWEL' array (Integer) for all wells.
WindowedArray<int> iWell_;

View File

@@ -53,9 +53,11 @@ 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);
const std::vector<double>& data() const
{

View File

@@ -41,6 +41,7 @@ namespace Opm {
class EclipseState;
class SummaryConfig;
class Schedule;
class SummaryState;
/*!
* \brief A class to write the reservoir state and the well state of a
@@ -177,7 +178,7 @@ public:
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,
bool write_double = false);
const bool write_double = false);
/*
@@ -224,6 +225,8 @@ public:
EclipseIO( const EclipseIO& ) = delete;
~EclipseIO();
const SummaryState& summaryState() const;
private:
class Impl;
std::unique_ptr< Impl > impl;

View File

@@ -85,6 +85,10 @@ namespace Opm { namespace RestartIO {
int mxwsit;
int mxwpit;
};
struct Group {
int ngroups;
};
InteHEAD();
~InteHEAD() = default;
@@ -112,6 +116,7 @@ namespace Opm { namespace RestartIO {
InteHEAD& variousParam(const int version, const int iprog);
InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
InteHEAD& regionDimensions(const RegDims& rdim);
InteHEAD& ngroups(const Group& gr);
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

@@ -38,7 +38,9 @@ namespace Opm { namespace RestartIO {
LogiHEAD& variousParam(const bool e300_radial,
const bool e100_radial,
const int nswlmx);
const int nswlmx,
const bool enableHyster
);
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,35 +24,38 @@
#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/parser/eclipse/EclipseState/Schedule/Well/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 <opm/parser/eclipse/EclipseState/Schedule/SummaryState.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 <map>
#include <utility>
#include <vector>
namespace Opm {
class EclipseGrid;
class EclipseState;
class Phases;
class Schedule;
class EclipseGrid;
class EclipseState;
class Phases;
class Schedule;
namespace RestartIO {
} // namespace Opm
/*
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
@@ -68,28 +72,30 @@ 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,
RestartValue value,
const EclipseState& es,
const EclipseGrid& grid,
const Schedule& schedule,
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);
std::pair<RestartValue, SummaryState>
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 = {});
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 = {});
}} // namespace Opm::RestartIO
}
}
#endif
#endif // RESTART_IO_HPP

View File

@@ -71,6 +71,9 @@ namespace Opm {
void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
void addExtra(const std::string& key, std::vector<double> data);
const std::vector<double>& getExtra(const std::string& key) const;
void convertFromSI(const UnitSystem& units);
void convertToSI(const UnitSystem& units);
};
}

View File

@@ -20,16 +20,15 @@
#ifndef OPM_OUTPUT_SUMMARY_HPP
#define OPM_OUTPUT_SUMMARY_HPP
#include <map>
#include <string>
#include <vector>
#include <unordered_map>
#include <ert/ecl/ecl_sum.h>
#include <ert/ecl/Smspec.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/output/eclipse/SummaryState.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/output/eclipse/RegionCache.hpp>
@@ -64,6 +63,8 @@ class Summary {
const SummaryState& get_restart_vectors() const;
void reset_cumulative_quantities(const SummaryState& rstrt);
private:
class keyword_handlers;

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).
@@ -42,6 +44,15 @@ namespace Opm {
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,6 +112,30 @@ namespace Opm {
const bool gas,
const bool oil,
const bool wat);
/// 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);
};
/// Emit normalised tabular information (TABDIMS and TAB vectors) to

View File

@@ -0,0 +1,76 @@
/*
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_CONNECTION_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace IConn {
enum index : std::vector<int>::size_type {
SeqIndex = 0, // Connection sequence index
CellI = 1, // I-location (1-based cell index) of connection
CellJ = 2, // J-location (1-based cell index) of connection
CellK = 3, // K-location (1-based cell index) of connection
ConnStat = 5, // Connection status.
// > 0 => open, shut otherwise
Drainage = 6, // Saturation function (table ID) for drainage
Imbibition = 9, // Saturation function (table ID) for imbibition
ComplNum = 12, // Completion ID (1-based)
ConnDir = 13, // Penetration direction (1:X, 2:Y, 3:Z)
Segment = 14, // Segment ID of connection
// 0 for regular connections, > 0 for MSW.
};
} // IConn
namespace SConn {
enum index : std::vector<float>::size_type {
ConnTrans = 0, // Connection transmissibility factor
Depth = 1, // Connection centre depth
Diameter = 2, // Connection diameter
EffectiveKH = 3, // Effective Kh product of connection
item12 = 11, // Connection transmissibility factor
SegDistEnd = 20, // Distance to end of connection in segment
SegDistStart = 21, // Distance to start of connection in segment
item30 = 29, // Unknown
item31 = 30, // Unknown
};
} // SConn
namespace XConn {
enum index : std::vector<double>::size_type {
OilRate = 0, // Surface flow rate (oil)
WaterRate = 1, // Surface flow rate (water)
GasRate = 2, // Surface Flow rate (gas)
Pressure = 34, // Connection pressure value
ResVRate = 49, // Reservoir voidage rate
};
} // XConn
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_CONNECTION_HPP

View File

@@ -0,0 +1,37 @@
/*
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
};
}}}} // 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

@@ -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

@@ -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

@@ -42,12 +42,13 @@ namespace Opm {
namespace Opm { namespace RestartIO { namespace Helpers {
const double UNIMPLEMENTED_VALUE = 1e-100; // placeholder for values not yet available
std::vector<double>
createDoubHead(const EclipseState& es,
const Schedule& sched,
const std::size_t lookup_step,
const double simTime);
const double simTime,
const double nextTimeStep);
@@ -57,12 +58,12 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const Schedule& sched,
const double simTime,
const int num_solver_steps,
const int lookup_step, // The integer index used to look up dynamic properties, e.g. the number of well.
const int report_step); // The integer number this INTEHEAD keyword will be saved to, typically report_step = lookup_step + 1.
const int lookup_step); // The integer index used to look up dynamic properties, e.g. the number of well.
std::vector<bool>
createLogiHead(const EclipseState& es);
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.

File diff suppressed because it is too large Load Diff

View File

@@ -147,6 +147,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

@@ -105,7 +105,7 @@ 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;
std::vector< int > ival;

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

@@ -93,6 +93,7 @@ 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);

View File

@@ -29,11 +29,13 @@
namespace Opm {
class Deck;
class ParseContext;
class ErrorGuard;
class EclipseConfig
{
public:
EclipseConfig(const Deck& deck);
EclipseConfig(const Deck& deck, const ParseContext& parseContext, ErrorGuard& errors);
const InitConfig& init() const;
const IOConfig& io() const;

View File

@@ -23,15 +23,17 @@
#include <memory>
#include <vector>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
namespace Opm {
@@ -64,9 +66,11 @@ namespace Opm {
AllProperties = IntProperties | DoubleProperties
};
EclipseState(const Deck& deck , ParseContext parseContext = ParseContext());
template<typename T>
EclipseState(const Deck& deck , const ParseContext& parseContext, T&& errors);
EclipseState(const Deck& deck , const ParseContext& parseContext, ErrorGuard& errors);
EclipseState(const Deck& deck);
const ParseContext& getParseContext() const;
const IOConfig& getIOConfig() const;
IOConfig& getIOConfig();
@@ -85,6 +89,11 @@ namespace Opm {
const NNC& getInputNNC() const;
bool hasInputNNC() const;
/// editing non-neighboring connections
/// the non-standard adjacencies as specified in input deck
const EDITNNC& getInputEDITNNC() const;
bool hasInputEDITNNC() const;
const Eclipse3DProperties& get3DProperties() const;
const TableManager& getTableManager() const;
const EclipseConfig& getEclipseConfig() const;
@@ -112,12 +121,12 @@ namespace Opm {
void complainAboutAmbiguousKeyword(const Deck& deck,
const std::string& keywordName);
ParseContext m_parseContext;
const TableManager m_tables;
Runspec m_runspec;
EclipseConfig m_eclipseConfig;
UnitSystem m_deckUnitSystem;
NNC m_inputNnc;
EDITNNC m_inputEditNnc;
EclipseGrid m_inputGrid;
Eclipse3DProperties m_eclipseProperties;
const SimulationConfig m_simulationConfig;

View File

@@ -0,0 +1,48 @@
/*
Copyright 2018 Equinor AS
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_COMMON_EDITNNC_HPP
#define OPM_COMMON_EDITNNC_HPP
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
namespace Opm
{
/// Represents edit information for non-neighboring connections (NNCs, faults, etc.)
class EDITNNC
{
public:
EDITNNC() = default;
/// Construct from input deck
explicit EDITNNC(const Deck& deck);
/// \brief Get an ordered set of EDITNNC
const std::vector<NNCdata>& data() const
{
return m_editnnc;
}
/// \brief Get the number of entries
size_t size() const;
/// \brief Whether EDITNNC was empty.
bool empty() const;
private:
std::vector<NNCdata> m_editnnc;
};
}
#endif // OPM_COMMON_EDITNNC_HPP

View File

@@ -38,6 +38,7 @@ namespace Opm {
class Deck;
class ZcornMapper;
class NNC;
/**
About cell information and dimension: The actual grid
@@ -76,6 +77,8 @@ namespace Opm {
/// explicitly. If a null pointer is passed, every cell is active.
EclipseGrid(const Deck& deck, const int * actnum = nullptr);
static bool hasGDFILE(const Deck& deck);
static bool hasCylindricalKeywords(const Deck& deck);
static bool hasCornerPointKeywords(const Deck&);
static bool hasCartesianKeywords(const Deck&);
@@ -85,6 +88,8 @@ namespace Opm {
size_t activeIndex(size_t i, size_t j, size_t k) const;
size_t activeIndex(size_t globalIndex) const;
void save(const std::string& filename, UnitSystem::UnitType output_units) const;
void addNNC(const NNC& nnc);
/*
Observe that the there is a getGlobalIndex(i,j,k)
implementation in the base class. This method - translating
@@ -107,7 +112,7 @@ namespace Opm {
PinchMode::ModeEnum getMultzOption( ) const;
MinpvMode::ModeEnum getMinpvMode() const;
double getMinpvValue( ) const;
const std::vector<double>& getMinpvVector( ) const;
/*
@@ -176,7 +181,7 @@ namespace Opm {
const ecl_grid_type * c_ptr() const;
private:
double m_minpvValue;
std::vector<double> m_minpvVector;
MinpvMode::ModeEnum m_minpvMode;
Value<double> m_pinch;
PinchMode::ModeEnum m_pinchoutMode;
@@ -200,6 +205,7 @@ namespace Opm {
ert_ptr( ecl_grid_alloc_copy( src.get() ) ) {}
};
grid_ptr m_grid;
void initBinaryGrid(const Deck& deck);
void initCornerPointGrid(const std::array<int,3>& dims ,
const std::vector<double>& coord ,

View File

@@ -52,7 +52,7 @@ private:
void addFaultFaces(const GridDims& grid,
const DeckRecord& faultRecord,
const std::string& faultName);
OrderedMap<Fault> m_faults;
OrderedMap<std::string, Fault> m_faults;
};
}

View File

@@ -42,6 +42,7 @@ namespace Opm {
size_t getNY() const;
size_t getNZ() const;
size_t operator[](int dim) const;
const std::array<int, 3> getNXYZ() const;
@@ -64,6 +65,7 @@ namespace Opm {
private:
void init(const DeckKeyword& keyword);
void binary_init(const Deck& deck);
};
}

View File

@@ -141,12 +141,13 @@ namespace Opm {
void handleMULTIPLYRecord( const DeckRecord& record, BoxManager& boxManager);
void handleCOPYRecord( const DeckRecord& record, BoxManager& boxManager);
void handleEQUALSRecord( const DeckRecord& record, BoxManager& boxManager);
void handleOPERATERecord( const DeckRecord& record , BoxManager& boxManager);
void handleEQUALREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty );
void handleADDREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty );
void handleMULTIREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty );
void handleCOPYREGRecord( const DeckRecord& record, const GridProperty<int>& regionProperty );
void handleOPERATERecord( const DeckRecord& record , BoxManager& boxManager);
void handleOPERATERRecord( const DeckRecord& record , const GridProperty<int>& regionProperty );
/*
Iterators over initialized properties. The overloaded
operator*() opens the pair which comes natively from the
@@ -184,6 +185,11 @@ namespace Opm {
const std::string& dimString,
const bool defaultInitializable );
void postAddKeyword(const std::string& name,
std::function< std::vector< T >(size_t) > initProcessor,
const std::string& dimString);
GridProperty<T>& getKeyword(const std::string& keyword);
bool addAutoGeneratedKeyword_(const std::string& keywordName) const;
void insertKeyword(const SupportedKeywordInfo& supportedKeyword) const;

View File

@@ -177,13 +177,91 @@ public:
grid and call the cellsEqual( T , std::vector<int>&) overload,
otherwise it will return indexEqual( value );
*/
std::vector<size_t> cellsEqual(T value, const EclipseGrid& grid, bool active = true) const;
std::vector<size_t> cellsEqual(T value, const EclipseGrid& grid, bool active = true) const;
/*
Will return a std::vector<T> of the data in the active cells.
*/
std::vector<T> compressedCopy( const EclipseGrid& grid) const;
/*
The grid properties like PORO and SATNUM can be created in essentially two
ways; either they can be explicitly assigned in the deck as:
PORO
1000*0.15 /
or they can be created indirectly through various mathematical operations
like:
MULTIPLY
TRANX 0.20 /
/
The deckAssigned() property is used so that we can differentiate between
properties which have been explicitly assigned/loaded from the deck, and
those where the default construction has been invoked. This functionality
is implemented purely to support the TRAN? keywords. The transmissibility
is be default calculated by the simulator code, but the TRAN keywords can
be used in the deck to manipulate this calculation in two different ways:
1. TRAN explicitly assigned in GRID section
===========================================
...
TRANX
1000*0.026 /
COPY
'TRANX' 'TRANY' /
/
In this case the simulator should detect that the input deck has TRANX
specified and just use the input values from the deck. This is the
normal handling of keywords, and agrees with e.g. PERMX and PORO. This
also applies when the COPY keyword has been used, as in the case of
'TRANY' above.
2. TRAN modifier present in EDIT section
========================================
The scenario here is that there is no mention of TRANX in the GRID
section, however the EDIT section contains modifiers like this:
MULTIPLY
TRANX 0.25 /
I.e. we request the TRANX values to be reduced with a factor of 0.25. In
this case the simulator should still calculate transmissibility according
to it's normal algorithm, and then subsequently scale that result with a
factor of 0.25.
In this case the input layer needs to autocreate a TRANX keyword,
defaulted to 1.0 and then scale that to 0.25.
Now - the important point is that when doing transmissibility calculations
the simulator must be able to distinguish between cases 1 and 2,
specifically whether the TRANX keyword should be interpreted as absolute
values(case 1) or as a multiplier(case 2). That is the purpose of the
deckAssigned() property. Pseudo code for the transmissibility calculations
in the simulator could be:
const auto& input_tranx = properties.getKeyword("TRANX");
if (input_tranx.deckAssigned()) {
// set simulator internal transmissibilities to values from input_tranx
tranx = input_tranx;
} else {
// Calculate transmissibilities according to normal simulator algorithm
...
...
// Scale transmissibilities with scale factor from input_tranx
tranx *= input_tranx;
}
*/
bool deckAssigned() const;
private:
const DeckItem& getDeckItem( const DeckKeyword& );
void setDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem);
@@ -192,6 +270,7 @@ private:
SupportedKeywordInfo m_kwInfo;
std::vector<T> m_data;
bool m_hasRunPostProcessor = false;
bool assigned = false;
};
// initialize the TEMPI grid property using the temperature vs depth

View File

@@ -50,14 +50,11 @@ namespace Opm {
class MULTREGTRecord {
public:
MULTREGTRecord(int src, int target, double trans_mult, int directions, MULTREGT::NNCBehaviourEnum nnc_behaviour, const std::string& region_name);
struct MULTREGTRecord {
int src_value;
int target_value;
int directions;
double trans_mult;
int directions;
MULTREGT::NNCBehaviourEnum nnc_behaviour;
std::string region_name;
};

View File

@@ -28,6 +28,10 @@ namespace Opm
{
struct NNCdata {
NNCdata(size_t c1, size_t c2, double t)
: cell1(c1), cell2(c2), trans(t)
{}
NNCdata() = default;
size_t cell1;
size_t cell2;
double trans;

View File

@@ -105,6 +105,41 @@ namespace Opm {
------ Default ------
If no keywords for config of writing restart files have been handled; no restart files are written.
ECL compatible restart
======================
Unfortunately flow & eclipse are not compatible across restarts. The
RestartIO implementation can write restart files for flow -> flow restart
or alternatively for flow -> eclipse restart. This is regulated by the
boolean flag ecl_compatible_restart in the IOConfig class. The difference
between the two are as follows:
ecl_compatible_restart = false:
1. The 'extra' fields in the RestartValue structure are actually
written to disk.
2. You can optionally ask the RestartIO::save() function to save the
solution in double precision.
3. The RestartIO::save() function will save opm specific vector OPM_IWEL
and OPM_XWEL.
ecl_compatible_restart = true:
1. The 'extra' fields in the RestartValue are silently ignored.
2. If request double precision solution data that is silently ignored,
it will be float.
3. The OPM_IWEL and OPM_XWEL vectors will not be written.
Observe that the solution data in the RestartValue is passed
unconditionally to the solution section in the restart file, so if you
pass a field in the solution section which Eclipse does not recognize you
will end up with a restart file which Eclipse can not read, even if you
have set ecl_compatible_restart to true.
*/
@@ -117,7 +152,8 @@ namespace Opm {
explicit IOConfig( const Deck& );
explicit IOConfig( const std::string& input_path );
void setEclCompatibleRST(bool ecl_rst);
bool getEclCompatibleRST() const;
bool getWriteEGRIDFile() const;
bool getWriteINITFile() const;
bool getUNIFOUT() const;
@@ -138,7 +174,7 @@ namespace Opm {
void setOutputDir(const std::string& outputDir);
const std::string& getBaseName() const;
void setBaseName(std::string baseName);
void setBaseName(const std::string& baseName);
/// Return a string consisting of outputpath and basename;
/// i.e. /path/to/sim/CASE
@@ -163,8 +199,9 @@ namespace Opm {
std::string m_deck_filename;
bool m_output_enabled = true;
std::string m_output_dir;
std::string m_base_name;
bool m_nosim;
std::string m_base_name;
bool ecl_compatible_rst = true;
IOConfig( const GRIDSection&,
const RUNSPECSection&,

View File

@@ -200,7 +200,8 @@ namespace Opm {
class SOLUTIONSection;
class TimeMap;
class Schedule;
class ParseContext;
class ErrorGuard;
/*The IOConfig class holds data about input / ouput configurations
@@ -317,19 +318,27 @@ namespace Opm {
public:
RestartConfig();
explicit RestartConfig( const Deck& );
template<typename T>
RestartConfig( const Deck&, const ParseContext& parseContext, T&& errors );
RestartConfig( const Deck&, const ParseContext& parseContext, ErrorGuard& errors );
RestartConfig( const Deck& );
RestartConfig( const SCHEDULESection& schedule,
const SOLUTIONSection& solution,
const ParseContext& parseContext,
ErrorGuard& errors,
TimeMap timemap );
int getFirstRestartStep() const;
bool getWriteRestartFile(size_t timestep) const;
bool getWriteRestartFile(size_t timestep, bool log=true) const;
const std::map< std::string, int >& getRestartKeywords( size_t timestep ) const;
int getKeyword( const std::string& keyword, size_t timeStep) const;
void overrideRestartWriteInterval(size_t interval);
void handleSolutionSection(const SOLUTIONSection& solutionSection);
void handleSolutionSection(const SOLUTIONSection& solutionSection, const ParseContext& parseContext, ErrorGuard& errors);
void setWriteInitialRestartFile(bool writeInitialRestartFile);
RestartSchedule getNode( size_t timestep ) const;
@@ -356,12 +365,13 @@ namespace Opm {
int m_first_restart_step;
bool m_write_initial_RST_file = false;
void handleScheduleSection( const SCHEDULESection& schedule);
void handleScheduleSection( const SCHEDULESection& schedule, const ParseContext& parseContext, ErrorGuard& errors);
void update( size_t step, const RestartSchedule& rs);
static RestartSchedule rptsched( const DeckKeyword& );
DynamicState< RestartSchedule > restart_schedule;
DynamicState< std::map< std::string, int > > restart_keywords;
std::vector< bool > save_keywords;
};
} //namespace Opm

View File

@@ -24,7 +24,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
#include <opm/parser/eclipse/EclipseState/EndpointScaling.hpp>
#include <opm/parser/eclipse/EclipseState/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
namespace Opm {
class Deck;
@@ -75,7 +75,12 @@ public:
return this->nGMax;
}
int maxWellsInField() const
{
return this->nWMax;
}
private:
int nWMax { 0 };
int nCWMax { 0 };
int nWGMax { 0 };
int nGMax { 0 };
@@ -107,27 +112,73 @@ private:
int nLatBranchMax;
};
class Runspec {
public:
explicit Runspec( const Deck& );
class EclHysterConfig
{
public:
explicit EclHysterConfig(const Deck& deck);
const UDQConfig& udqConfig() const noexcept;
const Phases& phases() const noexcept;
const Tabdims& tabdims() const noexcept;
const EndpointScaling& endpointScaling() const noexcept;
const Welldims& wellDimensions() const noexcept;
const WellSegmentDims& wellSegmentDimensions() const noexcept;
int eclPhaseMask( ) const noexcept;
private:
Phases active_phases;
Tabdims m_tabdims;
EndpointScaling endscale;
Welldims welldims;
WellSegmentDims wsegdims;
UDQConfig udq_config;
/*!
* \brief Specify whether hysteresis is enabled or not.
*/
//void setActive(bool yesno);
/*!
* \brief Returns whether hysteresis is enabled (active).
*/
bool active() const;
/*!
* \brief Return the type of the hysteresis model which is used for capillary pressure.
*
* -1: capillary pressure hysteresis is disabled
* 0: use the Killough model for capillary pressure hysteresis
*/
int pcHysteresisModel() const;
/*!
* \brief Return the type of the hysteresis model which is used for relative permeability.
*
* -1: relperm hysteresis is disabled
* 0: use the Carlson model for relative permeability hysteresis
*/
int krHysteresisModel() const;
private:
// enable hysteresis at all
bool activeHyst { false };
// the capillary pressure and the relperm hysteresis models to be used
int pcHystMod { 0 };
int krHystMod { 0 };
};
class Runspec {
public:
explicit Runspec( const Deck& );
const UDQParams& udqParams() const noexcept;
const Phases& phases() const noexcept;
const Tabdims& tabdims() const noexcept;
const EndpointScaling& endpointScaling() const noexcept;
const Welldims& wellDimensions() const noexcept;
const WellSegmentDims& wellSegmentDimensions() const noexcept;
int eclPhaseMask( ) const noexcept;
const EclHysterConfig& hysterPar() const noexcept;
private:
Phases active_phases;
Tabdims m_tabdims;
EndpointScaling endscale;
Welldims welldims;
WellSegmentDims wsegdims;
UDQParams udq_params;
EclHysterConfig hystpar;
};
}
#endif // OPM_RUNSPEC_HPP

View File

@@ -0,0 +1,50 @@
/*
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/>.
*/
#ifndef ActionAST_HPP
#define ActionAST_HPP
#include <string>
#include <vector>
#include <memory>
namespace Opm {
class ActionContext;
class ASTNode;
class ActionAST{
public:
ActionAST() = default;
explicit ActionAST(const std::vector<std::string>& tokens);
bool eval(const ActionContext& context, std::vector<std::string>& matching_wells) const;
private:
/*
The use of a pointer here is to be able to create this class with only a
forward declaration of the ASTNode class. Would have prefered to use a
unique_ptr, but that requires writing custom destructors - the use of a
shared_ptr does not imply any shared ownership.
*/
std::shared_ptr<ASTNode> condition;
};
}
#endif

View File

@@ -0,0 +1,55 @@
/*
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/>.
*/
#ifndef ActionContext_HPP
#define ActionContext_HPP
#include <string>
#include <map>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
namespace Opm {
class ActionContext {
public:
/*
Observe that the ActionContext takes a copy of the SummaryState object.
*/
explicit ActionContext(const SummaryState& summary_state);
/*
The get methods will first check the internal storage in the 'values' map
and then subsequently query the SummaryState member.
*/
double get(const std::string& func, const std::string& arg) const;
void add(const std::string& func, const std::string& arg, double value);
double get(const std::string& func) const;
void add(const std::string& func, double value);
std::vector<std::string> wells(const std::string& func) const;
private:
SummaryState summary_state;
std::map<std::string, double> values;
};
}
#endif

View File

@@ -22,6 +22,11 @@
#define ActionX_HPP_
#include <string>
#include <vector>
#include <ctime>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp>
namespace Opm {
/*
@@ -49,21 +54,36 @@ namespace Opm {
*/
class DeckKeyword;
class ActionContext;
class ActionX {
public:
ActionX(const std::string& name, size_t max_run, double max_wait);
explicit ActionX(const DeckKeyword& kw);
ActionX(const std::string& name, size_t max_run, double max_wait, std::time_t start_time);
ActionX(const DeckKeyword& kw, std::time_t start_time);
ActionX(const DeckRecord& record, std::time_t start_time);
void addKeyword(const DeckKeyword& kw);
bool ready(std::time_t sim_time) const;
bool eval(std::time_t sim_time, const ActionContext& context, std::vector<std::string>& wells) const;
const std::string& name() const;
std::string name() const { return this->m_name; }
size_t max_run() const { return this->m_max_run; }
double min_wait() const { return this->m_min_wait; }
std::time_t start_time() const { return this->m_start_time; }
std::vector<DeckKeyword>::const_iterator begin() const;
std::vector<DeckKeyword>::const_iterator end() const;
static bool valid_keyword(const std::string& keyword);
private:
std::string m_name;
size_t max_run;
double max_wait;
size_t m_max_run = 0;
double m_min_wait = 0.0;
std::time_t m_start_time;
std::vector<DeckKeyword> keywords;
ActionAST condition;
mutable size_t run_count = 0;
mutable std::time_t last_run = 0;
};
}

View File

@@ -0,0 +1,45 @@
/*
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/>.
*/
#ifndef ActionCOnfig_HPP
#define ActionCOnfig_HPP
#include <string>
#include <ctime>
#include <map>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
namespace Opm {
class Actions {
public:
Actions() = default;
size_t size() const;
bool empty() const;
void add(const ActionX& action);
bool ready(std::time_t sim_time) const;
ActionX& at(const std::string& name);
std::vector<const ActionX *> pending(std::time_t sim_time) const;
private:
std::map<std::string, ActionX> actions;
};
}
#endif

View File

@@ -0,0 +1,42 @@
/*
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_ARRAYDIM_CHECKER_HPP
#define OPM_ARRAYDIM_CHECKER_HPP
#include <cstddef>
namespace Opm {
class ErrorGuard;
class EclipseState;
class ParseContext;
class Schedule;
} // Opm
namespace Opm {
int maxGroupSize(const Schedule& sched,
const std::size_t step);
void checkConsistentArrayDimensions(const EclipseState& es,
const Schedule& sched,
const ParseContext& ctxt,
ErrorGuard& guard);
} // Opm
#endif // OPM_ARRAYDIM_CHECKER_HPP

View File

@@ -24,6 +24,7 @@
#include <stdexcept>
#include <vector>
#include <algorithm>
#include <utility>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
@@ -114,25 +115,70 @@ class DynamicState {
this->m_data[index] = value;
}
/// Will return the index of the first occurence of @value, or
/// -1 if @value is not found.
int find(const T& value) const {
auto iter = std::find( m_data.begin() , m_data.end() , value);
if( iter == this->m_data.end() ) return -1;
return std::distance( m_data.begin() , iter );
/*
Will assign all currently equal values starting at index with the new
value. Purpose of the method is to support manipulations of an existing
Schedule object, if e.g. a well is initially closed in the interval
[T1,T2] and then opened at time T1 < Tx < T2 then the open should be
applied for all times in the range [Tx,T2].
*/
void update_equal(size_t index, const T& value) {
if (this->m_data.size() <= index)
throw std::out_of_range("Invalid index for update_equal()");
const T prev_value = this->m_data[index];
if (prev_value == value)
return;
while (true) {
if (this->m_data[index] != prev_value)
break;
this->m_data[index] = value;
index++;
if (index == this->m_data.size())
break;
}
}
/// Will return the index of the first occurence of @value, or
/// -1 if @value is not found.
int find(const T& value) const {
auto iter = std::find( m_data.begin() , m_data.end() , value);
if( iter == this->m_data.end() ) return -1;
return std::distance( m_data.begin() , iter );
}
template<typename P>
int find_if(P&& pred) const {
auto iter = std::find_if(m_data.begin(), m_data.end(), std::forward<P>(pred));
if( iter == this->m_data.end() ) return -1;
return std::distance( m_data.begin() , iter );
}
/// Will return the index of the first value which is != @value, or -1
/// if all values are == @value
int find_not(const T& value) const {
auto iter = std::find_if_not( m_data.begin() , m_data.end() , [&value] (const T& elm) { return value == elm; });
if( iter == this->m_data.end() ) return -1;
return std::distance( m_data.begin() , iter );
}
iterator begin() {
return this->m_data.begin();
}
iterator end() {
return this->m_data.end();
}
iterator begin() {
return this->m_data.begin();
}
iterator end() {
return this->m_data.end();
}
private:
std::vector< T > m_data;

View File

@@ -45,7 +45,7 @@ namespace Opm
WELL_WELSPECS_UPDATE = 2,
WELL_POLYMER_UPDATE = 4,
//WELL_POLYMER_UPDATE = 4,
/*
The NEW_GROUP event is triggered by the WELSPECS and
GRUPTREE keywords.
@@ -61,7 +61,7 @@ namespace Opm
*/
PRODUCTION_UPDATE = 16,
INJECTION_UPDATE = 32,
POLYMER_UPDATES = 64,
//POLYMER_UPDATES = 64,
/*
This event is triggered if the well status is changed

View File

@@ -24,6 +24,7 @@
#include <memory>
#include <set>
#include <string>
#include <stddef.h>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
@@ -66,9 +67,10 @@ namespace Opm {
class Group {
public:
Group(const std::string& name, const TimeMap& timeMap , size_t creationTimeStep);
Group(const std::string& name, const size_t& seqIndex, const TimeMap& timeMap , size_t creationTimeStep);
bool hasBeenDefined(size_t timeStep) const;
const std::string& name() const;
const size_t& seqIndex() const;
bool isProductionGroup(size_t timeStep) const;
bool isInjectionGroup(size_t timeStep) const;
void setProductionGroup(size_t timeStep, bool isProductionGroup);
@@ -133,6 +135,7 @@ namespace Opm {
private:
size_t m_creationTimeStep;
std::string m_name;
size_t m_seqIndex;
GroupInjection::InjectionData m_injection;
GroupProduction::ProductionData m_production;
DynamicState< std::set< std::string > > m_wells;

View File

@@ -22,17 +22,20 @@
#include <string>
#include <vector>
#include <map>
namespace Opm {
class GroupTree {
public:
void update( const std::string& name );
void update( const std::string& name, const std::string& parent );
void update( const std::string& name);
void update( const std::string& name, const std::string& parent);
void updateSeqIndex( const std::string& name, const std::string& other_parent);
bool exists( const std::string& group ) const;
const std::string& parent( const std::string& name ) const;
std::vector< std::string > children( const std::string& parent ) const;
const std::map<std::string , size_t>& nameSeqIndMap() const;
const std::map<size_t, std::string >& seqIndNameMap() const;
bool operator==( const GroupTree& ) const;
bool operator!=( const GroupTree& ) const;
@@ -53,6 +56,8 @@ class GroupTree {
std::vector< group > groups = { group { "FIELD", "" } };
friend bool operator<( const std::string&, const group& );
std::vector< group >::iterator find( const std::string& );
std::map<std::string , size_t> m_nameSeqIndMap;
std::map<size_t, std::string > m_seqIndNameMap;
};
}

View File

@@ -22,11 +22,13 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
namespace Opm {
WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections, const WellSegments& segments);
WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections,
const WellSegments& segments, const EclipseGrid& grid);
}
#endif

View File

@@ -21,6 +21,7 @@
#include <string>
#include <memory>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
@@ -28,24 +29,27 @@ namespace Opm
{
/*
* The OilVaporizationProperties class
* This classe is used to store the values from {VAPPARS, DRSDT, DRVDT} the behavior of the keywords are mutal exclusive.
* Any one of the three keywords {VAPPARS, DRSDT, DRVDT} will cancel previous settings of the other keywords.
* This classe is used to store the values from {VAPPARS, DRSDT, DRVDT}
* The VAPPARS and {DRSDT, DRVDT} are mutal exclusive and will cancel previous settings of the other keywords.
* Ask for type first and the ask for the correct values for this type, asking for values not valid for the current type will throw a logic exception.
*/
class OilVaporizationProperties {
public:
OilVaporizationProperties() = default;
static OilVaporizationProperties createDRSDT(double maxDRSDT, const std::string& option);
static OilVaporizationProperties createDRVDT(double maxDRVDT);
static OilVaporizationProperties createVAPPARS(double vap1, double vap2);
explicit OilVaporizationProperties(const size_t numPvtReginIdx);
static void updateDRSDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRSDT, const std::vector<std::string>& option);
static void updateDRVDT(Opm::OilVaporizationProperties& ovp, const std::vector<double>& maxDRVDT);
static void updateVAPPARS(Opm::OilVaporizationProperties& ovp, const std::vector<double>& vap1, const std::vector<double>& vap2);
Opm::OilVaporizationEnum getType() const;
double getVap1() const;
double getVap2() const;
double getMaxDRSDT() const;
double getMaxDRVDT() const;
bool getOption() const;
double getVap1(const size_t pvtRegionIdx) const;
double getVap2(const size_t pvtRegionIdx) const;
double getMaxDRSDT(const size_t pvtRegionIdx) const;
double getMaxDRVDT(const size_t pvtRegionIdx) const;
bool getOption(const size_t pvtRegionIdx) const;
bool drsdtActive() const;
bool drvdtActive() const;
bool defined() const;
size_t numPvtRegions() const {return m_maxDRSDT.size();}
/*
* if either argument was default constructed == will always be false
@@ -56,11 +60,11 @@ namespace Opm
private:
Opm::OilVaporizationEnum m_type = OilVaporizationEnum::UNDEF;
double m_vap1;
double m_vap2;
double m_maxDRSDT;
double m_maxDRVDT;
bool m_maxDRSDT_allCells;
std::vector<double> m_vap1;
std::vector<double> m_vap2;
std::vector<double> m_maxDRSDT;
std::vector<bool> m_maxDRSDT_allCells;
std::vector<double> m_maxDRVDT;
};
}
#endif // DRSDT_H

View File

@@ -0,0 +1,57 @@
/*
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 RFT_CONFIG_HPP
#define RFT_CONFIG_HPP
#include <cstddef>
#include <unordered_map>
#include <unordered_set>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
namespace Opm {
class TimeMap;
class RFTConfig {
public:
explicit RFTConfig(const TimeMap& time_map);
bool rft(const std::string& well, std::size_t report_step) const;
bool plt(const std::string& well, std::size_t report_step) const;
bool getWellOpenRFT(const std::string& well_name, std::size_t report_step) const;
void setWellOpenRFT(std::size_t report_step);
void setWellOpenRFT(const std::string& well_name);
bool active(std::size_t report_step) const;
std::size_t firstRFTOutput() const;
void updateRFT(const std::string& well, std::size_t report_step, RFTConnections::RFTEnum value);
void updatePLT(const std::string& well, std::size_t report_step, PLTConnections::PLTEnum value);
void addWellOpen(const std::string& well, std::size_t report_step);
private:
const TimeMap& tm;
std::pair<bool, std::size_t> well_open_rft_time;
std::unordered_set<std::string> well_open_rft_name;
std::unordered_map<std::string, std::size_t> well_open;
std::unordered_map<std::string, DynamicState<std::pair<RFTConnections::RFTEnum, std::size_t>>> rft_config;
std::unordered_map<std::string, DynamicState<std::pair<PLTConnections::PLTEnum, std::size_t>>> plt_config;
};
}
#endif

View File

@@ -24,6 +24,7 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
@@ -32,39 +33,70 @@
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp>
namespace Opm
{
class Actions;
class Deck;
class DeckKeyword;
class DeckRecord;
class EclipseGrid;
class Eclipse3DProperties;
class EclipseState;
class Runspec;
class SCHEDULESection;
class SummaryState;
class TimeMap;
class UnitSystem;
class EclipseState;
class ErrorGuard;
class WListManager;
class UDQInput;
class Schedule {
public:
Schedule(const Deck& deck,
const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties,
const Phases &phases,
const ParseContext& parseContext = ParseContext());
const Runspec &runspec,
const ParseContext& parseContext,
ErrorGuard& errors);
template<typename T>
Schedule(const Deck& deck,
const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties,
const Runspec &runspec,
const ParseContext& parseContext,
T&& errors);
Schedule(const Deck& deck,
const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties,
const Runspec &runspec);
Schedule(const Deck& deck,
const EclipseState& es,
const ParseContext& parseContext = ParseContext());
const ParseContext& parseContext,
ErrorGuard& errors);
template <typename T>
Schedule(const Deck& deck,
const EclipseState& es,
const ParseContext& parseContext,
T&& errors);
Schedule(const Deck& deck,
const EclipseState& es);
/*
* If the input deck does not specify a start time, Eclipse's 1. Jan
@@ -73,7 +105,9 @@ namespace Opm
time_t getStartTime() const;
time_t posixStartTime() const;
time_t posixEndTime() const;
time_t simTime(size_t timeStep) const;
double seconds(size_t timeStep) const;
double stepLength(size_t timeStep) const;
const TimeMap& getTimeMap() const;
@@ -81,6 +115,12 @@ namespace Opm
size_t numWells(size_t timestep) const;
size_t getMaxNumConnectionsForWells(size_t timestep) const;
bool hasWell(const std::string& wellName) const;
std::vector<std::string> wellNames(const std::string& pattern, size_t timeStep, const std::vector<std::string>& matching_wells = {}) const;
std::vector<std::string> wellNames(const std::string& pattern) const;
std::vector<std::string> wellNames(size_t timeStep) const;
std::vector<std::string> wellNames() const;
const Well* getWell(const std::string& wellName) const;
std::vector< const Well* > getOpenWells(size_t timeStep) const;
std::vector< const Well* > getWells() const;
@@ -95,22 +135,33 @@ namespace Opm
is an inefficient way to get all the wells defined at time
't'.
*/
//std::vector< const Group& > getChildGroups(const std::string& group_name, size_t timeStep) const;
std::vector< const Group* > getChildGroups(const std::string& group_name, size_t timeStep) const;
std::vector< const Well* > getWells(const std::string& group, size_t timeStep) const;
std::vector< const Well* > getWellsMatching( const std::string& ) const;
std::vector< const Well* > getChildWells(const std::string& group_name, size_t timeStep) const;
const OilVaporizationProperties& getOilVaporizationProperties(size_t timestep) const;
const WellTestConfig& wtestConfig(size_t timestep) const;
const WListManager& getWListManager(size_t timeStep) const;
const UDQInput& getUDQConfig(size_t timeStep) const;
const Actions& actions() const;
void evalAction(const SummaryState& summary_state, size_t timeStep);
const GroupTree& getGroupTree(size_t t) const;
size_t numGroups() const;
size_t numGroups(size_t timeStep) const;
bool hasGroup(const std::string& groupName) const;
const Group& getGroup(const std::string& groupName) const;
std::vector< const Group* > getGroups() const;
std::vector< const Group* > getGroups(size_t timeStep) const;
const Tuning& getTuning() const;
const MessageLimits& getMessageLimits() const;
void invalidNamePattern (const std::string& namePattern, const ParseContext& parseContext, const DeckKeyword& keyword) const;
void invalidNamePattern (const std::string& namePattern, const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& keyword) const;
const RFTConfig& rftConfig() const;
const Events& getEvents() const;
const Events& getWellEvents(const std::string& well) const;
bool hasWellEvent(const std::string& well, uint64_t event_mask, size_t reportStep) const;
const Deck& getModifierDeck(size_t timeStep) const;
bool hasOilVaporizationProperties() const;
const VFPProdTable& getVFPProdTable(int table_id, size_t timeStep) const;
@@ -122,68 +173,82 @@ namespace Opm
active. Will scan through all wells and all timesteps.
*/
void filterConnections(const EclipseGrid& grid);
size_t size() const;
void applyAction(size_t reportStep, const ActionX& action, const std::vector<std::string>& matching_wells);
private:
TimeMap m_timeMap;
OrderedMap< Well > m_wells;
OrderedMap< Group > m_groups;
OrderedMap< std::string, Well > m_wells;
OrderedMap< std::string, Group > m_groups;
DynamicState< GroupTree > m_rootGroupTree;
DynamicState< OilVaporizationProperties > m_oilvaporizationproperties;
Events m_events;
DynamicVector< Deck > m_modifierDeck;
Tuning m_tuning;
MessageLimits m_messageLimits;
Phases m_phases;
Runspec m_runspec;
std::map<int, DynamicState<std::shared_ptr<VFPProdTable>>> vfpprod_tables;
std::map<int, DynamicState<std::shared_ptr<VFPInjTable>>> vfpinj_tables;
DynamicState<std::shared_ptr<WellTestConfig>> wtest_config;
DynamicState<std::shared_ptr<WListManager>> wlist_manager;
DynamicState<std::shared_ptr<UDQInput>> udq_config;
DynamicState<WellProducer::ControlModeEnum> global_whistctl_mode;
RFTConfig rft_config;
WellProducer::ControlModeEnum m_controlModeWHISTCTL;
Actions m_actions;
std::vector< Well* > getWells(const std::string& wellNamePattern);
std::vector< Well* > getWells(const std::string& wellNamePattern, const std::vector<std::string>& matching_wells = {});
std::vector< Group* > getGroups(const std::string& groupNamePattern);
std::map<std::string,Events> well_events;
void updateWellStatus( Well& well, size_t reportStep , WellCommon::StatusEnum status);
void addWellToGroup( Group& newGroup , Well& well , size_t timeStep);
void iterateScheduleSection(const ParseContext& parseContext , const SCHEDULESection& , const EclipseGrid& grid,
void iterateScheduleSection(const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties);
bool handleGroupFromWELSPECS(const std::string& groupName, GroupTree& newTree) const;
void addGroup(const std::string& groupName , size_t timeStep);
void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder);
void handleCOMPORD(const ParseContext& parseContext, const DeckKeyword& compordKeyword, size_t currentStep);
void handleUDQ(const DeckKeyword& keyword, size_t currentStep);
void handleWLIST(const DeckKeyword& keyword, size_t currentStep);
void handleCOMPORD(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& compordKeyword, size_t currentStep);
void handleWELSPECS( const SCHEDULESection&, size_t, size_t );
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext);
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext, ErrorGuard& errors);
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWGRUPCON( const DeckKeyword& keyword, size_t currentStep);
void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext);
void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext, ErrorGuard& errors);
void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep );
void handleWELSEGS( const DeckKeyword& keyword, size_t currentStep);
void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep);
void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext );
void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid);
void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWTRACER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors, const std::vector<std::string>& matching_wells = {});
void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleTUNING( const DeckKeyword& keyword, size_t currentStep);
void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep);
void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep);
void handleWRFT( const DeckKeyword& keyword, size_t currentStep);
void handleWTEST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWTEST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWRFTPLT( const DeckKeyword& keyword, size_t currentStep);
void handleWPIMULT( const DeckKeyword& keyword, size_t currentStep);
void handleDRSDT( const DeckKeyword& keyword, size_t currentStep);
void handleDRVDT( const DeckKeyword& keyword, size_t currentStep);
void handleDRSDTR( const DeckKeyword& keyword, size_t currentStep);
void handleDRVDTR( const DeckKeyword& keyword, size_t currentStep);
void handleVAPPARS( const DeckKeyword& keyword, size_t currentStep);
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
void handleWHISTCTL(const ParseContext& parseContext, const DeckKeyword& keyword);
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep);
void handleVFPPROD(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
@@ -193,16 +258,17 @@ namespace Opm
const SCHEDULESection& section,
size_t keywordIdx,
const DeckKeyword& keyword,
const ParseContext& parseContext,
const ParseContext& parseContext, ErrorGuard& errors,
const EclipseGrid& grid,
const Eclipse3DProperties& eclipseProperties,
const UnitSystem& unit_system,
std::vector<std::pair<const DeckKeyword*, size_t > >& rftProperties);
static double convertInjectionRateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem);
static double convertInjectionRateToSI(double rawRate, Phase wellPhase, const Opm::UnitSystem &unitSystem);
void addWellEvent(const std::string& well, ScheduleEvents::Events event, size_t reportStep);
static bool convertEclipseStringToBool(const std::string& eclipseString);
#ifdef CHECK_WELLS
bool checkWells(const ParseContext& parseContext, ErrorGuard& errors) const;
#endif
};
}

View File

@@ -69,6 +69,31 @@ namespace Opm {
}
namespace WellTarget {
enum ControlModeEnum {
ORAT = 1,
WRAT = 2,
GRAT = 3,
LRAT = 4,
CRAT = 5, // Not supported
RESV = 6,
BHP = 7,
THP = 8,
VFP = 9,
LIFT = 10, // Not supported
GUID = 11
};
/*
There are unfortuntaley separate enums for production controls,
injection controls and also for WELTARG control arguments. Since the
WELTARG control arguments are *not* used to enumerate available
controls the numerical values are - conciously - not in 2^n range.
*/
ControlModeEnum ControlModeFromString(const std::string& string_value);
}
namespace WellInjector {
enum TypeEnum {
WATER = 1,
@@ -230,8 +255,7 @@ namespace Opm {
enum OilVaporizationEnum{
UNDEF = 0,
VAPPARS = 1,
DRSDT = 2,
DRVDT = 3
DRDT = 2 // DRSDT or DRVDT
};

View File

@@ -0,0 +1,91 @@
/*
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 <vector>
#include <unordered_map>
#include <unordered_set>
#include <ert/ecl/smspec_node.hpp>
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*.
The main key used to access the content of this container is the eclipse style
colon separated string - i.e. 'WWCT:OPX' to get the watercut in well 'OPX'.
The main usage of the SummaryState class is a temporary holding ground while
assembling data for the summary output, but it is also used as a context
object when evaulating the condition in ACTIONX keywords. For that reason some
of the data is duplicated both in the general structure and a specialized
structure:
SummaryState st;
st.add_well_var("OPX", "WWCT", 0.75);
st.add("WGOR:OPY", 120);
// The WWCT:OPX key has been added with the specialized add_well_var()
// method and this data is available both with the general
// st.has("WWCT:OPX") and the specialized st.has_well_var("OPX", "WWCT");
st.has("WWCT:OPX") => True
st.has_well_var("OPX", "WWCT") => True
// The WGOR:OPY key is added with the general add("WGOR:OPY") and is *not*
// accessible through the specialized st.has_well_var("OPY", "WGOR").
st.has("WGOR:OPY") => True
st.has_well_var("OPY", "WGOR") => False
*/
class SummaryState {
public:
typedef std::unordered_map<std::string, double>::const_iterator const_iterator;
double get(const std::string&) const;
bool has(const std::string& key) const;
void add(const std::string& key, double value);
void add(const ecl::smspec_node& node, double value);
void add_well_var(const std::string& well, const std::string& var, double value);
bool has_well_var(const std::string& well, const std::string& var) const;
double get_well_var(const std::string& well, const std::string& var) const;
std::vector<std::string> wells() const;
std::vector<std::string> wells(const std::string& var) const;
const_iterator begin() const;
const_iterator end() const;
private:
std::unordered_map<std::string,double> values;
// The first key is the variable and the second key is the well.
std::unordered_map<std::string, std::unordered_map<std::string, double>> well_values;
std::unordered_set<std::string> m_wells;
};
}
#endif

View File

@@ -44,6 +44,7 @@ namespace Opm {
size_t last() const;
size_t numTimesteps() const;
double getTotalTime() const;
double seconds(size_t timeStep) const;
std::time_t operator[] (size_t index) const;
/// Return the date and time where a given time step starts.
@@ -65,8 +66,8 @@ namespace Opm {
static std::time_t forward(std::time_t t0, int64_t seconds);
static std::time_t mkdate(int year, int month, int day);
static std::time_t mkdatetime(int year, int month, int day, int hour, int minute, int second);
private:
static const std::map<std::string, int>& eclipseMonthIndices();
private:
std::vector<std::time_t> m_timeList;

View File

@@ -15,35 +15,36 @@
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/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ActionX.hpp>
#ifndef UDQASSIGN_HPP_
#define UDQASSIGN_HPP_
#include <string>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
namespace Opm {
ActionX::ActionX(const std::string& name, size_t max_run, double max_wait) :
m_name(name),
max_run(max_run),
max_wait(max_wait)
{}
ActionX::ActionX(const DeckKeyword& kw) {
const auto& record = kw.getRecord(0);
this->m_name = record.getItem("NAME").getTrimmedString(0);
this->max_run = record.getItem("NUM").get<int>(0);
this->max_wait = record.getItem("MAX_WAIT").getSIDouble(0);
class UDQAssign{
public:
UDQAssign(const std::string& keyword, const std::vector<std::string>& selector, double value);
const std::string& keyword() const;
double value() const;
UDQVarType var_type() const;
const std::vector<std::string>& selector() const;
UDQWellSet eval_wells(const std::vector<std::string>& wells) const;
private:
std::string m_keyword;
UDQVarType m_var_type;
std::vector<std::string> m_selector;
double m_value;
};
}
void ActionX::addKeyword(const DeckKeyword& kw) {
this->keywords.push_back(kw);
}
const std::string& ActionX::name() const {
return this->m_name;
}
}
#endif

View File

@@ -0,0 +1,50 @@
/*
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 UDQ_CONTEXT_HPP
#define UDQ_CONTEXT_HPP
#include <vector>
#include <string>
#include <unordered_map>
namespace Opm {
class SummaryState;
class UDQFunctionTable;
class UDQContext{
public:
UDQContext(const UDQFunctionTable& udqft, const SummaryState& summary_state);
double get(const std::string& key) const;
double get_well_var(const std::string& well, const std::string& var) const;
void add(const std::string& key, double value);
const UDQFunctionTable& function_table() const;
std::vector<std::string> wells() const;
private:
const UDQFunctionTable& udqft;
const SummaryState& summary_state;
std::unordered_map<std::string, double> values;
};
}
#endif

View File

@@ -0,0 +1,74 @@
/*
Copyright 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 UDQ_DEFINE_HPP
#define UDQ_DEFINE_HPP
#include <string>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
namespace Opm {
class UDQASTNode;
class ParseContext;
class ErrorGuard;
class UDQDefine{
public:
UDQDefine(const UDQParams& udq_params,
const std::string& keyword,
const std::vector<std::string>& deck_data);
UDQDefine(const UDQParams& udq_params,
const std::string& keyword,
const std::vector<std::string>& deck_data,
const ParseContext& parseContext,
ErrorGuard& errors);
template <typename T>
UDQDefine(const UDQParams& udq_params,
const std::string& keyword,
const std::vector<std::string>& deck_data,
const ParseContext& parseContext,
T&& errors);
UDQWellSet eval_wells(const UDQContext& context) const;
UDQSet eval(const UDQContext& context) const;
const std::string& keyword() const;
const std::vector<std::string>& tokens() const;
UDQVarType var_type() const;
private:
std::vector<std::string> input_tokens;
const UDQParams& udq_params; // Beacuse of the shared RNG stream this must be a reference.
std::string m_keyword;
std::shared_ptr<UDQASTNode> ast;
UDQVarType m_var_type;
};
}
#endif

View File

@@ -0,0 +1,114 @@
/*
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 UDQ_ENUMS_HPP
#define UDQ_ENUMS_HPP
namespace Opm {
enum class UDQVarType {
WELL_VAR = 1,
CONNECTION_VAR= 2,
FIELD_VAR = 3,
GROUP_VAR = 4,
REGION_VAR = 5,
SEGMENT_VAR = 6,
AQUIFER_VAR = 7,
BLOCK_VAR = 8
};
enum class UDQTokenType{
error = 0,
number = 1,
open_paren = 2,
close_paren = 3,
ecl_expr = 7,
//
binary_op_add = 8,
binary_op_sub = 9,
binary_op_div = 10,
binary_op_mul = 11,
binary_op_pow = 12,
binary_op_uadd = 13,
binary_op_umul = 14,
binary_op_umin = 15,
binary_op_umax = 16,
binary_cmp_eq = 17,
binary_cmp_ne = 18,
binary_cmp_le = 19,
binary_cmp_ge = 20,
binary_cmp_lt = 21,
binary_cmp_gt = 22,
//
elemental_func_randn = 23,
elemental_func_randu = 24,
elemental_func_rrandn = 25,
elemental_func_rrandu = 26,
elemental_func_abs = 27,
elemental_func_def = 28,
elemental_func_exp = 29,
elemental_func_idv = 30,
elemental_func_ln = 31,
elemental_func_log = 32,
elemental_func_nint = 33,
elemental_func_sorta = 34,
elemental_func_sortd = 35,
elemental_func_undef = 36,
//
scalar_func_sum = 37,
scalar_func_avea = 38,
scalar_func_aveg = 39,
scalar_func_aveh = 40,
scalar_func_max = 41,
scalar_func_min = 42,
scalar_func_norm1 = 43,
scalar_func_norm2 = 44,
scalar_func_normi = 45,
scalar_func_prod = 46,
//
table_lookup = 47,
//
end = 100
};
enum class UDQAction {
ASSIGN,
DEFINE,
UNITS,
UPDATE};
namespace UDQ {
UDQVarType varType(const std::string& keyword);
UDQAction actionType(const std::string& action_string);
UDQTokenType funcType(const std::string& func_name);
bool binaryFunc(UDQTokenType token_type);
bool elementalUnaryFunc(UDQTokenType token_type);
bool scalarFunc(UDQTokenType token_type);
bool cmpFunc(UDQTokenType token_type);
}
}
#endif

View File

@@ -24,21 +24,23 @@
#include <vector>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
namespace Opm {
enum class UDQAction {ASSIGN, DEFINE, UNITS, UPDATE};
class UDQExpression {
public:
UDQExpression(const std::string& action, const std::string& keyword, const std::vector<std::string>& data);
UDQExpression(UDQAction action, const std::string& keyword, const std::vector<std::string>& data);
explicit UDQExpression(const DeckRecord& expression);
const std::vector<std::string>& tokens() const;
UDQAction action() const;
const std::string& keyword() const;
private:
UDQAction action;
std::string keyword;
UDQAction m_action;
std::string m_keyword;
UDQVarType m_var_type;
std::vector<std::string> data;
};
}

View File

@@ -0,0 +1,117 @@
/*
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 UDQFUNCTION_HPP
#define UDQFUNCTION_HPP
#include <stdexcept>
#include <vector>
#include <functional>
#include <random>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
namespace Opm {
class UDQFunction {
public:
UDQFunction(const std::string& name);
virtual ~UDQFunction() = default;
const std::string& name() const;
UDQTokenType type() const;
private:
std::string m_name;
UDQTokenType func_type;
};
class UDQScalarFunction : public UDQFunction {
public:
UDQScalarFunction(const std::string&name, std::function<UDQScalar(const UDQSet& arg)> f);
UDQScalar eval(const UDQSet& arg) const;
static UDQScalar SUM(const UDQSet& arg);
static UDQScalar AVEA(const UDQSet& arg);
static UDQScalar AVEG(const UDQSet& arg);
static UDQScalar AVEH(const UDQSet& arg);
static UDQScalar MIN(const UDQSet& arg);
static UDQScalar MAX(const UDQSet& arg);
static UDQScalar NORM1(const UDQSet& arg);
static UDQScalar NORM2(const UDQSet& arg);
static UDQScalar NORMI(const UDQSet& arg);
static UDQScalar PROD(const UDQSet& arg);
private:
std::function<UDQScalar(const UDQSet& arg)> func;
};
class UDQUnaryElementalFunction : public UDQFunction {
public:
UDQUnaryElementalFunction(const std::string&name, std::function<UDQSet(const UDQSet& arg)> f);
UDQSet eval(const UDQSet& arg) const;
static UDQSet ABS(const UDQSet& arg);
static UDQSet DEF(const UDQSet& arg);
static UDQSet EXP(const UDQSet& arg);
static UDQSet IDV(const UDQSet& arg);
static UDQSet LN(const UDQSet& arg);
static UDQSet LOG(const UDQSet& arg);
static UDQSet NINT(const UDQSet& arg);
static UDQSet SORTA(const UDQSet& arg);
static UDQSet SORTD(const UDQSet& arg);
static UDQSet UNDEF(const UDQSet& arg);
static UDQSet RANDN(std::mt19937& rng, const UDQSet& arg);
static UDQSet RANDU(std::mt19937& rng, const UDQSet& arg);
private:
std::function<UDQSet(const UDQSet& arg)> func;
};
class UDQBinaryFunction : public UDQFunction {
public:
UDQBinaryFunction(const std::string& name, std::function<UDQSet(const UDQSet& lhs, const UDQSet& rhs)> f);
UDQSet eval(const UDQSet&, const UDQSet& arg) const;
static UDQSet EQ(double eps, const UDQSet& lhs, const UDQSet& rhs);
static UDQSet NE(double eps, const UDQSet& lhs, const UDQSet& rhs);
static UDQSet LE(double eps, const UDQSet& lhs, const UDQSet& rhs);
static UDQSet GE(double eps, const UDQSet& lhs, const UDQSet& rhs);
static UDQSet POW(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet LT(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet GT(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet ADD(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet MUL(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet SUB(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet DIV(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet UADD(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet UMUL(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet UMAX(const UDQSet& lhs, const UDQSet& rhs);
static UDQSet UMIN(const UDQSet& lhs, const UDQSet& rhs);
private:
std::function<UDQSet(const UDQSet& lhs, const UDQSet& rhs)> func;
};
}
#endif

View File

@@ -0,0 +1,43 @@
/*
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 UDQFUNCTIONTABLE_HPP
#define UDQFUNCTIONTABLE_HPP
#include <unordered_map>
#include <memory>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
namespace Opm {
class UDQFunctionTable {
public:
explicit UDQFunctionTable(const UDQParams& params);
UDQFunctionTable();
bool has_function(const std::string& name) const;
const UDQFunction& get(const std::string& name) const;
private:
void insert_function(std::shared_ptr<const UDQFunction> func);
UDQParams params;
std::unordered_map<std::string, std::shared_ptr<const UDQFunction>> function_table;
};
}
#endif

View File

@@ -0,0 +1,68 @@
/*
Copyright 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 UDQINPUT_HPP_
#define UDQINPUT_HPP_
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.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>
namespace Opm {
class DeckRecord;
class Deck;
class UDQInput {
public:
explicit UDQInput(const Deck& deck);
const std::string& unit(const std::string& key) const;
bool has_unit(const std::string& keyword) const;
bool has_keyword(const std::string& keyword) const;
void add_record(const DeckRecord& record);
void assign_unit(const std::string& keyword, const std::string& unit);
const std::vector<UDQDefine>& definitions() const;
std::vector<UDQDefine> definitions(UDQVarType var_type) const;
const std::vector<UDQAssign>& assignments() const;
std::vector<UDQAssign> assignments(UDQVarType var_type) const;
const UDQFunctionTable& function_table() const;
private:
UDQParams udq_params;
UDQFunctionTable udqft;
std::vector<UDQDefine> m_definitions;
std::vector<UDQAssign> m_assignments;
std::unordered_map<std::string, std::string> units;
std::unordered_set<std::string> keywords;
};
}
#endif

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