Compare commits

..

64 Commits

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

added keywords MULTREGH, MULTSIG, MULTSIGV.

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

added keywords LSOWCR, LSWCR, LSWL.

LSWLPC, LSWU, LTOSIGMA.

added keywords LWKRO, LWKRORG, LWKRORW.

added keywords LWKRW, LWKRWR, LWPCW.

LWSLTNUM, LWSNUM, LWSOGCR.

added keywords LWSOWCR, LWSWCR, LWSWL.

added keywords LWSWLPC, LWSWU, LX.

added keywords LY, LZ, MATCORR.

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

added keywords KRNUN, KRNUMMF.

added keywords LANGMPL, LANGMUIR, LANGSOLV.

added keywords LGRCOPY, LGRFREE, LGRLOCK.

added keywords LGROFF, LGRON, LINKPERM.

added keywords LKRO, LKRORG, LKRORW.

added keywords LKRW, LKRWR, LOAD.
2019-10-20 10:53:29 +02:00
Markus Blatt
8488efde1f Merge pull request #1126 from blattms/backport-of-pr-1125
Fix memory error during EclipseGrid creation with Actnum. (backport PR #1125)
2019-10-17 20:29:25 +02:00
Markus Blatt
3a89d05646 Fix memory error during EclipseGrid creation with Actnum.
We pass an int pointer to the function initCornerPointGrid.
With ACTNUM  this pointer was initialized with data pointer
of an int vector that we threw away before the function call
(otherwise it was null). To fix this we move the int-vector up one
scope.
2019-10-17 20:26:55 +02:00
Markus Blatt
0d3037383a Merge pull request #1120 from blattms/backport-of-pr-1116
fixed: build using gcc 5 (ubuntu xenial) (backport of PR #1116
2019-10-17 13:25:35 +02:00
Arne Morten Kvarving
de67ce4083 fixed: build using gcc 5 (ubuntu xenial)
the tuple-from-initializer-list constructor is explicit.
2019-10-17 13:21:25 +02:00
Markus Blatt
0fadb026af Merge pull request #1118 from blattms/backport-of-pr-1107
Decouple OPM Flow From Libecl  (Backport of pr #1107)
2019-10-17 13:08:52 +02:00
Bård Skaflestad
fe275a55fd Drop libecl From Python Setup
Suggested by [at]akva2.
2019-10-17 12:21:53 +02:00
Arne Morten Kvarving
a44febc314 remove libecl from buildsystem, jenkins and packaging 2019-10-17 12:21:53 +02:00
Bård Skaflestad
895c43dff0 Reimplement test_Restart in Terms of TimeStampUTC
Only affects the 'first_sim()' helper function.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
e2ca798005 Reimplement test_EclipseIO in Terms of TimeStampUTC
Mostly just to provide a simple overload of the utility function

    ecl_util_make_date

from libecl.  The rest of the test code remains intact.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
8fa07537fc Reimplement ScheduleTests in Terms of TimeStampUTC
Note that we have to reduce the year-range in the specific test

    createDeckWithDRSDTthenDRVDT

in order not to wrap around for system_clock.  This is a deficency of
the new time-service protocol.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
7f9d250fd3 Reimplement TimeMap in Terms of TimeStampUTC 2019-10-17 11:53:15 +02:00
Bård Skaflestad
5eab9b003f Add Simple Time-Service Protocol
Mostly for converting between std::time_t and broken-down time
stamps.  Uses UTC and std::chrono::system_clock.  May wrap in as
little as 292 years, depending on the period of system_clock.

Intended to replace various timestamping utility functions from
libecl.  A comprehensive time-service protocol for Flow is much more
work than this, and will likely not be easily realized before we
have C++17 and its much expanded time/calendar library.
2019-10-17 11:53:15 +02:00
Bård Skaflestad
14625b3279 Defaulted Table Column: Don't Use 'ssize_t'
Instead, switch to 'int' for the 'before' and 'after' row indices.
The 'ssize_t' Posix type alias is not appropriate for this usage
since its range is only guaranteed to be [ -1 .. (1<<15)-1 ].
2019-10-17 11:53:15 +02:00
Bård Skaflestad
3cb23e6857 Reimplement 'test_EclipseIO' in Terms of Opm-Common Classes
In particular, use EGrid, ERst and EclFile as appropriate.
2019-10-17 11:53:15 +02:00
Markus Blatt
f8f1efc0ac Merge pull request #1111 from blattms/backport-of-pr-1110
Allow building a module with dependencies installed (backport of #1110)
2019-10-16 13:56:12 +02:00
Markus Blatt
6d92c1f5de Allow building a module with dependencies installed but source lying around.
If you set CMAKE_INSTALL_PREFIX, have the dependencies installed there, but
the source of them lying around in the parent directory of the build
directory, then the build will fail starting with opm-models because
we assume that ../opm-material is a build directory and set opm-material_DIR
to it. CMake will complain about not finding opm-material-config.cmake or
Opm-materialConfig.cmake. With this commit we will only set opm-material_DIR
if the directory contains a file CMakeCache.txt (which should be the case in
a configured build directory.

Directory outline of the failing situation is
- ${CMAKE_INSTALL_PREFIX} # where all dependencies are installed
- parent_dir
|____ opm-common #source dir
|____ opm-material #source dir
|____ ...
|____ build #build directory for current module (e.g. opm-modules)

Change is tested with sibling build

- build
|___ opm-common #build dir
|___ opm-material #build dir
|___ ...

and the dune version of it

- parent_dir
|___ opm-common # source dir
    |____ build # build dir opm-common

|___ opm-material # source dir
    |____ build # build dir opm-material
...
2019-10-16 13:52:47 +02:00
Markus Blatt
c68ec9c28b Merge pull request #1108 from blattms/backport-of-pr-1092
Update of ESmry, now supporting non-unified result files. (backport of PR #1092)
2019-10-16 09:47:38 +02:00
Torbjørn Skille
2dd6400d06 Update of ESmry, now supporting non-unified result files. 2019-10-16 09:12:02 +02:00
Markus Blatt
aa10ded01a Merge pull request #1104 from blattms/backport-of-pr-1094
Make RestartKey default contructable. (Backport of #1094)
2019-10-14 22:13:54 +02:00
Markus Blatt
edaa5ae561 Make RestartKey default contructable.
Otherwise we cannot even resize a vector of it and this will be needed
for restart when getting rid off the global grid on all processes.
2019-10-14 21:46:43 +02:00
Markus Blatt
aa56a40e8d Merge pull request #1103 from blattms/backport-pr-1088
Backport of pr #1088
2019-10-14 21:43:00 +02:00
Bård Skaflestad
2d7ba6a3c9 INTEHEAD Test: Initialize Maximum Number of Wells in Field
Fixes a warning about missing initializers.
2019-10-14 21:38:32 +02:00
Bård Skaflestad
6c397ff2a8 Make 'test_Restart' Mostly Independent of libecl
In particular, swith to using class EclIO::ERst to read the files
produced by RestartIO::save().
2019-10-14 21:29:27 +02:00
Bård Skaflestad
c83feddb28 Make 'test_Summary' Independent of LibeECL
This commit switches the 'test_Summary' unit test to use class ESmry
for inspecting the values output to disk by 'out::Summary'.  As a
consequence, we are not able to verify units of measure for the
parameters, at least not for the time being.  Moreover, class ESmry
exclusively uses the "i,j,k" sub-key for block-related parameters so
switch those to reference the IJK identifiers.

Finally, as class ESmry currently does not support reading separate
(multiple) summary files, switch the input decks to generate unified
output.
2019-10-14 21:29:27 +02:00
Bård Skaflestad
6d9deefb29 Make Most Unit Tests Independent of LibECL
This commit switches a set of OPM-Common's unit tests away from
using direct calls to libecl functions and into using base types
from OPM-Common itself (along with Boost.Filesystem).

In particular summary related queries are replaced by calls to ESmry
member functions (wrapped in libecl-like interfaces to minimise code
changes).  We disable checks on unit strings since ESmry currently
does not have a way of associating those with individual variables.
2019-10-14 21:29:27 +02:00
Bård Skaflestad
afaa99d3f4 Decouple Most of OPM-Common From LibECL
This commit takes a pass at the implementation files in opm-common
and removes references to libecl functions where practical.  In
particular we switch to using types from C++'s standard library (and
Boost.Filesystem) to achieve the effects of the interfaces being
replaced.

We also insert direct calls to Posix function fnmatch() to preserve
existing pattern matching behaviour (well lists and well templates).
2019-10-14 21:29:27 +02:00
Bård Skaflestad
c69a111e7a ESmry: Add Way of Retrieving Ministep Index at Start of Report Step
This commit introduces a new member function

    int ESmry::miniStepIdxAtReportStep(rptStep)

which returns the zero-based ministep corresponding to the start of
the given report step (one-based indexing).  This will simplify
decoupling a few unit tests from libecl.
2019-10-14 21:29:27 +02:00
Markus Blatt
112e698d0a Merge pull request #1102 from blattms/backport-pr-1082
Backport PR #1082
2019-10-14 21:12:11 +02:00
Bård Skaflestad
7dffd9f2e7 Replace Writer for Summary/SMSPEC Files
This commit replaces the existing system for writing summary and
specification (SMSPEC) files with a new implementation based on
class EclOutput.  We package the evaluators of individual parameters
in a set of classes determined by the parameter's category which
each implement a virtual 'update()' function.  This update function
ultimately writes new values into a SummaryState object.

Add a factory-like system for instantiating the appropriate class
depending on a SummaryNode's 'category()'.  Also, add a helper class
for managing the parameters that a configured in a simulation
model's SUMMARY section in order to distinguish these from those
parameters that are merely needed for restart purposes.  The summary
class's 'eval()' function then becomes a loop over the evaluators
for parameters in SUMMARY followed by a loop over the evaluators for
restart vectors.

We reimplement the 'internal_store()' function in terms of an
std::vector of a helper structure 'MiniStep' which holds a ministep
ID (contiguous counter started at zero), a report step ID, and all
the evaluated parameters of this ministep.  The final write function
then consists of outputting those ministep structures that have
accumulated since the previous call to write().  If a simulation
does not call write at all, then this will accumulate all parameters
for all ministeps throughout the simulation history.

We create the SMSPEC file at most once, and write to it at most each
report step.  We create the summary file once (if unified) or at
each report step (if separate).
2019-10-14 20:47:36 +02:00
Bård Skaflestad
a3f2c115f1 SMSPEC: Temporarily Restore Unconditional RESTART Vector
Needed to ensure we create the same summary/specification files as
the existing system.  We will revert this change once the new system
is in place and we can afford to update the reference solutions.
2019-10-14 20:47:36 +02:00
802 changed files with 15386 additions and 75844 deletions

View File

@@ -9,9 +9,9 @@ option(ENABLE_ECL_INPUT "Enable eclipse input support?" ON)
option(ENABLE_ECL_OUTPUT "Enable eclipse output support?" ON)
option(ENABLE_MOCKSIM "Build the mock simulator for io testing" ON)
option(OPM_ENABLE_PYTHON "Enable python bindings?" OFF)
option(OPM_INSTALL_PYTHON "Enable python bindings?" OFF)
option(OPM_ENABLE_EMBEDDED_PYTHON "Enable python bindings?" OFF)
# Output implies input
if(ENABLE_ECL_OUTPUT)
set(ENABLE_ECL_INPUT ON)
@@ -110,10 +110,7 @@ macro (sources_hook)
include(GenerateKeywords.cmake)
# Append generated sources
list(INSERT opm-common_SOURCES 0 ${PROJECT_BINARY_DIR}/ParserInit.cpp)
foreach (name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
list(INSERT opm-common_SOURCES 0 ${PROJECT_BINARY_DIR}/ParserKeywords/${name}.cpp)
endforeach()
list(APPEND opm-common_SOURCES ${PROJECT_BINARY_DIR}/ParserKeywords.cpp)
endif()
set_source_files_properties(src/opm/parser/eclipse/Python/Python.cpp
PROPERTIES COMPILE_FLAGS -Wno-shadow)
@@ -137,21 +134,6 @@ macro (install_hook)
PATTERN *.hpp)
endmacro (install_hook)
# If opm-common is configured to embed the python interpreter we must make sure
# that all downstream modules link libpython transitively. Due to the required
# integration with Python+cmake machinery provided by pybind11 this is done by
# manually adding to the opm-common_LIBRARIES variable here, and not in the
# OpmnLibMain function. Here only the library dependency is implemented, the
# bulk of the python configuration is further down in the file.
if (OPM_ENABLE_PYTHON)
find_package(PythonInterp REQUIRED)
if (OPM_ENABLE_EMBEDDED_PYTHON)
find_package(PythonLibs REQUIRED)
list(APPEND opm-common_LIBRARIES ${PYTHON_LIBRARY})
endif()
endif()
# all setup common to the OPM library modules is done here
include (OpmLibMain)
@@ -169,8 +151,7 @@ if (ENABLE_MOCKSIM)
foreach( test test_msim test_msim_ACTIONX )
opm_add_test(${test} SOURCES tests/msim/${test}.cpp
LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests
CONDITION HAVE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND)
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach()
endif()
@@ -186,11 +167,7 @@ if(ENABLE_ECL_INPUT)
test_util/convertECL.cpp
)
add_executable(summary
test_util/summary.cpp
)
foreach(target compareECL convertECL summary)
foreach(target compareECL convertECL)
target_link_libraries(${target} opmcommon)
install(TARGETS ${target} DESTINATION bin)
endforeach()
@@ -201,7 +178,7 @@ if(ENABLE_ECL_INPUT)
opm_add_test(test_EclFilesComparator
CONDITION
ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
ENABLE_ECL_INPUT
SOURCES
tests/test_EclFilesComparator.cpp
test_util/EclFilesComparator.cpp
@@ -213,7 +190,7 @@ if(ENABLE_ECL_INPUT)
opm_add_test(test_EclRegressionTest
CONDITION
ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
ENABLE_ECL_INPUT
SOURCES
tests/test_EclRegressionTest.cpp
test_util/EclFilesComparator.cpp
@@ -225,7 +202,7 @@ if(ENABLE_ECL_INPUT)
)
foreach(test test_EclIO test_EGrid test_ERft test_ERst test_ESmry)
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach()
@@ -240,94 +217,67 @@ install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
if (OPM_ENABLE_PYTHON)
# -------------------------------------------------------------------------
# 1: Wrap C++ functionality in Python
find_package(PythonInterp REQUIRED)
include(FindPythonInterp)
make_directory(${CMAKE_BINARY_DIR}/python)
set(PYTHON_PACKAGE_PATH "site-packages")
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
make_directory(${PROJECT_BINARY_DIR}/python)
get_target_property(_opmcommon_include_dirs opmcommon INCLUDE_DIRECTORIES)
list(APPEND _opmcommon_include_dirs ${_ecl_include_dirs})
string(REPLACE ";" ":" _setup_include_dirs "${_opmcommon_include_dirs}")
if (CMAKE_PREFIX_PATH)
set(_opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR})
else()
set(_opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib)
endif()
set(_opmcommon_lib_dirs ${CMAKE_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/lib)
string(REPLACE ";" ":" _setup_lib_dirs "${_opmcommon_lib_dirs}")
if (USE_RUNPATH)
set (_python_rpath_list)
if (CMAKE_PREFIX_PATH)
foreach(path ${CMAKE_PREFIX_PATH})
list(APPEND _python_rpath_list "${path}/${CMAKE_INSTALL_LIBDIR}")
endforeach()
endif()
if (BUILD_SHARED_LIBS)
list(APPEND _python_rpath_list "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (_python_rpath_list)
string(REPLACE ";" ":" _rpath "${_python_rpath_list}")
set( _rpath_arg "--rpath=${_rpath}")
else()
set(_rpath_arg "")
endif()
else()
set( _rpath_arg "")
endif()
execute_process(COMMAND ${PYTHON_EXECUTABLE} target_name.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python
OUTPUT_VARIABLE python_lib_target)
add_custom_target(copy_python ALL
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/python/install.py ${PROJECT_SOURCE_DIR}/python ${PROJECT_BINARY_DIR} 0)
add_custom_command(OUTPUT python/python/opm/${python_lib_target}
DEPENDS ${PYTHON_CXX_DEPENDS}
DEPENDS copy_python
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/setup.py
add_custom_command(OUTPUT python/python/opm/libopmcommon_python.so
DEPENDS
python/cxx/connection.cpp
python/cxx/converters.hpp
python/cxx/deck.cpp
python/cxx/deck_keyword.cpp
python/cxx/eclipse_3d_properties.cpp
python/cxx/eclipse_config.cpp
python/cxx/eclipse_grid.cpp
python/cxx/eclipse_state.cpp
python/cxx/group.cpp
python/cxx/log.cpp
python/cxx/parsecontext.cpp
python/cxx/parser.cpp
python/cxx/schedule.cpp
python/cxx/export.cpp
python/cxx/export.hpp
python/cxx/common_state.cpp
python/cxx/common_state.hpp
python/cxx/table_manager.cpp
python/cxx/well.cpp
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/python/ ${CMAKE_BINARY_DIR}/python
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python/setup.py
build
build_ext
--build-lib=${PROJECT_BINARY_DIR}/python/python/opm
--build-lib=${CMAKE_BINARY_DIR}/python/python/opm
--library-dirs=${_setup_lib_dirs}
${_rpath_arg}
--include-dirs=${_setup_include_dirs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python
COMMENT "Building python bindings")
add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/${python_lib_target})
add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/libopmcommon_python.so)
add_dependencies(opmcommon_python opmcommon)
# The install target is based on manually copying the python file tree to the
# installation area with a small installation script 'install.py'. Would have
# preferred to use standard setup.py install, but the setup.py based solution
# refuses to install to a location which the current python executable can not
# load from, and the use of eggs in the setup.py based installation makes
# debugging quite difficult.
#
# Since the installation of Python code is nonstandard it is protected by an
# extra cmake switch, OPM_INSTALL_PYTHON. If you prefer you can still invoke
# setup.py install manually - optionally with the generated script
# setup-install.sh - and completely bypass cmake in the installation phase.
if (OPM_INSTALL_PYTHON)
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
endif()
install( CODE "execute_process(COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} )" )
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} python/setup.py build_ext --dry-run install --prefix=${CMAKE_INSTALL_PREFIX} )" )
# Observe that if the opmcommon library has been built as a shared library the
# python library opmcommon_python will in general not find it runtime while
# testing.
add_test(NAME python_tests
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python
COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${PROJECT_BINARY_DIR}/python/python/opm test
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python
COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${CMAKE_BINARY_DIR}/python/python/opm test
)
set_target_properties(opmcommon PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/python/python)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/python/python)
# -------------------------------------------------------------------------
# Let cmake configure some small shell scripts which can be used to simplify
# building, testing and installation of the Python extensions.
# building and testing of the Python extensions.
configure_file(python/setup-build.sh.in tmp/setup-build.sh)
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-build.sh
DESTINATION ${PROJECT_BINARY_DIR}
@@ -338,11 +288,6 @@ if (OPM_ENABLE_PYTHON)
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
configure_file(python/setup-install.sh.in tmp/setup-install.sh)
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-install.sh
DESTINATION ${PROJECT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
configure_file(python/enable-python.sh.in enable-python.sh)
# -------------------------------------------------------------------------

View File

@@ -30,8 +30,6 @@ list (APPEND MAIN_SOURCE_FILES
src/opm/common/OpmLog/OpmLog.cpp
src/opm/common/OpmLog/StreamLog.cpp
src/opm/common/OpmLog/TimerLog.cpp
src/opm/common/utility/ActiveGridCells.cpp
src/opm/common/utility/FileSystem.cpp
src/opm/common/utility/numeric/MonotCubicInterpolator.cpp
src/opm/common/utility/parameters/Parameter.cpp
src/opm/common/utility/parameters/ParameterGroup.cpp
@@ -48,20 +46,18 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/Deck/DeckKeyword.cpp
src/opm/parser/eclipse/Deck/DeckRecord.cpp
src/opm/parser/eclipse/Deck/DeckOutput.cpp
src/opm/parser/eclipse/Deck/DeckSection.cpp
src/opm/parser/eclipse/Deck/Section.cpp
src/opm/parser/eclipse/Deck/UDAValue.cpp
src/opm/parser/eclipse/Python/Python.cpp
src/opm/parser/eclipse/EclipseState/AquiferConfig.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/FieldProps.cpp
src/opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.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
@@ -70,9 +66,10 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Grid/Fault.cpp
src/opm/parser/eclipse/EclipseState/Grid/FaultFace.cpp
src/opm/parser/eclipse/EclipseState/Grid/GridDims.cpp
src/opm/parser/eclipse/EclipseState/Grid/GridProperties.cpp
src/opm/parser/eclipse/EclipseState/Grid/GridProperty.cpp
src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp
src/opm/parser/eclipse/EclipseState/Grid/NNC.cpp
src/opm/parser/eclipse/EclipseState/Grid/Operate.cpp
src/opm/parser/eclipse/EclipseState/Grid/PinchMode.cpp
src/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.cpp
src/opm/parser/eclipse/EclipseState/Grid/setKeywordBox.cpp
@@ -93,34 +90,28 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/Condition.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Action/PyAction.cpp
src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/Group2.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/icd.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/MSW/SpiralICD.cpp
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.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/ScheduleTypes.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/Connection.cpp
src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WList.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.cpp
@@ -128,23 +119,18 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.cpp
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellBrineProperties.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/BCConfig.cpp
src/opm/parser/eclipse/EclipseState/SimulationConfig/RockConfig.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
src/opm/parser/eclipse/EclipseState/Tables/ColumnSchema.cpp
src/opm/parser/eclipse/EclipseState/Tables/DenT.cpp
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/StandardCond.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
@@ -153,9 +139,6 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp
src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/PvtwsaltTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/BrineDensityTable.cpp
src/opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.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
@@ -187,43 +170,31 @@ if(ENABLE_ECL_INPUT)
src/opm/parser/eclipse/Utility/Stringview.cpp
)
# This list is only used to register a CMake dependency between the the python
# extension and the corresponding C++ wrapper files. The cpp files actually
# listed here are repeated in the actual definition of the extension in the
# setup.py file.
list( APPEND PYTHON_CXX_SOURCE_FILES
if (OPM_ENABLE_EMBEDDED_PYTHON)
list( APPEND PYTHON_SOURCE_FILES
src/opm/parser/eclipse/Python/PythonInterp.cpp
python/cxx/connection.cpp
python/cxx/converters.cpp
python/cxx/deck.cpp
python/cxx/deck_keyword.cpp
python/cxx/eclipse_io.cpp
python/cxx/field_props.cpp
python/cxx/eclipse_3d_properties.cpp
python/cxx/eclipse_config.cpp
python/cxx/eclipse_grid.cpp
python/cxx/eclipse_state.cpp
python/cxx/export.cpp
python/cxx/group.cpp
python/cxx/log.cpp
python/cxx/parsecontext.cpp
python/cxx/parser.cpp
python/cxx/schedule.cpp
python/cxx/summary_state.cpp
python/cxx/export.cpp
python/cxx/common_state.cpp
python/cxx/table_manager.cpp
python/cxx/unit_system.cpp
python/cxx/well.cpp
python/cxx/log.cpp
)
if (OPM_ENABLE_EMBEDDED_PYTHON)
set_source_files_properties(${PYTHON_CXX_SOURCE_FILES} PROPERTIES COMPILE_FLAGS -Wno-shadow)
set_source_files_properties(src/opm/parser/eclipse/Python/PythonInterp.cpp PROPERTIES COMPILE_FLAGS -Wno-shadow)
set_source_files_properties(src/opm/parser/eclipse/EclipseState/Schedule/Action/PyAction.cpp PROPERTIES COMPILE_FLAGS -Wno-shadow)
list( APPEND MAIN_SOURCE_FILES src/opm/parser/eclipse/Python/PythonInterp.cpp ${PYTHON_CXX_SOURCE_FILES})
set_source_files_properties(${PYTHON_SOURCE_FILES} PROPERTIES COMPILE_FLAGS -Wno-shadow)
list( APPEND MAIN_SOURCE_FILES ${PYTHON_SOURCE_FILES})
endif()
list( APPEND PYTHON_CXX_DEPENDS ${PYTHON_CXX_SOURCE_FILES}
python/cxx/converters.hpp
python/cxx/export.hpp)
if(NOT cjson_FOUND)
list(APPEND MAIN_SOURCE_FILES external/cjson/cJSON.c)
@@ -239,19 +210,11 @@ if(ENABLE_ECL_OUTPUT)
src/opm/io/eclipse/ERst.cpp
src/opm/io/eclipse/ESmry.cpp
src/opm/io/eclipse/OutputStream.cpp
src/opm/io/eclipse/rst/connection.cpp
src/opm/io/eclipse/rst/group.cpp
src/opm/io/eclipse/rst/header.cpp
src/opm/io/eclipse/rst/segment.cpp
src/opm/io/eclipse/rst/state.cpp
src/opm/io/eclipse/rst/well.cpp
src/opm/output/eclipse/AggregateActionxData.cpp
src/opm/output/eclipse/AggregateConnectionData.cpp
src/opm/output/eclipse/AggregateGroupData.cpp
src/opm/output/eclipse/AggregateMSWData.cpp
src/opm/output/eclipse/AggregateUDQData.cpp
src/opm/output/eclipse/AggregateWellData.cpp
src/opm/output/eclipse/CreateActionxDims.cpp
src/opm/output/eclipse/CreateDoubHead.cpp
src/opm/output/eclipse/CreateInteHead.cpp
src/opm/output/eclipse/CreateLogiHead.cpp
@@ -275,7 +238,6 @@ if(ENABLE_ECL_OUTPUT)
endif()
list (APPEND TEST_SOURCE_FILES
tests/test_ActiveGridCells.cpp
tests/test_calculateCellVol.cpp
tests/test_cmp.cpp
tests/test_cubic.cpp
@@ -283,7 +245,6 @@ list (APPEND TEST_SOURCE_FILES
tests/test_nonuniformtablelinear.cpp
tests/test_OpmLog.cpp
tests/test_param.cpp
tests/test_RootFinders.cpp
tests/test_SimulationDataContainer.cpp
tests/test_sparsevector.cpp
tests/test_uniformtablelinear.cpp
@@ -292,7 +253,10 @@ if(ENABLE_ECL_INPUT)
list(APPEND TEST_SOURCE_FILES
tests/parser/ACTIONX.cpp
tests/parser/ADDREGTests.cpp
tests/parser/AquiferTests.cpp
tests/parser/AquiferCTTests.cpp
tests/parser/AquifetpTests.cpp
tests/parser/AqudimsTests.cpp
tests/parser/AquanconTests.cpp
tests/parser/BoxTests.cpp
tests/parser/ColumnSchemaTests.cpp
tests/parser/ConnectionTests.cpp
@@ -302,16 +266,17 @@ if(ENABLE_ECL_INPUT)
tests/parser/DeckTests.cpp
tests/parser/DynamicStateTests.cpp
tests/parser/DynamicVectorTests.cpp
tests/parser/Eclipse3DPropertiesTests.cpp
tests/parser/EclipseGridTests.cpp
tests/parser/EmbeddedPython.cpp
tests/parser/EqualRegTests.cpp
tests/parser/EventTests.cpp
tests/parser/FaceDirTests.cpp
tests/parser/FaultTests.cpp
tests/parser/FieldPropsTests.cpp
tests/parser/FoamTests.cpp
tests/parser/FunctionalTests.cpp
tests/parser/GeomodifierTests.cpp
tests/parser/GridPropertyTests.cpp
tests/parser/GroupTests.cpp
tests/parser/InitConfigTest.cpp
tests/parser/IOConfigTests.cpp
@@ -324,14 +289,13 @@ if(ENABLE_ECL_INPUT)
tests/parser/ParseContext_EXIT1.cpp
tests/parser/ParseDATAWithDefault.cpp
tests/parser/PYACTION.cpp
tests/parser/PORVTests.cpp
tests/parser/RawKeywordTests.cpp
tests/parser/ResinsightTest.cpp
tests/parser/RestartConfigTests.cpp
tests/parser/RFTConfigTests.cpp
tests/parser/RockTableTests.cpp
tests/parser/RunspecTests.cpp
tests/parser/SaltTableTests.cpp
tests/parser/ScheduleRestartTests.cpp
tests/parser/SatfuncPropertyInitializersTests.cpp
tests/parser/ScheduleTests.cpp
tests/parser/SectionTests.cpp
tests/parser/SimpleTableTests.cpp
@@ -359,7 +323,6 @@ if(ENABLE_ECL_INPUT)
endif()
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_SOURCE_FILES
tests/test_AggregateActionxData.cpp
tests/test_AggregateWellData.cpp
tests/test_AggregateGroupData.cpp
tests/test_AggregateMSWData.cpp
@@ -376,7 +339,6 @@ if(ENABLE_ECL_OUTPUT)
tests/test_PaddedOutputString.cpp
tests/test_Restart.cpp
tests/test_RFT.cpp
tests/test_rst.cpp
tests/test_Solution.cpp
tests/test_Summary.cpp
tests/test_Tables.cpp
@@ -393,9 +355,8 @@ if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
tests/expect-wdims.chldg.err.out
tests/expect-wdims.err.out
tests/BASE_SIM.DATA
tests/BASE_SIM_THPRES.DATA
tests/RESTART_SIM.DATA
tests/FIRST_SIM.DATA
tests/FIRST_SIM_THPRES.DATA
tests/summary_deck.DATA
tests/group_group.DATA
tests/testblackoilstate3.DATA
@@ -409,15 +370,6 @@ if(ENABLE_ECL_OUTPUT)
tests/SPE9_CP_PACKED.DATA
tests/SOFR_TEST.DATA
tests/UDQ_TEST_WCONPROD_IUAD-2.DATA
tests/UDQ_ACTIONX_TEST1.DATA
tests/include_example_pvt.txt
tests/include_example_summary.txt
tests/include_sgof.txt
tests/include_swof.txt
tests/include_grid_3x5x4.grdecl
tests/SPE1CASE2.DATA
tests/SPE1CASE2_RESTART.DATA
tests/SPE1CASE2.X0060
)
endif()
@@ -442,7 +394,6 @@ if(ENABLE_ECL_INPUT)
examples/opmi.cpp
examples/opmpack.cpp
examples/opmhash.cpp
tests/rst_load.cpp
)
endif()
@@ -469,12 +420,9 @@ list( APPEND PUBLIC_HEADER_FILES
opm/common/OpmLog/LogUtil.hpp
opm/common/OpmLog/MessageFormatter.hpp
opm/common/OpmLog/MessageLimiter.hpp
opm/common/OpmLog/Location.hpp
opm/common/OpmLog/OpmLog.hpp
opm/common/OpmLog/StreamLog.hpp
opm/common/OpmLog/TimerLog.hpp
opm/common/utility/ActiveGridCells.hpp
opm/common/utility/FileSystem.hpp
opm/common/utility/numeric/cmp.hpp
opm/common/utility/platform_dependent/disable_warnings.h
opm/common/utility/platform_dependent/reenable_warnings.h
@@ -527,23 +475,23 @@ if(ENABLE_ECL_INPUT)
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
opm/parser/eclipse/EclipseState/Grid/PinchMode.hpp
opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp
opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp
opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp
opm/parser/eclipse/EclipseState/Grid/Fault.hpp
opm/parser/eclipse/EclipseState/Grid/Box.hpp
opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp
opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp
opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp
opm/parser/eclipse/EclipseState/Grid/NNC.hpp
opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp
opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp
opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp
opm/parser/eclipse/EclipseState/Grid/MinpvMode.hpp
opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp
opm/parser/eclipse/EclipseState/EndpointScaling.hpp
opm/parser/eclipse/EclipseState/Tables/DenT.hpp
opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp
opm/parser/eclipse/EclipseState/Tables/StandardCond.hpp
opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp
opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp
opm/parser/eclipse/EclipseState/Tables/TlpmixpaTable.hpp
@@ -553,10 +501,6 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Tables/Regdims.hpp
opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp
opm/parser/eclipse/EclipseState/Tables/SpecrockTable.hpp
opm/parser/eclipse/EclipseState/Tables/PvtwsaltTable.hpp
opm/parser/eclipse/EclipseState/Tables/BrineDensityTable.hpp
opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.hpp
opm/parser/eclipse/EclipseState/Tables/SaltvdTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp
opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp
@@ -617,19 +561,15 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/EclipseState.hpp
opm/parser/eclipse/EclipseState/EclipseConfig.hpp
opm/parser/eclipse/EclipseState/Aquancon.hpp
opm/parser/eclipse/EclipseState/AquiferConfig.hpp
opm/parser/eclipse/EclipseState/AquiferCT.hpp
opm/parser/eclipse/EclipseState/Aquifetp.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/Condition.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp
opm/parser/eclipse/EclipseState/Schedule/Action/PyAction.hpp
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
@@ -637,12 +577,11 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellFoamProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellBrineProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp
@@ -654,36 +593,26 @@ if(ENABLE_ECL_INPUT)
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/ScheduleTypes.hpp
opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/Group2.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateModel.hpp
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp
opm/parser/eclipse/EclipseState/Schedule/Events.hpp
opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.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/MSW/SpiralICD.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/BCConfig.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/RockConfig.hpp
opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.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/UDQAssign.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp
@@ -696,13 +625,12 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp
opm/parser/eclipse/Deck/DeckItem.hpp
opm/parser/eclipse/Deck/Deck.hpp
opm/parser/eclipse/Deck/DeckSection.hpp
opm/parser/eclipse/Deck/Section.hpp
opm/parser/eclipse/Deck/DeckOutput.hpp
opm/parser/eclipse/Deck/DeckValue.hpp
opm/parser/eclipse/Deck/DeckKeyword.hpp
opm/parser/eclipse/Deck/DeckRecord.hpp
opm/parser/eclipse/Deck/UDAValue.hpp
opm/parser/eclipse/Deck/value_status.hpp
opm/parser/eclipse/Python/Python.hpp)
endif()
if(ENABLE_ECL_OUTPUT)
@@ -717,17 +645,9 @@ if(ENABLE_ECL_OUTPUT)
opm/io/eclipse/ESmry.hpp
opm/io/eclipse/PaddedOutputString.hpp
opm/io/eclipse/OutputStream.hpp
opm/io/eclipse/rst/connection.hpp
opm/io/eclipse/rst/group.hpp
opm/io/eclipse/rst/header.hpp
opm/io/eclipse/rst/segment.hpp
opm/io/eclipse/rst/state.hpp
opm/io/eclipse/rst/well.hpp
opm/output/data/Aquifer.hpp
opm/output/data/Cells.hpp
opm/output/data/Solution.hpp
opm/output/data/Wells.hpp
opm/output/eclipse/VectorItems/aquifer.hpp
opm/output/eclipse/VectorItems/connection.hpp
opm/output/eclipse/VectorItems/group.hpp
opm/output/eclipse/VectorItems/intehead.hpp
@@ -735,7 +655,6 @@ if(ENABLE_ECL_OUTPUT)
opm/output/eclipse/VectorItems/msw.hpp
opm/output/eclipse/VectorItems/tabdims.hpp
opm/output/eclipse/VectorItems/well.hpp
opm/output/eclipse/AggregateActionxData.hpp
opm/output/eclipse/AggregateGroupData.hpp
opm/output/eclipse/AggregateConnectionData.hpp
opm/output/eclipse/AggregateMSWData.hpp

View File

@@ -1,10 +1,14 @@
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${BASE_DIR}/tmp_gen/ParserInit.cpp
${BASE_DIR}/ParserInit.cpp)
${BASE_DIR}/tmp_gen/ParserKeywords.cpp
${BASE_DIR}/ParserKeywords.cpp)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${BASE_DIR}/tmp_gen/TestKeywords.cpp
${BASE_DIR}/TestKeywords.cpp)
${BASE_DIR}/tmp_gen/inlinekw.cpp
${BASE_DIR}/inlinekw.cpp)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${BASE_DIR}/tmp_gen/include/opm/parser/eclipse/Parser/ParserKeywords.hpp
${BASE_DIR}/include/opm/parser/eclipse/Parser/ParserKeywords.hpp)
file(GLOB HDRS ${BASE_DIR}/tmp_gen/include/opm/parser/eclipse/Parser/ParserKeywords/*.hpp)
@@ -14,11 +18,4 @@ foreach(HDR ${HDRS})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDR}
${BASE_DIR}/include/opm/parser/eclipse/Parser/ParserKeywords/${hdr})
endforeach()
foreach (name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${BASE_DIR}/tmp_gen/ParserKeywords/${name}.cpp
${BASE_DIR}/ParserKeywords/${name}.cpp)
endforeach()

View File

@@ -2,19 +2,24 @@
set(TEST_LIBS opmcommon Boost::unit_test_framework)
set(EXTRA_TESTS)
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
# Generated source, needs to be here
opm_add_test(InlineKeywordTest
EXE_NAME TestKeywords
SOURCES ${PROJECT_BINARY_DIR}/TestKeywords.cpp
EXE_NAME inlinekw
SOURCES ${PROJECT_BINARY_DIR}/inlinekw.cpp
LIBRARIES ${TEST_LIBS})
list(APPEND EXTRA_TESTS TestKeywords)
list(APPEND EXTRA_TESTS inlinekw)
# Extra compile definitions and extra parameters
include(cmake/Modules/CheckCaseSensitiveFileSystem.cmake)
set(_testdir ${PROJECT_SOURCE_DIR}/tests/parser/data)
opm_add_test(LoaderTest
SOURCES tests/parser/KeywordLoaderTests.cpp
src/opm/parser/eclipse/Generator/KeywordLoader.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${_testdir}/parser/keyword-generator/)
list(APPEND EXTRA_TESTS LoaderTest)
opm_add_test(ParserTests
SOURCES tests/parser/ParserTests.cpp
LIBRARIES ${TEST_LIBS}
@@ -85,18 +90,7 @@ if(HAVE_OPM_TESTS)
${OPM_TESTS_ROOT}/spe9/SPE9.DATA
${OPM_TESTS_ROOT}/spe10model1/SPE10_MODEL1.DATA
${OPM_TESTS_ROOT}/spe10model2/SPE10_MODEL2.DATA
${OPM_TESTS_ROOT}/msw_2d_h/2D_H__.DATA
${OPM_TESTS_ROOT}/model2/0_BASE_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/1_MULTREGT_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/2_MULTXYZ_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/3_MULTFLT_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/4_MINPVV_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/5_SWATINIT_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/6_ENDSCALE_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/7_HYSTERESIS_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/8_MULTIPLY_TRANXYZ_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/9_EDITNNC_MODEL2.DATA)
${OPM_TESTS_ROOT}/msw_2d_h/2D_H__.DATA )
get_filename_component(test_name ${deck} NAME_WE)
opm_add_test(${test_name} NO_COMPILE
EXE_NAME parse_write
@@ -105,8 +99,6 @@ if(HAVE_OPM_TESTS)
opm_add_test("SPE9_CP_GROUP2" NO_COMPILE EXE_NAME parse_write TEST_ARGS "${OPM_TESTS_ROOT}/spe9group/SPE9_CP_GROUP.DATA")
set_property(TEST NORNE_ATW2013
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")
opm_add_test("RST_LOAD_MSW" NO_COMPILE EXE_NAME rst_load TEST_ARGS "${OPM_TESTS_ROOT}/msw_3d_hfa/opm-simulation-reference/flow/3D_MSW.UNRST")
endif()
# JSON tests
@@ -115,5 +107,3 @@ opm_add_test(jsonTests
LIBRARIES ${TEST_LIBS}
TEST_ARGS ${PROJECT_SOURCE_DIR}/tests/json/example1.json)
list(APPEND EXTRA_TESTS jsonTests)
endif()

View File

@@ -32,7 +32,7 @@ if(NOT cjson_FOUND)
endif()
add_executable(genkw ${genkw_SOURCES})
target_link_libraries(genkw ${opm-common_LIBRARIES})
target_link_libraries(genkw Boost::regex Boost::filesystem Boost::system)
# Generate keyword list
include(src/opm/parser/eclipse/share/keywords/keyword_list.cmake)
@@ -40,74 +40,18 @@ string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/src/opm/parser/eclipse/sha
configure_file(src/opm/parser/eclipse/keyword_list.argv.in keyword_list.argv)
# Generate keyword source
add_custom_command( OUTPUT
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/A.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/B.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/C.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/D.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/E.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/F.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/G.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/H.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/I.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/J.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/K.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/L.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/M.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/N.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/O.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/P.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Q.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/R.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/S.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/T.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/U.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/V.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/W.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/X.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Y.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Z.cpp
${PROJECT_BINARY_DIR}/tmp_gen/TestKeywords.cpp
COMMAND genkw keyword_list.argv
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords
${PROJECT_BINARY_DIR}/tmp_gen/ParserInit.cpp
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp ${PROJECT_BINARY_DIR}/tmp_gen/inlinekw.cpp
COMMAND genkw keyword_list.argv
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp
${PROJECT_BINARY_DIR}/tmp_gen/include/
opm/parser/eclipse/Parser/ParserKeywords
${PROJECT_BINARY_DIR}/tmp_gen/TestKeywords.cpp
${PROJECT_BINARY_DIR}/tmp_gen/inlinekw.cpp
DEPENDS genkw ${keyword_files} src/opm/parser/eclipse/share/keywords/keyword_list.cmake
)
# To avoid some rebuilds
add_custom_command(OUTPUT
${PROJECT_BINARY_DIR}/ParserKeywords/A.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/B.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/C.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/D.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/E.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/F.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/G.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/H.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/I.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/J.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/K.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/L.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/M.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/N.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/O.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/P.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Q.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/R.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/S.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/T.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/U.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/V.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/W.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/X.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Y.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Z.cpp
${PROJECT_BINARY_DIR}/TestKeywords.cpp
${PROJECT_BINARY_DIR}/ParserInit.cpp
DEPENDS ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/A.cpp
add_custom_command(OUTPUT ParserKeywords.cpp inlinekw.cpp
DEPENDS ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp
COMMAND ${CMAKE_COMMAND} -DBASE_DIR=${PROJECT_BINARY_DIR}
-P ${PROJECT_SOURCE_DIR}/CopyHeaders.cmake)

View File

@@ -0,0 +1,468 @@
#
# Module that checks for supported C++11 (former C++0x) features.
#
# Sets the follwing variable:
#
# HAVE_FINAL True if the compiler supports the "final" quantifier
# HAVE_TYPE_TRAITS True if the <type_traits> header is available and implements sufficient functionality
# HAVE_SHARED_PTR True if std::shared_ptr is available
# HAVE_UNIQUE_PTR True if std::unique_ptr is available
# HAVE_NULLPTR True if nullptr is available
# HAVE_ARRAY True if header <array> and fill() are available
# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
# HAVE_CONSTEXPR True if constexpr attribute is available
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
# HAVE_STATIC_ASSERT True if static_assert is available
# HAVE_AUTO True if the compiler supports the auto keyword
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supported
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
# HAVE_TUPLE True if std::tuple is available
# HAVE_TR1_TUPLE True if std::tr1::tuple is available
include(CheckCXXSourceCompiles)
include(CheckCXXSourceRuns)
# test for C++11 flags
include(TestCXXAcceptsFlag)
include(CheckIncludeFileCXX)
# macro to only add option once
include(AddOptions)
# Force CXX Standard cross platfrom for CMakeVersion >=3.1
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
if(NOT MSVC)
foreach(_flag "14" "11")
set(_FLAG "CXX_FLAG_CXX${_flag}")
string(TOUPPER ${_FLAG} _FLAG)
# try to use compiler flag -std=c++${_flag}
CHECK_CXX_ACCEPTS_FLAG("-std=c++${_flag}" ${_FLAG})
if(${_FLAG})
if(CMAKE_VERSION VERSION_LESS 3.1)
add_options (CXX ALL_BUILDS "-std=c++${_flag}")
endif()
set(CXX_STD0X_FLAGS "-std=c++${_flag}")
#Use vriables for CMake > 3.1 set the standard with no extensions
set(CMAKE_CXX_STANDARD ${_flag})
break()
endif()
endforeach()
endif(NOT MSVC)
endif()
if(CMAKE_VERSION VERSION_LESS 3.1)
# if we are building with an Apple toolchain in MacOS X,
# we cannot use the old GCC 4.2 fork, but must use the
# new runtime library
set (CXX_STDLIB_FLAGS)
string (TOUPPER "${CMAKE_CXX_COMPILER_ID}" _comp_id)
if (APPLE AND (_comp_id MATCHES "CLANG"))
CHECK_CXX_ACCEPTS_FLAG ("-stdlib=libc++" CXX_FLAG_STDLIB_LIBCXX)
if (CXX_FLAG_STDLIB_LIBCXX)
add_options (CXX ALL_BUILDS "-stdlib=libc++")
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
endif (CXX_FLAG_STDLIB_LIBCXX)
endif (APPLE AND (_comp_id MATCHES "CLANG"))
# to format the command-line options pretty, we have an optional space
if (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE " ")
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
set (CXX_SPACE)
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
# Workaround bug in cmake:
# cxx standard flags are not applied in CheckCXXSourceCompiles
if (CMAKE_CXX_STANDARD EQUAL 14)
add_options(CXX ALL_BUILDS ${CMAKE_CXX14_STANDARD_COMPILE_OPTION})
else()
add_options(CXX ALL_BUILDS ${CMAKE_CXX11_STANDARD_COMPILE_OPTION})
endif()
endif()
# perform tests
include(CheckCXXSourceCompiles)
# the "final" method specifier
CHECK_CXX_SOURCE_COMPILES("
struct Base {
virtual void foo() = 0;
};
struct Derived : public Base {
virtual void foo() final {};
};
int main()
{
return 0;
}
" HAVE_FINAL
)
# std::is_convertible, std::is_base_of
CHECK_CXX_SOURCE_COMPILES("
#include <type_traits>
class Base {};
class Derived : public Base {};
int main()
{
bool foo = std::is_convertible<int, double>::value;
bool bar = std::is_base_of<Base, Derived>::value;
bool foobar = std::is_integral<double>::value;
return 0;
}
" HAVE_TYPE_TRAITS
)
# nullptr
CHECK_CXX_SOURCE_COMPILES("
#include <memory>
int main(void)
{
std::shared_ptr<int> foo(new int(123));
return 0;
}
" HAVE_SHARED_PTR
)
# this is required by dune-common to avoid linker errors. "fun"!
if (HAVE_SHARED_PTR)
set(HAVE_MAKE_SHARED 1)
set(SHARED_PTR_HEADER "<memory>")
set(SHARED_PTR_NAMESPACE "std")
endif()
# nullptr
CHECK_CXX_SOURCE_COMPILES("
#include <memory>
int main(void)
{
std::unique_ptr<int> foo(new int(123));
return 0;
}
" HAVE_UNIQUE_PTR
)
# nullptr
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
char* ch = nullptr;
return 0;
}
" HAVE_NULLPTR
)
# constexpr
CHECK_CXX_SOURCE_COMPILES("
template <class T>
inline constexpr int foo(T bar) { return bar*2; }
int main(void)
{
constexpr int foobar = foo(100);
return 0;
}
" HAVE_CONSTEXPR
)
# array and fill
CHECK_CXX_SOURCE_COMPILES("
#include <array>
int main(void)
{
std::array<int,2> a;
a.fill(9);
return 0;
}
" HAVE_ARRAY
)
# Check whether if std::integral_constant< T, v > is supported and casts into T
CHECK_CXX_SOURCE_COMPILES("
#include <type_traits>
void f( int ){}
int main(void){
f( std::integral_constant< int, 42 >() );
}
" HAVE_INTEGRAL_CONSTANT
)
# Check whether if <tuple> is available
check_include_file_cxx("tuple" HAVE_TUPLE)
# Check whether if <tr1/tuple> is available
check_include_file_cxx("tr1/tuple" HAVE_TR1_TUPLE)
# __attribute__((always_inline))
CHECK_CXX_SOURCE_COMPILES("
void __attribute__((always_inline)) foo(void) {}
int main(void)
{
foo();
return 0;
};
" HAVE_ATTRIBUTE_ALWAYS_INLINE
)
# __attribute__((unused))
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
int __attribute__((unused)) foo;
return 0;
};
" HAS_ATTRIBUTE_UNUSED
)
# __attribute__((deprecated))
CHECK_CXX_SOURCE_COMPILES("
#define DEP __attribute__((deprecated))
class bar
{
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng {
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
};
" HAS_ATTRIBUTE_DEPRECATED
)
# __attribute__((deprecated("msg")))
CHECK_CXX_SOURCE_COMPILES("
#define DEP __attribute__((deprecated(\"message\")))
class bar {
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng
{
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
};
" HAS_ATTRIBUTE_DEPRECATED_MSG
)
# static assert
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
static_assert(true,\"MSG\");
return 0;
}
" HAVE_STATIC_ASSERT
)
# auto keyword
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
auto foo = 1.23;
return 0;
}
" HAVE_AUTO
)
# variadic template support
CHECK_CXX_SOURCE_COMPILES("
#include <cassert>
template<typename... T>
int addints(T... x);
int add_ints()
{
return 0;
}
template<typename T1, typename... T>
int add_ints(T1 t1, T... t)
{
return t1 + add_ints(t...);
}
int main(void)
{
assert( 5 == add_ints(9,3,-5,-2) );
return 0;
}
" HAVE_VARIADIC_TEMPLATES
)
# SFINAE on variadic template constructors within template classes
CHECK_CXX_SOURCE_COMPILES("
#include <functional>
template<typename... U>
struct A
{
template<typename... T,
typename = typename std::enable_if<(sizeof...(T) < 2)>::type
>
A(T... t)
: i(1)
{}
template<typename... T,
typename = typename std::enable_if<(sizeof...(T) >= 2)>::type,
typename = void
>
A(T... t)
: i(-1)
{}
A()
: i(1)
{}
int i;
};
int main(void)
{
return (A<int>().i + A<int>(2).i + A<int>(\"foo\",3.4).i + A<int>(8,'a',A<int>()).i == 0 ? 0 : 1);
}
" HAVE_VARIADIC_CONSTRUCTOR_SFINAE
)
# rvalue references
CHECK_CXX_SOURCE_COMPILES("
#include <cassert>
#include <utility>
int foo(int&& x) { return 1; }
int foo(const int& x) { return -1; }
template<typename T>
int forward(T&& x)
{
return foo(std::forward<T>(x));
}
int main(void)
{
int i = 0;
assert( forward(i) + forward(int(2)) == 0);
return 0;
}
" HAVE_RVALUE_REFERENCES
)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
# Search for some tr1 headers
foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits)
string(REPLACE "/" "_" _HEADER_VAR ${_HEADER})
string(TOUPPER ${_HEADER_VAR} _HEADER_VAR )
check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}")
endforeach(_HEADER tuple tr1/tuple tr1/type_traits)
# make sure that the C++-11 features implemented by the compiler are a
# superset of those provided by GCC 4.4. This makes the test fail on
# all GCC compilers before 4.4.
set(CXX_FEATURES_MISSING "")
if (NOT HAVE_TYPE_TRAITS)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Sufficiently conformant type traits (defined by the 'type_traits' header file)\n")
endif()
if (NOT HAVE_SHARED_PTR)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Shared pointers (the std::shared_ptr class)\n")
endif()
if (NOT HAVE_UNIQUE_PTR)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Unique pointers (the std::unique_ptr class)\n")
endif()
if (NOT HAVE_ARRAY)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Statically sized arrays (the std::array class)\n")
endif()
if (NOT HAVE_STATIC_ASSERT)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Static assertations (the static_assert() mechanism)\n")
endif()
if (NOT HAVE_AUTO)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Automatically typed variables (the 'auto' keyword)\n")
endif()
if (NOT HAVE_VARIADIC_TEMPLATES)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Variable number of template arguments\n")
endif()
if (NOT HAVE_VARIADIC_CONSTRUCTOR_SFINAE)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Constructors with variable number of template arguments obeying the SFINAE (specialization failure is not an error) rule\n")
endif()
if (NOT HAVE_RVALUE_REFERENCES)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - References to rvalue objects\n")
endif()
if (NOT HAVE_TUPLE)
set(CXX_FEATURES_MISSING
"${CXX_FEATURES_MISSING} - Tuples (the std::tuple class)\n")
endif()
if(CXX_FEATURES_MISSING)
set (CXX11FEATURES_FOUND FALSE)
if (CXX11Features_FIND_REQUIRED)
message(FATAL_ERROR
"Your C++ compiler does not support the minimum set of C++-2011 features required. "
"Make sure to use a compiler which implements all C++-2011 features provided by GCC 4.4. "
"Your compiler does not seem to implement the following features:\n"
"${CXX_FEATURES_MISSING}")
endif()
else ()
set (CXX11FEATURES_FOUND TRUE)
endif()

View File

@@ -20,7 +20,8 @@ find_opm_package (
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
# we just include them to forward here in case anyone else does
"dune-grid REQUIRED;
"CXX11Features REQUIRED;
dune-grid REQUIRED;
ZLIB;
ZOLTAN;
METIS

View File

@@ -16,7 +16,8 @@ find_opm_package (
"dune-common"
# dependencies
"BLAS REQUIRED;
"CXX11Features REQUIRED;
BLAS REQUIRED;
LAPACK REQUIRED;
CxaDemangle;
MPI

View File

@@ -19,7 +19,8 @@ find_opm_package (
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
# we just include them to forward here in case anyone else does
"dune-common REQUIRED;
"CXX11Features REQUIRED;
dune-common REQUIRED;
dune-grid REQUIRED;
dune-alugrid;
ZLIB;

View File

@@ -19,7 +19,8 @@ find_opm_package (
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
# we just include them to forward here in case anyone else does
"dune-common REQUIRED
"CXX11Features REQUIRED;
dune-common REQUIRED
"
# header to search for
"dune/geometry/quadraturerules.hh"

View File

@@ -22,7 +22,8 @@ find_opm_package (
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
# we just include them to forward here in case anyone else does
"dune-common REQUIRED;
"CXX11Features REQUIRED;
dune-common REQUIRED;
dune-geometry REQUIRED;
dune-uggrid;
MPI;

View File

@@ -7,7 +7,8 @@ find_opm_package (
# dependencies
# TODO: we should probe for all the HAVE_* values listed below;
# however, we don't actually use them in our implementation, so
"dune-common REQUIRED
"CXX11Features REQUIRED;
dune-common REQUIRED
"
# header to search for
""

View File

@@ -1,99 +0,0 @@
# Check for various compiler extensions
# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
include(CheckCXXSourceCompiles)
# __attribute__((always_inline))
CHECK_CXX_SOURCE_COMPILES("
void __attribute__((always_inline)) foo(void) {}
int main(void)
{
foo();
return 0;
};
" HAVE_ATTRIBUTE_ALWAYS_INLINE
)
# __attribute__((unused))
CHECK_CXX_SOURCE_COMPILES("
int main(void)
{
int __attribute__((unused)) foo;
return 0;
};
" HAS_ATTRIBUTE_UNUSED
)
# __attribute__((deprecated))
CHECK_CXX_SOURCE_COMPILES("
#define DEP __attribute__((deprecated))
class bar
{
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng {
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
};
" HAS_ATTRIBUTE_DEPRECATED
)
# __attribute__((deprecated("msg")))
CHECK_CXX_SOURCE_COMPILES("
#define DEP __attribute__((deprecated(\"message\")))
class bar {
bar() DEP;
};
class peng { } DEP;
template <class T>
class t_bar
{
t_bar() DEP;
};
template <class T>
class t_peng
{
t_peng() {};
} DEP;
void foo() DEP;
void foo() {};
int main(void)
{
return 0;
};
" HAS_ATTRIBUTE_DEPRECATED_MSG
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
list(APPEND ${project}_LIBRARIES stdc++fs)
endif()
endif()

View File

@@ -64,19 +64,6 @@ project (${${project}_NAME})
enable_language (C)
enable_language (CXX)
# Languages and global compiler settings
if(CMAKE_VERSION VERSION_LESS 3.8)
message(WARNING "CMake version does not support c++17, guessing -std=c++17")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
else()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
# Various compiler extension checks
include(OpmCompilerChecks)
# print system information to better pinpoint issues from log alone
include (UseSystemInfo)
system_info ()

View File

@@ -56,9 +56,6 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
# compile each of these separately
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
if (NOT "${test_regexp}" STREQUAL "" AND NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
continue()
endif()
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
add_dependencies (${satellite} ${_sat_NAME})

View File

@@ -69,6 +69,12 @@ if(NOT @opm-project_NAME@_FOUND)
endif()
endif (NOT "@opm-project_TARGET@" STREQUAL "")
# ensure that we build with support for C++11 to preserve ABI
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (REPLACE "@CXX_STDLIB_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@@CXX_SPACE@@CXX_STDLIB_FLAGS@ ${CMAKE_CXX_FLAGS}")
# same as above, but for C99
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)

2
debian/changelog vendored
View File

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

26
debian/control vendored
View File

@@ -2,12 +2,11 @@ Source: opm-common
Priority: extra
Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
Build-Depends: build-essential, debhelper (>= 9),
pkg-config, cmake, git, libtool, doxygen, graphviz,
pkg-config, cmake, git, libtool, doxygen,
texlive-latex-extra, texlive-latex-recommended,
ghostscript, libboost-system-dev, libboost-test-dev,
zlib1g-dev, libpython3-dev, python3-numpy, python3-distutils,
python3-setuptools, python3-setuptools-scm, python3-pytest-runner,
python3-decorator
libboost-regex-dev, libboost-filesystem-dev,
zlib1g-dev
Standards-Version: 3.9.2
Section: libs
Homepage: http://opm-project.org
@@ -24,16 +23,6 @@ Provides: libopm-common
Description: OPM common library
The OPM common library contains generic code shared across all OPM modules.
Package: libopm-common1-bin
Section: libs
Pre-Depends: ${misc:Pre-Depends}
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: libopm-common-bin
Description: OPM common binaries
The OPM common binaries.
Package: libopm-common1-dev
Section: libdevel
Architecture: any
@@ -53,12 +42,3 @@ Provides: libopm-common-doc
Description: OPM common library -- documentation
The OPM common library contains the shared buildsystem
and helpers shared across all OPM modules.
Package: python3-opm-common
Section: libs
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, libopm-common1, python3-numpy, python3-decorator
Description: OPM common python bindings
Python package for opm-common

View File

@@ -1 +0,0 @@
usr/bin/*

View File

@@ -1 +0,0 @@
usr/lib/python*/*

4
debian/rules vendored
View File

@@ -10,7 +10,7 @@
#export DH_VERBOSE=1
%:
dh $@ --parallel
dh $@
override_dh_auto_clean:
dh_auto_clean --buildsystem=cmake
@@ -20,7 +20,7 @@ override_dh_auto_build:
# consider using -DUSE_VERSIONED_DIR=ON if backporting
override_dh_auto_configure:
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DOPM_ENABLE_PYTHON=1 -DOPM_INSTALL_PYTHON=1 -DPYTHON_EXECUTABLE=/usr/bin/python3
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF
override_dh_auto_install:
dh_auto_install -- install-html

View File

@@ -184,8 +184,8 @@ the WCONHIST keyword has the the following items specification:
{"name" : "ORAT" , "value_type" : "DOUBLE", "default" : 0.0, "dimension" : "LiquidSurfaceVolume/Time"},
{"name" : "WRAT" , "value_type" : "DOUBLE" , "default" : 0.0, "dimension" : "LiquidSurfaceVolume/Time"},
{"name" : "GRAT" , "value_type" : "DOUBLE" , "default" : 0.0, "dimension" : "GasSurfaceVolume/Time"},
{"name" : "VFP_TABLE" , "value_type" : "INT" , "default" : 0.0 , "comment":"The default is a state variable"},
{"name" : "LIFT" , "value_type" : "DOUBLE" , "default" : 0.0 , "comment":"The default is a state variable"},
{"name" : "VFPTable" , "value_type" : "INT" , "default" : 0.0 , "comment":"The default is a state variable"},
{"name" : "Lift" , "value_type" : "DOUBLE" , "default" : 0.0 , "comment":"The default is a state variable"},
{"name" : "THP" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Pressure"},
{"name" : "BHP" , "value_type" : "DOUBLE" , "default" : 0.0 ,"dimension" : "Pressure"},
{"name" : "NGLRAT" , "value_type" : "DOUBLE" , "default" : 0.0 ,"dimension" : "LiquidSurfaceVolume/Time"}]}

View File

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

View File

@@ -37,8 +37,8 @@ int main(int /* argc */, char** argv) {
Opm::ErrorGuard error_guard;
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
Opm::EclipseState state(deck);
Opm::Schedule schedule(deck, state, 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) {

View File

@@ -64,10 +64,9 @@ std::vector<keyword> load_deck(const char * deck_file) {
auto deck = parser.parseFile(deck_file, parseContext, errors);
for (const auto& kw : deck) {
std::stringstream ss;
const auto& location = kw.location();
ss << kw;
keywords.emplace_back(kw.name(), location.filename, location.lineno, std::hash<std::string>{}(ss.str()));
keywords.emplace_back(kw.name(), kw.getFileName(), kw.getLineNumber(), std::hash<std::string>{}(ss.str()));
}
return keywords;
}

View File

@@ -18,8 +18,6 @@
*/
#include <iostream>
#include <iomanip>
#include <chrono>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
@@ -46,37 +44,12 @@ inline void loadDeck( const char * deck_file) {
Opm::Parser parser;
std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
std::chrono::system_clock::time_point start;
start = std::chrono::system_clock::now();
auto deck = parser.parseFile(deck_file, parseContext, errors);
auto deck_time = std::chrono::system_clock::now() - start;
std::cout << "parse complete - creating EclipseState .... "; std::cout.flush();
start = std::chrono::system_clock::now();
Opm::EclipseState state( deck );
auto state_time = std::chrono::system_clock::now() - start;
std::cout << "creating Schedule .... "; std::cout.flush();
start = std::chrono::system_clock::now();
Opm::Schedule schedule( deck, state);
auto schedule_time = std::chrono::system_clock::now() - start;
std::cout << "creating SummaryConfig .... "; std::cout.flush();
start = std::chrono::system_clock::now();
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 );
auto summary_time = std::chrono::system_clock::now() - start;
std::cout << "complete." << std::endl << std::endl;
std::cout << "Time: " << std::endl;
std::cout << " deck.....: " << std::chrono::duration<double>(deck_time).count() << " seconds" << std::endl;
std::cout << " state....: " << std::chrono::duration<double>(state_time).count() << " seconds" << std::endl;
std::cout << " schedule.: " << std::chrono::duration<double>(schedule_time).count() << " seconds" << std::endl;
std::cout << " summary..: " << std::chrono::duration<double>(summary_time).count() << " seconds" << std::endl;
std::cout << "complete." << std::endl;
}

View File

@@ -17,21 +17,18 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fstream>
#include <iostream>
#include <getopt.h>
#include <boost/filesystem.hpp>
#include <opm/common/utility/FileSystem.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/G.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>
namespace fs = Opm::filesystem;
Opm::Deck pack_deck( const char * deck_file, std::ostream& os) {
inline void pack_deck( const char * deck_file, std::ostream& os) {
Opm::ParseContext parseContext(Opm::InputError::WARN);
Opm::ErrorGuard errors;
Opm::Parser parser;
@@ -39,7 +36,6 @@ Opm::Deck pack_deck( const char * deck_file, std::ostream& os) {
auto deck = parser.parseFile(deck_file, parseContext, errors);
os << deck;
return deck;
}
@@ -66,44 +62,21 @@ Print NEW_CASE in cwd:
opmpack -o NEW_CASE.DATA path/to/MY_CASE.DATA
As an alternative to the -o option you can use -c; that is equivalent to -o -
but restart and import files referred to in the deck are also copied. The -o and
-c options are mutually exclusive. )";
)";
std::cerr << help_text << std::endl;
exit(1);
}
void copy_file(const fs::path& source_dir, fs::path fname, const fs::path& target_dir) {
if (fname.is_absolute()) {
// change when moving to gcc8+
// fname = fs::relative(fname, source_dir);
auto prefix_len = fs::canonical(source_dir).string().size();
fname = fs::canonical(fname);
fname = fs::path( fname.string().substr(prefix_len + 1) );
}
auto source_file = source_dir / fname;
auto target_file = target_dir / fname;
if (!fs::is_directory(target_file.parent_path()))
fs::create_directories(target_file.parent_path());
fs::copy_file(source_file, target_file, fs::copy_options::overwrite_existing);
std::cerr << "Copying file " << source_file.string() << " -> " << target_file.string() << std::endl;
}
int main(int argc, char** argv) {
int arg_offset = 1;
bool stdout_output = true;
bool copy_binary = false;
const char * coutput_arg;
while (true) {
int c;
c = getopt(argc, argv, "c:o:");
c = getopt(argc, argv, "o:");
if (c == -1)
break;
@@ -112,11 +85,6 @@ int main(int argc, char** argv) {
stdout_output = false;
coutput_arg = optarg;
break;
case 'c':
stdout_output = false;
copy_binary = true;
coutput_arg = optarg;
break;
}
}
arg_offset = optind;
@@ -127,41 +95,16 @@ int main(int argc, char** argv) {
pack_deck(argv[arg_offset], std::cout);
else {
std::ofstream os;
fs::path input_arg(argv[arg_offset]);
fs::path output_arg(coutput_arg);
fs::path output_dir(coutput_arg);
if (fs::is_directory(output_arg)) {
fs::path output_path = output_arg / input_arg.filename();
using path = boost::filesystem::path;
path input_arg(argv[arg_offset]);
path output_arg(coutput_arg);
if (boost::filesystem::is_directory(output_arg)) {
path output_path = output_arg / input_arg.filename();
os.open(output_path.string());
} else {
} else
os.open(output_arg.string());
output_dir = output_arg.parent_path();
}
const auto& deck = pack_deck(argv[arg_offset], os);
if (copy_binary) {
Opm::InitConfig init_config(deck);
if (init_config.restartRequested()) {
Opm::IOConfig io_config(deck);
fs::path restart_file(io_config.getRestartFileName( init_config.getRestartRootName(), init_config.getRestartStep(), false ));
copy_file(input_arg.parent_path(), restart_file, output_dir);
}
for (std::size_t import_index = 0; import_index < deck.count("IMPORT"); import_index++) {
const auto& import_keyword = deck.getKeyword("IMPORT", import_index);
const auto& fname = import_keyword.getRecord(0).getItem("FILE").get<std::string>(0);
copy_file(input_arg.parent_path(), fname, output_dir);
}
using GDFILE = Opm::ParserKeywords::GDFILE;
if (deck.hasKeyword<GDFILE>()) {
const auto& gdfile_keyword = deck.getKeyword<GDFILE>();
const auto& fname = gdfile_keyword.getRecord(0).getItem<GDFILE::filename>().get<std::string>(0);
copy_file(input_arg.parent_path(), fname, output_dir);
}
}
pack_deck(argv[arg_offset], os);
}
}

View File

@@ -3,8 +3,8 @@
declare -A configurations
declare -A EXTRA_MODULE_FLAGS
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON -DBUILD_FLOW_VARIANTS=ON"
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON -DOPM_INSTALL_PYTHON=ON"
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON"
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON"
# Parse revisions from trigger comment and setup arrays
# Depends on: 'upstreams', upstreamRev',

View File

@@ -45,11 +45,6 @@ done
export REASON
export BRANCH_NAME
$WORKSPACE/deps/opm-simulators/tests/update_reference_data.sh $OPM_TESTS_ROOT
if test $? -eq 5
then
echo "No tests failed - no data to update. Exiting"
exit 0
fi
# Finally open the pull request
cd $OPM_TESTS_ROOT
@@ -86,10 +81,6 @@ then
PRNUMBER=${rev//[!0-9]/}
DATA_PR=`curl -X GET https://api.github.com/repos/OPM/opm-tests/pulls?head=jenkins4opm:$BRANCH_NAME | grep '"number":' | awk -F ':' '{print $2}' | sed -e 's/,//' -e 's/ //'`
git push -u jenkins4opm $BRANCH_NAME -f
fi
if [ -n "$DATA_PR" ]
then
curl -d "{ \"body\": \"Existing PR https://github.com/OPM/opm-tests/pull/$DATA_PR was updated\" }" -X POST https://api.github.com/repos/OPM/$MAIN_REPO/issues/$PRNUMBER/comments?access_token=$GH_TOKEN
else
git-open-pull -u jenkins4opm --base-account OPM --base-repo opm-tests -r /tmp/cmsg $BRANCH_NAME

View File

@@ -9,11 +9,22 @@ set (opm-common_CONFIG_VAR
set (opm-common_DEPS
# compile with C99 support if available
"C99"
)
list(APPEND opm-common_DEPS
# various runtime library enhancements
"Boost 1.44.0 COMPONENTS system unit_test_framework REQUIRED"
)
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
)
if(ENABLE_ECL_INPUT)
list(APPEND opm-common_DEPS
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS system filesystem unit_test_framework regex REQUIRED")
else()
list(APPEND opm-common_DEPS
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS system unit_test_framework REQUIRED")
endif()
# We need a defined target for libecl when linking.
# The definition of the target is done implicitly below when
# libecl is searched for.
find_package_deps(opm-common)

View File

@@ -1,44 +0,0 @@
/*
Copyright 2015 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 LOCATION_HPP
#define LOCATION_HPP
namespace Opm {
class Location {
public:
std::string filename = "<memory string>";
std::size_t lineno = 0;
Location() = default;
Location(std::string fname, std::size_t lno) :
filename(std::move(fname)),
lineno(lno)
{}
bool operator==(const Location& data) const {
return filename == data.filename &&
lineno == data.lineno;
}
};
}
#endif

View File

@@ -23,10 +23,7 @@
#include <cstdint>
#include <string>
#include <opm/common/OpmLog/Location.hpp>
namespace Opm {
namespace Log {
namespace MessageType {
const int64_t Debug = 1; /* Excessive information */
@@ -59,8 +56,8 @@ namespace Log {
bool isPower2(int64_t x);
std::string fileMessage(const Location& location, const std::string& msg);
std::string fileMessage(int64_t messageType , const Location& location , const std::string& msg);
std::string fileMessage(const std::string& path, int line , const std::string& msg);
std::string fileMessage(int64_t messageType , const std::string& path, int line , const std::string& msg);
std::string prefixMessage(int64_t messageType , const std::string& msg);
std::string colorCodeMessage(int64_t messageType , const std::string& msg);

View File

@@ -1,79 +0,0 @@
/*
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 ACTIVEGRIDCELLS_HPP
#define ACTIVEGRIDCELLS_HPP
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
#include <array>
namespace Opm
{
/**
* \brief Simple class capturing active cells of a grid
*
*/
class ActiveGridCells
: public GridDims
{
public:
/// \brief Constructs mapping of active cells.
/// \param xyz The cartesian dimensions of the grid
/// \param globalCell Pointer to first entry of contiguous
/// array mapping local index to cartesian one.
/// \param nc The number of cells of a grid.
ActiveGridCells(std::array<int, 3> xyz,
const int* globalCell, std::size_t nc);
/// \brief Constructs mapping of active cells.
/// \param nx Number of cells in x
/// \param ny Number of cells in y
/// \param nz Number of cells in z
/// \param globalCell Pointer to first entry of contiguous
/// array mapping local index to cartesian one.
/// \param nc The number of cells of a grid.
ActiveGridCells(std::size_t nx, std::size_t ny, std::size_t nz,
const int* globalCell, std::size_t nc);
bool cellActive(std::size_t i, std::size_t j, std::size_t k) const;
bool cellActive(std::size_t cartesianIndex) const;
std::vector<int> actNum() const;
/// \brief Get the local index of a cell
/// \param cartesianIndex The cartesian index of the cell
/// \return The local index or -1 if the cell is inactive
int localCell(std::size_t cartesianIndex) const;
/// \brief Get the local index of a cell
/// \param i The index in the i direction
/// \param j The index in the j direction
/// \param k The index in the k direction
/// \return The local index or -1 if the cell is inactive
int localCell(std::size_t i, std::size_t j, std::size_t k) const;
protected:
/// \brief Maps the cartesian index to a compressed local index.
///
/// nonactive cells are marked with -1.
std::vector<int> localCell_;
};
} // end namespace Opm
#endif // ACTIVEGRIDCELLS_HPP

View File

@@ -1,47 +0,0 @@
/*
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_FILESYSTEM_HPP
#define OPM_FILESYSTEM_HPP
#if __cplusplus < 201703L || \
(defined(__GNUC__) && __GNUC__ < 8)
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#include <string>
namespace Opm
{
#if __cplusplus < 201703L || \
(defined(__GNUC__) && __GNUC__ < 8)
namespace filesystem = std::experimental::filesystem;
#else
namespace filesystem = std::filesystem;
#endif
// A poor man's filesystem::unique_path
std::string unique_path(const std::string& input);
} // end namespace Opm
#endif // OPM_FILESYSTEM_HPP

View File

@@ -20,7 +20,6 @@
#ifndef OPM_TIMESERVICE_HEADER_INCLUDED
#define OPM_TIMESERVICE_HEADER_INCLUDED
#include <chrono>
#include <ctime>
namespace Opm {
@@ -32,34 +31,20 @@ namespace Opm {
int year{0};
int month{0};
int day{0};
bool operator==(const YMD& data) const
{
return year == data.year &&
month == data.month &&
day == data.day;
}
};
TimeStampUTC() = default;
explicit TimeStampUTC(const std::time_t tp);
explicit TimeStampUTC(const YMD& ymd);
TimeStampUTC(const YMD& ymd,
int hour,
int minutes,
int seconds,
int usec);
TimeStampUTC& operator=(const std::time_t tp);
bool operator==(const TimeStampUTC& data) const;
TimeStampUTC& hour(const int h);
TimeStampUTC& minutes(const int m);
TimeStampUTC& seconds(const int s);
TimeStampUTC& microseconds(const int us);
const YMD& ymd() const { return ymd_; }
int year() const { return this->ymd_.year; }
int month() const { return this->ymd_.month; }
int day() const { return this->ymd_.day; }
@@ -76,7 +61,6 @@ namespace Opm {
int usec_{0};
};
TimeStampUTC operator+(const TimeStampUTC& lhs, std::chrono::duration<double> delta);
std::time_t asTimeT(const TimeStampUTC& tp);
} // namespace Opm

View File

@@ -1,6 +1,21 @@
//===========================================================================
//
// File: RootFinders.hpp
//
// Created: Thu May 6 19:59:42 2010
//
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
// Jostein R Natvig <jostein.r.natvig@sintef.no>
//
// $Date$
//
// $Revision$
//
//===========================================================================
/*
Copyright 2010, 2019 SINTEF Digital
Copyright 2010, 2019 Equinor ASA
Copyright 2010 SINTEF ICT, Applied Mathematics.
Copyright 2010 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
@@ -280,126 +295,6 @@ namespace Opm
template <class ErrorPolicy = ThrowOnError>
class RegulaFalsiBisection
{
public:
inline static std::string name()
{
return "RegulaFalsiBisection";
}
/// Implements a modified regula falsi method as described in
/// "Improved algorithms of Illinois-type for the numerical
/// solution of nonlinear equations"
/// by J. A. Ford. Current variant is the 'Pegasus' method.
/// Combines this method with the bisection method, inspired by
/// http://phillipmfeldman.org/Python/roots/find_roots.html
template <class Functor>
inline static double solve(const Functor& f,
const double a,
const double b,
const int max_iter,
const double tolerance,
int& iterations_used)
{
using namespace std;
const double sqrt_half = std::sqrt(0.5);
const double macheps = numeric_limits<double>::epsilon();
const double eps = tolerance + macheps * max(max(fabs(a), fabs(b)), 1.0);
double x0 = a;
double x1 = b;
double f0 = f(x0);
const double epsF = tolerance + macheps * max(fabs(f0), 1.0);
if (fabs(f0) < epsF) {
return x0;
}
double f1 = f(x1);
if (fabs(f1) < epsF) {
return x1;
}
if (f0 * f1 > 0.0) {
return ErrorPolicy::handleBracketingFailure(a, b, f0, f1);
}
iterations_used = 0;
// In every iteraton, x1 is the last point computed,
// and x0 is the last point computed that makes it a bracket.
double width = fabs(x1 - x0);
double contraction = 1.0;
while (width >= 1e-9 * eps) {
// If we are contracting sufficiently to at least halve
// the interval width in two iterations we use regula
// falsi. Otherwise, we take a bisection step to avoid
// slow convergence.
const double xnew = (contraction < sqrt_half)
? regulaFalsiStep(x0, x1, f0, f1)
: bisectionStep(x0, x1, f0, f1);
const double fnew = f(xnew);
++iterations_used;
if (iterations_used > max_iter) {
return ErrorPolicy::handleTooManyIterations(x0, x1, max_iter);
}
if (fabs(fnew) < epsF) {
return xnew;
}
// Now we must check which point we must replace.
if ((fnew > 0.0) == (f0 > 0.0)) {
// We must replace x0.
x0 = x1;
f0 = f1;
} else {
// We must replace x1, this is the case where
// the modification to regula falsi kicks in,
// by modifying f0.
// 1. The classic Illinois method
// const double gamma = 0.5;
// @afr: The next two methods do not work??!!?
// 2. The method called 'Method 3' in the paper.
// const double phi0 = f1/f0;
// const double phi1 = fnew/f1;
// const double gamma = 1.0 - phi1/(1.0 - phi0);
// 3. The method called 'Method 4' in the paper.
// const double phi0 = f1/f0;
// const double phi1 = fnew/f1;
// const double gamma = 1.0 - phi0 - phi1;
// cout << "phi0 = " << phi0 <<" phi1 = " << phi1 <<
// " gamma = " << gamma << endl;
// 4. The 'Pegasus' method
const double gamma = f1 / (f1 + fnew);
// 5. Straight unmodified Regula Falsi
// const double gamma = 1.0;
f0 *= gamma;
}
x1 = xnew;
f1 = fnew;
const double widthnew = fabs(x1 - x0);
contraction = widthnew/width;
width = widthnew;
}
return 0.5 * (x0 + x1);
}
private:
inline static double regulaFalsiStep(const double a, const double b, const double fa, const double fb)
{
assert(fa * fb < 0.0);
return (b * fa - a * fb) / (fa - fb);
}
inline static double bisectionStep(const double a, const double b, const double fa, const double fb)
{
static_cast<void>(fa);
static_cast<void>(fb);
assert(fa * fb < 0.0);
return 0.5*(a + b);
}
};
/// Attempts to find an interval bracketing a zero by successive
/// enlargement of search interval.
template <class Functor>

View File

@@ -69,11 +69,13 @@
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
#pragma GCC diagnostic ignored "-Wunused-private-field"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#endif // COMPATIBLE_COMPILER
#endif // SILENCE_EXTERNAL_WARNINGS

View File

@@ -42,18 +42,10 @@ public:
void loadReportStepNumber(int number);
template <typename T>
const std::vector<T>& getRst(const std::string& name, int reportStepNumber, int occurrence);
template <typename T>
const std::vector<T>& getRst(int index, int reportStepNumber){
auto indRange = this->getIndexRange(reportStepNumber);
return this->get<T>(index + std::get<0>(indRange));
}
int count(const std::string& name, int reportStepNumber) const;
const std::vector<T>& getRst(const std::string& name, int reportStepNumber);
const std::vector<int>& listOfReportStepNumbers() const { return seqnum; }
std::vector<EclEntry> listOfRstArrays(int reportStepNumber);
friend class OutputStream::Restart;
@@ -67,12 +59,10 @@ private:
void initUnified();
void initSeparate(const int number);
int getArrayIndex(const std::string& name, int seqnum, int occurrence) const;
std::tuple<int,int> getIndexRange(int reportStepNumber) const;
int getArrayIndex(const std::string& name, int seqnum) const;
std::streampos
restartStepWritePosition(const int seqnumValue) const;
};
}} // namespace Opm::EclIO

View File

@@ -21,7 +21,7 @@
#include <string>
#include <vector>
#include <opm/common/utility/FileSystem.hpp>
#include <boost/filesystem.hpp>
namespace Opm { namespace EclIO {
@@ -54,13 +54,13 @@ private:
std::vector<int> seqIndex;
std::vector<float> seqTime;
std::vector<std::string> checkForMultipleResultFiles(const Opm::filesystem::path& rootN, bool formatted) const;
std::vector<std::string> checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const;
void getRstString(const std::vector<std::string>& restartArray,
Opm::filesystem::path& pathRst,
Opm::filesystem::path& rootN) const;
boost::filesystem::path& pathRst,
boost::filesystem::path& rootN) const;
void updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const;
void updatePathAndRootName(boost::filesystem::path& dir, boost::filesystem::path& rootN) const;
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num) const;
};

View File

@@ -35,7 +35,7 @@ namespace Opm { namespace EclIO {
class EclFile
{
public:
explicit EclFile(const std::string& filename, bool preload = false);
explicit EclFile(const std::string& filename);
bool formattedInput() { return formatted; }
void loadData(); // load all data
@@ -64,7 +64,6 @@ public:
bool hasKey(const std::string &name) const;
const std::vector<std::string>& arrayNames() const { return array_name; }
std::size_t size() const;
protected:
bool formatted;

View File

@@ -1,66 +0,0 @@
/*
Copyright 2020 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 RST_CONNECTION
#define RST_CONNECTION
#include <array>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
namespace Opm {
class UnitSystem;
namespace RestartIO {
class Header;
struct RstConnection {
RstConnection(const ::Opm::UnitSystem& unit_system, const int* icon, const float* scon, const double *xcon);
int insert_index;
std::array<int,3> ijk;
Connection::State state;
int drain_sat_table;
int imb_sat_table;
int completion;
Connection::Direction dir;
int segment;
float tran;
float depth;
float diameter;
float kh;
float segdist_end;
float segdist_start;
double oil_rate;
double water_rate;
double gas_rate;
double pressure;
double resv_rate;
};
}
}
#endif

View File

@@ -1,84 +0,0 @@
/*
Copyright 2020 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 RST_GROUP
#define RST_GROUP
#include <array>
#include <vector>
#include <string>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstHeader;
struct RstGroup {
RstGroup(const UnitSystem& unit_system,
const std::string* zwel,
const int * igrp,
const float * sgrp,
const double * xgrp);
std::string name;
float oil_rate_limit;
float water_rate_limit;
float gas_rate_limit;
float liquid_rate_limit;
float water_surface_limit;
float water_reservoir_limit;
float water_reinject_limit;
float water_voidage_limit;
float gas_surface_limit;
float gas_reservoir_limit;
float gas_reinject_limit;
float gas_voidage_limit;
double oil_production_rate;
double water_production_rate;
double gas_production_rate;
double liquid_production_rate;
double water_injection_rate;
double gas_injection_rate;
double wct;
double gor;
double oil_production_total;
double water_production_total;
double gas_production_total;
double voidage_production_total;
double water_injection_total;
double gas_injection_total;
double oil_production_potential;
double water_production_potential;
double history_total_oil_production;
double history_total_water_production;
double history_total_water_injection;
double history_total_gas_production;
double history_total_gas_injection;
};
}
}
#endif

View File

@@ -1,127 +0,0 @@
/*
Copyright 2020 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 RST_HEADER
#define RST_HEADER
#include <vector>
#include <ctime>
#include <cstddef>
namespace Opm {
namespace RestartIO {
struct RstHeader {
RstHeader(const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& doubhead);
int nx;
int ny;
int nz;
int nactive;
int num_wells;
int ncwmax;
int max_wells_in_group;
int max_groups_in_field;
int max_wells_in_field;
int year;
int month;
int mday;
int hour;
int minute;
int microsecond;
int phase_sum;
int niwelz;
int nswelz;
int nxwelz;
int nzwelz;
int niconz;
int nsconz;
int nxconz;
int nigrpz;
int nsgrpz;
int nxgrpz;
int nzgrpz;
int ncamax;
int niaaqz;
int nsaaqz;
int nxaaqz;
int nicaqz;
int nscaqz;
int nacaqz;
int tstep;
int report_step;
int newtmx;
int newtmn;
int litmax;
int litmin;
int mxwsit;
int mxwpit;
int version;
int iprog;
int nsegwl;
int nswlmx;
int nsegmx;
int nlbrmx;
int nisegz;
int nrsegz;
int nilbrz;
int ntfip ;
int nmfipr;
int nrfreg;
int ntfreg;
int nplmix;
int ngroup;
bool e300_radial;
bool e100_radial;
bool enable_hysteris;
bool enable_msw;
bool is_live_oil;
bool is_wet_gas;
bool const_comp_oil;
bool dir_relperm;
bool reversible_relperm;
bool endscale;
bool dir_eps;
bool reversible_eps;
bool alt_eps;
double next_timestep1;
double next_timestep2;
double max_timestep;
double guide_rate_a;
double guide_rate_b;
double guide_rate_c;
double guide_rate_d;
double guide_rate_e;
double guide_rate_f;
double udq_range;
double udq_undefined;
double udq_eps;
std::pair<std::time_t, std::size_t> restart_info() const;
};
}
}
#endif

View File

@@ -1,78 +0,0 @@
/*
Copyright 2020 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 RST_SEGMENT
#define RST_SEGMENT
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstSegment {
RstSegment(const ::Opm::UnitSystem& unit_system, const int* iseg, const double * rseg);
int segment;
int outlet_segment;
int branch;
Segment::SegmentType segment_type;
int icd_scaling_mode;
ICDStatus icd_status;
double dist_outlet;
double outlet_dz;
double diameter;
double roughness;
double area;
double volume;
double dist_bhp_ref;
double bhp_ref_dz;
double total_flow;
double water_flow_fraction;
double gas_flow_fraction;
double pressure;
double valve_length;
double valve_area;
double valve_flow_coeff;
double valve_max_area;
double base_strength;
double fluid_density;
double fluid_viscosity;
double critical_water_fraction;
double transition_region_width;
double max_emulsion_ratio;
double max_valid_flow_rate;
double icd_length;
double valve_area_fraction;
std::vector<int> inflow_segments;
};
}
}
#endif

View File

@@ -1,90 +0,0 @@
/*
Copyright 2020 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 RST_STATE
#define RST_STATE
#include <vector>
#include <string>
#include <opm/io/eclipse/ERst.hpp>
#include <opm/io/eclipse/rst/header.hpp>
#include <opm/io/eclipse/rst/group.hpp>
#include <opm/io/eclipse/rst/well.hpp>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstState {
RstState(const ::Opm::UnitSystem& unit_system,
const std::vector<int>& intehead,
const std::vector<bool>& logihead,
const std::vector<double>& doubhead,
const std::vector<std::string>& zgrp,
const std::vector<int>& igrp,
const std::vector<float>& sgrp,
const std::vector<double>& xgrp,
const std::vector<std::string>& zwel,
const std::vector<int>& iwel,
const std::vector<float>& swel,
const std::vector<double>& xwel,
const std::vector<int>& icon,
const std::vector<float>& scon,
const std::vector<double>& xcon);
RstState(const ::Opm::UnitSystem& unit_system,
const std::vector<int>& intehead,
const std::vector<bool>& logihead,
const std::vector<double>& doubhead,
const std::vector<std::string>& zgrp,
const std::vector<int>& igrp,
const std::vector<float>& sgrp,
const std::vector<double>& xgrp,
const std::vector<std::string>& zwel,
const std::vector<int>& iwel,
const std::vector<float>& swel,
const std::vector<double>& xwel,
const std::vector<int>& icon,
const std::vector<float>& scon,
const std::vector<double>& xcon,
const std::vector<int>& iseg,
const std::vector<double>& rseg);
static RstState load(EclIO::ERst& rst_file, int report_step);
const RstWell& get_well(const std::string& wname) const;
std::vector<RstWell> wells;
std::vector<RstGroup> groups;
RstHeader header;
private:
void add_groups(const ::Opm::UnitSystem& unit_system,
const std::vector<std::string>& zgrp,
const std::vector<int>& igrp,
const std::vector<float>& sgrp,
const std::vector<double>& xgrp);
};
}
}
#endif

View File

@@ -1,124 +0,0 @@
/*
Copyright 2020 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 RST_WELL
#define RST_WELL
#include <array>
#include <vector>
#include <string>
#include <unordered_map>
#include <opm/io/eclipse/rst/connection.hpp>
#include <opm/io/eclipse/rst/segment.hpp>
namespace Opm {
class UnitSystem;
namespace RestartIO {
struct RstHeader;
struct RstWell {
RstWell(const ::Opm::UnitSystem& unit_system,
const RstHeader& header,
const std::string& group_arg,
const std::string* zwel,
const int * iwel,
const float * swel,
const double * xwel,
const int * icon,
const float * scon,
const double * xcon);
RstWell(const ::Opm::UnitSystem& unit_system,
const RstHeader& header,
const std::string& group_arg,
const std::string* zwel,
const int * iwel,
const float * swel,
const double * xwel,
const int * icon,
const float * scon,
const double * xcon,
const std::vector<int>& iseg,
const std::vector<double>& rseg);
std::string name;
std::string group;
std::array<int, 2> ij;
std::pair<int,int> k1k2;
int wtype;
int active_control;
int vfp_table;
int pred_requested_control;
bool allow_xflow;
int hist_requested_control;
int msw_index;
int completion_ordering;
float orat_target;
float wrat_target;
float grat_target;
float lrat_target;
float resv_target;
float thp_target;
float bhp_target_float;
float hist_lrat_target;
float hist_grat_target;
float hist_bhp_target;
float datum_depth;
double oil_rate;
double water_rate;
double gas_rate;
double liquid_rate;
double void_rate;
double flow_bhp;
double wct;
double gor;
double oil_total;
double water_total;
double gas_total;
double void_total;
double water_inj_total;
double gas_inj_total;
double gas_fvf;
double bhp_target_double;
double hist_oil_total;
double hist_wat_total;
double hist_gas_total;
double hist_water_inj_total;
double hist_gas_inj_total;
double water_void_rate;
double gas_void_rate;
const RstSegment segment(int segment_number) const;
std::vector<RstConnection> connections;
std::vector<RstSegment> segments;
};
}
}
#endif

View File

@@ -22,7 +22,7 @@
#include <string>
#include <opm/common/utility/FileSystem.hpp>
#include <boost/filesystem/path.hpp>
struct cJSON;
@@ -30,7 +30,7 @@ namespace Json {
class JsonObject {
public:
explicit JsonObject(const Opm::filesystem::path& jsonFile );
explicit JsonObject(const boost::filesystem::path& jsonFile );
explicit JsonObject(const std::string& inline_json);
explicit JsonObject(const char * inline_json);
explicit JsonObject(cJSON * root);

View File

@@ -1,59 +0,0 @@
/*
Copyright 2019 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_OUTPUT_AQUIFER_HPP
#define OPM_OUTPUT_AQUIFER_HPP
#include <map>
#include <memory>
#include <vector>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace Opm { namespace data {
/**
* Small struct that keeps track of data for output to restart/summary
* files.
*/
enum class AquiferType
{
Fetkovich, CarterTracey,
};
struct FetkovichData {
double initVolume;
double prodIndex;
double timeConstant;
};
struct AquiferData {
int aquiferID; //< One-based ID, range 1..NANAQ
double pressure; //< Aquifer pressure
double volume; //< Produced liquid volume
double initPressure; //< Aquifer's initial pressure
double datumDepth; //< Aquifer's pressure reference depth
AquiferType type;
std::shared_ptr<FetkovichData> aquFet;
};
}} // Opm::data
#endif // OPM_OUTPUT_AQUIFER_HPP

View File

@@ -69,13 +69,6 @@ namespace data {
UnitSystem::measure dim; //< Dimension of the data to write
std::vector<double> data; //< The actual data itself
TargetType target;
bool operator==(const CellData& cell2) const
{
return dim == cell2.dim &&
data == cell2.data &&
target == cell2.target;
}
};
}

View File

@@ -30,8 +30,6 @@
#include <unordered_map>
#include <vector>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
namespace Opm {
namespace data {
@@ -84,16 +82,14 @@ namespace Opm {
/// chaining.
inline Rates& set( opt m, double value );
/// Returns true if any of the rates oil, gas, water is nonzero
inline bool flowing() const;
/// true if any option is set; false otherwise
inline bool any() const noexcept;
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
template <class MessageBufferType>
void read(MessageBufferType& buffer);
bool operator==(const Rates& rat2) const;
private:
double& get_ref( opt );
const double& get_ref( opt ) const;
@@ -121,7 +117,7 @@ namespace Opm {
struct Connection {
using global_index = size_t;
static const constexpr int restart_size = 6;
static const constexpr int restart_size = 2;
global_index index;
Rates rates;
@@ -132,18 +128,6 @@ namespace Opm {
double cell_saturation_gas;
double effective_Kh;
bool operator==(const Connection& conn2) const
{
return index == conn2.index &&
rates == conn2.rates &&
pressure == conn2.pressure &&
reservoir_rate == conn2.reservoir_rate &&
cell_pressure == conn2.cell_pressure &&
cell_saturation_water == conn2.cell_saturation_water &&
cell_saturation_gas == conn2.cell_saturation_gas &&
effective_Kh == conn2.effective_Kh;
}
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
template <class MessageBufferType>
@@ -155,38 +139,6 @@ namespace Opm {
double pressure;
std::size_t segNumber;
bool operator==(const Segment& seg2) const
{
return rates == seg2.rates &&
pressure == seg2.pressure &&
segNumber == seg2.segNumber;
}
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
template <class MessageBufferType>
void read(MessageBufferType& buffer);
};
struct CurrentControl {
bool isProducer{true};
::Opm::Well::ProducerCMode prod {
::Opm::Well::ProducerCMode::CMODE_UNDEFINED
};
::Opm::Well::InjectorCMode inj {
::Opm::Well::InjectorCMode::CMODE_UNDEFINED
};
bool operator==(const CurrentControl& rhs) const
{
return (this->isProducer == rhs.isProducer)
&& ((this->isProducer && (this->prod == rhs.prod)) ||
(!this->isProducer && (this->inj == rhs.inj)));
}
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
@@ -202,25 +154,11 @@ namespace Opm {
int control;
std::vector< Connection > connections;
std::unordered_map<std::size_t, Segment> segments;
CurrentControl current_control;
inline bool flowing() const noexcept;
template <class MessageBufferType>
void write(MessageBufferType& buffer) const;
template <class MessageBufferType>
void read(MessageBufferType& buffer);
bool operator==(const Well& well2) const
{
return rates == well2.rates &&
bhp == well2.bhp &&
thp == well2.thp &&
temperature == well2.temperature &&
control == well2.control &&
connections == well2.connections &&
segments == well2.segments &&
current_control == well2.current_control;
}
};
@@ -275,9 +213,10 @@ namespace Opm {
this->emplace(name, well);
}
}
};
using Wells = WellRates;
using Wells = WellRates;
/* IMPLEMENTATIONS */
@@ -313,28 +252,6 @@ namespace Opm {
return *this;
}
inline bool Rates::operator==(const Rates& rate) const
{
return mask == rate.mask &&
wat == rate.wat &&
oil == rate.oil &&
gas == rate.gas &&
polymer == rate.polymer &&
solvent == rate.solvent &&
energy == rate.energy &&
dissolved_gas == rate.dissolved_gas &&
vaporized_oil == rate.vaporized_oil &&
reservoir_water == rate.reservoir_water &&
reservoir_oil == rate.reservoir_oil &&
reservoir_gas == rate.reservoir_gas &&
productivity_index_water == rate.productivity_index_water &&
productivity_index_gas == rate.productivity_index_gas &&
productivity_index_oil == rate.productivity_index_oil &&
well_potential_water == rate.well_potential_water &&
well_potential_oil == rate.well_potential_oil &&
well_potential_gas == rate.well_potential_gas;
}
/*
* To avoid error-prone and repetitve work when extending rates with new
@@ -379,15 +296,12 @@ namespace Opm {
);
}
bool inline Rates::flowing() const {
return ((this->wat != 0) ||
(this->oil != 0) ||
(this->gas != 0));
inline bool Rates::any() const noexcept {
return static_cast< enum_size >( this->mask ) != 0;
}
inline bool Well::flowing() const noexcept {
return this->rates.flowing();
return this->rates.any();
}
template <class MessageBufferType>
@@ -431,18 +345,6 @@ namespace Opm {
buffer.write(this->pressure);
}
template <class MessageBufferType>
void CurrentControl::write(MessageBufferType& buffer) const
{
buffer.write(this->isProducer);
if (this->isProducer) {
buffer.write(this->prod);
}
else {
buffer.write(this->inj);
}
}
template <class MessageBufferType>
void Well::write(MessageBufferType& buffer) const {
this->rates.write(buffer);
@@ -464,8 +366,6 @@ namespace Opm {
seg.second.write(buffer);
}
}
this->current_control.write(buffer);
}
template <class MessageBufferType>
@@ -509,18 +409,6 @@ namespace Opm {
buffer.read(this->pressure);
}
template <class MessageBufferType>
void CurrentControl::read(MessageBufferType& buffer)
{
buffer.read(this->isProducer);
if (this->isProducer) {
buffer.read(this->prod);
}
else {
buffer.read(this->inj);
}
}
template <class MessageBufferType>
void Well::read(MessageBufferType& buffer) {
this->rates.read(buffer);
@@ -555,8 +443,6 @@ namespace Opm {
const auto segNumber = seg.segNumber;
this->segments.emplace(segNumber, std::move(seg));
}
this->current_control.read(buffer);
}
}} // Opm::data

View File

@@ -1,122 +0,0 @@
/*
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_Actionx_DATA_HPP
#define OPM_AGGREGATE_Actionx_DATA_HPP
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <cstddef>
#include <string>
#include <vector>
#include <map>
namespace Opm {
class Schedule;
class UDQInput;
class UDQActive;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
class AggregateActionxData
{
public:
explicit AggregateActionxData(const std::vector<int>& actDims);
void captureDeclaredActionxData( const Opm::Schedule& sched,
const Opm::SummaryState& st,
const std::vector<int>& actDims,
const std::size_t simStep);
const std::vector<int>& getIACT() const
{
return this->iACT_.data();
}
const std::vector<float>& getSACT() const
{
return this->sACT_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZACT() const
{
return this->zACT_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZLACT() const
{
return this->zLACT_.data();
}
const std::vector<EclIO::PaddedOutputString<8>>& getZACN() const
{
return this->zACN_.data();
}
const std::vector<int>& getIACN() const
{
return this->iACN_.data();
}
const std::vector<double>& getSACN() const
{
return this->sACN_.data();
}
private:
/// Aggregate 'IACT' array (Integer) for all ACTIONX data (9 integers pr UDQ)
WindowedArray<int> iACT_;
/// Aggregate 'SACT' array (Integer) for all ACTIONX data (5 integers pr ACTIONX - currently all zero - meaning unknown)
WindowedArray<float> sACT_;
/// Aggregate 'ZACT' array (Character) for all ACTIONX data. (4 * 8 chars pr ACIONX keyword - name of Action)
WindowedArray<EclIO::PaddedOutputString<8>> zACT_;
/// Aggregate 'ZLACT' array (Character) for all Actionx data. (max 16 * 8 characters pr line (default 80 chars pr line)
WindowedArray<EclIO::PaddedOutputString<8>> zLACT_;
/// Aggregate 'ZACN' array (Character) for all Actionx data (length equal to max no of conditions pr Actionx * the number of Actiox kwords)
WindowedArray<EclIO::PaddedOutputString<8>> zACN_;
/// Aggregate 'IACN' array (Integer) for all Actionx data (length 26* the max number of conditoins pr Actionx * the number of Actionx kwords)
WindowedArray<int> iACN_;
/// Aggregate 'SACN' array (Integer) for all Actionx data (16 * max number of Actionx conditions)
WindowedArray<double> sACN_;
};
}}} // Opm::RestartIO::Helpers
#endif //OPM_AGGREGATE_WELL_DATA_HPP

View File

@@ -23,7 +23,7 @@
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <cstddef>
#include <string>
#include <vector>
@@ -32,8 +32,7 @@
namespace Opm {
class Schedule;
class SummaryState;
//class Group;
class UnitSystem;
class Group2;
} // Opm
namespace Opm { namespace RestartIO { namespace Helpers {
@@ -43,11 +42,10 @@ class AggregateGroupData
public:
explicit AggregateGroupData(const std::vector<int>& inteHead);
void captureDeclaredGroupData(const Opm::Schedule& sched,
const Opm::UnitSystem& units,
const std::size_t simStep,
const Opm::SummaryState& sumState,
const std::vector<int>& inteHead);
void captureDeclaredGroupData(const Opm::Schedule& sched,
const std::size_t simStep,
const Opm::SummaryState& sumState,
const std::vector<int>& inteHead);
const std::vector<int>& getIGroup() const
{
@@ -106,19 +104,6 @@ public:
{"GGPTH", 143},
{"GGITH", 144},
};
using inj_cmode_enum = Opm::Group::InjectionCMode;
const std::map<inj_cmode_enum, int> cmodeToNum = {
{inj_cmode_enum::NONE, 0},
{inj_cmode_enum::RATE, 1},
{inj_cmode_enum::RESV, 2},
{inj_cmode_enum::REIN, 3},
{inj_cmode_enum::VREP, 4},
{inj_cmode_enum::FLD, 0},
{inj_cmode_enum::SALE, 0},
};
const std::map<std::string, size_t> fieldKeyToIndex = {
{"FOPR", 0},

View File

@@ -23,7 +23,6 @@
#include <opm/output/eclipse/WindowedArray.hpp>
#include <opm/io/eclipse/PaddedOutputString.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionResult.hpp>
#include <cstddef>
#include <string>
@@ -40,11 +39,6 @@ namespace Opm { namespace data {
}} // Opm::data
namespace Opm { namespace RestartIO { namespace Helpers {
struct ActionResStatus {
std::vector<Opm::Action::Result> result;
std::vector<std::string> name;
};
class AggregateWellData
{

View File

@@ -25,7 +25,7 @@
#include <vector>
namespace Opm {
struct Tuning;
class Tuning;
class Schedule;
class UDQParams;
}
@@ -39,18 +39,7 @@ namespace Opm { namespace RestartIO {
std::chrono::time_point<std::chrono::system_clock> start;
std::chrono::duration<double, std::chrono::seconds::period> elapsed;
};
struct guideRate {
double A;
double B;
double C;
double D;
double E;
double F;
double delay;
double damping_fact;
};
DoubHEAD();
~DoubHEAD() = default;
@@ -61,6 +50,7 @@ namespace Opm { namespace RestartIO {
DoubHEAD& operator=(DoubHEAD&& rhs) = default;
DoubHEAD& tuningParameters(const Tuning& tuning,
const std::size_t lookup_step,
const double cnvT);
DoubHEAD& timeStamp(const TimeStamp& ts);
@@ -69,9 +59,8 @@ namespace Opm { namespace RestartIO {
DoubHEAD& drsdt(const Schedule& sched,
const std::size_t lookup_step,
const double cnvT);
DoubHEAD& udq_param(const UDQParams& udqPar);
DoubHEAD& guide_rate_param(const guideRate& guide_rp);
const std::vector<double>& data() const
{

View File

@@ -25,16 +25,15 @@
#include <memory>
#include <vector>
namespace Opm {
class UnitSystem;
namespace RestartIO {
namespace Opm { namespace RestartIO {
class InteHEAD
{
public:
enum class UnitSystem {
Metric, Field, Lab, PVT_M
};
struct WellTableDim {
int numWells;
int maxPerf;
@@ -94,24 +93,8 @@ namespace RestartIO {
struct UdqParam {
int udqParam_1;
int no_wudqs;
int no_gudqs;
int no_fudqs;
int no_iuads;
int no_iuaps;
};
struct ActionParam {
int no_actions;
int max_no_sched_lines_per_action;
int max_no_conditions_per_action;
int max_no_characters_per_line;
};
struct GuideRateNominatedPhase {
int nominated_phase;
};
InteHEAD();
~InteHEAD() = default;
@@ -132,19 +115,14 @@ namespace RestartIO {
InteHEAD& params_NWELZ(const int niwelz, const int nswelz, const int nxwelz, const int nzwelz);
InteHEAD& params_NCON(const int niconz, const int nsconz, const int nxconz);
InteHEAD& params_GRPZ(const std::array<int, 4>& grpz);
InteHEAD& params_NGCTRL(const int gct);
InteHEAD& params_NAAQZ(const int ncamax, const int niaaqz, const int nsaaqz, const int nxaaqz, const int nicaqz, const int nscaqz, const int nacaqz);
InteHEAD& stepParam(const int tstep, const int report_step);
InteHEAD& tuningParam(const TuningPar& tunpar);
InteHEAD& variousParam(const int version, const int iprog);
InteHEAD& wellSegDimensions(const WellSegDims& wsdim);
InteHEAD& regionDimensions(const RegDims& rdim);
InteHEAD& ngroups(const Group& gr);
InteHEAD& ngroups(const Group& gr);
InteHEAD& udqParam_1(const UdqParam& udqpar);
InteHEAD& actionParam(const ActionParam& act_par);
InteHEAD& variousUDQ_ACTIONXParam();
InteHEAD& nominatedPhaseGuideRate(GuideRateNominatedPhase nphase);
InteHEAD& whistControlMode(int mode);
const std::vector<int>& data() const
{

View File

@@ -23,6 +23,7 @@
#include <vector>
namespace Opm {
class Eclipse3DProperties;
class Schedule;
class EclipseGrid;
@@ -30,7 +31,7 @@ namespace out {
class RegionCache {
public:
RegionCache() = default;
RegionCache(const std::vector<int>& fipnum, const EclipseGrid& grid, const Schedule& schedule);
RegionCache(const Eclipse3DProperties& properties, const EclipseGrid& grid, const Schedule& schedule);
const std::vector<std::pair<std::string,size_t>>& connections( int region_id ) const;
private:

View File

@@ -18,19 +18,17 @@
#ifndef RESTART_VALUE_HPP
#define RESTART_VALUE_HPP
#include <map>
#include <string>
#include <utility>
#include <map>
#include <vector>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/output/data/Aquifer.hpp>
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
namespace Opm {
class RestartKey {
public:
@@ -53,30 +51,24 @@ namespace Opm {
required(_required)
{}
bool operator==(const RestartKey& key2) const
{
return key == key2.key &&
dim == key2.dim &&
required == key2.required;
}
};
/*
A simple class used to communicate values between the simulator and
the RestartIO functions.
A simple class used to communicate values between the simulator and the
RestartIO function.
*/
class RestartValue {
public:
using ExtraVector = std::vector<std::pair<RestartKey, std::vector<double>>>;
data::Solution solution;
data::Wells wells;
ExtraVector extra;
std::vector<data::AquiferData> aquifer;
RestartValue(data::Solution sol, data::Wells wells_arg);
RestartValue() {}
bool hasExtra(const std::string& key) const;
void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
void addExtra(const std::string& key, std::vector<double> data);
@@ -84,15 +76,9 @@ namespace Opm {
void convertFromSI(const UnitSystem& units);
void convertToSI(const UnitSystem& units);
bool operator==(const RestartValue& val2) const
{
return solution == val2.solution &&
wells == val2.wells &&
extra == val2.extra;
}
};
}
#endif // RESTART_VALUE_HPP
#endif

View File

@@ -1,70 +0,0 @@
/*
Copyright (c) 2019 Equinor ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_AQUIFER_HPP
#define OPM_OUTPUT_ECLIPSE_VECTOR_AQUIFER_HPP
#include <vector>
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace IAnalyticAquifer {
enum index : std::vector<int>::size_type {
NumAquiferConn = 0,
WatPropTable = 1,
TypeRelated1 = 9,
TypeRelated2 = 10,
};
} // IAnalyticAquifer
namespace SAnalyticAquifer {
enum index : std::vector<float>::size_type {
Compressibility = 0,
FetInitVol = 1,
FetProdIndex = 2,
FetTimeConstant = 3,
CTRadius = 1,
CTPermeability = 2,
CTPorosity = 3,
InitPressure = 4,
DatumDepth = 5,
CTThickness = 6,
CTAngle = 7,
CTWatMassDensity = 8,
CTWatViscosity = 9,
};
} // SAnalyticAquifer
namespace XAnalyticAquifer {
enum index : std::vector<double>::size_type {
FlowRate = 0,
Pressure = 1, // Dynamic aquifer pressure
ProdVolume = 2, // Liquid volume produced from aquifer (into reservoir)
TotalArea = 3,
};
} // XAnalyticAquifer
}}}} // Opm::RestartIO::Helpers::VectorItems
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_AQUIFER_HPP

View File

@@ -57,7 +57,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
item30 = 29, // Unknown
item31 = 30, // Unknown
CFInDeck = 40, // = 0 for connection factor not defined, = 1 for connection factor defined
};
} // SConn

View File

@@ -27,20 +27,12 @@ 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
GRpar_a = 87, // Guiderate parameter A
GRpar_b = 88, // Guiderate parameter B
GRpar_c = 89, // Guiderate parameter C
GRpar_d = 90, // Guiderate parameter D
GRpar_e = 91, // Guiderate parameter E
GRpar_f = 92, // Guiderate parameter F
GRpar_int = 97, // Guiderate parameter delay interval
GRpar_damp = 144, // Guiderate parameter damping factor
UdqPar_2 = 212, // UDQPARAM item number 2 (Permitted range (+/-) of user-defined quantities)
UdqPar_3 = 213, // UDQPARAM item number 3 (Value given to undefined elements when outputting data)
UdqPar_4 = 214, // UDQPARAM item number 4 (fractional equality tolerance used in ==, <= etc. functions)
TsInit = 1, // Maximum Length of Next Timestep
TsMaxz = 2, // Maximum Length of Timestep After Next
TsMinz = 3, // Minumum Length of All Timesteps
UdqPar_2 = 212, // UDQPARAM item number 2 (Permitted range (+/-) of user-defined quantities)
UdqPar_3 = 213, // UDQPARAM item number 3 (Value given to undefined elements when outputting data)
UdqPar_4 = 214, // UDQPARAM item number 4 (fractional equality tolerance used in ==, <= etc. functions)
};
}}}} // Opm::RestartIO::Helpers::VectorItems

View File

@@ -24,30 +24,6 @@
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
namespace SGroup {
enum prod_index : std::vector<float>::size_type {
OilRateLimit = 6, // Group's oil production target/limit
WatRateLimit = 7, // Group's water production target/limit
GasRateLimit = 8, // Group's gas production target/limit
LiqRateLimit = 9, // Group's liquid production target/limit
};
enum inj_index : std::vector<float>::size_type {
waterSurfRateLimit = 15, //i Group's water surface volume injection rate target/limit
waterResRateLimit = 16, // Group's water reservoir volume injection rate target/limit
waterReinjectionLimit = 17, // Group's water reinjection fraction target/limit
waterVoidageLimit = 18, // Group's water voidage injection fraction target/limit
gasSurfRateLimit = 20, // Group's gas surface volume injection rate target/limit
gasResRateLimit = 21, // Group's gas reservoir volume injection rate target/limit
gasReinjectionLimit = 22, // Group's gas reinjection fraction target/limit
gasVoidageLimit = 23, // Group's gas voidage injection fraction target/limit
};
} // SGroup
namespace XGroup {
enum index : std::vector<double>::size_type {
OilPrRate = 0, // Group's oil production rate

View File

@@ -27,110 +27,66 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
// This is a subset of the items in src/opm/output/eclipse/InteHEAD.cpp .
// Promote items from that list to this in order to make them public.
enum intehead : std::vector<int>::size_type {
ISNUM = 0, // An encoded integer corresponding to the
// time the file was created. For files not
// originating from ECLIPSE, this value may
// be set to zero.
ISNUM = 0, // An encoded integer corresponding to the
// time the file was created. For files not
// originating from ECLIPSE, this value may
// be set to zero.
VERSION = 1, // Simulator version
UNIT = 2, // Units convention
// 1: METRIC, 2: FIELD, 3: LAB, 4: PVT-M
VERSION = 1, // Simulator version
UNIT = 2, // Units convention
// 1: METRIC, 2: FIELD, 3: LAB, 4: PVT-M
NX = 8, // #cells in X direction (Cartesian)
NY = 9, // #cells in Y direction (Cartesian)
NZ = 10, // #cells in Z direction (Cartesian)
NACTIV = 11, // Number of active cells
NX = 8, // #cells in X direction (Cartesian)
NY = 9, // #cells in Y direction (Cartesian)
NZ = 10, // #cells in Z direction (Cartesian)
NACTIV = 11, // Number of active cells
PHASE = 14, // Phase indicator:
// 1: oil, 2: water, 3: O/W, 4: gas,
// 5: G/O, 6: G/W, 7: O/G/W
PHASE = 14, // Phase indicator:
// 1: oil, 2: water, 3: O/W, 4: gas,
// 5: G/O, 6: G/W, 7: O/G/W
NWELLS = 16, // Number of wells
NCWMAX = 17, // Maximum number of completions per well
NGRP = 18, // Actual number of groups
NWGMAX = 19, // Maximum number of wells in any well group
NGMAXZ = 20, // Maximum number of groups in field
NWELLS = 16, // Number of wells
NCWMAX = 17, // Maximum number of completions per well
NWGMAX = 19, // Maximum number of wells in any well group
NGMAXZ = 20, // Maximum number of groups in field
NIWELZ = 24, // Number of data elements per well in IWEL array
// (default 97 for ECLIPSE, 94 for ECLIPSE 300).
NSWELZ = 25, // Number of data elements per well in SWEL array
NXWELZ = 26, // Number of delements per well in XWEL array
NZWELZ = 27, // Number of 8-character words per well in ZWEL array
NIWELZ = 24, // Number of data elements per well in IWEL array
// (default 97 for ECLIPSE, 94 for ECLIPSE 300).
NSWELZ = 25, // Number of data elements per well in SWEL array
NXWELZ = 26, // Number of delements per well in XWEL array
NZWELZ = 27, // Number of 8-character words per well in ZWEL array
NICONZ = 32, // Number of data elements per completion
// in ICON array (default 19)
NSCONZ = 33, // Number of data elements per completion in SCON array
NXCONZ = 34, // Number of data elements per completion in XCON array
NICONZ = 32, // Number of data elements per completion
// in ICON array (default 19)
NSCONZ = 33, // Number of data elements per completion in SCON array
NXCONZ = 34, // Number of data elements per completion in XCON array
NIGRPZ = 36, // Number of data elements per group in IGRP array
NSGRPZ = 37, // Number of data elements per group in SGRP array
NXGRPZ = 38, // Number of data elements per group in XGRP array
NZGRPZ = 39, // Number of data elements per group in ZGRP array
NIGRPZ = 36, // Number of data elements per group in IGRP array
NSGRPZ = 37, // Number of data elements per group in SGRP array
NXGRPZ = 38, // Number of data elements per group in XGRP array
NZGRPZ = 39, // Number of data elements per group in ZGRP array
NCAMAX = 41, // Maximum number of analytic aquifer connections
NCAMAX = 41, // Maximum number of analytic aquifer connections
NIAAQZ = 42, // Number of data elements per aquifer in IAAQ array
NSAAQZ = 43, // Number of data elements per aquifer in SAAQ array
NXAAQZ = 44, // Number of data elements per aquifer in XAAQ array
NIAAQZ = 42, // Number of data elements per aquifer in IAAQ array
NSAAQZ = 43, // Number of data elements per aquifer in SAAQ array
NXAAQZ = 44, // Number of data elements per aquifer in XAAQ array
NICAQZ = 45, // Number of data elements per aquifer connection in ICAQ array
NSCAQZ = 46, // Number of data elements per aquifer connection in SCAQ array
NACAQZ = 47, // Number of data elements per aquifer connection in ACAQ array
NICAQZ = 45, // Number of data elements per aquifer connection in ICAQ array
NSCAQZ = 46, // Number of data elements per aquifer connection in SCAQ array
NACAQZ = 47, // Number of data elements per aquifer connection in ACAQ array
NGCTRL = 51, // Index indicating if group control is used or not (1 - if group control, 0 if not)
NWMAXZ = 163, // Maximum number of wells in the model
NSEGWL = 174, // Number of multisegment wells defined with WELSEG
NSWLMX = 175, // Maximum number of segmented wells (item 1 ofWSEGDIMS)
NSEGMX = 176, // Maximum number of segments per well (item 2 of WSEGDIMS)
NLBRMX = 177, // Maximum number of lateral branches (item 3 of WSEGDIMS)
NGRNPH = 58, // Index indicating if group control is used or not (1 - if group control, 0 if not)
DAY = 64, // Calendar day of report step (1..31)
MONTH = 65, // Calendar month of report step (1..12)
YEAR = 66, // Calendar year of report step
NUM_SOLVER_STEPS = 67, //
REPORT_STEP = 68, //
WHISTC = 71, // Calendar year of report step
NEWTMX = 80, // Tuning, Record3, Item1
NEWTMN = 81, // Tuning, Record3, Item2
LITMAX = 82, // Tuning, Record3, Item3
LITMIN = 83, // Tuning, Record3, Item4
MXWSIT = 86, // Tuning, Record3, Item5
MXWPIT = 87, // Tuning, Record3, Item6
NTFIP = 89, // REGDIMS item1, or TABDIMS item 5
IPROG = 94, // IPROG = simulation program identifier: 100 - ECLIPSE 100, 300 - ECLIPSE 300, 500 - ECLIPSE 300
// (thermal option), negative - Other simulator,
NMFIPR = 99, // REGDIMS item2
NOOFACTIONS = 156, // The number of actions in the dataset
MAXNOLINES = 157, // Maximum number of lines of schedule data for ACTION keyword - including ENDACTIO
MAXNOSTRPRLINE = 158, // Maximum number of 8-chars strings pr input line of Action data (rounded up from input)
NWMAXZ = 163, // Maximum number of wells in the model
NSEGWL = 174, // Number of multisegment wells defined with WELSEG
NSWLMX = 175, // Maximum number of segmented wells (item 1 ofWSEGDIMS)
NSEGMX = 176, // Maximum number of segments per well (item 2 of WSEGDIMS)
NLBRMX = 177, // Maximum number of lateral branches (item 3 of WSEGDIMS)
NISEGZ = 178, // Number of entries per segment in ISEG array
NRSEGZ = 179, // Number of entries per segment in RSEG array
NILBRZ = 180, // Number of entries per segment in ILBR array
IHOURZ = 206, // IHOURZ = current simulation time HH:MM:SS number of hours (HH) (0-23).
IMINTS = 207, // IMINTS = current simulation time HH:MM:SS number of minutes (MM) (0-59).
MAX_ACT_COND = 245, // Maximum number of conditions pr action
MAX_AN_AQUIFERS = 252, // Maximum number of analytic aquifers
NO_FIELD_UDQS = 262, // No of Field UDQ data (parameters) /
NO_GROUP_UDQS = 263, // No of Group UDQ data (parameters) /
NO_WELL_UDQS = 266, // No of Well UDQ data (parameters) /
UDQPAR_1 = 267, // Integer seed value for the RAND /
NO_IUADS = 290, // No IUADs
NO_IUAPS = 291, // No IUAPs
RSEED = 296,
ISECND = 410 // ISECND = current simulation time HH:MM:SS - number of seconds (SS), reported in microseconds
// (0-59,999,999)
NISEGZ = 178, // Number of entries per segment in ISEG array
NRSEGZ = 179, // Number of entries per segment in RSEG array
NILBRZ = 180, // Number of entries per segment in ILBR array
UDQPAR_1 = 267, // Integer seed value for the RAND /
};
}}}} // Opm::RestartIO::Helpers::VectorItems

View File

@@ -30,13 +30,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
OutSeg = 1, // Outlet segment (one-based)
InSegCurBranch = 2, // Inflow segment current branch (one-based)
BranchNo = 3, // Branch number (one-based)
SegmentType = 11,
ICDScalingMode = 18,
ICDOpenShutFlag = 19,
};
} // ISeg
namespace RSeg {
@@ -56,26 +50,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
Pressure = 11, // Segment pressure
item40 = 39, // Unknown
ValveLength = 40, // Length of valve
ValveArea = 41, // Cross-sectional area of valve
ValveFlowCoeff = 42, // Valve's dimensionless flow coefficient
ValveMaxArea = 43, // Maximal cross-sectional valve area
DeviceBaseStrength = 86,
CalibrFluidDensity = 88,
CalibrFluidViscosity = 89,
CriticalWaterFraction = 90,
TransitionRegWidth = 91,
MaxEmulsionRatio = 92,
MaxValidFlowRate = 97,
ICDLength = 102,
ValveAreaFraction = 103,
item106 = 105, // Unknown
item107 = 106, // Unknown
item108 = 107, // Unknown

View File

@@ -63,6 +63,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
namespace Value {
enum WellType : int {
WTUnk = 0, // Unknown well type (OPM only)
Producer = 1, // Well is producer
OilInj = 2, // Well is oil injector
WatInj = 3, // Well is water injector
@@ -179,7 +180,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
namespace ZWell {
enum index : std::vector<const char*>::size_type {
WellName = 0, // Well name
ActionX = 2, // ActionX name
};
} // ZWell
}}}} // Opm::RestartIO::Helpers::VectorItems

View File

@@ -31,7 +31,6 @@
namespace Opm {
class Runspec;
class EclipseGrid;
class EclipseState;
class Schedule;
@@ -70,10 +69,6 @@ namespace Opm { namespace RestartIO { namespace Helpers {
const std::size_t lookup_step,
const std::vector<int>& inteHead);
std::vector<int>
createActionxDims( const Runspec& rspec,
const Schedule& sched,
const std::size_t simStep);
}}} // Opm::RestartIO::Helpers

View File

@@ -26,6 +26,8 @@
#include <vector>
#include <string>
#include <boost/filesystem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -98,8 +100,8 @@ namespace Opm {
DeckView( const_iterator first, const_iterator last );
explicit DeckView( std::pair< const_iterator, const_iterator > );
DeckView() = default;
void init( const_iterator, const_iterator );
void reinit( const_iterator, const_iterator );
private:
const_iterator first;
@@ -124,15 +126,9 @@ namespace Opm {
Deck();
Deck( const Deck& );
Deck(const std::vector<DeckKeyword>& keywords,
const UnitSystem& defUnits,
const UnitSystem* activeUnits,
const std::string& dataFile,
const std::string& inputPath,
size_t accessCount);
Deck& operator=(const Deck& rhs);
bool operator==(const Deck& data) const;
//! \brief Deleted assignment operator.
Deck& operator=(const Deck& rhs) = delete;
void addKeyword( DeckKeyword&& keyword );
void addKeyword( const DeckKeyword& keyword );
@@ -143,7 +139,6 @@ namespace Opm {
const UnitSystem& getActiveUnitSystem() const;
UnitSystem& getActiveUnitSystem();
UnitSystem& getDefaultUnitSystem();
void selectActiveUnitSystem( UnitSystem::UnitType unit_type );
const std::string& getInputPath() const;
const std::string& getDataFile() const;
@@ -154,20 +149,15 @@ namespace Opm {
iterator end();
void write( DeckOutput& output ) const ;
friend std::ostream& operator<<(std::ostream& os, const Deck& deck);
const std::vector<DeckKeyword>& keywords() const;
std::size_t unitSystemAccessCount() const;
const std::unique_ptr<UnitSystem>& activeUnitSystem() const;
private:
Deck(std::vector<DeckKeyword>&& keywordList);
Deck( std::vector< DeckKeyword >&& );
std::vector< DeckKeyword > keywordList;
UnitSystem defaultUnits;
std::unique_ptr<UnitSystem> activeUnits;
UnitSystem activeUnits;
std::string m_dataFile;
std::string input_path;
mutable std::size_t unit_system_access_count = 0;
};
}
#endif /* DECK_HPP */

View File

@@ -28,32 +28,17 @@
#include <opm/parser/eclipse/Units/Dimension.hpp>
#include <opm/parser/eclipse/Utility/Typetools.hpp>
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
#include <opm/parser/eclipse/Deck/value_status.hpp>
namespace Opm {
class DeckOutput;
class DeckItem {
public:
DeckItem() = default;
DeckItem( const std::string&, int);
DeckItem( const std::string&, double);
DeckItem( const std::string&, std::string);
DeckItem( const std::string&, double) = delete;
DeckItem( const std::string&, UDAValue) = delete;
DeckItem( const std::string&, UDAValue, const std::vector<Dimension>& active_dim, const std::vector<Dimension>& default_dim);
DeckItem( const std::string&, double, const std::vector<Dimension>& active_dim, const std::vector<Dimension>& default_dim);
DeckItem(const std::vector<double>& dVec,
const std::vector<int>& iVec,
const std::vector<std::string>& sVec,
const std::vector<UDAValue>& uVec,
type_tag type,
const std::string& itemName,
const std::vector<value::status>& valueStat,
bool rawdata,
const std::vector<Dimension>& activeDim,
const std::vector<Dimension>& defDim);
DeckItem( const std::string&, UDAValue);
const std::string& name() const;
@@ -70,19 +55,16 @@ namespace Opm {
// keywords like e.g. SGL), then the remaining values are defaulted. The deck
// creates the defaulted items if all their sizes are fully specified by the
// keyword, though...
size_t size() const;
size_t out_size() const;
size_t data_size() const;
template<typename T>
T get( size_t index ) const;
//template< typename T > T& get( size_t ) ;
template< typename T > T get( size_t ) const;
double getSIDouble( size_t ) const;
std::string getTrimmedString( size_t ) const;
template< typename T > const std::vector< T >& getData() const;
const std::vector< double >& getSIDoubleData() const;
const std::vector<value::status>& getValueStatus() const;
void push_back( UDAValue );
void push_back( int );
@@ -97,10 +79,11 @@ namespace Opm {
void push_backDefault( double );
void push_backDefault( std::string );
// trying to access the data of a "dummy default item" will raise an exception
template <typename T>
void push_backDummyDefault();
void push_backDimension( const Dimension& /* activeDimension */,
const Dimension& /* defaultDimension */);
type_tag getType() const;
void write(DeckOutput& writer) const;
@@ -114,6 +97,7 @@ namespace Opm {
account, i.e. two items will compare differently if one is
defaulted and the other has the default value explicitly
set. The default behaviour is cmp_default == false -
i.e. only the actual values in the items will be compared,
itrespective of whether they have been set explicitly or
have been defaulted.
*/
@@ -126,24 +110,6 @@ namespace Opm {
bool operator==(const DeckItem& other) const;
bool operator!=(const DeckItem& other) const;
static bool to_bool(std::string string_value);
const std::vector<double>& dVal() const;
const std::vector<int>& iVal() const;
const std::vector<std::string>& sVal() const;
const std::vector<UDAValue>& uVal() const;
const std::vector<value::status>& valueStatus() const;
bool rawData() const;
const std::vector<Dimension>& activeDimensions() const;
const std::vector<Dimension>& defaultDimensions() const;
bool is_uda() { return (type == get_type< UDAValue >()); };
bool is_double() { return type == get_type< double >(); };
bool is_int() { return type == get_type< int >() ; };
bool is_string() { return type == get_type< std::string >(); };
UDAValue& get_uda() { return uval[0]; };
private:
mutable std::vector< double > dval;
std::vector< int > ival;
@@ -153,16 +119,14 @@ namespace Opm {
type_tag type = type_tag::unknown;
std::string item_name;
std::vector<value::status> value_status;
std::vector< bool > defaulted;
std::vector< Dimension > dimensions;
/*
To save space we mutate the dval object in place when asking for SI
data; the current state of of the dval member is tracked with the
raw_data bool member.
*/
mutable bool raw_data = true;
std::vector< Dimension > active_dimensions;
std::vector< Dimension > default_dimensions;
template< typename T > std::vector< T >& value_ref();
template< typename T > const std::vector< T >& value_ref() const;
template< typename T > void push( T );

View File

@@ -28,8 +28,6 @@
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckValue.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/value_status.hpp>
#include <opm/common/OpmLog/Location.hpp>
namespace Opm {
class DeckOutput;
@@ -37,45 +35,38 @@ namespace Opm {
class DeckKeyword {
public:
typedef std::vector< DeckRecord >::const_iterator const_iterator;
DeckKeyword();
explicit DeckKeyword(const ParserKeyword& parserKeyword);
DeckKeyword(const Location& location, const std::string& keywordName);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<std::vector<DeckValue>>& record_list, UnitSystem& system_active, UnitSystem& system_default);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<int>& data);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<double>& data, UnitSystem& system_active, UnitSystem& system_default);
DeckKeyword(const std::string& kwName,
const Location& loc,
const std::vector<DeckRecord>& record,
bool dataKw,
bool slashTerminated);
DeckKeyword(const ParserKeyword& parserKeyword, const std::string& keywordName);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<std::vector<DeckValue>>& record_list);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<int>& data);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<double>& data);
const std::string& name() const;
void setFixedSize();
const Location& location() const;
void setLocation(const std::pair<const std::string&, std::size_t>& location);
const std::string& getFileName() const;
int getLineNumber() const;
std::pair<std::string, std::size_t> location() const;
size_t size() const;
void addRecord(DeckRecord&& record);
const DeckRecord& getRecord(size_t index) const;
DeckRecord& getRecord(size_t index);
const std::vector<DeckRecord>& records() const;
const DeckRecord& getDataRecord() const;
void setDataKeyword(bool isDataKeyword = true);
void setDoubleRecordKeyword(bool isDoubleRecordKeyword = true);
bool isDataKeyword() const;
bool isDoubleRecordKeyword() const;
bool isSlashTerminated() const;
const std::vector<int>& getIntData() const;
const std::vector<double>& getRawDoubleData() const;
const std::vector<double>& getSIDoubleData() const;
const std::vector<std::string>& getStringData() const;
const std::vector<value::status>& getValueStatus() const;
const ParserKeyword& parserKeyword() const;
size_t getDataSize() const;
void write( DeckOutput& output ) const;
void write_data( DeckOutput& output ) const;
@@ -99,12 +90,13 @@ namespace Opm {
friend std::ostream& operator<<(std::ostream& os, const DeckKeyword& keyword);
private:
std::string m_keywordName;
Location m_location;
std::string m_fileName;
int m_lineNumber;
std::vector< DeckRecord > m_recordList;
bool m_isDataKeyword;
bool m_slashTerminated;
bool m_isDoubleRecordKeyword = false;
ParserKeyword parser_keyword;
};
}

View File

@@ -70,8 +70,6 @@ namespace Opm {
bool operator==(const DeckRecord& other) const;
bool operator!=(const DeckRecord& other) const;
const std::vector<DeckItem>& getItems() const;
private:
std::vector< DeckItem > m_items;

View File

@@ -26,26 +26,14 @@
namespace Opm {
enum class Section {
RUNSPEC,
GRID,
EDIT,
PROPS,
REGIONS,
SOLUTION,
SUMMARY,
SCHEDULE
};
class UnitSystem;
class Parser;
class DeckSection : public DeckView {
class Section : public DeckView {
public:
using DeckView::const_iterator;
DeckSection( const Deck& deck, const std::string& startKeyword );
Section( const Deck& deck, const std::string& startKeyword );
const std::string& name() const;
const UnitSystem& unitSystem() const;
@@ -70,52 +58,52 @@ class DeckSection : public DeckView {
};
class RUNSPECSection : public DeckSection {
class RUNSPECSection : public Section {
public:
using DeckSection::const_iterator;
explicit RUNSPECSection(const Deck& deck) : DeckSection(deck, "RUNSPEC") {}
using Section::const_iterator;
explicit RUNSPECSection(const Deck& deck) : Section(deck, "RUNSPEC") {}
};
class GRIDSection : public DeckSection {
class GRIDSection : public Section {
public:
using DeckSection::const_iterator;
explicit GRIDSection(const Deck& deck) : DeckSection(deck, "GRID") {}
using Section::const_iterator;
explicit GRIDSection(const Deck& deck) : Section(deck, "GRID") {}
};
class EDITSection : public DeckSection {
class EDITSection : public Section {
public:
using DeckSection::const_iterator;
explicit EDITSection(const Deck& deck) : DeckSection(deck, "EDIT") {}
using Section::const_iterator;
explicit EDITSection(const Deck& deck) : Section(deck, "EDIT") {}
};
class PROPSSection : public DeckSection {
class PROPSSection : public Section {
public:
using DeckSection::const_iterator;
explicit PROPSSection(const Deck& deck) : DeckSection(deck, "PROPS") {}
using Section::const_iterator;
explicit PROPSSection(const Deck& deck) : Section(deck, "PROPS") {}
};
class REGIONSSection : public DeckSection {
class REGIONSSection : public Section {
public:
using DeckSection::const_iterator;
explicit REGIONSSection(const Deck& deck) : DeckSection(deck, "REGIONS") {}
using Section::const_iterator;
explicit REGIONSSection(const Deck& deck) : Section(deck, "REGIONS") {}
};
class SOLUTIONSection : public DeckSection {
class SOLUTIONSection : public Section {
public:
using DeckSection::const_iterator;
explicit SOLUTIONSection(const Deck& deck) : DeckSection(deck, "SOLUTION") {}
using Section::const_iterator;
explicit SOLUTIONSection(const Deck& deck) : Section(deck, "SOLUTION") {}
};
class SUMMARYSection : public DeckSection {
class SUMMARYSection : public Section {
public:
using DeckSection::const_iterator;
explicit SUMMARYSection(const Deck& deck) : DeckSection(deck, "SUMMARY") {}
using Section::const_iterator;
explicit SUMMARYSection(const Deck& deck) : Section(deck, "SUMMARY") {}
};
class SCHEDULESection : public DeckSection {
class SCHEDULESection : public Section {
public:
using DeckSection::const_iterator;
explicit SCHEDULESection(const Deck& deck) : DeckSection(deck, "SCHEDULE") {}
using Section::const_iterator;
explicit SCHEDULESection(const Deck& deck) : Section(deck, "SCHEDULE") {}
};
}

View File

@@ -34,24 +34,10 @@ public:
UDAValue();
explicit UDAValue(double);
explicit UDAValue(const std::string&);
UDAValue(const UDAValue& src, const Dimension& dim);
UDAValue(double data, const Dimension& dim);
UDAValue(const std::string& data, const Dimension& dim);
/*
The get<double>() and get<std::string>() methods will throw an
exception if the internal type and the template parameter disagree.
*/
template<typename T>
T get() const;
/*
The getSI() can only be called for numerical values.
*/
double getSI() const;
bool zero() const;
template<typename T>
bool is() const;
@@ -60,13 +46,11 @@ public:
void assert_numeric() const;
void assert_numeric(const std::string& error_msg) const;
void set_dim(const Dimension& dim) const;
const Dimension& get_dim() const;
bool operator==(const UDAValue& other) const;
bool operator!=(const UDAValue& other) const;
bool is_numeric() { return numeric_value; }
private:
bool numeric_value;
double double_value;
@@ -74,7 +58,7 @@ private:
/* This 'mutable' modifier is a hack to avoid tampering with the overall
const-ness of the data in a deck item. */
Dimension dim;
mutable Dimension dim;
};
std::ostream& operator<<( std::ostream& stream, const UDAValue& uda_value );

View File

@@ -1,56 +0,0 @@
/*
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 VALUE_STATUS
#define VALUE_STATUS
namespace Opm {
namespace value {
enum class status : unsigned char { uninitialized = 0,
deck_value = 1,
empty_default = 2,
valid_default = 3 };
inline bool defaulted(status st) {
if (st == status::empty_default)
return true;
if (st == status::valid_default)
return true;
return false;
}
inline bool has_value(status st) {
if (st == status::deck_value)
return true;
if (st == status::valid_default)
return true;
return false;
}
}
}
#endif

View File

@@ -26,10 +26,7 @@
implement the analytical aquifer models in OPM Flow.
*/
#include <unordered_map>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
@@ -37,54 +34,38 @@
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
namespace Opm {
namespace{
struct AquanconRecord;
}
class Aquancon {
public:
struct AquancCell {
int aquiferID;
std::size_t global_index;
std::pair<bool, double> influx_coeff;
double influx_mult;
FaceDir::DirEnum face_dir;
struct AquanconOutput{
int aquiferID;
std::vector<size_t> 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;
};
AquancCell(int aquiferID_arg, std::size_t gi, const std::pair<bool, double>& ic, double im, FaceDir::DirEnum fd) :
aquiferID(aquiferID_arg),
global_index(gi),
influx_coeff(ic),
influx_mult(im),
face_dir(fd)
{}
AquancCell() = default;
bool operator==(const AquancCell& other) const {
return this->aquiferID == other.aquiferID &&
this->global_index == other.global_index &&
this->influx_coeff == other.influx_coeff &&
this->influx_mult == other.influx_mult &&
this->face_dir == other.face_dir;
}
};
Aquancon() = default;
Aquancon(const EclipseGrid& grid, const Deck& deck);
Aquancon(const std::unordered_map<int, std::vector<Aquancon::AquancCell>>& data);
const std::unordered_map<int, std::vector<Aquancon::AquancCell>>& data() const;
bool operator==(const Aquancon& other) const;
bool active() const;
const std::vector<Aquancon::AquanconOutput>& getAquOutput() const;
const std::vector<Aquancon::AquancCell> operator[](int aquiferID) const;
private:
static bool cellInsideReservoirAndActive(const EclipseGrid& grid, int i, int j, int k);
static bool neighborCellInsideReservoirAndActive(const EclipseGrid& grid, int i, int j, int k, FaceDir::DirEnum faceDir);
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,
std::vector<int> m_aquiferID_per_record, int m_maxAquID);
std::unordered_map<int, std::vector<Aquancon::AquancCell>> cells;
void convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id, int i,
std::vector<int> m_aquiferID_per_record);
std::vector<Aquancon::AquanconOutput> m_aquoutput;
};
}

View File

@@ -39,62 +39,61 @@
namespace Opm {
class TableManager;
class EclipseState;
class AquiferCT {
public:
struct AQUCT_data{
struct AQUCT_data{
AQUCT_data(const DeckRecord& record, const TableManager& tables);
AQUCT_data() = default;
AQUCT_data(int aqID,
int infID,
int pvtID,
double phi_aq_,
double d0_,
double C_t_,
double r_o_,
double k_a_,
double c1_,
double h_,
double theta_,
double c2_,
const std::pair<bool, double>& p0_,
const std::vector<double>& td_,
const std::vector<double>& pi_,
const std::vector<int>& cell_id_);
// Aquifer ID
int aquiferID;
// Table IDs
int inftableID, pvttableID;
std::vector<int> cell_id;
// Variables constants
double phi_aq , //aquifer porosity
d0, //aquifer datum depth
C_t , //total compressibility
r_o , //aquifer inner radius
k_a , //aquifer permeability
c1, // 0.008527 (METRIC, PVT-M); 0.006328 (FIELD); 3.6 (LAB)
h , //aquifer thickness
theta , //angle subtended by the aquifer boundary
c2 ; //6.283 (METRIC, PVT-M); 1.1191 (FIELD); 6.283 (LAB).
int aquiferID;
int inftableID, pvttableID;
std::shared_ptr<double> p0; //Initial aquifer pressure at datum depth, d0
std::vector<double> td, pi;
};
double phi_aq , // aquifer porosity
d0, // aquifer datum depth
C_t , // total compressibility
r_o , // aquifer inner radius
k_a , // aquifer permeability
c1, // 0.008527 (METRIC, PVT-M); 0.006328 (FIELD); 3.6 (LAB)
h , // aquifer thickness
theta , // angle subtended by the aquifer boundary
c2 ; // 6.283 (METRIC, PVT-M); 1.1191 (FIELD); 6.283 (LAB).
AquiferCT(const EclipseState& eclState, const Deck& deck);
std::pair<bool, double> p0; //Initial aquifer pressure at datum depth, d0
std::vector<double> td, pi;
std::vector<int> cell_id;
const std::vector<AquiferCT::AQUCT_data>& getAquifers() const;
int getAqInflTabID(size_t aquiferIndex);
int getAqPvtTabID(size_t aquiferIndex);
bool operator==(const AQUCT_data& other) const;
};
AquiferCT() = default;
AquiferCT(const TableManager& tables, const Deck& deck);
AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
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.
//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,
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,
80, 90, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000 };
td = default_time_;
pi = default_pressure_;
}
std::size_t size() const;
std::vector<AquiferCT::AQUCT_data>::const_iterator begin() const;
std::vector<AquiferCT::AQUCT_data>::const_iterator end() const;
const std::vector<AquiferCT::AQUCT_data>& data() const;
bool operator==(const AquiferCT& other) const;
private:
std::vector<AquiferCT::AQUCT_data> m_aquct;
};
}

View File

@@ -1,52 +0,0 @@
/*
Copyright (C) 2020 Equinor
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_AUQIFER_CONFIG_HPP
#define OPM_AUQIFER_CONFIG_HPP
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
namespace Opm {
class TableManager;
class EclipseGrid;
class Deck;
class AquiferConfig {
public:
AquiferConfig() = default;
AquiferConfig(const TableManager& tables, const EclipseGrid& grid, const Deck& deck);
AquiferConfig(const Aquifetp& fetp, const AquiferCT& ct, const Aquancon& conn);
bool active() const;
const AquiferCT& ct() const;
const Aquifetp& fetp() const;
const Aquancon& connections() const;
bool operator==(const AquiferConfig& other);
private:
Aquifetp aquifetp;
AquiferCT aquiferct;
Aquancon aqconn;
};
}
#endif

View File

@@ -25,44 +25,49 @@
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 <vector>
#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 Deck;
class DeckRecord;
class Aquifetp {
public:
class Aquifetp {
public:
struct AQUFETP_data{
struct AQUFETP_data{
AQUFETP_data(const DeckRecord& record);
AQUFETP_data() = default;
AQUFETP_data(int aquiferID_, int pvttableID_, double J_, double C_t_, double V0_, double d0_, const std::pair<bool, double>& p0_);
bool operator==(const AQUFETP_data& other) const;
// 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;
int aquiferID;
int pvttableID;
double J, // Specified Productivity Index
C_t, // total rock compressibility
V0, // initial volume of water in aquifer
d0; // aquifer datum depth
std::pair<bool, double> p0;
};
Aquifetp() = default;
Aquifetp(const Deck& deck);
Aquifetp(const std::vector<Aquifetp::AQUFETP_data>& data);
const std::vector<Aquifetp::AQUFETP_data>& data() const;
std::size_t size() const;
std::vector<Aquifetp::AQUFETP_data>::const_iterator begin() const;
std::vector<Aquifetp::AQUFETP_data>::const_iterator end() const;
bool operator==(const Aquifetp& other) const;
private:
std::vector<Aquifetp::AQUFETP_data> m_aqufetp;
};
}

View File

@@ -0,0 +1,112 @@
/*
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 OPM_ECLIPSE_PROPERTIES_HPP
#define OPM_ECLIPSE_PROPERTIES_HPP
#include <vector>
#include <string>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
namespace Opm {
class Box;
class BoxManager;
class Deck;
class DeckItem;
class DeckKeyword;
class DeckRecord;
class EclipseGrid;
class Section;
class TableManager;
class UnitSystem;
/// Class representing properties on 3D grid for use in EclipseState.
class Eclipse3DProperties
{
public:
Eclipse3DProperties() = default;
Eclipse3DProperties(const Deck& deck,
const TableManager& tableManager,
const EclipseGrid& eclipseGrid);
Eclipse3DProperties( UnitSystem unit_system,
const TableManager& tableManager,
const EclipseGrid& eclipseGrid);
std::vector< int > getRegions( const std::string& keyword ) const;
std::string getDefaultRegionKeyword() const;
const GridProperty<int>& getIntGridProperty ( const std::string& keyword ) const;
const GridProperty<double>& getDoubleGridProperty ( const std::string& keyword ) const;
const GridProperties<int>& getIntProperties() const;
const GridProperties<double>& getDoubleProperties() const;
bool hasDeckIntGridProperty(const std::string& keyword) const;
bool hasDeckDoubleGridProperty(const std::string& keyword) const;
bool supportsGridProperty(const std::string& keyword) const;
private:
const GridProperty<int>& getRegion(const DeckItem& regionItem) const;
void processGridProperties(const Deck& deck,
const EclipseGrid& eclipseGrid);
void scanSection(const Section& section,
const EclipseGrid& eclipseGrid,
bool edit_section);
void handleADDKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleBOXKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleCOPYKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleENDBOXKeyword( BoxManager& boxManager);
void handleEQUALSKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleMAXVALUEKeyword(const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleMINVALUEKeyword(const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleMULTIPLYKeyword(const DeckKeyword& deckKeyword, BoxManager& boxManager);
void handleADDREGKeyword( const DeckKeyword& deckKeyword );
void handleCOPYREGKeyword( const DeckKeyword& deckKeyword );
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,
bool edity_section);
void adjustSOGCRwithSWL();
std::string m_defaultRegion;
UnitSystem m_deckUnitSystem;
GridProperties<int> m_intGridProperties;
GridProperties<double> m_doubleGridProperties;
};
}
#endif // OPM_ECLIPSE_PROPERTIES_HPP

View File

@@ -24,28 +24,30 @@
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
namespace Opm {
class Deck;
class ParseContext;
class ErrorGuard;
class EclipseConfig
{
public:
EclipseConfig() = default;
EclipseConfig(const Deck& deck);
EclipseConfig(const InitConfig& initConfig, const IOConfig& io_conf);
EclipseConfig(const Deck& deck, const ParseContext& parseContext, ErrorGuard& errors);
const InitConfig& init() const;
IOConfig& io();
const IOConfig& io() const;
IOConfig& io();
const RestartConfig& restart() const;
const InitConfig& getInitConfig() const;
bool operator==(const EclipseConfig& data) const;
const RestartConfig& getRestartConfig() const;
private:
InitConfig m_initConfig;
IOConfig io_config;
IOConfig m_ioConfig;
const InitConfig m_initConfig;
RestartConfig m_restartConfig;
};
}

View File

@@ -23,11 +23,11 @@
#include <memory>
#include <vector>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferConfig.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/FieldPropsManager.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>
@@ -38,8 +38,6 @@
namespace Opm {
bool enable3DPropsTesting();
template< typename > class GridProperty;
template< typename > class GridProperties;
@@ -52,13 +50,13 @@ namespace Opm {
class EclipseGrid;
class InitConfig;
class IOConfig;
class ParseContext;
class RestartConfig;
class DeckSection;
class Section;
class SimulationConfig;
class TableManager;
class UnitSystem;
class EclipseState {
public:
enum EnabledTypes {
@@ -68,7 +66,9 @@ namespace Opm {
AllProperties = IntProperties | DoubleProperties
};
EclipseState() = default;
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 IOConfig& getIOConfig() const;
@@ -76,7 +76,10 @@ namespace Opm {
const InitConfig& getInitConfig() const;
const SimulationConfig& getSimulationConfig() const;
virtual const EclipseGrid& getInputGrid() const;
const RestartConfig& getRestartConfig() const;
RestartConfig& getRestartConfig();
const EclipseGrid& getInputGrid() const;
const FaultCollection& getFaults() const;
const TransMult& getTransMult() const;
@@ -91,14 +94,10 @@ namespace Opm {
const EDITNNC& getInputEDITNNC() const;
bool hasInputEDITNNC() const;
// The potentially parallelized field properties
virtual const FieldPropsManager& fieldProps() const;
// Always the non-parallel field properties
virtual const FieldPropsManager& globalFieldProps() const;
const Eclipse3DProperties& get3DProperties() const;
const TableManager& getTableManager() const;
const EclipseConfig& getEclipseConfig() const;
const EclipseConfig& cfg() const;
const GridDims& gridDims() const;
// the unit system used by the deck. note that it is rarely needed to convert
// units because internally to opm-parser everything is represented by SI
@@ -111,33 +110,31 @@ namespace Opm {
void applyModifierDeck(const Deck& deck);
const Runspec& runspec() const;
const AquiferConfig& aquifer() const;
private:
void initIOConfigPostSchedule(const Deck& deck);
void initTransMult();
void initFaults(const Deck& deck);
void setMULTFLT(const Opm::DeckSection& section);
void setMULTFLT(const Opm::Section& section);
void complainAboutAmbiguousKeyword(const Deck& deck,
const std::string& keywordName);
protected:
TableManager m_tables;
const TableManager m_tables;
Runspec m_runspec;
EclipseConfig m_eclipseConfig;
UnitSystem m_deckUnitSystem;
NNC m_inputNnc;
EDITNNC m_inputEditNnc;
EclipseGrid m_inputGrid;
GridDims m_gridDims;
FieldPropsManager field_props;
SimulationConfig m_simulationConfig;
Eclipse3DProperties m_eclipseProperties;
const SimulationConfig m_simulationConfig;
TransMult m_transMult;
FaultCollection m_faults;
std::string m_title;
AquiferConfig aquifer_config;
};
}

View File

@@ -31,9 +31,6 @@ public:
/// Construct from input deck
explicit EDITNNC(const Deck& deck);
explicit EDITNNC(const std::vector<NNCdata>& data);
/// \brief Get an ordered set of EDITNNC
const std::vector<NNCdata>& data() const
{
@@ -44,8 +41,6 @@ public:
/// \brief Whether EDITNNC was empty.
bool empty() const;
bool operator==(const EDITNNC& data) const;
private:
std::vector<NNCdata> m_editnnc;
};

View File

@@ -29,7 +29,6 @@ class EndpointScaling {
public:
EndpointScaling() noexcept = default;
explicit EndpointScaling( const Deck& );
EndpointScaling(const std::bitset<4>& opts);
/* true if endpoint scaling is enabled, otherwise false */
operator bool() const noexcept;
@@ -41,10 +40,6 @@ class EndpointScaling {
bool twopoint() const noexcept;
bool threepoint() const noexcept;
unsigned long getBits() const;
bool operator==(const EndpointScaling& data) const;
private:
enum class option {
any = 0,

View File

@@ -25,34 +25,21 @@
#include <cstddef>
namespace Opm {
class DeckRecord;
class EclipseGrid;
class Box {
public:
struct cell_index {
std::size_t global_index;
std::size_t active_index;
std::size_t data_index;
cell_index(std::size_t g,std::size_t a, std::size_t d) :
global_index(g),
active_index(a),
data_index(d)
{}
struct index_pair {
std::size_t global;
std::size_t active;
};
Box(const EclipseGrid& grid);
Box(const EclipseGrid& grid , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void update(const DeckRecord& deckRecord);
void reset();
size_t size() const;
bool isGlobal() const;
size_t getDim(size_t idim) const;
const std::vector<cell_index>& index_list() const;
const std::vector<index_pair>& index_list() const;
const std::vector<size_t>& getIndexList() const;
bool equal(const Box& other) const;
@@ -65,16 +52,15 @@ namespace Opm {
int K2() const;
private:
void init(int i1, int i2, int j1, int j2, int k1, int k2);
void initIndexList();
const EclipseGrid& grid;
size_t m_stride[3];
size_t m_dims[3] = { 0, 0, 0 };
size_t m_offset[3];
size_t m_stride[3];
bool m_isGlobal;
std::vector<size_t> global_index_list;
std::vector<cell_index> m_index_list;
std::vector<index_pair> m_index_list;
int lower(int dim) const;
int upper(int dim) const;

View File

@@ -64,7 +64,6 @@ namespace Opm {
void endKeyword();
const Box& getActiveBox() const;
const std::vector<Box::cell_index>& index_list() const;
private:
const EclipseGrid& grid;

View File

@@ -53,7 +53,6 @@ namespace Opm {
class EclipseGrid : public GridDims {
public:
EclipseGrid() = default;
explicit EclipseGrid(const std::string& filename);
/*
@@ -151,8 +150,8 @@ namespace Opm {
/// Will return a vector a length num_active; where the value
/// of each element is the corresponding global index.
const std::vector<int>& getActiveMap() const;
std::array<double, 3> getCellCenter(size_t i,size_t j, size_t k) const;
std::array<double, 3> getCellCenter(size_t globalIndex) const;
const std::array<double, 3>& getCellCenter(size_t i,size_t j, size_t k) const;
const std::array<double, 3>& getCellCenter(size_t globalIndex) const;
std::array<double, 3> getCornerPos(size_t i,size_t j, size_t k, size_t corner_index) const;
double getCellVolume(size_t globalIndex) const;
double getCellVolume(size_t i , size_t j , size_t k) const;
@@ -196,6 +195,7 @@ namespace Opm {
PinchMode::ModeEnum m_pinchoutMode;
PinchMode::ModeEnum m_multzMode;
mutable std::vector< int > activeMap;
bool m_circle = false;
size_t zcorn_fixed = 0;
@@ -213,6 +213,14 @@ namespace Opm {
std::vector<int> m_active_to_global;
std::vector<int> m_global_to_active;
// Geometry data.
std::vector<double> m_volume;
std::vector<double> m_depth;
std::vector<double> m_dx;
std::vector<double> m_dy;
std::vector<double> m_dz;
std::vector<std::array<double, 3>> m_cellCenter;
void initGridFromEGridFile(Opm::EclIO::EclFile& egridfile, std::string fileName);
void initBinaryGrid(const Deck& deck);
@@ -252,12 +260,9 @@ namespace Opm {
double sumJdir(int i, int k, int j1, const std::array<int, 3>& dims, const std::vector<double>& dy) const;
double sumKdir(int i, int j, const std::array<int, 3>& dims, const std::vector<double>& dz) const;
void getCellCorners(const std::array<int, 3>& ijk, const std::array<int, 3>& dims, std::array<double,8>& X, std::array<double,8>& Y, std::array<double,8>& Z) const;
void getCellCorners(const std::size_t globalIndex,
std::array<double,8>& X,
std::array<double,8>& Y,
std::array<double,8>& Z) const;
void calculateGeometryData();
void getCellCorners(const std::array<int, 3>& ijk, const std::array<int, 3>& dims, std::array<double,8>& X, std::array<double,8>& Y, std::array<double,8>& Z) const;
};
class CoordMapper {

View File

@@ -32,11 +32,7 @@ namespace Opm {
class Fault {
public:
Fault() = default;
explicit Fault(const std::string& faultName);
Fault(const std::string& name,
double transMult,
const std::vector<FaultFace>& faceList);
const std::string& getName() const;
void setTransMult(double transMult);
@@ -44,14 +40,13 @@ public:
void addFace( FaultFace );
std::vector< FaultFace >::const_iterator begin() const;
std::vector< FaultFace >::const_iterator end() const;
const std::vector<FaultFace>& getFaceList() const;
bool operator==( const Fault& rhs ) const;
bool operator!=( const Fault& rhs ) const;
private:
std::string m_name;
double m_transMult = 0.0;
double m_transMult;
std::vector< FaultFace > m_faceList;
};
}

View File

@@ -36,7 +36,6 @@ class FaultCollection {
public:
FaultCollection();
FaultCollection(const GRIDSection& gridSection, const GridDims& grid);
FaultCollection(const OrderedMap<std::string, Fault>& faults);
size_t size() const;
bool hasFault(const std::string& faultName) const;
@@ -49,10 +48,6 @@ public:
void addFault(const std::string& faultName);
void setTransMult(const std::string& faultName , double transMult);
const OrderedMap<std::string, Fault>& getFaults() const;
bool operator==(const FaultCollection& data) const;
private:
void addFaultFaces(const GridDims& grid,
const DeckRecord& faultRecord,

View File

@@ -29,25 +29,22 @@ namespace Opm {
class FaultFace {
public:
FaultFace() = default;
FaultFace(size_t nx , size_t ny , size_t nz,
size_t I1 , size_t I2,
size_t J1 , size_t J2,
size_t K1 , size_t K2,
FaceDir::DirEnum faceDir);
FaultFace(const std::vector<size_t>& indices, FaceDir::DirEnum faceDir);
std::vector<size_t>::const_iterator begin() const;
std::vector<size_t>::const_iterator end() const;
FaceDir::DirEnum getDir() const;
const std::vector<size_t>& getIndices() const;
bool operator==( const FaultFace& rhs ) const;
bool operator!=( const FaultFace& rhs ) const;
private:
static void checkCoord(size_t dim , size_t l1 , size_t l2);
FaceDir::DirEnum m_faceDir = FaceDir::XPlus;
FaceDir::DirEnum m_faceDir;
std::vector<size_t> m_indexList;
};

View File

@@ -1,232 +0,0 @@
/*
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 FIELDPROPS_MANAGER_HPP
#define FIELDPROPS_MANAGER_HPP
#include <memory>
#include <vector>
namespace Opm {
class EclipseGrid;
class Deck;
class FieldProps;
class Phases;
class TableManager;
class FieldPropsManager {
struct MemInfo {
std::size_t global_size;
std::size_t active_size;
std::size_t int_fields;
std::size_t double_fields;
std::size_t total;
MemInfo(std::size_t gsize, std::size_t asize, std::size_t num_int, std::size_t num_double) :
global_size(gsize),
active_size(asize),
int_fields(num_int),
double_fields(num_double),
total(asize * sizeof(int) * num_int + // The integer fields like SATNUM and PVTNUM
asize * sizeof(double) * num_double + // The double fields like PORO and SWATINIT
asize * sizeof(double) * 2 + // Depth and volume of all active cells
asize * sizeof(unsigned char) * (num_int + num_double) + // The per cell value status flag
gsize * sizeof(int)) // The global ACTNUM mapping
{
};
};
public:
// The default constructor should be removed when the FieldPropsManager is mandatory
// The default constructed fieldProps object is **NOT** usable
FieldPropsManager() = default;
FieldPropsManager(const Deck& deck, const Phases& ph, const EclipseGrid& grid, const TableManager& tables);
virtual void reset_actnum(const std::vector<int>& actnum);
const std::string& default_region() const;
virtual std::vector<int> actnum() const;
virtual std::vector<double> porv(bool global = false) const;
MemInfo meminfo( ) const;
/*
The number of cells in the fields managed by this FieldPropsManager.
Initially this will correspond to the number of active cells in the grid
used when constructing the FieldPropsManager, but using the reset_actnum()
method it is possible to deactivate additional cells.
*/
std::size_t active_size() const;
/*
Because the FieldProps class can autocreate properties the semantics of
get() and has() is slightly non intuitve:
- The has<T>("KW") method will check if the current FieldProps container
has an installed "KW" keyword; if the container has the keyword in
question it will check if all elements have been assigned a value - only
in that case will it return true. The has<T>("KW") method will *not* try
to create a new keyword.
- The has<T>("KW") method will *not* consult the supported<T>("KW")
method; i.e. if you ask has<T>("UNKNOWN_KEYWORD") you will just get a
false.
- The get<T>("KW") method will try to create a new keyword if it does not
already have the keyword you are asking for. This implies that you can
get the following non intuitive sequence of events:
FieldPropsManager fpm(deck, grid);
fpm.has<int>("SATNUM"); => false
auto satnum = fpm.get<int>("SATNUM"); => SATNUM is autocreated
fpm.has<int>("SATNUM"); => true
- When checking whether the container has the keyword you should rephrase
the question slightly:
* Does the container have the keyword *right now* => has<T>("KW")
* Can the container provide the keyword => ptr = try_get<T>("KW")
- It is quite simple to create a deck where the keywords are only partly
initialized, all the methods in the FieldPropsManager only consider
fully initialized keywords.
*/
/*
The get_copy() has exactly the same behaviour as get(), but the important
difference is that said keyword is not already in the container it is not
installed in the container; if we look at SATNUM which is a keywor which
can be automatically instantiated we have the following behavior:
get():
fp.has<int>("SATNUM") -> false
const std::vector<int>& satnum = fp.get<int>("SATNUM")
fp.has<int>("SATNUM") -> true;
get_copy():
fp.has<int>("SATNUM") -> false
const std::vector<int>& satnum = fp.get_copy<int>("SATNUM")
fp.has<int>("SATNUM") -> false
*/
template <typename T>
std::vector<T> get_copy(const std::string& keyword, bool global=false) const;
/*
Will return a pointer to the keyword data, or nullptr if the container
does not have suce a keyword. Observe that container will hold on to an
manage the underlying keyword data.
The try_get function will return a nullptr if the container does not
contain said keyword, or if the keyword has not been fully initialized. If
you ask for a totally unknown keyword the method will return nullptr.
*/
template <typename T> const std::vector<T>* try_get(const
std::string& keyword) const;
/*
You can ask whether the elements in the keyword have a default value -
which typically is calculated in some way, or if it has been explicitly
assigned to in the deck.
*/
template <typename T>
std::vector<bool> defaulted(const std::string& keyword) const;
/*
Check whether the container supports/recognizes a keyword at all:
supported<double>("PORO") => true
supported<double>("NO_SUCH_KEYWORD") => false
The method does not at all consult the content of the container - it is a
static method.
*/
template <typename T>
static bool supported(const std::string& keyword);
/*
The keys() function will return a list of keys corresponding to the fully
initialized keywords in the container. Observe that the implementation
special cases the PORV and ACTNUM keywords, since these are present with
special functions porv(bool) and actnum() the "PORV" and "ACTNUM" string
literals are excluded from the keys() list.
*/
template <typename T>
std::vector<std::string> keys() const;
virtual const std::vector<int>& get_int(const std::string& keyword) const { return this->get<int>(keyword); }
virtual std::vector<int> get_global_int(const std::string& keyword) const { return this->get_global<int>(keyword); }
virtual const std::vector<double>& get_double(const std::string& keyword) const { return this->get<double>(keyword); }
virtual std::vector<double> get_global_double(const std::string& keyword) const { return this->get_global<double>(keyword); }
virtual bool has_int(const std::string& keyword) const { return this->has<int>(keyword); }
virtual bool has_double(const std::string& keyword) const { return this->has<double>(keyword); }
private:
/*
Return the keyword values as a std::vector<>. All elements in the return
value are guaranteed to be assigned a valid value. If the keyword is not
in the container, or not all elements have a valid value - an exception
will be raised:
- keyword which is not supported at all -> std::logic_error
- keyword which is not in the deck at all -> std::out_of_range
- keyword which has not been fully initialized -> std::runtime_error
Many of the keywords in the container can be automatically created, in
that case the get() method will silently create a new keyword and default
initialize if it is not already in the container. The different exceptions
raised for the different error conditions are the same for get(),
get_copy() and get_global().
*/
template <typename T>
const std::vector<T>& get(const std::string& keyword) const;
/*
Will check if the container has the keyword loaded; in a fully initialized
state. If you ask for a keyword which is not supported at all you will
just get false back.
*/
template <typename T>
bool has(const std::string& keyword) const;
/*
This is exactly like the get() method, but the returned vector will have
global cartesian size, where all inactive cells have been filled with
zeros.
*/
template <typename T>
std::vector<T> get_global(const std::string& keyword) const;
std::shared_ptr<FieldProps> fp;
};
}
#endif

View File

@@ -32,7 +32,6 @@ namespace Opm {
{
public:
GridDims();
explicit GridDims(std::array<int, 3> xyz);
GridDims(size_t nx, size_t ny, size_t nz);
@@ -57,9 +56,9 @@ namespace Opm {
void assertIJK(size_t i, size_t j, size_t k) const;
bool operator==(const GridDims& data) const;
protected:
GridDims();
size_t m_nx;
size_t m_ny;
size_t m_nz;

View File

@@ -0,0 +1,208 @@
/*
Copyright 2014 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 ECLIPSE_GRIDPROPERTIES_HPP_
#define ECLIPSE_GRIDPROPERTIES_HPP_
#include <set>
#include <string>
#include <vector>
#include <unordered_map>
#include <map>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/Section.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp>
#include <opm/parser/eclipse/Units/Dimension.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
/*
This class implements a container (std::unordered_map<std::string ,
Gridproperty<T>>) of Gridproperties. Usage is as follows:
1. Instantiate the class; passing the number of grid cells and the
supported keywords as a list of strings to the constructor.
2. Query the container with the supportsKeyword() and hasKeyword()
methods.
3. When you ask the container to get a keyword with the
getKeyword() method it will automatically create a new
GridProperty object if the container does not have this
property.
*/
namespace Opm {
class Eclipse3DProperties;
template <typename T>
class GridProperties {
public:
typedef typename GridProperty<T>::SupportedKeywordInfo SupportedKeywordInfo;
struct const_iterator;
GridProperties() = default;
GridProperties(const EclipseGrid& eclipseGrid,
const UnitSystem* deckUnitSystem,
std::vector< SupportedKeywordInfo >&& supportedKeywords);
explicit GridProperties(const EclipseGrid& eclipseGrid,
std::vector< SupportedKeywordInfo >&& supportedKeywords);
T convertInputValue( const GridProperty<T>& property , double doubleValue) const;
T convertInputValue( double doubleValue ) const;
bool supportsKeyword(const std::string& keyword) const;
bool isDefaultInitializable(const std::string& keyword) const;
/*
The difference between hasKeyword() and hasDeckKeyword( ) is
that hasDeckKeyword( ) will return false for keywords which
have only been auto created - and are not explicitly
mentioned in the deck.
*/
bool hasKeyword(const std::string& keyword) const;
bool hasDeckKeyword(const std::string& keyword) const;
size_t size() const;
void assertKeyword(const std::string& keyword) const;
/*
The getKeyword() method will auto create a keyword if
requested, the getDeckKeyword() method will onyl return a
keyword if it has been explicitly mentioned in the deck. The
getDeckKeyword( ) method will throw an exception instead of
auto creating the keyword.
*/
const GridProperty<T>& getKeyword(const std::string& keyword) const;
const GridProperty<T>& getDeckKeyword(const std::string& keyword) const;
bool addKeyword(const std::string& keywordName);
void copyKeyword(const std::string& srcField ,
const std::string& targetField ,
const Box& inputBox);
template <class Keyword>
bool hasKeyword() const {
return hasKeyword( Keyword::keywordName );
}
template <class Keyword>
const GridProperty<T>& getKeyword() const {
return getKeyword( Keyword::keywordName );
}
template <class Keyword>
const GridProperty<T>& getInitializedKeyword() const {
return getInitializedKeyword( Keyword::keywordName );
}
GridProperty<T>& getOrCreateProperty(const std::string& name);
/**
The fine print of the manual says the ADD keyword should support
some state dependent semantics regarding endpoint scaling arrays
in the PROPS section. That is not supported.
*/
void handleADDRecord( const DeckRecord& record, BoxManager& boxManager);
void handleMAXVALUERecord( const DeckRecord& record, BoxManager& boxManager);
void handleMINVALUERecord( const DeckRecord& record, BoxManager& boxManager);
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 handleOPERATERRecord( const DeckRecord& record , const GridProperty<int>& regionProperty );
/*
Iterators over initialized properties. The overloaded
operator*() opens the pair which comes natively from the
std::map iterator.
*/
const_iterator begin() const {
return const_iterator( m_properties.begin() );
}
const_iterator end() const {
return const_iterator( m_properties.end() );
}
/*
* storage MUST ensure that std::addressof(storage.at( key )) is valid.
*/
typedef typename std::map<std::string , GridProperty<T> > storage;
typedef typename storage::const_iterator storage_iterator;
struct const_iterator : public storage_iterator {
const_iterator( storage_iterator iter ) : storage_iterator( iter ) { }
const GridProperty<T>& operator*( ) {
const auto& pair = storage_iterator::operator*( );
return pair.second;
}
};
private:
/// this method exists for (friend) Eclipse3DProperties to be allowed initializing PORV and ACTNUM keyword
void postAddKeyword(const std::string& name,
const T defaultValue,
std::function< void( const std::vector<bool>& defaulted, std::vector< T >& ) > postProcessor,
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;
bool isAutoGenerated_(const std::string& keyword) const;
friend class Eclipse3DProperties; // needed for PORV keyword entanglement
size_t nx = 0;
size_t ny = 0;
size_t nz = 0;
const UnitSystem * m_deckUnitSystem = nullptr;
mutable std::unordered_map<std::string, SupportedKeywordInfo> m_supportedKeywords;
mutable storage m_properties;
mutable std::set<std::string> m_autoGeneratedProperties;
};
}
#endif // ECLIPSE_GRIDPROPERTIES_HPP_

View File

@@ -0,0 +1,333 @@
/*
Copyright 2014 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 ECLIPSE_GRIDPROPERTY_HPP_
#define ECLIPSE_GRIDPROPERTY_HPP_
#include <functional>
#include <string>
#include <utility>
#include <vector>
/*
This class implemenents a class representing properties which are
define over an ECLIPSE grid, i.e. with one value for each logical
cartesian cell in the grid.
*/
namespace Opm {
class Box;
class DeckItem;
class DeckKeyword;
class EclipseGrid;
class TableManager;
template< typename > class GridProperties;
template< typename T >
class GridPropertySupportedKeywordInfo {
public:
GridPropertySupportedKeywordInfo() = default;
using init = std::function< std::vector< T >( size_t ) >;
/**
* Property post-processor function type.
*
* Defaulted flag (one element for each Cartesian cell/data element)
* identifies whether the property value was defaulted in that cell
* (true) or assigned through a deck mechanism (false).
*/
using post = std::function<
void(const std::vector<bool>& defaulted,
std::vector< T >&)
>;
GridPropertySupportedKeywordInfo(
const std::string& name,
init initializer,
post postProcessor,
const std::string& dimString,
bool m_defaultInitializable = false );
GridPropertySupportedKeywordInfo(
const std::string& name,
init initializer,
const std::string& dimString,
bool m_defaultInitializable = false );
/* this is a convenience constructor which can be used if the default
* value for the grid property is just a constant.
*/
GridPropertySupportedKeywordInfo(
const std::string& name,
const T defaultValue,
const std::string& dimString,
bool m_defaultInitializable = false );
GridPropertySupportedKeywordInfo(
const std::string& name,
const T defaultValue,
post postProcessor,
const std::string& dimString,
bool m_defaultInitializable = false );
const std::string& getKeywordName() const;
const std::string& getDimensionString() const;
const init& initializer() const;
const post& postProcessor() const;
bool isDefaultInitializable() const;
/**
* Replace post-processor after object is created.
*
* XXX: This is essentially a hack, but it enables using
* post-processors that can't be created at construction time.
*
* One example of this use case is the post-processor for SOGCR in
* a run using Family I (SWOF/SGOF) saturation function tables.
* The SGOF table is implicitly defined in terms of the connate
* water saturation, and the critical oil-in-gas saturation
* post-processor needs to take this fact into account. That, in
* turn, means that the post-processor must have a way of
* accessing SWL data (defaulted or assigned) which means that the
* post-processor needs to be aware of the collection of grid
* properties, not just a single property in isolation.
*
* In our current system, the GridPropertySupportedKeywordInfo
* objects are constructor arguments to that collection and so
* have no way of referring to the collection itself. This method
* provides a mechanism for creating the post-processor once the
* collection is formed.
*
* \param[in] processor New post-processor function. Replaces
* existing post-processor, typically created at construction
* time.
*/
void setPostProcessor(post processor)
{
this->m_postProcessor = std::move(processor);
}
private:
std::string m_keywordName;
init m_initializer;
post m_postProcessor;
std::string m_dimensionString;
bool m_defaultInitializable;
};
template< typename T >
class GridProperty {
public:
typedef GridPropertySupportedKeywordInfo<T> SupportedKeywordInfo;
GridProperty( size_t nx, size_t ny, size_t nz, const SupportedKeywordInfo& kwInfo );
size_t getCartesianSize() const;
size_t getNX() const;
size_t getNY() const;
size_t getNZ() const;
T iget(size_t index) const;
T iget(size_t i , size_t j , size_t k) const;
void iset(size_t index, T value);
void iset(size_t i , size_t j , size_t k , T value);
const std::vector<bool>& wasDefaulted() const;
const std::vector<T>& getData() const;
std::vector<T>& getData();
bool containsNaN() const;
const std::string& getDimensionString() const;
void multiplyWith( const GridProperty<T>& );
void multiplyValueAtIndex( size_t index, T factor );
void maskedSet( T value, const std::vector< bool >& mask );
void maskedMultiply( T value, const std::vector< bool >& mask );
void maskedAdd( T value, const std::vector< bool >& mask );
void maskedCopy( const GridProperty< T >& other, const std::vector< bool >& mask );
void initMask( T value, std::vector<bool>& mask ) const;
/**
Due to the convention where it is only necessary to supply the
top layer of the petrophysical properties we can unfortunately
not enforce that the number of elements elements in the
DeckKeyword equals nx*ny*nz.
*/
void loadFromDeckKeyword( const DeckKeyword& , bool);
void loadFromDeckKeyword( const Box&, const DeckKeyword& , bool);
void copyFrom( const GridProperty< T >&, const Box& );
void scale( T scaleFactor, const Box& );
void maxvalue( T value, const Box& );
void minvalue( T value, const Box& );
void add( T shiftValue, const Box& );
void setScalar( T value, const Box& );
const std::string& getKeywordName() const;
const SupportedKeywordInfo& getKeywordInfo() const;
/**
Will check that all elements in the property are in the closed
interval [min,max].
*/
void checkLimits( T min, T max ) const;
/*
The runPostProcessor() method is public; and it is no harm in
calling it from arbitrary locations. But the intention is that
should only be called from the Eclipse3DProperties class
assembling the properties.
*/
void runPostProcessor();
/*
Will scan through the roperty and return a vector of all the
indices where the property value agrees with the input value.
*/
std::vector<size_t> indexEqual(T value) const;
/*
Will run through all the cells in the activeMap and return a
list of the elements where the property value agrees with the
input value. The values returned will be in the space
[0,nactive) - i.e. 'active' indices.
*/
std::vector<size_t> cellsEqual(T value , const std::vector<int>& activeMap) const;
/*
If active == true the method will get the activeMap from the
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;
/*
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);
void mulDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem);
void setElement(const typename std::vector<T>::size_type i,
const T value,
const bool defaulted = false);
size_t m_nx, m_ny, m_nz;
SupportedKeywordInfo m_kwInfo;
std::vector<T> m_data;
std::vector<bool> m_defaulted;
bool m_hasRunPostProcessor = false;
bool assigned = false;
};
// initialize the TEMPI grid property using the temperature vs depth
// table (stemming from the TEMPVD or the RTEMPVD keyword)
std::vector< double > temperature_lookup( size_t,
const TableManager*,
const EclipseGrid*,
const GridProperties<int>* );
}
#endif

View File

@@ -21,7 +21,7 @@
#ifndef OPM_PARSER_MULTREGTSCANNER_HPP
#define OPM_PARSER_MULTREGTSCANNER_HPP
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
@@ -57,15 +57,6 @@ namespace Opm {
int directions;
MULTREGT::NNCBehaviourEnum nnc_behaviour;
std::string region_name;
bool operator==(const MULTREGTRecord& data) const {
return src_value == data.src_value &&
target_value == data.target_value &&
trans_mult == data.trans_mult &&
directions == data.directions &&
nnc_behaviour == data.nnc_behaviour &&
region_name == data.region_name;
}
};
typedef std::map< std::pair<int , int> , const MULTREGTRecord * > MULTREGTSearchMap;
@@ -76,41 +67,16 @@ namespace Opm {
class MULTREGTScanner {
public:
using ExternalSearchMap = std::map<std::string, std::map<std::pair<int,int>, int>>;
MULTREGTScanner() = default;
MULTREGTScanner(const MULTREGTScanner& data);
MULTREGTScanner(const GridDims& grid,
const FieldPropsManager* fp_arg,
MULTREGTScanner(const Eclipse3DProperties& e3DProps,
const std::vector< const DeckKeyword* >& keywords);
MULTREGTScanner(const std::array<size_t,3>& size,
const std::vector<MULTREGTRecord>& records,
const ExternalSearchMap& searchMap,
const std::map<std::string, std::vector<int>>& region,
const std::string& defaultRegion);
double getRegionMultiplier(size_t globalCellIdx1, size_t globalCellIdx2, FaceDir::DirEnum faceDir) const;
std::array<size_t,3> getSize() const;
const std::vector<MULTREGTRecord>& getRecords() const;
ExternalSearchMap getSearchMap() const;
const std::map<std::string, std::vector<int>>& getRegions() const;
const std::string& getDefaultRegion() const;
bool operator==(const MULTREGTScanner& data) const;
MULTREGTScanner& operator=(const MULTREGTScanner& data);
private:
void constructSearchMap(const ExternalSearchMap& searchMap);
void addKeyword( const DeckKeyword& deckKeyword, const std::string& defaultRegion);
void assertKeywordSupported(const DeckKeyword& deckKeyword);
std::size_t nx = 0,ny = 0, nz = 0;
const FieldPropsManager* fp = nullptr;
void addKeyword( const Eclipse3DProperties& props, const DeckKeyword& deckKeyword, const std::string& defaultRegion);
void assertKeywordSupported(const DeckKeyword& deckKeyword, const std::string& defaultRegion);
std::vector< MULTREGTRecord > m_records;
std::map<std::string , MULTREGTSearchMap> m_searchMap;
std::map<std::string, std::vector<int>> regions;
std::string default_region;
const Eclipse3DProperties& m_e3DProps;
};
}

View File

@@ -28,6 +28,7 @@ namespace Opm {
enum ModeEnum {
Inactive = 1,
EclSTD = 2,
OpmFIL = 3
};
}
}

View File

@@ -32,14 +32,6 @@ struct NNCdata {
: cell1(c1), cell2(c2), trans(t)
{}
NNCdata() = default;
bool operator==(const NNCdata& data) const
{
return cell1 == data.cell1 &&
cell2 == data.cell2 &&
trans == data.trans;
}
size_t cell1;
size_t cell2;
double trans;
@@ -56,14 +48,11 @@ public:
/// Construct from input deck.
explicit NNC(const Deck& deck);
explicit NNC(const std::vector<NNCdata>& nncdata) : m_nnc(nncdata) {}
void addNNC(const size_t cell1, const size_t cell2, const double trans);
const std::vector<NNCdata>& data() const { return m_nnc; }
const std::vector<NNCdata>& nncdata() const { return m_nnc; }
size_t numNNC() const;
bool hasNNC() const;
bool operator==(const NNC& data) const;
private:
std::vector<NNCdata> m_nnc;

View File

@@ -19,227 +19,184 @@
#ifndef ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP
#define ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP
#include <string>
#include <vector>
#include <string>
#include <opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp>
namespace Opm {
class Phases;
class EclipseGrid;
class TableManager;
namespace satfunc {
std::vector<double> SGLEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SGLEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISGLEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISGLEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SGUEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SGUEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISGUEndpoint(size_t, const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISGUEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SWLEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SWLEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISWLEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISWLEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SWUEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SWUEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISWUEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISWUEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SGCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SGCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISGCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISGCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SOWCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SOWCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISOWCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISOWCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SOGCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SOGCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISOGCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISOGCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> SWCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> SWCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> ISWCREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> ISWCREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> PCWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> PCWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IPCWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IPCWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> PCGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> PCGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IPCGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IPCGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKRWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRWREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRWREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRWREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKRWREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KROEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KROEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKROEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKROEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRORWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRORWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRORWEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKRORWEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRORGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRORGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRORGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKRORGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRGEndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> IKRGEndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> KRGREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
std::vector<double> KRGREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> IKRGREndpoint(const TableManager&,
const Phases&,
const std::vector<double>&,
const std::vector<int>&,
const std::vector<int>&);
std::vector<double> init(const std::string& kewyord,
const TableManager& tables,
const Phases& phases,
const std::vector<double>& cell_depth,
const std::vector<int>& num,
const std::vector<int>& endnum);
}
std::vector<double> IKRGREndpoint(size_t,
const TableManager*,
const EclipseGrid*,
GridProperties<int>*);
}
#endif // ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP

View File

@@ -41,42 +41,30 @@ namespace Opm {
template< typename > class GridProperty;
class Fault;
class FaultCollection;
class Eclipse3DProperties;
class DeckKeyword;
class FieldPropsManager;
class TransMult {
public:
TransMult() = default;
TransMult(const GridDims& dims, const Deck& deck, const FieldPropsManager& fp);
TransMult(const std::array<size_t,3>& size,
const std::map<FaceDir::DirEnum, std::vector<double>>& trans,
const std::map<FaceDir::DirEnum, std::string>& names,
const MULTREGTScanner& scanner);
TransMult(const GridDims& dims, const Deck& deck, const Eclipse3DProperties& props);
double getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const;
double getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const;
double getRegionMultiplier( size_t globalCellIndex1, size_t globalCellIndex2, FaceDir::DirEnum faceDir) const;
void applyMULT(const std::vector<double>& srcMultProp, FaceDir::DirEnum faceDir);
void applyMULT(const GridProperty<double>& srcMultProp, FaceDir::DirEnum faceDir);
void applyMULTFLT(const FaultCollection& faults);
void applyMULTFLT(const Fault& fault);
std::array<size_t,3> getSize() const;
const std::map<FaceDir::DirEnum, std::vector<double>>& getTrans() const;
const std::map<FaceDir::DirEnum, std::string>& getNames() const;
const MULTREGTScanner& getScanner() const;
bool operator==(const TransMult& data) const;
private:
size_t getGlobalIndex(size_t i , size_t j , size_t k) const;
void assertIJK(size_t i , size_t j , size_t k) const;
double getMultiplier__(size_t globalIndex , FaceDir::DirEnum faceDir) const;
void insertNewProperty(FaceDir::DirEnum faceDir);
bool hasDirectionProperty(FaceDir::DirEnum faceDir) const;
std::vector<double>& getDirectionProperty(FaceDir::DirEnum faceDir);
GridProperty<double>& getDirectionProperty(FaceDir::DirEnum faceDir);
size_t m_nx = 0, m_ny = 0, m_nz = 0;
std::map<FaceDir::DirEnum , std::vector<double> > m_trans;
size_t m_nx , m_ny , m_nz;
std::map<FaceDir::DirEnum , GridProperty<double> > m_trans;
std::map<FaceDir::DirEnum , std::string> m_names;
MULTREGTScanner m_multregtScanner;
};

View File

@@ -151,15 +151,6 @@ namespace Opm {
IOConfig() = default;
explicit IOConfig( const Deck& );
explicit IOConfig( const std::string& input_path );
IOConfig(bool write_init, bool write_egrid,
bool unifin, bool unifout,
bool fmtin, bool fmtout,
const std::string& deck_name,
bool output_enabled,
const std::string& output_dir,
bool no_sim,
const std::string& base_name,
bool ecl_compatible_rst);
void setEclCompatibleRST(bool ecl_rst);
bool getEclCompatibleRST() const;
@@ -169,8 +160,6 @@ namespace Opm {
bool getUNIFIN() const;
bool getFMTIN() const;
bool getFMTOUT() const;
const std::string& getDeckFileName() const;
bool getNoSim() const;
const std::string& getEclipseInputPath() const;
void overrideNOSIM(bool nosim);
@@ -193,7 +182,11 @@ namespace Opm {
bool initOnly() const;
bool operator==(const IOConfig& data) const;
// Proxy methods forwarding directly to corresponding RestartConfig
bool getWriteRestartFile(size_t timestep) const;
int getFirstRestartStep() const;
void overrideRestartWriteInterval(size_t interval);
void setWriteInitialRestartFile(bool writeInitialRestartFile);
private:
bool m_write_INIT_file = false;
@@ -202,6 +195,7 @@ namespace Opm {
bool m_UNIFOUT = false;
bool m_FMTIN = false;
bool m_FMTOUT = false;
int m_first_restart_step;
std::string m_deck_filename;
bool m_output_enabled = true;
std::string m_output_dir;

View File

@@ -23,8 +23,7 @@
#include <vector>
#include <set>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <boost/date_time.hpp>
/*
The RestartConfig class internalizes information of when (at which
@@ -199,6 +198,7 @@ namespace Opm {
class RUNSPECSection;
class SCHEDULESection;
class SOLUTIONSection;
class TimeMap;
class Schedule;
class ParseContext;
class ErrorGuard;
@@ -312,22 +312,25 @@ namespace Opm {
size_t rptsched_restart = 0;
};
// }
class RestartConfig {
class RestartConfig {
public:
RestartConfig() = default;
RestartConfig();
template<typename T>
RestartConfig( const TimeMap& time_map, const Deck&, const ParseContext& parseContext, T&& errors );
RestartConfig( const TimeMap& time_map, const Deck&, const ParseContext& parseContext, ErrorGuard& errors );
RestartConfig( const TimeMap& time_map, const Deck& );
RestartConfig(const TimeMap& timeMap,
int firstRestartStep,
bool writeInitial,
const DynamicState<RestartSchedule>& restart_sched,
const DynamicState<std::map<std::string,int>>& restart_keyw,
const std::vector<bool>& save_keyw);
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, bool log=true) const;
@@ -340,14 +343,6 @@ namespace Opm {
RestartSchedule getNode( size_t timestep ) const;
static std::string getRestartFileName(const std::string& restart_base, int report_step, bool unified, bool fmt_file);
const TimeMap& timeMap() const;
bool writeInitialRst() const;
const DynamicState<RestartSchedule>& restartSchedule() const;
const DynamicState<std::map<std::string,int>>& restartKeywords() const;
const std::vector<bool>& saveKeywords() const;
bool operator==(const RestartConfig& data) const;
private:
@@ -365,14 +360,15 @@ namespace Opm {
bool years = false,
bool months = false) const;
void handleRPTSOL( const DeckKeyword& keyword);
TimeMap m_timemap;
int m_first_restart_step;
bool m_write_initial_RST_file = false;
void handleScheduleSection( const SCHEDULESection& schedule, const ParseContext& parseContext, ErrorGuard& errors);
void update( size_t step, const RestartSchedule& rs);
static RestartSchedule rptsched( const DeckKeyword& );
TimeMap m_timemap;
int m_first_restart_step = 1;
bool m_write_initial_RST_file = false;
DynamicState< RestartSchedule > restart_schedule;
DynamicState< std::map< std::string, int > > restart_keywords;
std::vector< bool > save_keywords;

View File

@@ -19,13 +19,9 @@ namespace Opm {
bool wetGasInitConstantRv() const;
int initializationTargetAccuracy() const;
EquilRecord();
EquilRecord( double datum_depth_arg, double datum_depth_pc_arg, double woc_depth, double woc_pc, double goc_depth, double goc_pc, bool live_oil_init, bool wet_gas_init, int target_accuracy);
bool operator==(const EquilRecord& data) const;
private:
double datum_depth;
double datum_depth_ps;
double water_oil_contact_depth;
@@ -44,10 +40,8 @@ namespace Opm {
Equil() = default;
explicit Equil( const DeckKeyword& );
Equil(const std::vector<EquilRecord>& records);
const EquilRecord& getRecord( size_t id ) const;
const std::vector<EquilRecord>& records() const;
size_t size() const;
bool empty() const;
@@ -55,10 +49,8 @@ namespace Opm {
const_iterator begin() const;
const_iterator end() const;
bool operator==(const Equil& data) const;
private:
std::vector< EquilRecord > m_records;
std::vector< EquilRecord > records;
};
}

View File

@@ -33,14 +33,8 @@ class DeckRecord;
class FoamData
{
public:
FoamData();
FoamData(const DeckRecord& FOAMFSC_record, const DeckRecord& FOAMROCK_record);
explicit FoamData(const DeckRecord& FOAMROCK_record);
FoamData(double reference_surfactant_concentration,
double exponent,
double minimum_surfactant_concentration,
bool allow_desorption,
double rock_density);
double referenceSurfactantConcentration() const;
double exponent() const;
@@ -49,8 +43,6 @@ public:
bool allowDesorption() const;
double rockDensity() const;
bool operator==(const FoamData& data) const;
private:
double reference_surfactant_concentration_;
double exponent_;
@@ -65,10 +57,8 @@ class FoamConfig
public:
FoamConfig() = default;
explicit FoamConfig(const Deck&);
FoamConfig(const std::vector<FoamData>& data);
const FoamData& getRecord(std::size_t index) const;
const std::vector<FoamData>& records() const;
std::size_t size() const;
bool empty() const;
@@ -77,8 +67,6 @@ public:
const_iterator begin() const;
const_iterator end() const;
bool operator==(const FoamConfig& data) const;
private:
std::vector<FoamData> data_;
};

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