Compare commits
73 Commits
master
...
release/20
Author | SHA1 | Date | |
---|---|---|---|
|
a30fcddfd4 | ||
|
edbf93e762 | ||
|
f8e6aa595b | ||
|
78a2aa5c3e | ||
|
109c9bb256 | ||
|
d9968f6380 | ||
|
1ba0a174db | ||
|
5b317b856b | ||
|
ef6f42d457 | ||
|
69a0a31309 | ||
|
3be35ec286 | ||
|
0469d28fa2 | ||
|
7cd7c7a158 | ||
|
7bc1fc8362 | ||
|
b573c28594 | ||
|
693c4607c8 | ||
|
1c17a5daed | ||
|
edee59df30 | ||
|
c5fcbf2084 | ||
|
8e860c4b7a | ||
|
ad9fbfe4ea | ||
|
53fff6bb3f | ||
|
8e23316eba | ||
|
d4e6c9ec44 | ||
|
ae9712232e | ||
|
d376ee9ed4 | ||
|
1067b66696 | ||
|
ac43482944 | ||
|
3ca39f2e62 | ||
|
aaaa22e279 | ||
|
646d263883 | ||
|
f1e0dcea81 | ||
|
7b3b26c452 | ||
|
5f9d67a6eb | ||
|
8e44ca1b2c | ||
|
89e2ebd5f9 | ||
|
06287e8631 | ||
|
4cd26c5f9a | ||
|
d4ce9fe909 | ||
|
7ee05a9ceb | ||
|
8a9814ad16 | ||
|
96b7bb65e2 | ||
|
4761fe724b | ||
|
8488efde1f | ||
|
3a89d05646 | ||
|
0d3037383a | ||
|
de67ce4083 | ||
|
0fadb026af | ||
|
fe275a55fd | ||
|
a44febc314 | ||
|
895c43dff0 | ||
|
e2ca798005 | ||
|
8fa07537fc | ||
|
7f9d250fd3 | ||
|
5eab9b003f | ||
|
14625b3279 | ||
|
3cb23e6857 | ||
|
f8f1efc0ac | ||
|
6d92c1f5de | ||
|
c68ec9c28b | ||
|
2dd6400d06 | ||
|
aa10ded01a | ||
|
edaa5ae561 | ||
|
aa56a40e8d | ||
|
2d7ba6a3c9 | ||
|
6c397ff2a8 | ||
|
c83feddb28 | ||
|
6d9deefb29 | ||
|
afaa99d3f4 | ||
|
c69a111e7a | ||
|
112e698d0a | ||
|
7dffd9f2e7 | ||
|
a3f2c115f1 |
@ -224,14 +224,11 @@ if (OPM_ENABLE_PYTHON)
|
||||
set(PYTHON_PACKAGE_PATH "site-packages")
|
||||
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
||||
|
||||
get_target_property(_ecl_include_dirs ecl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
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}")
|
||||
|
||||
get_target_property(_ecl_lib ecl LOCATION)
|
||||
get_filename_component(_ecl_lib_dir ${_ecl_lib} DIRECTORY)
|
||||
set(_opmcommon_lib_dirs ${_ecl_lib_dir} ${CMAKE_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/lib)
|
||||
set(_opmcommon_lib_dirs ${CMAKE_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/lib)
|
||||
string(REPLACE ";" ":" _setup_lib_dirs "${_opmcommon_lib_dirs}")
|
||||
|
||||
add_custom_command(OUTPUT python/python/opm/libopmcommon_python.so
|
||||
|
@ -35,6 +35,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
src/opm/common/utility/parameters/ParameterGroup.cpp
|
||||
src/opm/common/utility/parameters/ParameterTools.cpp
|
||||
src/opm/common/utility/numeric/calculateCellVol.cpp
|
||||
src/opm/common/utility/TimeService.cpp
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND MAIN_SOURCE_FILES
|
||||
@ -441,6 +442,7 @@ list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/utility/parameters/ParameterStrings.hpp
|
||||
opm/common/utility/parameters/ParameterTools.hpp
|
||||
opm/common/utility/numeric/calculateCellVol.hpp
|
||||
opm/common/utility/TimeService.hpp
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Libs to link tests against
|
||||
set(TEST_LIBS opmcommon ecl Boost::unit_test_framework)
|
||||
set(TEST_LIBS opmcommon Boost::unit_test_framework)
|
||||
set(EXTRA_TESTS)
|
||||
|
||||
# Generated source, needs to be here
|
||||
|
@ -32,7 +32,7 @@ if(NOT cjson_FOUND)
|
||||
endif()
|
||||
add_executable(genkw ${genkw_SOURCES})
|
||||
|
||||
target_link_libraries(genkw ecl Boost::regex Boost::filesystem Boost::system)
|
||||
target_link_libraries(genkw Boost::regex Boost::filesystem Boost::system)
|
||||
|
||||
# Generate keyword list
|
||||
include(src/opm/parser/eclipse/share/keywords/keyword_list.cmake)
|
||||
|
18
changelog.md
18
changelog.md
@ -3,6 +3,24 @@
|
||||
A short month-by-month synopsis of change highlights. Most bugfixes won't make
|
||||
it in here, only the bigger features and interface changes.
|
||||
|
||||
# Important changes between release 2019.04 and 2019.10
|
||||
|
||||
* opm-common and the rest of OPM does not use libecl anymore and
|
||||
supports reading and writing Eclipse files directly
|
||||
* Improved Eclipse compatible restart, support for unified and non unified
|
||||
files, and formatted and unformatted files
|
||||
* Support for reading and checking various additional keywords was introduced (those
|
||||
starting with A - M, R, T, V, W, Z).
|
||||
* ACTIONX support implemented
|
||||
* NUPCOL support implemented
|
||||
* UDA, UDQ support implemented
|
||||
* Implemented writing saturation function scaled end-point arrays (e.g., SWL, SGU,
|
||||
SOWCR, KRORW, PCG) to INIT file
|
||||
* Fixes concerning interaction of WELOPEN and WCON* with WECON and
|
||||
WTEST
|
||||
* Added support for FOAM keywords (FOAMMOB, FOAMROCK, WFOAM)
|
||||
* Refactored and reimplemented Well representation in deck
|
||||
|
||||
# 2016.12
|
||||
* ZCORN adjustments improved, considers cell-cell relations
|
||||
* Slightly more robust compilation - won't crash if locales are broken
|
||||
|
@ -1,287 +0,0 @@
|
||||
# - Find the Ensemble-based Reservoir Tool (ERT)
|
||||
#
|
||||
# Set the cache variable ERT_ROOT to the install location of the ERT
|
||||
# libraries and header files.
|
||||
#
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# ERT_INCLUDE_DIRS Header file directories
|
||||
# ERT_LIBRARIES Archives and shared objects
|
||||
# ERT_CONFIG_VARS Definitions that goes in config.h
|
||||
# ERT_LINKER_FLAGS Options that must be passed to linker
|
||||
#
|
||||
# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to
|
||||
# link with the ERT libraries.
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (ERT_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (ERT_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# if a directory has been specified by the user, then don't go look
|
||||
# in the system directories as well
|
||||
if (ERT_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else (ERT_ROOT)
|
||||
set (_no_default_path "")
|
||||
endif (ERT_ROOT)
|
||||
|
||||
# ERT doesn't have any config-mode file, so we need to specify the root
|
||||
# directory in its own variable
|
||||
find_path (ERT_ECL_INCLUDE_DIR
|
||||
NAMES "ert/ecl/ecl_util.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_ECL_WELL_INCLUDE_DIR
|
||||
NAMES "ert/ecl_well/well_const.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl_well/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_ECLXX_INCLUDE_DIR
|
||||
NAMES "ert/ecl/EclKW.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libeclxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_UTIL_INCLUDE_DIR
|
||||
NAMES "ert/util/stringlist.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_UTILXX_INCLUDE_DIR
|
||||
NAMES "ert/util/ert_unique_ptr.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_utilxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_GEN_INCLUDE_DIR
|
||||
NAMES "ert/util/int_vector.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include"
|
||||
"include" "build/libert_util/include" "build/libert_util/include"
|
||||
DOC "Path to ERT generated library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
|
||||
# need all of these libraries
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
find_library (ERT_LIBRARY_ECL
|
||||
NAMES "ecl"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_ECLXX
|
||||
NAMES "eclxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse C++ library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_ECL_WELL
|
||||
NAMES "ecl_well"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_GEOMETRY
|
||||
NAMES "ert_geometry"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Geometry library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_UTIL
|
||||
NAMES "ert_util"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Utilities library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_UTILXX
|
||||
NAMES "ert_utilxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Utilities library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
# the "library" found here is actually a list of several files
|
||||
list (APPEND ERT_INCLUDE_DIR
|
||||
${ERT_ECL_INCLUDE_DIR}
|
||||
${ERT_ECL_WELL_INCLUDE_DIR}
|
||||
${ERT_ECLXX_INCLUDE_DIR}
|
||||
${ERT_UTIL_INCLUDE_DIR}
|
||||
${ERT_UTILXX_INCLUDE_DIR}
|
||||
${ERT_GEN_INCLUDE_DIR}
|
||||
)
|
||||
list (APPEND ERT_LIBRARY
|
||||
${ERT_LIBRARY_ECL}
|
||||
${ERT_LIBRARY_ECLXX}
|
||||
${ERT_LIBRARY_ECL_WELL}
|
||||
${ERT_LIBRARY_GEOMETRY}
|
||||
${ERT_LIBRARY_UTIL}
|
||||
${ERT_LIBRARY_UTILXX}
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${ERT_LIBRARY})
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR})
|
||||
|
||||
# if we didn't find any files, then don't proceed through the entire dependency list
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY
|
||||
)
|
||||
# clear the cache so the find probe is attempted again if files becomes
|
||||
# available (only upon a unsuccessful *compile* should we disable further
|
||||
# probing)
|
||||
set (HAVE_ERT)
|
||||
unset (HAVE_ERT CACHE)
|
||||
return ()
|
||||
endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
|
||||
|
||||
# dependencies
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
find_openmp (ERT)
|
||||
|
||||
# compression library
|
||||
find_package (ZLIB ${ERT_QUIET})
|
||||
if (ZLIB_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif (ZLIB_FOUND)
|
||||
|
||||
# numerics
|
||||
find_package (BLAS ${ERT_QUIET})
|
||||
if (BLAS_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
endif (BLAS_FOUND)
|
||||
|
||||
find_package (LAPACK ${ERT_QUIET})
|
||||
if (LAPACK_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS})
|
||||
endif (LAPACK_FOUND)
|
||||
|
||||
# math library (should exist on all unices; automatically linked on Windows)
|
||||
if (UNIX)
|
||||
find_library (MATH_LIBRARY
|
||||
NAMES "m"
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${MATH_LIBRARY})
|
||||
endif (UNIX)
|
||||
|
||||
# if shared libraries are disabled on linux, explcitly linking to the
|
||||
# pthreads library is required by ERT
|
||||
find_package(Threads ${ERT_QUIET})
|
||||
if (CMAKE_THREAD_LIBS_INIT)
|
||||
list (APPEND ERT_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# Platform specific library where dlopen with friends lives
|
||||
list (APPEND ERT_LIBRARIES ${CMAKE_DL_LIBS})
|
||||
|
||||
# since OpenMP often implies pthreads, we need to tidy up
|
||||
# (last instance of library must be left standing, thus reversing that
|
||||
# list before removing duplicates)
|
||||
include (Duplicates)
|
||||
remove_dup_deps (ERT)
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
|
||||
check_cxx_source_compiles (
|
||||
"#include <ert/ecl/ecl_grid.h>
|
||||
int main ( ) {
|
||||
ecl_grid_type * grid = ecl_grid_alloc_rectangular( 10,10,10,1,1,1, NULL);
|
||||
ecl_grid_free( grid );
|
||||
return 0;
|
||||
}" HAVE_ERT)
|
||||
cmake_pop_check_state ()
|
||||
else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
# clear the cache so the find probe is attempted again if files becomes
|
||||
# available (only upon a unsuccessful *compile* should we disable further
|
||||
# probing)
|
||||
set (HAVE_ERT)
|
||||
unset (HAVE_ERT CACHE)
|
||||
endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
# - Find the Python wrappers for Ensemble-based Reservoir Tool (ERT)
|
||||
#
|
||||
# Set the cache variable ERT_PYTHON_PATH to the install location of
|
||||
# the root ert package.
|
||||
|
||||
find_package(PythonInterp)
|
||||
if(PYTHONINTERP_FOUND)
|
||||
|
||||
# We try to find the ert Python distribution. This is done by running
|
||||
# Python code which tries to 'import ert' and prints out the path to
|
||||
# the module if the import succeeds.
|
||||
#
|
||||
# The normal Python import machinery is employed, so if you have
|
||||
# installed ert python in a default location, or alternatively set the
|
||||
# PYTHONPATH variable the ert Python distribution will eventually be
|
||||
# found there, independently of the alternatives which are tested with
|
||||
# the ${PATH_LIST} variable.
|
||||
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set( PYTHON_PACKAGE_PATH "dist-packages")
|
||||
else()
|
||||
set( PYTHON_PACKAGE_PATH "site-packages")
|
||||
endif()
|
||||
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
||||
|
||||
set(PATH_LIST)
|
||||
if (ERT_ROOT)
|
||||
list(APPEND PATH_LIST ${ERT_ROOT})
|
||||
endif()
|
||||
list(APPEND PATH_LIST ${CMAKE_PREFIX_PATH})
|
||||
|
||||
# Add various popular sibling alternatives.
|
||||
list(APPEND PATH_LIST "${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build")
|
||||
|
||||
foreach( PATH ${PATH_LIST})
|
||||
set( python_code "import sys; sys.path.insert(0 , '${PATH}/${PYTHON_INSTALL_PREFIX}'); import os.path; import inspect; import ert; print os.path.dirname(os.path.dirname(inspect.getfile(ert))); from ert.ecl import EclSum")
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
|
||||
RESULT_VARIABLE import_result
|
||||
OUTPUT_VARIABLE stdout_output
|
||||
ERROR_VARIABLE stderr_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if (${import_result} EQUAL 0)
|
||||
set( ERT_PYTHON_PATH ${stdout_output} CACHE PATH "Python path for ERT Python" )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
find_package_handle_standard_args("ERTPython" DEFAULT_MSG ERT_PYTHON_PATH)
|
||||
|
||||
|
||||
|
@ -152,22 +152,7 @@ macro (find_and_append_package_to prefix name)
|
||||
if ( (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND )
|
||||
OR _search_components GREATER -1)
|
||||
string(REGEX MATCH "(dune|opm)-.*" _is_opm ${name})
|
||||
if(${name} STREQUAL "ecl")
|
||||
# Give us a chance to find ecl installed to CMAKE_INSTALL_PREFIX.
|
||||
# We need to deactivate the package registry for this.
|
||||
create_module_dir_var(ecl)
|
||||
set(ARGN_NO_REQUIRED ${ARGN})
|
||||
if(ARGN)
|
||||
list(REMOVE_ITEM ARGN_NO_REQUIRED "REQUIRED")
|
||||
endif()
|
||||
find_package (${name} ${ARGN_NO_REQUIRED} NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_PACKAGE_REGISTRY)
|
||||
if(TARGET ecl)
|
||||
# Need to grab from target to enable transitional depends
|
||||
#get_target_property(ecl_INCLUDE_DIRS ecl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(ecl_LIBRARIES ecl)
|
||||
set(HAVE_ERT 1)
|
||||
endif()
|
||||
elseif(_${name}_exempted LESS 0 AND NOT _is_opm)
|
||||
if(_${name}_exempted LESS 0 AND NOT _is_opm)
|
||||
find_package (${name} ${ARGN})
|
||||
elseif(_${name}_exempted GREATER -1)
|
||||
find_package (${name} ${ARGN})
|
||||
|
@ -9,12 +9,7 @@ macro(create_module_dir_var module)
|
||||
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
|
||||
#Try if <module-name>/<build-dir> is used
|
||||
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
|
||||
if ("${module}" STREQUAL "ecl")
|
||||
#use clone directory libecl
|
||||
set(_clone_dir "libecl")
|
||||
else()
|
||||
set(_clone_dir "${module}")
|
||||
endif()
|
||||
set(_clone_dir "${module}")
|
||||
if(IS_DIRECTORY ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
|
||||
set(${module}_DIR ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
|
||||
else()
|
||||
@ -23,7 +18,8 @@ macro(create_module_dir_var module)
|
||||
AND IS_DIRECTORY ${_parent_full_dir}/${_module_leaf})
|
||||
# We are using build directories named <prefix><module-name><postfix>
|
||||
set(${module}_DIR ${_parent_full_dir}/${_module_leaf})
|
||||
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir})
|
||||
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir} AND
|
||||
EXISTS ${_parent_full_dir}/${_clone_dir}/CMakeCache.txt)
|
||||
# All modules are in a common build dir
|
||||
set(${module}_DIR "${_parent_full_dir}/${_clone_dir}")
|
||||
endif()
|
||||
|
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -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
|
||||
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -5,7 +5,7 @@ Build-Depends: build-essential, debhelper (>= 9),
|
||||
pkg-config, cmake, git, libtool, doxygen,
|
||||
texlive-latex-extra, texlive-latex-recommended,
|
||||
ghostscript, libboost-system-dev, libboost-test-dev,
|
||||
libecl-dev, libboost-regex-dev, libboost-filesystem-dev,
|
||||
libboost-regex-dev, libboost-filesystem-dev,
|
||||
zlib1g-dev
|
||||
Standards-Version: 3.9.2
|
||||
Section: libs
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
Module: opm-common
|
||||
Description: Open Porous Media Initiative shared infrastructure
|
||||
Version: 2019.10-pre
|
||||
Label: 2019.10-pre
|
||||
Version: 2019.10
|
||||
Label: 2019.10
|
||||
Maintainer: opm@opm-project.org
|
||||
MaintainerName: OPM community
|
||||
Url: http://opm-project.org
|
||||
|
@ -5,7 +5,6 @@ declare -A configurations
|
||||
declare -A EXTRA_MODULE_FLAGS
|
||||
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON"
|
||||
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON"
|
||||
EXTRA_MODULE_FLAGS[libecl]="-DCMAKE_POSITION_INDEPENDENT_CODE=1"
|
||||
|
||||
# Parse revisions from trigger comment and setup arrays
|
||||
# Depends on: 'upstreams', upstreamRev',
|
||||
@ -13,7 +12,6 @@ EXTRA_MODULE_FLAGS[libecl]="-DCMAKE_POSITION_INDEPENDENT_CODE=1"
|
||||
# 'ghprbCommentBody',
|
||||
# 'CONFIGURATIONS', 'TOOLCHAINS'
|
||||
function parseRevisions {
|
||||
# Set default for libecl to be last known good commit.
|
||||
for upstream in ${upstreams[*]}
|
||||
do
|
||||
if grep -qi "$upstream=" <<< $ghprbCommentBody
|
||||
@ -148,12 +146,7 @@ function clone_module {
|
||||
mkdir -p $WORKSPACE/deps/$1
|
||||
cd $WORKSPACE/deps/$1
|
||||
git init .
|
||||
if [ "$1" == "libecl" ]
|
||||
then
|
||||
git remote add origin https://github.com/equinor/$1
|
||||
else
|
||||
git remote add origin https://github.com/OPM/$1
|
||||
fi
|
||||
git remote add origin https://github.com/OPM/$1
|
||||
git fetch --depth 1 origin $2:branch_to_build
|
||||
git checkout branch_to_build
|
||||
git log HEAD -1 | cat
|
||||
|
@ -6,11 +6,9 @@ source `dirname $0`/build-opm-module.sh
|
||||
mkdir deps
|
||||
ln -sf $WORKSPACE deps/opm-common
|
||||
|
||||
# No upstreams
|
||||
declare -a upstreams
|
||||
upstreams=(libecl)
|
||||
|
||||
declare -A upstreamRev
|
||||
upstreamRev[libecl]=master
|
||||
|
||||
# Downstreams and revisions
|
||||
declare -a downstreams
|
||||
|
@ -15,7 +15,6 @@ set (opm-common_DEPS
|
||||
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND opm-common_DEPS
|
||||
"ecl REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS system filesystem unit_test_framework regex REQUIRED")
|
||||
|
68
opm/common/utility/TimeService.hpp
Normal file
68
opm/common/utility/TimeService.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media Project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_TIMESERVICE_HEADER_INCLUDED
|
||||
#define OPM_TIMESERVICE_HEADER_INCLUDED
|
||||
|
||||
#include <ctime>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class TimeStampUTC
|
||||
{
|
||||
public:
|
||||
struct YMD {
|
||||
int year{0};
|
||||
int month{0};
|
||||
int day{0};
|
||||
};
|
||||
|
||||
TimeStampUTC() = default;
|
||||
|
||||
explicit TimeStampUTC(const std::time_t tp);
|
||||
explicit TimeStampUTC(const YMD& ymd);
|
||||
|
||||
TimeStampUTC& operator=(const std::time_t tp);
|
||||
|
||||
TimeStampUTC& hour(const int h);
|
||||
TimeStampUTC& minutes(const int m);
|
||||
TimeStampUTC& seconds(const int s);
|
||||
TimeStampUTC& microseconds(const int us);
|
||||
|
||||
int year() const { return this->ymd_.year; }
|
||||
int month() const { return this->ymd_.month; }
|
||||
int day() const { return this->ymd_.day; }
|
||||
int hour() const { return this->hour_; }
|
||||
int minutes() const { return this->minutes_; }
|
||||
int seconds() const { return this->seconds_; }
|
||||
int microseconds() const { return this->usec_; }
|
||||
|
||||
private:
|
||||
YMD ymd_{};
|
||||
int hour_{0};
|
||||
int minutes_{0};
|
||||
int seconds_{0};
|
||||
int usec_{0};
|
||||
};
|
||||
|
||||
std::time_t asTimeT(const TimeStampUTC& tp);
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_TIMESERVICE_HEADER_INCLUDED
|
@ -21,14 +21,17 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace Opm { namespace EclIO {
|
||||
|
||||
class ESmry
|
||||
{
|
||||
public:
|
||||
explicit ESmry(const std::string& filename, bool loadBaseRunData=false); // filename (smspec file) or file root name
|
||||
|
||||
// input is smspec (or fsmspec file)
|
||||
explicit ESmry(const std::string& filename, bool loadBaseRunData=false);
|
||||
|
||||
int numberOfVectors() const { return nVect; }
|
||||
|
||||
bool hasKey(const std::string& key) const;
|
||||
@ -39,9 +42,10 @@ public:
|
||||
|
||||
const std::vector<std::string>& keywordList() const { return keyword; }
|
||||
|
||||
int timestepIdxAtReportstepStart(const int reportStep) const;
|
||||
|
||||
private:
|
||||
int nVect, nI, nJ, nK;
|
||||
std::string path="";
|
||||
|
||||
void ijk_from_global_index(int glob, int &i, int &j, int &k) const;
|
||||
std::vector<std::vector<float>> param;
|
||||
@ -49,9 +53,14 @@ private:
|
||||
|
||||
std::vector<int> seqIndex;
|
||||
std::vector<float> seqTime;
|
||||
|
||||
std::vector<std::string> checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const;
|
||||
|
||||
void getRstString(const std::vector<std::string>& restartArray,
|
||||
boost::filesystem::path& pathRst,
|
||||
boost::filesystem::path& rootN) const;
|
||||
|
||||
void getRstString(const std::vector<std::string> &restartArray, std::string &path, std::string &rootN) const;
|
||||
void updatePathAndRootName(std::string &path, std::string &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;
|
||||
};
|
||||
|
@ -34,7 +34,9 @@ namespace Opm {
|
||||
|
||||
std::string key;
|
||||
UnitSystem::measure dim;
|
||||
bool required;
|
||||
bool required = false;
|
||||
|
||||
RestartKey() = default;
|
||||
|
||||
RestartKey( const std::string& _key, UnitSystem::measure _dim)
|
||||
: key(_key),
|
||||
|
@ -21,66 +21,58 @@
|
||||
#define OPM_OUTPUT_SUMMARY_HPP
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <ert/ecl/ecl_sum.h>
|
||||
#include <ert/util/ert_unique_ptr.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/output/eclipse/RegionCache.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class EclipseGrid;
|
||||
class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class EclipseGrid;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
} // namespace Opm
|
||||
|
||||
namespace out {
|
||||
namespace Opm { namespace data {
|
||||
class WellRates;
|
||||
}} // namespace Opm::data
|
||||
|
||||
namespace Opm { namespace out {
|
||||
|
||||
class Summary {
|
||||
public:
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const std::string& );
|
||||
Summary( const EclipseState&, const SummaryConfig&, const EclipseGrid&, const Schedule&, const char* basename );
|
||||
|
||||
void add_timestep(const SummaryState& st,
|
||||
int report_step);
|
||||
|
||||
|
||||
void eval(SummaryState& summary_state,
|
||||
int report_step,
|
||||
double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::Wells&,
|
||||
const std::map<std::string, double>& single_values,
|
||||
const std::map<std::string, std::vector<double>>& region_values = {},
|
||||
const std::map<std::pair<std::string, int>, double>& block_values = {}) const;
|
||||
|
||||
using GlobalProcessParameters = std::map<std::string, double>;
|
||||
using RegionParameters = std::map<std::string, std::vector<double>>;
|
||||
using BlockValues = std::map<std::pair<std::string, int>, double>;
|
||||
|
||||
Summary(const EclipseState& es,
|
||||
const SummaryConfig& sumcfg,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& sched,
|
||||
const std::string& basename = "");
|
||||
|
||||
~Summary();
|
||||
|
||||
void add_timestep(const SummaryState& st, const int report_step);
|
||||
|
||||
void eval(SummaryState& summary_state,
|
||||
const int report_step,
|
||||
const double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::WellRates& well_solution,
|
||||
const GlobalProcessParameters& single_values,
|
||||
const RegionParameters& region_values = {},
|
||||
const BlockValues& block_values = {}) const;
|
||||
|
||||
void write() const;
|
||||
|
||||
private:
|
||||
void internal_store(const SummaryState& summary_state, int report_step);
|
||||
|
||||
|
||||
class keyword_handlers;
|
||||
|
||||
const EclipseGrid& grid;
|
||||
out::RegionCache regionCache;
|
||||
ERT::ert_unique_ptr< ecl_sum_type, ecl_sum_free > ecl_sum;
|
||||
std::unique_ptr< keyword_handlers > handlers;
|
||||
class SummaryImplementation;
|
||||
std::unique_ptr<SummaryImplementation> pImpl_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}} // namespace Opm::out
|
||||
|
||||
#endif //OPM_OUTPUT_SUMMARY_HPP
|
||||
|
@ -56,14 +56,20 @@ namespace Opm {
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Aquancon::AquanconOutput> logic_application(const std::vector<Aquancon::AquanconOutput>& original_vector);
|
||||
static std::vector<Aquancon::AquanconOutput> logic_application(const std::vector<Aquancon::AquanconOutput>& original_vector);
|
||||
|
||||
void collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
|
||||
static 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);
|
||||
const std::vector<int>& m_aquiferID_per_record, int m_maxAquID);
|
||||
|
||||
void convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id, int i,
|
||||
std::vector<int> m_aquiferID_per_record);
|
||||
static void convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id, int i,
|
||||
const std::vector<int>& m_aquiferID_per_record);
|
||||
|
||||
// for a cell to be inside reservoir, its indices need to be within the reservoir grid dimension range,
|
||||
// and it needs to be active
|
||||
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> m_aquoutput;
|
||||
};
|
||||
|
@ -77,7 +77,8 @@ namespace Opm {
|
||||
const EclipseGrid& eclipseGrid);
|
||||
|
||||
void scanSection(const Section& section,
|
||||
const EclipseGrid& eclipseGrid);
|
||||
const EclipseGrid& eclipseGrid,
|
||||
bool edit_section);
|
||||
|
||||
void handleADDKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
|
||||
void handleBOXKeyword( const DeckKeyword& deckKeyword, BoxManager& boxManager);
|
||||
@ -96,7 +97,8 @@ namespace Opm {
|
||||
void handleOPERATERKeyword( const DeckKeyword& deckKeyword);
|
||||
|
||||
void loadGridPropertyFromDeckKeyword(const Box& inputBox,
|
||||
const DeckKeyword& deckKeyword);
|
||||
const DeckKeyword& deckKeyword,
|
||||
bool edity_section);
|
||||
|
||||
void adjustSOGCRwithSWL();
|
||||
|
||||
|
@ -175,8 +175,8 @@ public:
|
||||
DeckKeyword equals nx*ny*nz.
|
||||
*/
|
||||
|
||||
void loadFromDeckKeyword( const DeckKeyword& );
|
||||
void loadFromDeckKeyword( const Box&, const DeckKeyword& );
|
||||
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& );
|
||||
@ -309,6 +309,7 @@ public:
|
||||
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);
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef OPM_IO_CONFIG_HPP
|
||||
#define OPM_IO_CONFIG_HPP
|
||||
|
||||
#include <boost/date_time/gregorian/gregorian_types.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class Deck;
|
||||
|
@ -62,7 +62,7 @@ struct DeckRecordIterator
|
||||
|
||||
bool is_int(const std::string& s)
|
||||
{
|
||||
return !s.empty() && std::find_if(s.begin(),
|
||||
return !s.empty() && std::find_if(s.begin(),
|
||||
s.end(), [](char c) { return !std::isdigit(c); }) == s.end();
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ void push_string_as_deck_value(std::vector<DeckValue>& record, const std::string
|
||||
std::size_t star_pos = str.find('*');
|
||||
if (star_pos != std::string::npos) {
|
||||
int multiplier = 1;
|
||||
|
||||
|
||||
std::string mult_str = str.substr(0, star_pos);
|
||||
|
||||
if (mult_str.length() > 0) {
|
||||
@ -94,7 +94,7 @@ void push_string_as_deck_value(std::vector<DeckValue>& record, const std::string
|
||||
|
||||
for (int i = 0; i < multiplier; i++)
|
||||
record.push_back( value );
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
record.push_back( DeckValue(str) );
|
||||
@ -115,31 +115,31 @@ void python::common::export_DeckKeyword(py::module& module) {
|
||||
py::list record = record_obj.cast<py::list>();
|
||||
std::vector<DeckValue> value_record;
|
||||
|
||||
for (py::handle value_obj : record) {
|
||||
for (const py::handle& value_obj : record) {
|
||||
|
||||
try {
|
||||
int val_int = value_obj.cast<int>();
|
||||
value_record.push_back( DeckValue(val_int) );
|
||||
continue;
|
||||
}
|
||||
catch (std::exception e_int) {}
|
||||
catch (const std::exception& e_int) {}
|
||||
|
||||
try {
|
||||
double val_double = value_obj.cast<double>();
|
||||
value_record.push_back( DeckValue(val_double) );
|
||||
continue;
|
||||
}
|
||||
catch (std::exception e_double) {}
|
||||
catch (const std::exception& e_double) {}
|
||||
|
||||
try {
|
||||
std::string val_string = value_obj.cast<std::string>();
|
||||
std::string val_string = value_obj.cast<std::string>();
|
||||
push_string_as_deck_value(value_record, val_string);
|
||||
continue;
|
||||
}
|
||||
catch (std::exception e_string) {}
|
||||
catch (const std::exception& e_string) {}
|
||||
|
||||
throw py::type_error("DeckKeyword: tried to add unkown type to record.");
|
||||
|
||||
|
||||
}
|
||||
value_record_list.push_back( value_record );
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ ext_modules = [
|
||||
'cxx/well.cpp',
|
||||
'cxx/export.cpp'
|
||||
],
|
||||
libraries=['opmcommon', 'boost_filesystem', 'boost_regex', 'ecl', 'z'],
|
||||
libraries=['opmcommon', 'boost_filesystem', 'boost_regex'],
|
||||
language='c++',
|
||||
undef_macros=["NDEBUG"],
|
||||
include_dirs=["pybind11/include"]
|
||||
|
@ -5,16 +5,15 @@
|
||||
%define tag final
|
||||
|
||||
Name: opm-common
|
||||
Version: 2018.10
|
||||
Version: 2019.10
|
||||
Release: 0
|
||||
Summary: Open Porous Media - common helpers and buildsystem
|
||||
License: GPL-3.0
|
||||
Group: Development/Libraries/C and C++
|
||||
Url: http://www.opm-project.org/
|
||||
Source0: https://github.com/OPM/%{name}/archive/release/%{version}/%{tag}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
BuildRequires: git doxygen bc devtoolset-6-toolchain ecl-devel openmpi-devel mpich-devel zlib-devel
|
||||
%{?el6:BuildRequires: cmake3 boost148-devel}
|
||||
%{!?el6:BuildRequires: cmake boost-devel}
|
||||
BuildRequires: git doxygen bc devtoolset-6-toolchain openmpi-devel mpich-devel
|
||||
BuildRequires: cmake3 rh-mariadb102-boost-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -107,7 +106,7 @@ This package contains the documentation files for opm-common
|
||||
scl enable devtoolset-6 bash
|
||||
mkdir serial
|
||||
cd serial
|
||||
%{?el6:cmake3} %{?!el6:cmake} -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran %{?el6:-DBOOST_LIBRARYDIR=%{_libdir}/boost148 -DBOOST_INCLUDEDIR=%{_includedir}/boost148} ..
|
||||
cmake3 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran -DBOOST_LIBRARYDIR=/opt/rh/rh-mariadb102/root/usr/lib64 -DBOOST_INCLUDEDIR=/opt/rh/rh-mariadb102/root/usr/include ..
|
||||
make %{?_smp_mflags}
|
||||
make test
|
||||
cd ..
|
||||
@ -116,7 +115,7 @@ mkdir openmpi
|
||||
cd openmpi
|
||||
%{?el6:module load openmpi-x86_64}
|
||||
%{?!el6:module load mpi/openmpi-x86_64}
|
||||
%{?el6:cmake3} %{?!el6:cmake} -DUSE_MPI=1 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix}/lib64/openmpi -DCMAKE_INSTALL_LIBDIR=lib -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran %{?el6:-DBOOST_LIBRARYDIR=%{_libdir}/boost148 -DBOOST_INCLUDEDIR=%{_includedir}/boost148} ..
|
||||
cmake3 -DUSE_MPI=1 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix}/lib64/openmpi -DCMAKE_INSTALL_LIBDIR=lib -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran -DBOOST_LIBRARYDIR=/opt/rh/rh-mariadb102/root/usr/lib64 -DBOOST_INCLUDEDIR=/opt/rh/rh-mariadb102/root/usr/include ..
|
||||
make %{?_smp_mflags}
|
||||
make test
|
||||
cd ..
|
||||
@ -127,7 +126,7 @@ cd mpich
|
||||
%{?el6:module load mpich-x86_64}
|
||||
%{?!el6:module rm mpi/openmpi-x86_64}
|
||||
%{?!el6:module load mpi/mpich-x86_64}
|
||||
%{?el6:cmake3} %{?!el6:cmake} -DUSE_MPI=1 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix}/lib64/mpich -DCMAKE_INSTALL_LIBDIR=lib -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran %{?el6:-DBOOST_LIBRARYDIR=%{_libdir}/boost148 -DBOOST_INCLUDEDIR=%{_includedir}/boost148} ..
|
||||
cmake3 -DUSE_MPI=1 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DCMAKE_INSTALL_PREFIX=%{_prefix}/lib64/mpich -DCMAKE_INSTALL_LIBDIR=lib -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-6/root/usr/bin/gfortran -DBOOST_LIBRARYDIR=/opt/rh/rh-mariadb102/root/usr/lib64 -DBOOST_INCLUDEDIR=/opt/rh/rh-mariadb102/root/usr/include ..
|
||||
make %{?_smp_mflags}
|
||||
make test
|
||||
|
||||
|
119
src/opm/common/utility/TimeService.cpp
Normal file
119
src/opm/common/utility/TimeService.cpp
Normal file
@ -0,0 +1,119 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media Project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <ctime>
|
||||
#include <utility>
|
||||
|
||||
namespace {
|
||||
std::time_t advance(const std::time_t tp, const double sec)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
using TP = time_point<system_clock>;
|
||||
using DoubSec = duration<double, seconds::period>;
|
||||
|
||||
const auto t = system_clock::from_time_t(tp) +
|
||||
duration_cast<TP::duration>(DoubSec(sec));
|
||||
|
||||
return system_clock::to_time_t(t);
|
||||
}
|
||||
|
||||
std::time_t makeUTCTime(std::tm timePoint)
|
||||
{
|
||||
const auto ltime = std::mktime(&timePoint);
|
||||
auto tmval = *std::gmtime(<ime); // Mutable.
|
||||
|
||||
// offset = ltime - tmval
|
||||
// == #seconds by which 'ltime' is AHEAD of tmval.
|
||||
const auto offset =
|
||||
std::difftime(ltime, std::mktime(&tmval));
|
||||
|
||||
// Advance 'ltime' by 'offset' so that std::gmtime(return value) will
|
||||
// have the same broken-down elements as 'tp'.
|
||||
return advance(ltime, offset);
|
||||
}
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC::TimeStampUTC(const std::time_t tp)
|
||||
{
|
||||
auto t = tp;
|
||||
const auto tm = *std::gmtime(&t);
|
||||
|
||||
this->ymd_ = YMD { tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday };
|
||||
|
||||
this->hour(tm.tm_hour).minutes(tm.tm_min).seconds(tm.tm_sec);
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC& Opm::TimeStampUTC::operator=(const std::time_t tp)
|
||||
{
|
||||
auto t = tp;
|
||||
const auto tm = *std::gmtime(&t);
|
||||
|
||||
this->ymd_ = YMD { tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday };
|
||||
|
||||
this->hour(tm.tm_hour).minutes(tm.tm_min).seconds(tm.tm_sec);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC::TimeStampUTC(const YMD& ymd)
|
||||
: ymd_{ std::move(ymd) }
|
||||
{}
|
||||
|
||||
Opm::TimeStampUTC& Opm::TimeStampUTC::hour(const int h)
|
||||
{
|
||||
this->hour_ = h;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC& Opm::TimeStampUTC::minutes(const int m)
|
||||
{
|
||||
this->minutes_ = m;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC& Opm::TimeStampUTC::seconds(const int s)
|
||||
{
|
||||
this->seconds_ = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Opm::TimeStampUTC& Opm::TimeStampUTC::microseconds(const int us)
|
||||
{
|
||||
this->usec_ = us;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::time_t Opm::asTimeT(const TimeStampUTC& tp)
|
||||
{
|
||||
auto timePoint = std::tm{};
|
||||
|
||||
timePoint.tm_year = tp.year() - 1900;
|
||||
timePoint.tm_mon = tp.month() - 1;
|
||||
timePoint.tm_mday = tp.day();
|
||||
|
||||
timePoint.tm_hour = tp.hour();
|
||||
timePoint.tm_min = tp.minutes();
|
||||
timePoint.tm_sec = tp.seconds();
|
||||
|
||||
return makeUTCTime(timePoint);
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <opm/common/utility/numeric/calculateCellVol.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
/*
|
||||
Cell volume calculation based on following publication:
|
||||
@ -87,26 +88,18 @@ double perm123sign(int i1, int i2, int i3){
|
||||
|
||||
if ((i1 ==1 ) && (i2==2) && (i3 == 3)){
|
||||
temp = 1.0;
|
||||
}
|
||||
|
||||
if ((i1 == 1) && (i2==3) && (i3 == 2)){
|
||||
} else if ((i1 == 1) && (i2==3) && (i3 == 2)){
|
||||
temp = -1.0;
|
||||
}
|
||||
|
||||
if ((i1 == 2) && (i2 == 1) && (i3 == 3)){
|
||||
} else if ((i1 == 2) && (i2 == 1) && (i3 == 3)){
|
||||
temp = -1.0;
|
||||
}
|
||||
|
||||
if ((i1 == 2) && (i2 == 3) && (i3 == 1)){
|
||||
} else if ((i1 == 2) && (i2 == 3) && (i3 == 1)){
|
||||
temp = 1.0;
|
||||
}
|
||||
|
||||
if ((i1 == 3) && (i2 == 1) && (i3 == 2)){
|
||||
} else if ((i1 == 3) && (i2 == 1) && (i3 == 2)){
|
||||
temp = 1.0;
|
||||
}
|
||||
|
||||
if ((i1 == 3) && (i2 == 2) && (i3 == 1)){
|
||||
} else if ((i1 == 3) && (i2 == 2) && (i3 == 1)){
|
||||
temp = -1.0;
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "Wrong indices in perm123sign");
|
||||
}
|
||||
|
||||
return temp;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
@ -28,9 +29,12 @@
|
||||
#include <limits>
|
||||
#include <limits.h>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <opm/io/eclipse/EclFile.hpp>
|
||||
|
||||
/*
|
||||
|
||||
KEYWORDS WGNAMES NUMS | PARAM index Corresponding ERT key
|
||||
@ -55,46 +59,40 @@ namespace Opm { namespace EclIO {
|
||||
|
||||
ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
{
|
||||
std::string rootN;
|
||||
bool formatted=false;
|
||||
|
||||
boost::filesystem::path inputFileName(filename);
|
||||
boost::filesystem::path rootName = inputFileName.parent_path() / inputFileName.stem();
|
||||
|
||||
char buff[PATH_MAX];
|
||||
// if root name (without any extension) given as first argument in constructor, binary will then be assumed
|
||||
if (inputFileName.extension()==""){
|
||||
inputFileName+=".SMSPEC";
|
||||
}
|
||||
|
||||
if (getcwd( buff, PATH_MAX )==NULL){
|
||||
throw std::invalid_argument("failed when trying to get current working directory");
|
||||
std::vector<bool> formattedVect;
|
||||
|
||||
if ((inputFileName.extension()!=".SMSPEC") && (inputFileName.extension()!=".FSMSPEC")){
|
||||
throw std::invalid_argument("Inptut file should have extension .SMSPEC or .FSMSPEC");
|
||||
}
|
||||
|
||||
std::string currentWorkingDir(buff);
|
||||
bool formatted = inputFileName.extension()==".SMSPEC" ? false : true;
|
||||
formattedVect.push_back(formatted);
|
||||
|
||||
boost::filesystem::path path = boost::filesystem::current_path();;
|
||||
|
||||
std::string smspec_filen;
|
||||
updatePathAndRootName(path, rootName);
|
||||
|
||||
boost::filesystem::path smspec_file = path / rootName;
|
||||
smspec_file += inputFileName.extension();
|
||||
|
||||
if (filename.substr(filename.length() - 7, 7) == ".SMSPEC") {
|
||||
rootN = filename.substr(0,filename.length() -7);
|
||||
} else if (filename.substr(filename.length() -8, 8) == ".FSMSPEC") {
|
||||
rootN=filename.substr(0,filename.length() -8);
|
||||
formatted = true;
|
||||
} else {
|
||||
rootN = filename;
|
||||
}
|
||||
|
||||
path = currentWorkingDir;
|
||||
updatePathAndRootName(path, rootN);
|
||||
|
||||
if (formatted) {
|
||||
smspec_filen = path + "/" + rootN + ".FSMSPEC";
|
||||
} else {
|
||||
smspec_filen = path + "/" + rootN + ".SMSPEC";
|
||||
}
|
||||
|
||||
std::string rstRootN = "";
|
||||
std::string pathRstFile = path;
|
||||
boost::filesystem::path rstRootN;
|
||||
boost::filesystem::path pathRstFile = path;
|
||||
|
||||
std::set<std::string> keywList;
|
||||
std::vector<std::pair<std::string,int>> smryArray;
|
||||
|
||||
// Read data from the summary into local data members.
|
||||
{
|
||||
|
||||
EclFile smspec1(smspec_filen);
|
||||
EclFile smspec1(smspec_file.string());
|
||||
|
||||
smspec1.loadData(); // loading all data
|
||||
|
||||
@ -115,20 +113,31 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
keywList.insert(str1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getRstString(restartArray, pathRstFile, rstRootN);
|
||||
|
||||
smryArray.push_back({smspec_filen, dimens[5]});
|
||||
|
||||
smryArray.push_back({smspec_file.string(), dimens[5]});
|
||||
}
|
||||
|
||||
// checking if this is a restart run. Supporting nested restarts (restart, from restart, ...)
|
||||
// std::set keywList is storing keywords from all runs involved
|
||||
|
||||
while ((rstRootN != "") && (loadBaseRunData)) {
|
||||
|
||||
std::string rstFile=pathRstFile+"/"+rstRootN+".SMSPEC";
|
||||
|
||||
EclFile smspec_rst(rstFile);
|
||||
while ((rstRootN.string() != "") && (loadBaseRunData)) {
|
||||
|
||||
boost::filesystem::path rstFile = pathRstFile / rstRootN;
|
||||
rstFile += ".SMSPEC";
|
||||
|
||||
bool baseRunFmt = false;
|
||||
|
||||
// if unformatted file not exists, check for formatted file
|
||||
if (!boost::filesystem::exists(rstFile)){
|
||||
rstFile = pathRstFile / rstRootN;
|
||||
rstFile += ".FSMSPEC";
|
||||
|
||||
baseRunFmt = true;
|
||||
}
|
||||
|
||||
EclFile smspec_rst(rstFile.string());
|
||||
smspec_rst.loadData();
|
||||
|
||||
std::vector<int> dimens = smspec_rst.get<int>("DIMENS");
|
||||
@ -144,7 +153,9 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
}
|
||||
}
|
||||
|
||||
smryArray.push_back({rstFile,dimens[5]});
|
||||
smryArray.push_back({rstFile.string(),dimens[5]});
|
||||
|
||||
formattedVect.push_back(baseRunFmt);
|
||||
|
||||
getRstString(restartArray, pathRstFile, rstRootN);
|
||||
}
|
||||
@ -161,7 +172,8 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
}
|
||||
|
||||
int n = nFiles - 1;
|
||||
|
||||
|
||||
|
||||
while (n >= 0){
|
||||
|
||||
auto smry = smryArray[n];
|
||||
@ -179,7 +191,7 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
std::vector<std::string> wgnames = smspec.get<std::string>("WGNAMES");
|
||||
std::vector<int> nums = smspec.get<int>("NUMS");
|
||||
|
||||
std::vector<int> tmpVect(keywords.size(), -1);
|
||||
std::vector<int> tmpVect(keywords.size(), -1);
|
||||
arrayInd[n]=tmpVect;
|
||||
|
||||
std::set<std::string>::iterator it;
|
||||
@ -218,41 +230,93 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
toReportStepNumber = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
std::string smspecFile = std::get<0>(smryArray[n]);
|
||||
std::string unsmryFile = smspecFile.substr(0, smspecFile.size() - 6) + "UNSMRY";
|
||||
boost::filesystem::path smspecFile(std::get<0>(smryArray[n]));
|
||||
rootName = smspecFile.parent_path() / smspecFile.stem();
|
||||
|
||||
EclFile unsmry(unsmryFile);
|
||||
unsmry.loadData();
|
||||
|
||||
// check if multiple or unified result files should be used
|
||||
// to import data, no information in smspec file regarding this
|
||||
// if both unified and non-unified files exists, will use most recent based on
|
||||
// time stamp
|
||||
|
||||
std::vector<EclFile::EclEntry> list1 = unsmry.getList();
|
||||
boost::filesystem::path unsmryFile = rootName;
|
||||
|
||||
formattedVect[n] ? unsmryFile += ".FUNSMRY" : unsmryFile += ".UNSMRY";
|
||||
|
||||
// 2 or 3 arrays pr time step.
|
||||
// If timestep is a report step: MINISTEP, PARAMS and SEQHDR
|
||||
// else : MINISTEP and PARAMS
|
||||
bool use_unified = boost::filesystem::exists(unsmryFile.string());
|
||||
|
||||
// if summary file starts with a SEQHDR, this will be ignored
|
||||
std::vector<std::string> multFileList = checkForMultipleResultFiles(rootName, formattedVect[n]);
|
||||
|
||||
int i = 0;
|
||||
std::vector<std::string> resultsFileList;
|
||||
|
||||
if ((!use_unified) && (multFileList.size()==0)){
|
||||
throw std::runtime_error("neigther unified or non-unified result files found");
|
||||
} else if ((use_unified) && (multFileList.size()>0)){
|
||||
auto time_multiple = boost::filesystem::last_write_time(multFileList.back());
|
||||
auto time_unified = boost::filesystem::last_write_time(unsmryFile);
|
||||
|
||||
if (time_multiple > time_unified){
|
||||
resultsFileList=multFileList;
|
||||
} else {
|
||||
resultsFileList.push_back(unsmryFile.string());
|
||||
}
|
||||
|
||||
} else if (use_unified){
|
||||
resultsFileList.push_back(unsmryFile.string());
|
||||
} else {
|
||||
resultsFileList=multFileList;
|
||||
}
|
||||
|
||||
// make array list with reference to source files (unifed or non unified)
|
||||
|
||||
std::vector<std::tuple<std::string, std::string, int>> arraySourceList;
|
||||
|
||||
if (std::get<0>(list1[0]) == "SEQHDR") {
|
||||
i = 1;
|
||||
for (std::string fileName : resultsFileList){
|
||||
EclFile unsmry(fileName);
|
||||
|
||||
std::vector<EclFile::EclEntry> arrayList = unsmry.getList();
|
||||
|
||||
for (size_t nn = 0; nn < arrayList.size(); nn++){
|
||||
std::tuple<std::string, std::string, int> t1 = std::make_tuple(std::get<0>(arrayList[nn]), fileName, static_cast<int>(nn));
|
||||
arraySourceList.push_back(t1);
|
||||
}
|
||||
}
|
||||
|
||||
while (i < static_cast<int>(list1.size())){
|
||||
// loop through arrays and extract symmary data from result files, arrays PARAMS
|
||||
//
|
||||
// 2 or 3 arrays pr time step.
|
||||
// If timestep is a report step: MINISTEP, PARAMS and SEQHDR
|
||||
// else : MINISTEP and PARAMS
|
||||
|
||||
if (std::get<0>(list1[i]) != "MINISTEP"){
|
||||
std::string message="Reading summary file, expecting keyword MINISTEP, found '" + std::get<0>(list1[i]) + "'";
|
||||
size_t i = std::get<0>(arraySourceList[0]) == "SEQHDR" ? 1 : 0 ;
|
||||
|
||||
std::string prevFile;
|
||||
std::unique_ptr<EclFile> pEclFile;
|
||||
|
||||
while (i < arraySourceList.size()){
|
||||
|
||||
if (std::get<0>(arraySourceList[i]) != "MINISTEP"){
|
||||
std::string message="Reading summary file, expecting keyword MINISTEP, found '" + std::get<0>(arraySourceList[i]) + "'";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
|
||||
if (std::get<0>(arraySourceList[i+1]) != "PARAMS") {
|
||||
std::string message="Reading summary file, expecting keyword PARAMS, found '" + std::get<0>(arraySourceList[i]) + "'";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if (std::get<0>(list1[i]) != "PARAMS") {
|
||||
std::string message="Reading summary file, expecting keyword PARAMS, found '" + std::get<0>(list1[i]) + "'";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
|
||||
std::vector<float> tmpData = unsmry.get<float>(i);
|
||||
if (std::get<1>(arraySourceList[i]) != prevFile){
|
||||
pEclFile = std::make_unique<EclFile>(std::get<1>(arraySourceList[i]));
|
||||
pEclFile->loadData();
|
||||
|
||||
prevFile = std::get<1>(arraySourceList[i]);
|
||||
}
|
||||
|
||||
int m = std::get<2>(arraySourceList[i]);
|
||||
|
||||
std::vector<float> tmpData = pEclFile->get<float>(m);
|
||||
|
||||
time = tmpData[0];
|
||||
|
||||
@ -263,8 +327,8 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
|
||||
i++;
|
||||
|
||||
if (i < static_cast<int>(list1.size())){
|
||||
if (std::get<0>(list1[i]) == "SEQHDR") {
|
||||
if (i < arraySourceList.size()){
|
||||
if (std::get<0>(arraySourceList[i]) == "SEQHDR") {
|
||||
i++;
|
||||
reportStepNumber++;
|
||||
seqTime.push_back(time);
|
||||
@ -289,9 +353,9 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
param[ind][step] = tmpData[j];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (reportStepNumber >= toReportStepNumber) {
|
||||
i = static_cast<int>(list1.size());
|
||||
i = arraySourceList.size();
|
||||
}
|
||||
|
||||
step++;
|
||||
@ -301,41 +365,58 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
|
||||
n--;
|
||||
}
|
||||
|
||||
|
||||
nVect = keywList.size();
|
||||
|
||||
|
||||
for (auto keyw : keywList){
|
||||
keyword.push_back(keyw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ESmry::getRstString(const std::vector<std::string>& restartArray, std::string& pathRst, std::string& rootN) const {
|
||||
std::vector<std::string> ESmry::checkForMultipleResultFiles(const boost::filesystem::path& rootN, bool formatted) const {
|
||||
|
||||
std::vector<std::string> fileList;
|
||||
std::string pathRootN = rootN.parent_path().string();
|
||||
|
||||
rootN = "";
|
||||
std::string fileFilter = formatted ? rootN.stem().string()+".A" : rootN.stem().string()+".S";
|
||||
|
||||
for (auto str : restartArray) {
|
||||
rootN = rootN + str;
|
||||
for (boost::filesystem::directory_iterator itr(pathRootN); itr!=boost::filesystem::directory_iterator(); ++itr)
|
||||
{
|
||||
std::string file = itr->path().filename().string();
|
||||
|
||||
if ((file.find(fileFilter) != std::string::npos) && (file.find("SMSPEC") == std::string::npos)) {
|
||||
fileList.push_back(pathRootN + "/" + file);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(fileList.begin(), fileList.end());
|
||||
|
||||
return fileList;
|
||||
}
|
||||
|
||||
void ESmry::getRstString(const std::vector<std::string>& restartArray, boost::filesystem::path& pathRst, boost::filesystem::path& rootN) const {
|
||||
|
||||
std::string rootNameStr="";
|
||||
|
||||
for (auto str : restartArray) {
|
||||
rootNameStr = rootNameStr + str;
|
||||
}
|
||||
|
||||
rootN = boost::filesystem::path(rootNameStr);
|
||||
|
||||
updatePathAndRootName(pathRst, rootN);
|
||||
}
|
||||
|
||||
void ESmry::updatePathAndRootName(std::string& dir, std::string& rootN) const {
|
||||
void ESmry::updatePathAndRootName(boost::filesystem::path& dir, boost::filesystem::path& rootN) const {
|
||||
|
||||
if (rootN.substr(0,2) == "./") {
|
||||
rootN = rootN.substr(2, rootN.size() - 2);
|
||||
}
|
||||
if (rootN.parent_path().is_absolute()){
|
||||
dir = rootN.parent_path();
|
||||
} else {
|
||||
dir = dir / rootN.parent_path();
|
||||
}
|
||||
|
||||
if (rootN.substr(0,1) == "/") {
|
||||
int p = rootN.find_last_of("/");
|
||||
dir = rootN.substr(0, p);
|
||||
rootN = rootN.substr(p + 1, rootN.size() - p - 1);
|
||||
} else if (rootN.find_first_of("/") != std::string::npos) {
|
||||
int p = rootN.find_last_of("/");
|
||||
dir = dir + "/" + rootN.substr(0, p);
|
||||
rootN = rootN.substr(p + 1, rootN.size() - p - 1);
|
||||
};
|
||||
rootN = rootN.stem();
|
||||
}
|
||||
|
||||
bool ESmry::hasKey(const std::string &key) const
|
||||
@ -442,4 +523,18 @@ std::vector<float> ESmry::get_at_rstep(const std::string& name) const
|
||||
return rstep_vector;
|
||||
}
|
||||
|
||||
int ESmry::timestepIdxAtReportstepStart(const int reportStep) const
|
||||
{
|
||||
const auto nReport = static_cast<int>(seqIndex.size());
|
||||
|
||||
if ((reportStep < 1) || (reportStep > nReport)) {
|
||||
throw std::invalid_argument {
|
||||
"Report step " + std::to_string(reportStep)
|
||||
+ " outside valid range 1 .. " + std::to_string(nReport)
|
||||
};
|
||||
}
|
||||
|
||||
return seqIndex[reportStep - 1];
|
||||
}
|
||||
|
||||
}} // namespace Opm::ecl
|
||||
|
@ -593,6 +593,7 @@ namespace {
|
||||
auto ret = std::vector<PaddedOutputString<substrLength>>{};
|
||||
|
||||
if (restart.root.empty()) {
|
||||
ret.resize(maxSubstrings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -605,6 +606,7 @@ namespace {
|
||||
|
||||
Opm::OpmLog::warning(msg);
|
||||
|
||||
ret.resize(maxSubstrings);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -738,7 +740,7 @@ SummarySpecification::write(const Parameters& params)
|
||||
// Pretend to be ECLIPSE 100
|
||||
smspec.write("INTEHEAD", std::vector<int>{ this->unit_, 100 });
|
||||
|
||||
if (! this->restart_.empty())
|
||||
// if (! this->restart_.empty())
|
||||
smspec.write("RESTART", this->restart_);
|
||||
|
||||
smspec.write("DIMENS",
|
||||
|
@ -126,7 +126,7 @@ namespace {
|
||||
segIndCB.push_back(segIndex);
|
||||
int newSInd = segIndex;
|
||||
const auto& origBranchNo = segSet[segIndex].branchNumber();
|
||||
bool endOrigBranch = true;
|
||||
bool endOrigBranch;
|
||||
// loop down branch to find all segments in branch and number from "toe" to "heel"
|
||||
while (newSInd < segSet.size()) {
|
||||
endOrigBranch = true;
|
||||
|
@ -55,12 +55,6 @@ namespace {
|
||||
return inteHead[20];
|
||||
}
|
||||
|
||||
// maximum number of wells
|
||||
std::size_t nwmaxz(const std::vector<int>& inteHead)
|
||||
{
|
||||
return inteHead[163];
|
||||
}
|
||||
|
||||
|
||||
namespace iUdq {
|
||||
|
||||
|
@ -82,7 +82,6 @@ createDoubHead(const EclipseState& es,
|
||||
const double nextTimeStep)
|
||||
{
|
||||
const auto& usys = es.getDeckUnitSystem();
|
||||
const auto& rspec = es.runspec();
|
||||
const auto tconv = getTimeConv(usys);
|
||||
|
||||
auto dh = DoubHEAD{}
|
||||
|
@ -49,15 +49,14 @@
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
#include <memory> // unique_ptr
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <utility> // move
|
||||
|
||||
#include <ert/ecl/EclFilename.hpp>
|
||||
#include <ert/ecl/ecl_util.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
|
||||
// namespace start here since we don't want the ERT headers in it
|
||||
namespace Opm {
|
||||
namespace {
|
||||
|
||||
inline std::string uppercase( std::string x ) {
|
||||
@ -67,8 +66,34 @@ inline std::string uppercase( std::string x ) {
|
||||
return x;
|
||||
}
|
||||
|
||||
void ensure_directory_exists( const boost::filesystem::path& odir )
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
if (fs::exists( odir ) && !fs::is_directory( odir ))
|
||||
throw std::runtime_error {
|
||||
"Filesystem element '" + odir.generic_string()
|
||||
+ "' already exists but is not a directory"
|
||||
};
|
||||
|
||||
boost::system::error_code ec{};
|
||||
if (! fs::exists( odir ))
|
||||
fs::create_directories( odir, ec );
|
||||
|
||||
if (ec != boost::system::errc::success) {
|
||||
std::ostringstream msg;
|
||||
|
||||
msg << "Failed to create output directory '"
|
||||
<< odir.generic_string()
|
||||
<< "\nSystem reports: " << ec << '\n';
|
||||
|
||||
throw std::runtime_error { msg.str() };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
class EclipseIO::Impl {
|
||||
public:
|
||||
Impl( const EclipseState&, EclipseGrid, const Schedule&, const SummaryConfig& );
|
||||
@ -113,14 +138,16 @@ void EclipseIO::Impl::writeINITFile(const data::Solution& simP
|
||||
|
||||
|
||||
void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) {
|
||||
const auto& ioConfig = this->es.getIOConfig();
|
||||
const auto formatted = this->es.cfg().io().getFMTOUT();
|
||||
|
||||
std::string egridFile( ERT::EclFilename( this->outputDir,
|
||||
this->baseName,
|
||||
ECL_EGRID_FILE,
|
||||
ioConfig.getFMTOUT() ));
|
||||
const auto ext = '.'
|
||||
+ (formatted ? std::string{"F"} : std::string{})
|
||||
+ "EGRID";
|
||||
|
||||
this->grid.save( egridFile, ioConfig.getFMTOUT(), nnc, this->es.getDeckUnitSystem());
|
||||
const auto egridFile = (boost::filesystem::path{ this->outputDir }
|
||||
/ (this->baseName + ext)).generic_string();
|
||||
|
||||
this->grid.save( egridFile, formatted, nnc, this->es.getDeckUnitSystem());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -236,19 +263,8 @@ EclipseIO::EclipseIO( const EclipseState& es,
|
||||
{
|
||||
if( !this->impl->output_enabled )
|
||||
return;
|
||||
{
|
||||
const auto& outputDir = this->impl->outputDir;
|
||||
|
||||
// make sure that the output directory exists, if not try to create it
|
||||
if ( !util_entry_exists( outputDir.c_str() ) ) {
|
||||
util_make_path( outputDir.c_str() );
|
||||
}
|
||||
|
||||
if( !util_is_directory( outputDir.c_str() ) ) {
|
||||
throw std::runtime_error( "The path specified as output directory '"
|
||||
+ outputDir + "' is not a directory");
|
||||
}
|
||||
}
|
||||
ensure_directory_exists( this->impl->outputDir );
|
||||
}
|
||||
|
||||
const out::Summary& EclipseIO::summary() {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -511,7 +511,6 @@ template std::string DeckItem::get< std::string >( size_t ) const;
|
||||
template UDAValue DeckItem::get< UDAValue >( size_t ) const;
|
||||
|
||||
template const std::vector< int >& DeckItem::getData< int >() const;
|
||||
template const std::vector< double >& DeckItem::getData< double >() const;
|
||||
template const std::vector< UDAValue >& DeckItem::getData< UDAValue >() const;
|
||||
template const std::vector< std::string >& DeckItem::getData< std::string >() const;
|
||||
}
|
||||
|
@ -26,9 +26,6 @@
|
||||
namespace Opm {
|
||||
namespace{
|
||||
struct AquanconRecord{
|
||||
// Grid cell box definition to connect aquifer
|
||||
int i1, i2, j1, j2, k1, k2;
|
||||
|
||||
std::vector<size_t> global_index_per_record;
|
||||
|
||||
// Variables constants
|
||||
@ -55,54 +52,63 @@ namespace Opm {
|
||||
aqurecords.resize(aquanconKeyword.size());
|
||||
aquiferID_per_record.resize(aquanconKeyword.size());
|
||||
|
||||
// We now do a loop over each record entry in aquancon
|
||||
for (size_t aquanconRecordIdx = 0; aquanconRecordIdx < aquanconKeyword.size(); ++aquanconRecordIdx)
|
||||
{
|
||||
const auto& aquanconRecord = aquanconKeyword.getRecord(aquanconRecordIdx);
|
||||
aquiferID_per_record.at(aquanconRecordIdx) = aquanconRecord.getItem("AQUIFER_ID").template get<int>(0);
|
||||
aquiferID_per_record[aquanconRecordIdx] = aquanconRecord.getItem("AQUIFER_ID").template get<int>(0);
|
||||
|
||||
aqurecords.at(aquanconRecordIdx).i1 = aquanconRecord.getItem("I1").template get<int>(0);
|
||||
aqurecords.at(aquanconRecordIdx).i2 = aquanconRecord.getItem("I2").template get<int>(0);
|
||||
aqurecords.at(aquanconRecordIdx).j1 = aquanconRecord.getItem("J1").template get<int>(0);
|
||||
aqurecords.at(aquanconRecordIdx).j2 = aquanconRecord.getItem("J2").template get<int>(0);
|
||||
aqurecords.at(aquanconRecordIdx).k1 = aquanconRecord.getItem("K1").template get<int>(0);
|
||||
aqurecords.at(aquanconRecordIdx).k2 = aquanconRecord.getItem("K2").template get<int>(0);
|
||||
// offset the indices
|
||||
const int i1 = aquanconRecord.getItem("I1").template get<int>(0) - 1;
|
||||
const int i2 = aquanconRecord.getItem("I2").template get<int>(0) - 1;
|
||||
const int j1 = aquanconRecord.getItem("J1").template get<int>(0) - 1;
|
||||
const int j2 = aquanconRecord.getItem("J2").template get<int>(0) - 1;
|
||||
const int k1 = aquanconRecord.getItem("K1").template get<int>(0) - 1;
|
||||
const int k2 = aquanconRecord.getItem("K2").template get<int>(0) - 1;
|
||||
|
||||
aquiferID_per_record.at(aquanconRecordIdx) = aquanconRecord.getItem("AQUIFER_ID").template get<int>(0);
|
||||
m_maxAquID = (m_maxAquID < aquiferID_per_record.at(aquanconRecordIdx) )?
|
||||
aquiferID_per_record.at(aquanconRecordIdx) : m_maxAquID;
|
||||
m_maxAquID = (m_maxAquID < aquiferID_per_record[aquanconRecordIdx] )?
|
||||
aquiferID_per_record[aquanconRecordIdx] : m_maxAquID;
|
||||
|
||||
double influx_mult = aquanconRecord.getItem("INFLUX_MULT").getSIDouble(0);
|
||||
const FaceDir::DirEnum faceDir = FaceDir::FromString(aquanconRecord.getItem("FACE").getTrimmedString(0));
|
||||
|
||||
FaceDir::DirEnum faceDir = FaceDir::FromString(aquanconRecord.getItem("FACE").getTrimmedString(0));
|
||||
// whether allow aquifer connections to locate inside reservoir
|
||||
const std::string& str_inside_reservoir = aquanconRecord.getItem("CONNECT_ADJOINING_ACTIVE_CELL").getTrimmedString(0);
|
||||
// not sure whether we should give a warning when input other than "YES" or "NO"
|
||||
const bool allow_aquifer_inside_reservoir = str_inside_reservoir == "YES" ? true : false;
|
||||
|
||||
auto& aqurecord = aqurecords[aquanconRecordIdx];
|
||||
// Loop over the cartesian indices to convert to the global grid index
|
||||
for (int k=aqurecords.at(aquanconRecordIdx).k1; k <= aqurecords.at(aquanconRecordIdx).k2; k++) {
|
||||
for (int j=aqurecords.at(aquanconRecordIdx).j1; j <= aqurecords.at(aquanconRecordIdx).j2; j++)
|
||||
for (int i=aqurecords.at(aquanconRecordIdx).i1; i <= aqurecords.at(aquanconRecordIdx).i2; i++)
|
||||
aqurecords.at(aquanconRecordIdx).global_index_per_record.push_back
|
||||
(
|
||||
grid.getGlobalIndex(i-1, j-1, k-1)
|
||||
);
|
||||
for (int k = k1; k <= k2; k++) {
|
||||
for (int j = j1; j <= j2; j++) {
|
||||
for (int i = i1; i <= i2; i++) {
|
||||
if ( grid.cellActive(i, j, k) ) { // the cell itself needs to be active
|
||||
if ( allow_aquifer_inside_reservoir
|
||||
|| !neighborCellInsideReservoirAndActive(grid, i, j, k, faceDir) ) {
|
||||
aqurecord.global_index_per_record.push_back(grid.getGlobalIndex(i, j, k));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t global_index_per_record_size = aqurecords.at(aquanconRecordIdx).global_index_per_record.size();
|
||||
const size_t global_index_per_record_size = aqurecord.global_index_per_record.size();
|
||||
|
||||
aqurecords.at(aquanconRecordIdx).influx_coeff_per_record.resize(global_index_per_record_size, nullptr);
|
||||
aqurecord.influx_coeff_per_record.resize(global_index_per_record_size, nullptr);
|
||||
|
||||
if (aquanconRecord.getItem("INFLUX_COEFF").hasValue(0))
|
||||
{
|
||||
const double influx_coeff = aquanconRecord.getItem("INFLUX_COEFF").getSIDouble(0);
|
||||
|
||||
for (auto& influx: aqurecords.at(aquanconRecordIdx).influx_coeff_per_record)
|
||||
for (auto& influx: aqurecord.influx_coeff_per_record)
|
||||
{
|
||||
influx.reset(new double(influx_coeff));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
aqurecords.at(aquanconRecordIdx).influx_mult_per_record.resize(global_index_per_record_size,influx_mult);
|
||||
aqurecords.at(aquanconRecordIdx).face_per_record.resize(global_index_per_record_size,faceDir);
|
||||
aqurecords.at(aquanconRecordIdx).record_index_per_record.resize(global_index_per_record_size,aquanconRecordIdx);
|
||||
const double influx_mult = aquanconRecord.getItem("INFLUX_MULT").getSIDouble(0);
|
||||
|
||||
aqurecord.influx_mult_per_record.resize(global_index_per_record_size, influx_mult);
|
||||
aqurecord.face_per_record.resize(global_index_per_record_size, faceDir);
|
||||
aqurecord.record_index_per_record.resize(global_index_per_record_size, aquanconRecordIdx);
|
||||
}
|
||||
|
||||
// Collate_function
|
||||
@ -113,10 +119,45 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
bool Aquancon::cellInsideReservoirAndActive(const Opm::EclipseGrid& grid, const int i, const int j, const int k)
|
||||
{
|
||||
if ( i < 0 || j < 0 || k < 0
|
||||
|| size_t(i) > grid.getNX() - 1
|
||||
|| size_t(j) > grid.getNY() - 1
|
||||
|| size_t(k) > grid.getNZ() - 1 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return grid.cellActive(i, j, k );
|
||||
}
|
||||
|
||||
bool Aquancon::neighborCellInsideReservoirAndActive(const Opm::EclipseGrid& grid,
|
||||
const int i, const int j, const int k, const Opm::FaceDir::DirEnum faceDir)
|
||||
{
|
||||
switch(faceDir) {
|
||||
case FaceDir::XMinus:
|
||||
return cellInsideReservoirAndActive(grid, i - 1, j, k);
|
||||
case FaceDir::XPlus:
|
||||
return cellInsideReservoirAndActive(grid, i + 1, j, k);
|
||||
case FaceDir::YMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j - 1, k);
|
||||
case FaceDir::YPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j + 1, k);
|
||||
case FaceDir::ZMinus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k - 1);
|
||||
case FaceDir::ZPlus:
|
||||
return cellInsideReservoirAndActive(grid, i, j, k + 1);
|
||||
default:
|
||||
throw std::runtime_error("Unknown FaceDir enum " + std::to_string(faceDir));
|
||||
}
|
||||
}
|
||||
|
||||
// This function is used to convert from a per record vector to a per aquifer ID vector.
|
||||
void Aquancon::collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
|
||||
std::vector<Opm::AquanconRecord>& aqurecords,
|
||||
std::vector<int> aquiferID_per_record, int m_maxAquID)
|
||||
const std::vector<int>& aquiferID_per_record,
|
||||
const int m_maxAquID)
|
||||
{
|
||||
output_vector.resize(m_maxAquID);
|
||||
// Find record indices at which the aquifer ids are located in
|
||||
@ -257,7 +298,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
void Aquancon::convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id,
|
||||
int i, std::vector<int> aquiferID_per_record)
|
||||
const int i, const std::vector<int>& aquiferID_per_record)
|
||||
{
|
||||
auto it = std::find_if( aquiferID_per_record.begin(), aquiferID_per_record.end(),
|
||||
[&](int id) {
|
||||
|
@ -642,14 +642,35 @@ namespace Opm {
|
||||
/// m_doubleGridProperties fields directly and *NOT* use the public methods
|
||||
/// getIntGridProperty / getDoubleGridProperty.
|
||||
void Eclipse3DProperties::loadGridPropertyFromDeckKeyword(const Box& inputBox,
|
||||
const DeckKeyword& deckKeyword) {
|
||||
const DeckKeyword& deckKeyword,
|
||||
bool edit_section) {
|
||||
static std::set<std::string> multiply_keywords = {"MULTX",
|
||||
"MULTY",
|
||||
"MULTZ",
|
||||
"MULTX-",
|
||||
"MULTY-",
|
||||
"MULTZ-"};
|
||||
/*
|
||||
The opm input handling is not really section aware, some keywords
|
||||
should be handled differently in the EDIT section and the GRID
|
||||
section. In particular this applies top the transmissibility
|
||||
multipliers MULT(XYZ) where they should be assigned and reassigned in
|
||||
the GRID section, and applied multiplicatively in the EDIT section.
|
||||
|
||||
Here we have special cased hack for the MULT(XYZ) keywords, there are
|
||||
probably other keywords as well which also should be handled
|
||||
differently in the GRID and EDIT sections, but this is handled on a
|
||||
bug by bug basis.
|
||||
*/
|
||||
|
||||
const std::string& keyword = deckKeyword.name();
|
||||
bool multiply = (edit_section && (multiply_keywords.count(keyword) == 1));
|
||||
if (m_intGridProperties.supportsKeyword( keyword )) {
|
||||
auto& gridProperty = m_intGridProperties.getOrCreateProperty( keyword );
|
||||
gridProperty.loadFromDeckKeyword( inputBox, deckKeyword );
|
||||
gridProperty.loadFromDeckKeyword( inputBox, deckKeyword , false );
|
||||
} else if (m_doubleGridProperties.supportsKeyword( keyword )) {
|
||||
auto& gridProperty = m_doubleGridProperties.getOrCreateProperty( keyword );
|
||||
gridProperty.loadFromDeckKeyword( inputBox, deckKeyword );
|
||||
gridProperty.loadFromDeckKeyword( inputBox, deckKeyword, multiply );
|
||||
} else {
|
||||
throw std::logic_error( "Tried to load unsupported grid property from keyword: " + deckKeyword.name() );
|
||||
}
|
||||
@ -747,31 +768,33 @@ namespace Opm {
|
||||
const EclipseGrid& eclipseGrid) {
|
||||
|
||||
if (Section::hasGRID(deck))
|
||||
scanSection(GRIDSection(deck), eclipseGrid);
|
||||
scanSection(GRIDSection(deck), eclipseGrid, false);
|
||||
|
||||
if (Section::hasREGIONS(deck))
|
||||
scanSection(REGIONSSection(deck), eclipseGrid);
|
||||
scanSection(REGIONSSection(deck), eclipseGrid, false);
|
||||
|
||||
if (Section::hasEDIT(deck))
|
||||
scanSection(EDITSection(deck), eclipseGrid);
|
||||
scanSection(EDITSection(deck), eclipseGrid, true);
|
||||
|
||||
if (Section::hasPROPS(deck))
|
||||
scanSection(PROPSSection(deck), eclipseGrid);
|
||||
scanSection(PROPSSection(deck), eclipseGrid, false);
|
||||
|
||||
if (Section::hasSOLUTION(deck))
|
||||
scanSection(SOLUTIONSection(deck), eclipseGrid);
|
||||
scanSection(SOLUTIONSection(deck), eclipseGrid, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Eclipse3DProperties::scanSection(const Section& section,
|
||||
const EclipseGrid& eclipseGrid) {
|
||||
const EclipseGrid& eclipseGrid,
|
||||
bool edit_section) {
|
||||
BoxManager boxManager(eclipseGrid);
|
||||
for( const auto& deckKeyword : section ) {
|
||||
|
||||
if (supportsGridProperty(deckKeyword.name()) )
|
||||
loadGridPropertyFromDeckKeyword( boxManager.getActiveBox(),
|
||||
deckKeyword);
|
||||
deckKeyword,
|
||||
edit_section);
|
||||
else {
|
||||
if (deckKeyword.name() == "BOX")
|
||||
handleBOXKeyword(deckKeyword, boxManager);
|
||||
|
@ -875,7 +875,7 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
|
||||
zb = zt + sumKdir(i, j, dims, dz);
|
||||
|
||||
double xt=-999;
|
||||
double xb=-999;
|
||||
double xb;
|
||||
|
||||
if (j == (dims[1]-1) ) {
|
||||
xt = sumIdir(i, j, 0, dims, dx);
|
||||
@ -899,8 +899,6 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
|
||||
coord.push_back(xb);
|
||||
coord.push_back(yb);
|
||||
coord.push_back(zb);
|
||||
|
||||
x0 = xt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1152,10 +1150,11 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
|
||||
const std::vector<double>& coord = COORDKeyWord.getSIDoubleData();
|
||||
|
||||
int * actnum = nullptr;
|
||||
std::vector<int> actnumVector;
|
||||
|
||||
if (deck.hasKeyword<ParserKeywords::ACTNUM>()) {
|
||||
const auto& actnumKeyword = deck.getKeyword<ParserKeywords::ACTNUM>();
|
||||
std::vector<int> actnumVector = actnumKeyword.getIntData();
|
||||
actnumVector = actnumKeyword.getIntData();
|
||||
|
||||
actnum=actnumVector.data();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#include <ert/ecl/ecl_grid_dims.hpp>
|
||||
#include <opm/io/eclipse/EGrid.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -140,15 +140,11 @@ namespace Opm {
|
||||
void GridDims::binary_init(const Deck& deck) {
|
||||
const DeckKeyword& gdfile_kw = deck.getKeyword("GDFILE");
|
||||
const std::string& gdfile_arg = gdfile_kw.getRecord(0).getItem("filename").get<std::string>(0);
|
||||
std::string filename = deck.makeDeckPath(gdfile_arg);
|
||||
ecl_grid_dims_type * grid_dims = ecl_grid_dims_alloc( filename.c_str(), nullptr );
|
||||
if (grid_dims) {
|
||||
const auto& dims = ecl_grid_dims_iget_dims(grid_dims, 0);
|
||||
m_nx = dims->nx;
|
||||
m_ny = dims->ny;
|
||||
m_nz = dims->nz;
|
||||
} else
|
||||
throw std::invalid_argument("Could not determine grid dimensions from: " + filename);
|
||||
const EclIO::EGrid egrid( deck.makeDeckPath(gdfile_arg) );
|
||||
const auto& dimens = egrid.dimension();
|
||||
m_nx = dimens[0];
|
||||
m_ny = dimens[1];
|
||||
m_nz = dimens[2];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -261,21 +261,25 @@ namespace Opm {
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void GridProperty< T >::loadFromDeckKeyword( const DeckKeyword& deckKeyword ) {
|
||||
void GridProperty< T >::loadFromDeckKeyword( const DeckKeyword& deckKeyword, bool multiply ) {
|
||||
const auto& deckItem = getDeckItem(deckKeyword);
|
||||
const auto size = deckItem.size();
|
||||
for (size_t dataPointIdx = 0; dataPointIdx < size; ++dataPointIdx) {
|
||||
if (!deckItem.defaultApplied(dataPointIdx))
|
||||
setDataPoint(dataPointIdx, dataPointIdx, deckItem);
|
||||
if (!deckItem.defaultApplied(dataPointIdx)) {
|
||||
if (multiply)
|
||||
mulDataPoint(dataPointIdx, dataPointIdx, deckItem);
|
||||
else
|
||||
setDataPoint(dataPointIdx, dataPointIdx, deckItem);
|
||||
}
|
||||
}
|
||||
|
||||
this->assigned = true;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
void GridProperty< T >::loadFromDeckKeyword( const Box& inputBox, const DeckKeyword& deckKeyword) {
|
||||
void GridProperty< T >::loadFromDeckKeyword( const Box& inputBox, const DeckKeyword& deckKeyword, bool multiply) {
|
||||
if (inputBox.isGlobal())
|
||||
loadFromDeckKeyword( deckKeyword );
|
||||
loadFromDeckKeyword( deckKeyword, multiply );
|
||||
else {
|
||||
const auto& deckItem = getDeckItem(deckKeyword);
|
||||
const std::vector<size_t>& indexList = inputBox.getIndexList();
|
||||
@ -285,7 +289,10 @@ namespace Opm {
|
||||
if (sourceIdx < deckItem.size()
|
||||
&& !deckItem.defaultApplied(sourceIdx))
|
||||
{
|
||||
setDataPoint(sourceIdx, targetIdx, deckItem);
|
||||
if (multiply)
|
||||
mulDataPoint(sourceIdx, targetIdx, deckItem);
|
||||
else
|
||||
setDataPoint(sourceIdx, targetIdx, deckItem);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -425,11 +432,21 @@ void GridProperty<double>::setDataPoint(size_t sourceIdx, size_t targetIdx, cons
|
||||
this->setElement(targetIdx, deckItem.getSIDouble(sourceIdx));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void GridProperty<T>::setElement(const typename std::vector<T>::size_type i, const T value, const bool defaulted) {
|
||||
this->m_data[i] = value;
|
||||
this->m_defaulted[i] = defaulted;
|
||||
}
|
||||
template <typename T>
|
||||
void GridProperty<T>::setElement(const typename std::vector<T>::size_type i, const T value, const bool defaulted) {
|
||||
this->m_data[i] = value;
|
||||
this->m_defaulted[i] = defaulted;
|
||||
}
|
||||
|
||||
template<>
|
||||
void GridProperty<double>::mulDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem) {
|
||||
this->m_data[targetIdx] *= deckItem.getSIDouble(sourceIdx);
|
||||
}
|
||||
|
||||
template<>
|
||||
void GridProperty<int>::mulDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem) {
|
||||
this->m_data[targetIdx] *= deckItem.get<int>(sourceIdx);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
|
@ -17,9 +17,10 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@ -32,9 +33,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
|
||||
#include <ert/ecl/EclFilename.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace {
|
||||
@ -190,9 +188,28 @@ namespace Opm {
|
||||
std::string IOConfig::getRestartFileName(const std::string& restart_base, int report_step, bool output) const {
|
||||
bool unified = output ? getUNIFOUT() : getUNIFIN();
|
||||
bool fmt_file = output ? getFMTOUT() : getFMTIN();
|
||||
ecl_file_enum file_type = (unified) ? ECL_UNIFIED_RESTART_FILE : ECL_RESTART_FILE;
|
||||
|
||||
return ERT::EclFilename( restart_base , file_type , report_step , fmt_file );
|
||||
auto ext = std::string{};
|
||||
if (unified) {
|
||||
ext = fmt_file ? "FUNRST" : "UNRST";
|
||||
}
|
||||
else {
|
||||
std::ostringstream os;
|
||||
|
||||
const char* fmt_prefix = "FGH";
|
||||
const char* unfmt_prefix = "XYZ";
|
||||
|
||||
const int cycle = 10 * 1000;
|
||||
const int p_ix = report_step / cycle;
|
||||
const int n = report_step % cycle;
|
||||
|
||||
os << (fmt_file ? fmt_prefix[p_ix] : unfmt_prefix[p_ix])
|
||||
<< std::setw(4) << std::setfill('0') << n;
|
||||
|
||||
ext = os.str();
|
||||
}
|
||||
|
||||
return restart_base + '.' + ext;
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,13 +20,13 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Utility/Functional.hpp>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
@ -708,12 +708,27 @@ void RestartConfig::handleScheduleSection(const SCHEDULESection& schedule, const
|
||||
|
||||
std::string RestartConfig::getRestartFileName(const std::string& restart_base, int report_step, bool unified , bool fmt_file) {
|
||||
|
||||
ecl_file_enum file_type = (unified) ? ECL_UNIFIED_RESTART_FILE : ECL_RESTART_FILE;
|
||||
char * c_str = ecl_util_alloc_filename( NULL , restart_base.c_str() , file_type, fmt_file , report_step);
|
||||
std::string restart_filename = c_str;
|
||||
free( c_str );
|
||||
auto ext = std::string{};
|
||||
if (unified) {
|
||||
ext = fmt_file ? "FUNRST" : "UNRST";
|
||||
}
|
||||
else {
|
||||
std::ostringstream os;
|
||||
|
||||
return restart_filename;
|
||||
const char* fmt_prefix = "FGH";
|
||||
const char* unfmt_prefix = "XYZ";
|
||||
|
||||
const int cycle = 10 * 1000;
|
||||
const int p_ix = report_step / cycle;
|
||||
const int n = report_step % cycle;
|
||||
|
||||
os << (fmt_file ? fmt_prefix[p_ix] : unfmt_prefix[p_ix])
|
||||
<< std::setw(4) << std::setfill('0') << n;
|
||||
|
||||
ext = os.str();
|
||||
}
|
||||
|
||||
return restart_base + '.' + ext;
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
@ -249,9 +247,13 @@ const EclHysterConfig& Runspec::hysterPar() const noexcept
|
||||
available phases in Eclipse restart and init files.
|
||||
*/
|
||||
int Runspec::eclPhaseMask( ) const noexcept {
|
||||
return ( active_phases.active( Phase::WATER ) ? ECL_WATER_PHASE : 0 )
|
||||
| ( active_phases.active( Phase::OIL ) ? ECL_OIL_PHASE : 0 )
|
||||
| ( active_phases.active( Phase::GAS ) ? ECL_GAS_PHASE : 0 );
|
||||
const int water = 1 << 2;
|
||||
const int oil = 1 << 0;
|
||||
const int gas = 1 << 1;
|
||||
|
||||
return ( active_phases.active( Phase::WATER ) ? water : 0 )
|
||||
| ( active_phases.active( Phase::OIL ) ? oil : 0 )
|
||||
| ( active_phases.active( Phase::GAS ) ? gas : 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,7 +171,7 @@ namespace Opm {
|
||||
for (int i = segment1; i <= segment2; ++i) {
|
||||
// for the first or the only segment in the range is the one specified in the WELSEGS
|
||||
// from the second segment in the range, the outlet segment is the previous segment in the range
|
||||
int outlet_segment = -1;
|
||||
int outlet_segment;
|
||||
if (i == segment1) {
|
||||
outlet_segment = outlet_segment_readin;
|
||||
} else {
|
||||
|
@ -18,8 +18,9 @@
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <opm/common/utility/TimeService.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
@ -27,7 +28,6 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace {
|
||||
@ -119,9 +119,14 @@ namespace {
|
||||
const std::time_t lastTime = m_timeList.back();
|
||||
const size_t step = m_timeList.size();
|
||||
if (newTime > lastTime) {
|
||||
int new_day, new_month, new_year, last_day, last_month, last_year;
|
||||
util_set_date_values_utc(newTime, &new_day, &new_month, &new_year);
|
||||
util_set_date_values_utc(lastTime, &last_day, &last_month, &last_year);
|
||||
const auto nw = TimeStampUTC{ newTime };
|
||||
const auto last = TimeStampUTC{ lastTime };
|
||||
|
||||
const auto new_month = nw .month();
|
||||
const auto last_month = last.month();
|
||||
|
||||
const auto new_year = nw .year();
|
||||
const auto last_year = last.year();
|
||||
|
||||
if (new_month != last_month)
|
||||
m_first_timestep_months.push_back(step);
|
||||
@ -305,16 +310,18 @@ namespace {
|
||||
}
|
||||
|
||||
std::time_t TimeMap::mkdatetime(int in_year, int in_month, int in_day, int hour, int minute, int second) {
|
||||
std::time_t t = util_make_datetime_utc(second, minute, hour, in_day, in_month, in_year);
|
||||
const auto tp = TimeStampUTC{ TimeStampUTC::YMD { in_year, in_month, in_day } }
|
||||
.hour(hour).minutes(minute).seconds(second);
|
||||
|
||||
std::time_t t = asTimeT(tp);
|
||||
{
|
||||
/*
|
||||
The underlying mktime( ) function will happily wrap
|
||||
around dates like January 33, this function will check
|
||||
that no such wrap-around has taken place.
|
||||
*/
|
||||
int out_year, out_day, out_month;
|
||||
util_set_date_values_utc( t, &out_day , &out_month, &out_year);
|
||||
if ((in_day != out_day) || (in_month != out_month) || (in_year != out_year))
|
||||
const auto check = TimeStampUTC{ t };
|
||||
if ((in_day != check.day()) || (in_month != check.month()) || (in_year != check.year()))
|
||||
throw std::invalid_argument("Invalid input arguments for date.");
|
||||
}
|
||||
return t;
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
|
||||
|
||||
#include <ert/util/util.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -728,7 +728,7 @@ double Well2::injection_rate(const SummaryState& st, Phase phase_arg) const {
|
||||
|
||||
bool Well2::wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern) {
|
||||
bool wellNameInPattern = false;
|
||||
if (util_fnmatch( wellNamePattern.c_str() , wellName.c_str()) == 0) {
|
||||
if (fnmatch( wellNamePattern.c_str() , wellName.c_str() , 0 ) == 0) {
|
||||
wellNameInPattern = true;
|
||||
}
|
||||
return wellNameInPattern;
|
||||
|
@ -63,7 +63,7 @@ namespace Opm {
|
||||
throw std::invalid_argument(msg);
|
||||
}
|
||||
|
||||
auto cmode = ProducerCMode::CMODE_UNDEFINED;
|
||||
ProducerCMode cmode;
|
||||
|
||||
if (effectiveHistoryProductionControl(this->whistctl_cmode) )
|
||||
cmode = this->whistctl_cmode;
|
||||
|
@ -16,14 +16,14 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
|
||||
|
||||
#include <ert/util/ssize_t.h>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
TableColumn::TableColumn(const ColumnSchema& schema) :
|
||||
@ -271,33 +271,37 @@ namespace Opm {
|
||||
for (size_t rowIdx = 0; rowIdx < size(); ++rowIdx) {
|
||||
if (defaultApplied( rowIdx )) {
|
||||
// find first row which was not defaulted before the current one
|
||||
ssize_t rowBeforeIdx = rowIdx;
|
||||
int rowBeforeIdx = static_cast<int>(rowIdx);
|
||||
for (; rowBeforeIdx >= 0; -- rowBeforeIdx)
|
||||
if (!defaultApplied(rowBeforeIdx))
|
||||
break;
|
||||
|
||||
// find first row which was not defaulted after the current one
|
||||
ssize_t rowAfterIdx = rowIdx;
|
||||
for (; rowAfterIdx < static_cast<ssize_t>(size()); ++ rowAfterIdx)
|
||||
int rowAfterIdx = static_cast<int>(rowIdx);
|
||||
for (; rowAfterIdx < static_cast<int>(size()); ++ rowAfterIdx)
|
||||
if (!defaultApplied(rowAfterIdx))
|
||||
break;
|
||||
|
||||
|
||||
// switch to extrapolation by a constant at the fringes
|
||||
if (rowBeforeIdx < 0 && rowAfterIdx >= static_cast<ssize_t>(size()))
|
||||
if (rowBeforeIdx < 0 && rowAfterIdx >= static_cast<int>(size()))
|
||||
throw std::invalid_argument("Column " + m_schema.name() + " can't be fully defaulted");
|
||||
else if (rowBeforeIdx < 0)
|
||||
rowBeforeIdx = rowAfterIdx;
|
||||
else if (rowAfterIdx >= static_cast<ssize_t>(size()))
|
||||
else if (rowAfterIdx >= static_cast<int>(size()))
|
||||
rowAfterIdx = rowBeforeIdx;
|
||||
|
||||
{
|
||||
const size_t before = static_cast<size_t>(rowBeforeIdx);
|
||||
const size_t after = static_cast<size_t>(rowAfterIdx);
|
||||
|
||||
// linear interpolation
|
||||
double alpha = 0.0;
|
||||
if (rowBeforeIdx != rowAfterIdx)
|
||||
alpha = (argColumn[rowIdx] - argColumn[rowBeforeIdx]) / (argColumn[rowAfterIdx] - argColumn[rowBeforeIdx]);
|
||||
alpha = (argColumn[rowIdx] - argColumn[before])
|
||||
/ (argColumn[after] - argColumn[before]);
|
||||
|
||||
double value = m_values[rowBeforeIdx]*(1-alpha) + m_values[rowAfterIdx]*alpha;
|
||||
double value = m_values[before]*(1-alpha) + m_values[after]*alpha;
|
||||
|
||||
updateValue( rowIdx , value );
|
||||
}
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <fnmatch.h>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
@ -266,7 +267,7 @@ namespace Opm {
|
||||
const char * c_pattern = pattern.c_str();
|
||||
for (const auto& pair : m_errorContexts) {
|
||||
const std::string& key = pair.first;
|
||||
if (util_fnmatch( c_pattern , key.c_str()) == 0)
|
||||
if (fnmatch( c_pattern , key.c_str() , 0 ) == 0)
|
||||
updateKey( key , action );
|
||||
}
|
||||
}
|
||||
|
@ -143,13 +143,14 @@ namespace Opm {
|
||||
m_count = 1;
|
||||
}
|
||||
else {
|
||||
m_count = std::stoi( m_countString );
|
||||
const auto cnt = std::stoi( m_countString );
|
||||
|
||||
if (m_count == 0)
|
||||
if (cnt < 1)
|
||||
// TODO: decorate the deck with a warning instead?
|
||||
throw std::invalid_argument("Specifing zero repetitions is not allowed. Token: \'" + token + "\'.");
|
||||
|
||||
m_count = static_cast<std::size_t>(cnt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@
|
||||
#ifndef STAR_TOKEN_HPP
|
||||
#define STAR_TOKEN_HPP
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
#include <opm/parser/eclipse/Utility/Stringview.hpp>
|
||||
#include <ert/util/ssize_t.h>
|
||||
|
||||
namespace Opm {
|
||||
bool isStarToken(const string_view& token,
|
||||
@ -49,7 +49,7 @@ public:
|
||||
init_(token);
|
||||
}
|
||||
|
||||
size_t count() const {
|
||||
std::size_t count() const {
|
||||
return m_count;
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ private:
|
||||
// must be set before calling this method.
|
||||
void init_(const string_view& token);
|
||||
|
||||
ssize_t m_count;
|
||||
std::size_t m_count;
|
||||
std::string m_countString;
|
||||
std::string m_valueString;
|
||||
};
|
||||
|
@ -6,6 +6,6 @@
|
||||
{"name" : "V0" , "value_type" : "DOUBLE" , "dimension" : "Length*Length*Length"},
|
||||
{"name" : "C_T" , "value_type" : "DOUBLE" , "dimension" : "1/Pressure"},
|
||||
{"name" : "PI" , "value_type" : "DOUBLE" , "dimension" : "ReservoirVolume/Pressure*Time"},
|
||||
{"name" : "TABLE_NUM_WATER_PRESS" , "value_type" : "INT" , "default_value" : 1},
|
||||
{"name" : "SALINITY" , "value_type" : "DOUBLE" , "default_value" : 0 , "dimension" : "Salinity"},
|
||||
{"name" : "TABLE_NUM_WATER_PRESS" , "value_type" : "INT" , "default" : 1},
|
||||
{"name" : "SALINITY" , "value_type" : "DOUBLE" , "default" : 0 , "dimension" : "Salinity"},
|
||||
{"name" : "TEMP" , "value_type" : "DOUBLE" , " dimension" : "Temperature"}]}
|
||||
|
@ -0,0 +1 @@
|
||||
{"name" : "ISOLNUM" , "sections" : ["GRID"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1,10 @@
|
||||
{"name" : "JFUNCR" , "sections" : ["GRID"], "size" : {"keyword" : "TABDIMS" , "item" : "NTSFUN"}, "items" : [
|
||||
{"name" : "J_FUNCTION" , "value_type" : "STRING", "default" : "BOTH"},
|
||||
{"name" : "OIL_WAT_SURF_TENSTION" , "value_type" : "DOUBLE"},
|
||||
{"name" : "OIL_GAS_SURF_TENSTION" , "value_type" : "DOUBLE"},
|
||||
{"name" : "POROSITY_POWER" , "value_type" : "DOUBLE", "dimension": "1", "default" : 0.5},
|
||||
{"name" : "PERMEABILITY_POWER" , "value_type" : "DOUBLE", "dimension" : "1", "default" : 0.5},
|
||||
{"name" : "PERM_DIRECTION" , "value_type" : "STRING", "default" : "XY"}
|
||||
|
||||
|
||||
]}
|
15
src/opm/parser/eclipse/share/keywords/000_Eclipse100/K/KRNUM
Normal file
15
src/opm/parser/eclipse/share/keywords/000_Eclipse100/K/KRNUM
Normal file
@ -0,0 +1,15 @@
|
||||
{"name" : "KRNUM" , "sections" : ["REGIONS"],
|
||||
"deck_name" : [
|
||||
"KRNUMX",
|
||||
"KRNUMX-",
|
||||
"KRNUMY",
|
||||
"KRNUMY-",
|
||||
"KRNUMZ",
|
||||
"KRNUMZ-",
|
||||
"KRNUMR",
|
||||
"KRNUMR-",
|
||||
"KRNUMT",
|
||||
"KRNUMT-"
|
||||
],
|
||||
"data" : {"value_type" : "INT"}
|
||||
}
|
@ -0,0 +1 @@
|
||||
{"name" : "KRNUMMF" , "sections" : ["REGIONS"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LANGMPL" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1,7 @@
|
||||
{"name" : "LANGMUIR" ,
|
||||
"sections" : ["PROPS"],
|
||||
"size" : {"keyword" : "REGDIMS" , "item" : "NTCREG"},
|
||||
"items" : [{"name" : "table" ,
|
||||
"value_type" : "DOUBLE" ,
|
||||
"size_type" : "ALL",
|
||||
"dimension" : ["Pressure", "GasSurfaceVolume/Length*Length*Length", "GasSurfaceVolume/Length*Length*Length"]}]}
|
@ -0,0 +1,7 @@
|
||||
{"name" : "LANGSOLV" ,
|
||||
"sections" : ["PROPS"],
|
||||
"size" : {"keyword" : "REGDIMS" , "item" : "NTCREG"},
|
||||
"items" : [{"name" : "table" ,
|
||||
"value_type" : "DOUBLE" ,
|
||||
"size_type" : "ALL",
|
||||
"dimension" : ["Pressure", "GasSurfaceVolume/Length*Length*Length"]}]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LGRCOPY" , "sections" : ["RUNSPEC", "GRID", "EDIT"]}
|
@ -0,0 +1,5 @@
|
||||
{"name" : "LGRFREE" , "sections" : ["SCHEDULE"], "items" : [
|
||||
{"name" : "LOCAL_GRID_REFINMENT" , "value_type" : "STRING"}
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1,5 @@
|
||||
{"name" : "LGRLOCK" , "sections" : ["SCHEDULE"], "items" : [
|
||||
{"name" : "LOCAL_GRID_REFINMENT" , "value_type" : "STRING"}
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1,6 @@
|
||||
{"name" : "LGROFF" , "sections" : ["SCHEDULE"], "size" : 1, "items" : [
|
||||
{"name" : "LOCAL_GRID_REFINMENT" , "value_type" : "STRING"},
|
||||
{"name" : "ACTIVE_WELLS" , "value_type" : "INT", "default" : 0}
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1,6 @@
|
||||
{"name" : "LGRON" , "sections" : ["SCHEDULE"], "size" : 1, "items" : [
|
||||
{"name" : "LOCAL_GRID_REFINMENT" , "value_type" : "STRING"},
|
||||
{"name" : "ACTIVE_WELLS" , "value_type" : "INT", "default" : 0}
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LINKPERM" , "sections" : ["GRID"], "data" : {"value_type" : "STRING"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LKRO" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LKRORG" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LKRORW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LKRW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LKRWR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
11
src/opm/parser/eclipse/share/keywords/000_Eclipse100/L/LOAD
Normal file
11
src/opm/parser/eclipse/share/keywords/000_Eclipse100/L/LOAD
Normal file
@ -0,0 +1,11 @@
|
||||
{"name" : "LOAD" , "sections" : ["RUNSPEC"], "size" : 1, "items" : [
|
||||
{"name" : "FILE" , "value_type" : "STRING"},
|
||||
{"name" : "REPORT_STEP" , "value_type" : "INT"},
|
||||
{"name" : "NOSIM" , "value_type" : "STRING", "default" : "SIM"},
|
||||
{"name" : "FORMATTED" , "value_type" : "STRING", "default" : "UNFORMATTED"},
|
||||
{"name" : "REQUEST_SAVE_OUTPUT" , "value_type" : "STRING", "default" : "NO"}
|
||||
|
||||
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LOWSALT" , "sections" : ["RUNSPEC"]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LPCW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"Pressure"}}
|
@ -0,0 +1,7 @@
|
||||
{"name" : "LSALTFNC" ,
|
||||
"sections" : ["PROPS"],
|
||||
"size" : {"keyword" : "TABDIMS" , "item" : "NTSFUN"},
|
||||
"items" : [{"name" : "table" ,
|
||||
"value_type" : "DOUBLE" ,
|
||||
"size_type" : "ALL",
|
||||
"dimension" : ["Pressure", "1", "1"]}]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSLTWNUM" , "sections" : ["REGIONS"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSNUM" , "sections" : ["REGIONS"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSOGCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSOWCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSWCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSWL" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSWLPC" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LSWU" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1,11 @@
|
||||
{"name" : "LTOSIGMA" , "sections" : ["GRID"], "size" : 1, "items" : [
|
||||
{"name" : "FX" , "value_type" : "DOUBLE", "dimension": "1", "default": 4.0},
|
||||
{"name" : "FY" , "value_type" : "DOUBLE", "dimension": "1", "default": 4.0},
|
||||
{"name" : "FZ" , "value_type" : "DOUBLE", "dimension": "1", "default": 4.0},
|
||||
{"name" : "FGD" , "value_type" : "DOUBLE", "dimension": "1", "default": 0.0},
|
||||
{"name" : "OPTION" , "value_type" : "STRING", "default": "XONLY"}
|
||||
|
||||
|
||||
|
||||
|
||||
]}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWKRO" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWKRORG" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWKRORW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWKRW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWKRWR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWPCW" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE" , "dimension":"Pressure"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSLTNUM" , "sections" : ["REGIONS"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSNUM" , "sections" : ["REGIONS"], "data" : {"value_type" : "INT"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSOGCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSOWCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSWCR" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSWL" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSWLPC" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LWSWU" , "sections" : ["PROPS"], "data" : {"value_type" : "DOUBLE", "dimension" : "1"}}
|
@ -0,0 +1 @@
|
||||
{"name" : "LX" , "sections" : ["GRID"], "data" : {"value_type" : "DOUBLE", "dimension" : "Length"}}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user