Compare commits

..

1 Commits

Author SHA1 Message Date
Arne Morten Kvarving
c0616be20e bump version to 2023.04-rc1 2023-04-13 14:30:31 +02:00
397 changed files with 48016 additions and 182307 deletions

View File

@@ -1,5 +1,6 @@
{
BasedOnStyle: WebKit,
AlignAfterOpenBracket: AlwaysBreak,
AlignConsecutiveAssignments: false,
AlignConsecutiveDeclarations: false,
AlignAfterOpenBracket: Align,

View File

@@ -216,25 +216,26 @@ if (OPM_ENABLE_PYTHON)
if(PYTHON_EXECUTABLE AND NOT Python3_EXECUTABLE)
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
# We always need to search for Development as we use
# pybind11_add_module even if don't embed Python
if (NOT OPM_ENABLE_EMBEDDED_PYTHON)
if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
endif()
else()
if(${CMAKE_VERSION} VERSION_LESS "3.18.0")
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Embed Development.Module)
endif()
if (OPM_ENABLE_EMBEDDED_PYTHON)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
get_target_property(_lib_path Python3::Python IMPORTED_LOCATION)
set(PYTHON_LIBRARY ${_lib_path})
set(PYTHON_LIBRARIES {PYTHON_LIBRARY})
list(APPEND opm-common_LIBRARIES ${PYTHON_LIBRARY})
set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
endif()
# Make sure we fail gracefully here without setuptool
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import setuptools"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
ERROR_VARIABLE SETUPTOOL_ERROR OUTPUT_VARIABLE SETUPTOOL_OUT
RESULT_VARIABLE SETUPTOOL_RESULT)
if(SETUPTOOL_RESULT GREATER 0)
message(WARNING "Trying to test setuptools resulted in error message: ${SETUPTOOL_ERROR}")
message(SEND_ERROR "To build the python bindings you need to install setuptool. "
"Either use \"apt-get install python3-setuptools\" (on Debian/Ubuntu) "
"or \"pip install setuptools\"")
endif()
if(Python3_VERSION_MINOR LESS 3)
# Python native namespace packages requires python >= 3.3
@@ -366,7 +367,7 @@ endif()
find_package(dune-common REQUIRED)
opm_need_version_of ("dune-common")
target_include_directories(dunecommon INTERFACE ${dune-common_INCLUDE_DIRS})
string(REPLACE " " ";" dflags "${dune-common_CXX_FLAGS}")
string(REPLACE " " ";" dflags ${dune-common_CXX_FLAGS})
target_compile_options(dunecommon INTERFACE ${dflags})
target_compile_definitions(dunecommon INTERFACE DUNE_COMMON_VERSION_MAJOR=${DUNE_COMMON_VERSION_MAJOR})
target_compile_definitions(dunecommon INTERFACE DUNE_COMMON_VERSION_MINOR=${DUNE_COMMON_VERSION_MINOR})
@@ -379,7 +380,6 @@ if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
endif()
if(BUILD_EXAMPLES)
target_link_libraries(co2brinepvt dunecommon)
install(TARGETS co2brinepvt DESTINATION bin)
endif()
# Install build system files and documentation

View File

@@ -51,7 +51,6 @@ list (APPEND MAIN_SOURCE_FILES
src/opm/material/common/TridiagonalMatrix.cpp
src/opm/material/common/UniformXTabulated2DFunction.cpp
src/opm/material/components/CO2.cpp
src/opm/material/components/H2.cpp
src/opm/material/densead/Evaluation.cpp
src/opm/material/fluidmatrixinteractions/EclEpsScalingPoints.cpp
src/opm/material/fluidsystems/BlackOilFluidSystem.cpp
@@ -119,7 +118,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/EclipseState/Grid/BoxManager.cpp
src/opm/input/eclipse/EclipseState/Grid/Carfin.cpp
src/opm/input/eclipse/EclipseState/Grid/CarfinManager.cpp
src/opm/input/eclipse/EclipseState/Grid/LgrCollection.cpp
src/opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp
src/opm/input/eclipse/EclipseState/Grid/FieldProps.cpp
src/opm/input/eclipse/EclipseState/Grid/FieldPropsManager.cpp
@@ -147,7 +145,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/EclipseState/Phase.cpp
src/opm/input/eclipse/EclipseState/TracerConfig.cpp
src/opm/input/eclipse/EclipseState/MICPpara.cpp
src/opm/input/eclipse/EclipseState/WagHysteresisConfig.cpp
src/opm/input/eclipse/Schedule/Action/ActionAST.cpp
src/opm/input/eclipse/Schedule/Action/ActionContext.cpp
src/opm/input/eclipse/Schedule/Action/ActionResult.cpp
@@ -162,7 +159,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/Schedule/Action/State.cpp
src/opm/input/eclipse/Schedule/Action/WGNames.cpp
src/opm/input/eclipse/Schedule/ArrayDimChecker.cpp
src/opm/input/eclipse/Schedule/BCProp.cpp
src/opm/input/eclipse/Schedule/CompletedCells.cpp
src/opm/input/eclipse/Schedule/eval_uda.cpp
src/opm/input/eclipse/Schedule/Events.cpp
@@ -174,7 +170,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/Schedule/Group/GuideRateModel.cpp
src/opm/input/eclipse/Schedule/Group/GConSale.cpp
src/opm/input/eclipse/Schedule/Group/GConSump.cpp
src/opm/input/eclipse/Schedule/Group/GroupEconProductionLimits.cpp
src/opm/input/eclipse/Schedule/Group/GTNode.cpp
src/opm/input/eclipse/Schedule/KeywordHandlers.cpp
src/opm/input/eclipse/Schedule/MessageLimits.cpp
@@ -203,13 +198,11 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/Schedule/Tuning.cpp
src/opm/input/eclipse/Schedule/WriteRestartFileEvents.cpp
src/opm/input/eclipse/Schedule/Well/Connection.cpp
src/opm/input/eclipse/Schedule/Well/FilterCake.cpp
src/opm/input/eclipse/Schedule/Well/injection.cpp
src/opm/input/eclipse/Schedule/Well/NameOrder.cpp
src/opm/input/eclipse/Schedule/Well/PAvg.cpp
src/opm/input/eclipse/Schedule/Well/PAvgCalculator.cpp
src/opm/input/eclipse/Schedule/Well/PAvgCalculatorCollection.cpp
src/opm/input/eclipse/Schedule/Well/PAvgDynamicSourceData.cpp
src/opm/input/eclipse/Schedule/Well/Well.cpp
src/opm/input/eclipse/Schedule/Well/WellConnections.cpp
src/opm/input/eclipse/Schedule/Well/WellMatcher.cpp
@@ -225,10 +218,8 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/Schedule/Well/WellTestState.cpp
src/opm/input/eclipse/Schedule/WellTraj/RigEclipseWellLogExtractor.cpp
src/opm/input/eclipse/Schedule/Well/WellTracerProperties.cpp
src/opm/input/eclipse/Schedule/Well/WINJMULT.cpp
src/opm/input/eclipse/Schedule/Well/WList.cpp
src/opm/input/eclipse/Schedule/Well/WListManager.cpp
src/opm/input/eclipse/Schedule/Well/WVFPDP.cpp
src/opm/input/eclipse/Schedule/Well/WVFPEXP.cpp
src/opm/input/eclipse/Schedule/WellTraj/RigEclipseWellLogExtractor.cpp
src/opm/input/eclipse/EclipseState/SimulationConfig/BCConfig.cpp
@@ -251,7 +242,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/EclipseState/Tables/TableContainer.cpp
src/opm/input/eclipse/EclipseState/Tables/TableIndex.cpp
src/opm/input/eclipse/EclipseState/Tables/TLMixpar.cpp
src/opm/input/eclipse/EclipseState/Tables/Ppcwmax.cpp
src/opm/input/eclipse/EclipseState/Tables/TableManager.cpp
src/opm/input/eclipse/EclipseState/Tables/TableSchema.cpp
src/opm/input/eclipse/EclipseState/Tables/Tables.cpp
@@ -301,8 +291,6 @@ if(ENABLE_ECL_INPUT)
src/opm/material/fluidmatrixinteractions/EclMaterialLawManagerHystParams.cpp
src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp
src/opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp
src/opm/material/fluidsystems/blackoilpvt/H2GasPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityBrinePvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.cpp
@@ -468,23 +456,19 @@ if(ENABLE_ECL_INPUT)
tests/test_RestartFileView.cpp
tests/test_EclIO.cpp
tests/test_EGrid.cpp
tests/test_EInit.cpp
tests/test_ERft.cpp
tests/test_ERst.cpp
tests/test_ESmry.cpp
tests/test_EInit.cpp
tests/test_ExtESmry.cpp
tests/test_PAvgCalculator.cpp
tests/test_PAvgDynamicSourceData.cpp
tests/test_Serialization.cpp
tests/material/test_co2brinepvt.cpp
tests/material/test_h2brinepvt.cpp
tests/material/test_eclblackoilfluidsystem.cpp
tests/material/test_eclblackoilpvt.cpp
tests/material/test_eclmateriallawmanager.cpp
tests/parser/ACTIONX.cpp
tests/parser/ADDREGTests.cpp
tests/parser/AquiferTests.cpp
tests/parser/BCConfigTests.cpp
tests/parser/BoxTests.cpp
tests/parser/CarfinTests.cpp
tests/parser/ColumnSchemaTests.cpp
@@ -507,7 +491,6 @@ if(ENABLE_ECL_INPUT)
tests/parser/ImportTests.cpp
tests/parser/InitConfigTest.cpp
tests/parser/IOConfigTests.cpp
tests/parser/LgrTests.cpp
tests/parser/MICPTests.cpp
tests/parser/MessageLimitTests.cpp
tests/parser/MultiRegTests.cpp
@@ -601,13 +584,6 @@ list(APPEND TEST_SOURCE_FILES ${DUNE_TEST_SOURCE_FILES})
list (APPEND TEST_DATA_FILES
tests/testdata.param
tests/material/brine_unittest.json
tests/material/co2_unittest_part1.json
tests/material/co2_unittest_part2.json
tests/material/co2_unittest_above_sat.json
tests/material/co2_unittest_below_sat.json
tests/material/h2o_unittest.json
tests/material/h2_unittest.json
)
if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_DATA_FILES
@@ -806,7 +782,6 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/components/Air.hpp
opm/material/components/C1.hpp
opm/material/components/Brine.hpp
opm/material/components/BrineDynamic.hpp
opm/material/fluidstates/BlackOilFluidState.hpp
opm/material/fluidstates/NonEquilibriumFluidState.hpp
opm/material/fluidstates/FluidStateSaturationModules.hpp
@@ -840,7 +815,6 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/binarycoefficients/H2O_CO2.hpp
opm/material/binarycoefficients/Air_Xylene.hpp
opm/material/binarycoefficients/Brine_CO2.hpp
opm/material/binarycoefficients/Brine_H2.hpp
opm/material/binarycoefficients/HenryIapws.hpp
opm/material/Constants.hpp
opm/material/fluidsystems/NullParameterCache.hpp
@@ -864,7 +838,6 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp
opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.hpp
opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.hpp
opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/GasPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/DryHumidGasPvt.hpp
@@ -877,11 +850,9 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityBrinePvt.hpp
opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp
opm/material/fluidsystems/blackoilpvt/Co2GasPvt.hpp
opm/material/fluidsystems/blackoilpvt/H2GasPvt.hpp
opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp
opm/material/fluidsystems/H2OAirFluidSystem.hpp
opm/material/fluidsystems/H2ON2FluidSystem.hpp
opm/material/fluidsystems/ThreeComponentFluidSystem.hh
opm/material/fluidmatrixinteractions/EclTwoPhaseMaterial.hpp
opm/material/fluidmatrixinteractions/SatCurveMultiplexerParams.hpp
opm/material/fluidmatrixinteractions/EclTwoPhaseMaterialParams.hpp
@@ -1097,7 +1068,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/Grid/Fault.hpp
opm/input/eclipse/EclipseState/Grid/Box.hpp
opm/input/eclipse/EclipseState/Grid/Carfin.hpp
opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp
opm/input/eclipse/EclipseState/Grid/FieldProps.hpp
opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp
opm/input/eclipse/EclipseState/Grid/FaultFace.hpp
@@ -1111,7 +1081,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/EndpointScaling.hpp
opm/input/eclipse/EclipseState/TracerConfig.hpp
opm/input/eclipse/EclipseState/MICPpara.hpp
opm/input/eclipse/EclipseState/WagHysteresisConfig.hpp
opm/input/eclipse/EclipseState/Tables/DenT.hpp
opm/input/eclipse/EclipseState/Tables/JouleThomson.hpp
opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp
@@ -1143,7 +1112,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/Tables/SgcwmisTable.hpp
opm/input/eclipse/EclipseState/Tables/Sof2Table.hpp
opm/input/eclipse/EclipseState/Tables/TLMixpar.hpp
opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp
opm/input/eclipse/EclipseState/Tables/TableManager.hpp
opm/input/eclipse/EclipseState/Tables/SwfnTable.hpp
opm/input/eclipse/EclipseState/Tables/EnptvdTable.hpp
@@ -1225,7 +1193,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/Schedule/Action/State.hpp
opm/input/eclipse/Schedule/Action/WGNames.hpp
opm/input/eclipse/Schedule/ArrayDimChecker.hpp
opm/input/eclipse/Schedule/BCProp.hpp
opm/input/eclipse/Schedule/GasLiftOpt.hpp
opm/input/eclipse/Schedule/Network/Balance.hpp
opm/input/eclipse/Schedule/Network/Branch.hpp
@@ -1234,11 +1201,9 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/Schedule/VFPInjTable.hpp
opm/input/eclipse/Schedule/VFPProdTable.hpp
opm/input/eclipse/Schedule/Well/Connection.hpp
opm/input/eclipse/Schedule/Well/FilterCake.hpp
opm/input/eclipse/Schedule/Well/PAvg.hpp
opm/input/eclipse/Schedule/Well/PAvgCalculator.hpp
opm/input/eclipse/Schedule/Well/PAvgCalculatorCollection.hpp
opm/input/eclipse/Schedule/Well/PAvgDynamicSourceData.hpp
opm/input/eclipse/Schedule/Well/Well.hpp
opm/input/eclipse/Schedule/Well/WellEnums.hpp
opm/input/eclipse/Schedule/Well/WellInjectionControls.hpp
@@ -1253,8 +1218,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/Schedule/Well/WellMICPProperties.hpp
opm/input/eclipse/Schedule/Well/WellPolymerProperties.hpp
opm/input/eclipse/Schedule/Well/WellTracerProperties.hpp
opm/input/eclipse/Schedule/Well/WINJMULT.hpp
opm/input/eclipse/Schedule/Well/WVFPDP.hpp
opm/input/eclipse/Schedule/Well/WVFPEXP.hpp
opm/input/eclipse/Schedule/Well/WellTestConfig.hpp
opm/input/eclipse/Schedule/Well/WellTestState.hpp
@@ -1277,7 +1240,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/Schedule/Group/GuideRate.hpp
opm/input/eclipse/Schedule/Group/GConSale.hpp
opm/input/eclipse/Schedule/Group/GConSump.hpp
opm/input/eclipse/Schedule/Group/GroupEconProductionLimits.hpp
opm/input/eclipse/Schedule/Group/GuideRateConfig.hpp
opm/input/eclipse/Schedule/Group/GuideRateModel.hpp
opm/input/eclipse/Schedule/MessageLimits.hpp

View File

@@ -294,7 +294,7 @@ if(SuiteSparse_FOUND)
string (TOUPPER ${_module} _MODULE)
if(SuiteSparse_${_MODULE}_FOUND)
if(NOT TARGET SuiteSparse::${_module})
message(STATUS "Creating target SuiteSparse::${_module}")
message(STATUS "Creating target SuitSparse::${_module}")
add_library(SuiteSparse::${_module} UNKNOWN IMPORTED GLOBAL)
set_target_properties(SuiteSparse::${_module} PROPERTIES
IMPORTED_LOCATION ${${_MODULE}_LIBRARY}

View File

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

View File

@@ -0,0 +1,200 @@
# translate a list of libraries into a command-line that can be passed to the
# compiler/linker. first parameter is the name of the variable that will
# receive this list, the rest is considered the list of libraries
function (linker_cmdline what INTO outvar FROM)
if (NOT (UNIX OR MSYS OR MINGW))
return ()
endif (NOT (UNIX OR MSYS OR MINGW))
# if we are going to put these in regexps, we must escape period
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")
string (REPLACE "." "\\." esc_ar_pref "${CMAKE_STATIC_LIBRARY_PREFIX}")
string (REPLACE "." "\\." esc_ar_suff "${CMAKE_STATIC_LIBRARY_PREFIX}")
# CMake loves absolute paths, whereas libtool won't have any of it!
# (you get an error message about argument not parsed). translate each
# of the libraries into a linker option
set (deplib_list "")
set (deplib_list_tmp "")
foreach (deplib IN LISTS ARGN)
# resolve imported targets
string(FIND ${deplib} "::" _sep)
if (_sep GREATER "-1")
set(_lib "")
# the code below does not really work for imported interface library
# as cmake will error out whene querying IMPORTED_LOCATION, because the
# property is not whitelisted. I have no idea how to determine if
# a library is an imported interface library
# At least it works for resolving OpenMP::OpenMP_CXX
#
# get_property(_def TARGET ${deplib} PROPERTY IMPORTED_LOCATION DEFINED)
# if (_def)
# get_property(_def TARGET ${deplib} PROPERTY IMPORTED_LOCATION SET)
# if (_def)
# get_target_property(_tmp_lib ${deplib} IMPORTED_LOCATION)
# list(APPEND _lib ${_tmp_lib})
# endif()
# endif()
get_property(_def TARGET ${deplib} PROPERTY INTERFACE_LINK_LIBRARIES SET)
if (_def)
get_target_property(_tmp_lib ${deplib} INTERFACE_LINK_LIBRARIES)
list(APPEND _lib ${_tmp_lib})
endif()
set(deplib ${_lib})
endif()
list(APPEND deplib_list_tmp ${deplib})
endforeach()
foreach (deplib IN LISTS deplib_list_tmp)
# starts with a hyphen already? then just add it
string (SUBSTRING ${deplib} 0 1 dash)
if (${dash} STREQUAL "-")
list (APPEND deplib_list ${deplib})
else (${dash} STREQUAL "-")
# otherwise, parse the name into a directory and a name
get_filename_component (deplib_dir ${deplib} PATH)
get_filename_component (deplib_orig ${deplib} NAME)
string (REGEX REPLACE
"^${esc_dl_pref}(.*)${esc_dl_suff}$"
"\\1"
deplib_name
${deplib_orig}
)
string (REGEX REPLACE
"^${esc_ar_pref}(.*)${esc_ar_suff}$"
"\\1"
deplib_name
${deplib_name}
)
# directory and name each on their own; this is somewhat
# unsatisfactory because it may be that a system dir is specified
# by an earlier directory and you start picking up libraries from
# there instead of the "closest" path here. also, the soversion
# is more or less lost. remove system default path, to lessen the
# chance that we pick the wrong library
if (NOT ((deplib_dir STREQUAL "/usr/lib") OR
(deplib_dir STREQUAL "") OR
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}")))
list (APPEND deplib_list "-L${deplib_dir}")
endif ()
# if there was no translation of the name, the library is named
# unconventionally (.so.3gf, I'm looking at you), so pass this
# name unmodified to the linker switch
if (deplib_orig STREQUAL deplib_name AND
NOT deplib_orig STREQUAL "stdc++fs")
list (APPEND deplib_list "-l:${deplib_orig}")
else ()
list (APPEND deplib_list "-l${deplib_name}")
endif (deplib_orig STREQUAL deplib_name AND
NOT deplib_orig STREQUAL "stdc++fs")
endif (${dash} STREQUAL "-")
endforeach (deplib)
# caller determines whether we want it returned as a list or a string
if ("${what}" STREQUAL "LIST")
set (${outvar} ${deplib_list})
else ("${what}" STREQUAL "LIST")
set (${outvar} "${deplib_list}")
string (REPLACE ";" " " ${outvar} "${${outvar}}")
endif ("${what}" STREQUAL "LIST")
set (${outvar} "${${outvar}}" PARENT_SCOPE)
endfunction (linker_cmdline what INTO outvar FROM)
function (configure_la name target)
if (NOT (UNIX OR MSYS OR MINGW))
return ()
endif (NOT (UNIX OR MSYS OR MINGW))
# these generic variables are initialized from the project info
set (current "${${name}_VERSION_MAJOR}")
set (age "${${name}_VERSION_MINOR}")
set (inherited_linker_flags "${${name}_LINKER_FLAGS}")
set (dependency_libs "${${name}_LIBRARIES}")
# translate list of libraries to command line
linker_cmdline (LIST INTO dependency_libs FROM ${dependency_libs})
# convert from CMake list (i.e. semi-colon separated)
string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}")
string (REPLACE ";" " " dependency_libs "${dependency_libs}")
# this is the preferred installation path
set (libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
# ${name}_LIBRARY_TYPE is either SHARED or STATIC
if (${name}_LIBRARY_TYPE STREQUAL "SHARED")
set (libprefix "${CMAKE_SHARED_LIBRARY_PREFIX}")
set (libsuffix "${CMAKE_SHARED_LIBRARY_SUFFIX}")
set (libname "${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
# only Unix has soversion in library names
if (UNIX)
set (dlname "${libname}.${current}")
set (library_names "${libname}.${current}.${age} ${libname}.${current} ${libname}")
else (UNIX)
set (dlname "${libname}")
set (library_names "${libname}")
endif (UNIX)
set (old_library "")
else (${name}_LIBRARY_TYPE STREQUAL "SHARED")
set (dlname "")
set (library_names "")
set (old_library "${CMAKE_STATIC_LIBRARY_PREFIX}${target}${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif (${name}_LIBRARY_TYPE STREQUAL "SHARED")
# get the version of libtool installed on the system; this is
# necessary because libtool checks that the file contains its own
# signature(!)
if (NOT libtool_MAIN)
find_file (
libtool_MAIN
ltmain.sh
PATHS /usr
PATH_SUFFIXES share/libtool/config/
DOC "Location of libtool"
)
mark_as_advanced (libtool_MAIN)
# notify the user if it not found after we explicitly searched
if (NOT libtool_MAIN)
message (STATUS "Not generating libtool archive (.la) since libtool was not found")
endif (NOT libtool_MAIN)
endif (NOT libtool_MAIN)
if (libtool_MAIN)
file (STRINGS
${libtool_MAIN}
ltversion_STRING
REGEX "^VERSION=\".*\""
)
endif (libtool_MAIN)
if (ltversion_STRING)
string (REGEX REPLACE
"^VERSION=\"?(.*)\"?"
"\\1"
ltversion
${ltversion_STRING}
)
endif (ltversion_STRING)
# assume that we are in cmake/Modules, and that the template have been
# put in cmake/Templates. we cannot use CMAKE_CURRENT_LIST_DIR because
# this is in a function, and we cannot know who's calling us
set (templ_dir "${OPM_MACROS_ROOT}/cmake/Templates")
# only write an .la if libtool is found; otherwise we have no use
# for it.
if (ltversion)
set (la_file "lib${target}.la")
message (STATUS "Writing libtool archive for ${target}")
configure_file (
${templ_dir}/la.in
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${la_file}
@ONLY@
)
else (ltversion)
set (la_file "")
endif (ltversion)
# return this variable to the caller
if (ARGV2)
set (${ARGV2} "${la_file}" PARENT_SCOPE)
endif (ARGV2)
endfunction (configure_la target)

View File

@@ -1,5 +1,38 @@
# - Helper routines for opm-core like projects
include (LibtoolArchives) # linker_cmdline
# convert a list back to a command-line string
function (unseparate_args var_name prefix value)
separate_arguments (value)
foreach (item IN LISTS value)
set (prefixed_item "${prefix}${item}")
if (${var_name})
set (${var_name} "${${var_name}} ${prefixed_item}")
else (${var_name})
set (${var_name} "${prefixed_item}")
endif (${var_name})
endforeach (item)
set (${var_name} "${${var_name}}" PARENT_SCOPE)
endfunction (unseparate_args var_name prefix value)
# wrapper to set variables in pkg-config file
function (configure_pc_file name source dest prefix libdir includedir)
# escape set of standard strings
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}")
unseparate_args (defs "" "${${name}_DEFINITIONS}")
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES})
# necessary to make these variables visible to configure_file
set (name "${${name}_NAME}")
set (description "${${name}_DESCRIPTION}")
set (major "${${name}_VERSION_MAJOR}")
set (minor "${${name}_VERSION_MINOR}")
set (target "${${name}_LIBRARY}")
linker_cmdline (STRING INTO target from ${target})
configure_file (${source} ${dest} @ONLY)
endfunction (configure_pc_file name source dist prefix libdir includedir)
function (configure_cmake_file name variant version)
# declarative list of the variable names that are used in the template
# and that must be defined in the project to be exported
@@ -58,6 +91,16 @@ function (opm_cmake_config name)
APPEND "${${name}_CONFIG_VARS}"
)
# config-mode .pc file; use this to find the build tree
configure_pc_file (
${name}
${template_dir}/opm-project.pc.in
${PROJECT_BINARY_DIR}/${${name}_NAME}.pc
${PROJECT_BINARY_DIR}
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
${PROJECT_SOURCE_DIR}
)
# The next replace will result in bogus entries if install directory is
# a subdirectory of source tree,
# and we have existing entries pointing to that install directory.
@@ -111,4 +154,28 @@ function (opm_cmake_config name)
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-config-version.cmake
DESTINATION share/cmake${${name}_VER_DIR}/${${name}_NAME}
)
# find-mode .pc file; use this to locate system installation
configure_pc_file (
${name}
${template_dir}/opm-project.pc.in
${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
${CMAKE_INSTALL_PREFIX}
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${${name}_VER_DIR}
${CMAKE_INSTALL_PREFIX}/include${${name}_VER_DIR}
)
# put this in the right system location; if we have binaries then it
# should go in the arch-specific lib/ directory, otherwise use the
# common/noarch lib/ directory (these targets come from UseMultiArch)
if (${name}_TARGET)
set (_pkg_dir ${CMAKE_INSTALL_LIBDIR})
else ()
set (_pkg_dir lib)
endif ()
install (
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
DESTINATION ${CMAKE_INSTALL_PREFIX}/${_pkg_dir}/pkgconfig${${name}_VER_DIR}/
RENAME ${${name}_NAME}.pc
)
endfunction (opm_cmake_config name)

View File

@@ -0,0 +1,103 @@
####################################################################
# #
# Setup static targets for all submodules. #
# Useful when building a static benchmark executable #
# #
####################################################################
# Macros
# Clone a git and build it statically
# If ARGN is specified installation is skipped, ARGN0 is
# a build-system target name and the rest of ARGN are build tool parameters
function(opm_from_git repo name revision)
if(ARGN)
list(GET ARGN 0 target)
list(REMOVE_AT ARGN 0)
# This is used for top build of benchmarks.
# Clones the local source tree and builds it against the static libraries,
# skipping the install step. Note that in pricinple URL instead of GIT_REPOSITORY
# could have been used, but externalproject cannot handle build directories
# which are a subdirectory of the source tree, and since that is typically the case
# we work-around by re-cloning the local git.
# The ommision of GIT_TAG ensures that we build the tip of the local git.
set(COMMANDS BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target ${target} -- ${ARGN}
GIT_TAG ${revision}
INSTALL_COMMAND)
else()
# This is used with "normal" static builds.
set(COMMANDS GIT_TAG ${revision})
endif()
externalproject_add(${name}-static
GIT_REPOSITORY ${repo}
PREFIX static/${name}
CONFIGURE_COMMAND PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/static/installed/lib/pkgconfig:${CMAKE_BINARY_DIR}/static/installed/${CMAKE_INSTALL_LIBDIR}/pkgconfig:$ENV{PKG_CONFIG_PATH}
${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/static/installed
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS=0
-DBUILD_TESTING=0 -DBUILD_EXAMPLES=0 <SOURCE_DIR>
-G ${CMAKE_GENERATOR}
${COMMANDS} "")
set_target_properties(${name}-static PROPERTIES EXCLUDE_FROM_ALL 1)
endfunction()
# Convenience macro for adding dependencies without having to include the -static all over
macro(opm_static_add_dependencies target)
foreach(arg ${ARGN})
add_dependencies(${target}-static ${arg}-static)
endforeach()
endmacro()
include(ExternalProject)
include(GNUInstallDirs)
# Defaults to building master
if(NOT OPM_BENCHMARK_VERSION)
set(OPM_BENCHMARK_VERSION "origin/master")
endif()
# ERT
externalproject_add(ert-static
GIT_REPOSITORY https://github.com/Ensembles/ert
PREFIX static/ert
GIT_TAG ${revision}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/static/installed
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS=0 <SOURCE_DIR>/devel)
set_target_properties(ert-static PROPERTIES EXCLUDE_FROM_ALL 1)
# 2015.04 release used dune v2.3.1
if(OPM_BENCHMARK_VERSION STREQUAL "release/2015.04/final")
set(DUNE_VERSION v2.3.1)
endif()
# Master currently uses dune v2.3.1
if(OPM_BENCHMARK_VERSION STREQUAL "origin/master")
set(DUNE_VERSION v2.3.1)
endif()
# Fallback
if(NOT DUNE_VERSION)
set(DUNE_VERSION v2.3.1)
endif()
# Dune
foreach(dune_repo dune-common dune-geometry dune-grid dune-istl)
opm_from_git(http://git.dune-project.org/repositories/${dune_repo} ${dune_repo} ${DUNE_VERSION})
endforeach()
opm_static_add_dependencies(dune-istl dune-common)
opm_static_add_dependencies(dune-geometry dune-common)
opm_static_add_dependencies(dune-grid dune-geometry)
# OPM
foreach(opm_repo opm-common opm-parser opm-core opm-output opm-grid opm-material
opm-upscaling)
opm_from_git(https://github.com/OPM/${opm_repo} ${opm_repo} ${OPM_BENCHMARK_VERSION})
endforeach()
opm_static_add_dependencies(opm-parser opm-common ert)
opm_static_add_dependencies(opm-core opm-parser dune-istl)
opm_static_add_dependencies(opm-grid opm-core dune-grid)
opm_static_add_dependencies(opm-material opm-core)
opm_static_add_dependencies(opm-upscaling opm-grid opm-material)

View File

@@ -0,0 +1,20 @@
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
# defines that must be present in config.h for our headers
set (opm-verteq_CONFIG_VAR
)
# dependencies
set (opm-verteq_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
# OPM dependency
"opm-common;
opm-core REQUIRED"
)

View File

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

View File

@@ -93,7 +93,7 @@ int main(int argc, char **argv)
if (argc > 6)
rs = atof(argv[6]);
const double MmNaCl = 58.44e-3; // molar mass of NaCl [kg/mol]
const double MmNaCl = 58e-3; // molar mass of NaCl [kg/mol]
// convert to mass fraction
std::vector<double> salinity = {0.0};
if (molality > 0.0)

View File

@@ -72,13 +72,13 @@ public:
void assign(const std::vector<T>& data);
void resize(size_t size);
void clear();
inline size_t size() const override;
inline virtual size_t size() const;
inline void set(size_t index, const T& val);
inline void setAll(const T& val);
inline void setConsecutive(const T& startVal);
inline const T& get(size_t index) const;
inline T val(size_t index) const override;
inline virtual T val(size_t index) const;
inline const T* ptr() const;
inline T* ptr();

View File

@@ -46,9 +46,7 @@ namespace cvf {
// User actions (interactive responses)
static const int USERACTION_CONTINUE = 0;
#ifdef WIN32
static const int USERACTION_DEBUGBREAK = 1;
#endif
static const int USERACTION_ABORT = 2;
@@ -81,7 +79,7 @@ public:
class AssertHandlerConsole : public AssertHandler
{
public:
Assert::FailAction handleAssert(const char* fileName, int lineNumber, const char* expr, const char* msg) override;
virtual Assert::FailAction handleAssert(const char* fileName, int lineNumber, const char* expr, const char* msg);
private:
static void reportToConsole(const char* fileName, int lineNumber, const char* expr, const char* msg);
@@ -272,7 +270,7 @@ void AssertHandlerConsole::winCreateConsoleAndRedirectIO(bool redirectInput)
class AssertHandlerWinDialog : public AssertHandler
{
public:
Assert::FailAction handleAssert(const char* fileName, int lineNumber, const char* expr, const char* msg) override;
virtual Assert::FailAction handleAssert(const char* fileName, int lineNumber, const char* expr, const char* msg);
private:
static int handleUsingDialog(const char* fileName, int lineNumber, const char* expr, const char* msg);

View File

@@ -112,7 +112,7 @@ public:
Color3f();
Color3f(float r, float g, float b);
Color3f(const Color3f& other);
explicit Color3f(ColorIdent colorIdent);
Color3f(ColorIdent colorIdent);
explicit Color3f(const Color3ub& other);
Color3f& operator=(const Color3f& rhs);
@@ -158,7 +158,7 @@ public:
Color3ub();
Color3ub(ubyte r, ubyte g, ubyte b);
Color3ub(const Color3ub& other);
explicit Color3ub(ColorIdent colorIdent);
Color3ub(ColorIdent colorIdent);
explicit Color3ub(const Color3f& other);
Color3ub& operator=(const Color3ub& rhs);

View File

@@ -60,7 +60,7 @@ public:
};
public:
explicit DebugTimer(const char* prefix, OperationMode operationMode = NORMAL);
DebugTimer(const char* prefix, OperationMode operationMode = NORMAL);
~DebugTimer();
void restart(const char* msg = NULL);

View File

@@ -52,7 +52,7 @@ class Flags
public:
inline Flags();
inline Flags(const Flags& other);
explicit inline Flags(FlagEnum flag);
inline Flags(FlagEnum flag);
inline Flags& operator=(const Flags& rhs);
inline Flags& operator=(FlagEnum flag);

View File

@@ -99,7 +99,7 @@ class ref
public:
ref(T* object = NULL);
ref(const ref& other);
template<typename T2> explicit ref(const ref<T2>& other);
template<typename T2> ref(const ref<T2>& other);
~ref();
ref& operator=(T* rhs);
@@ -150,7 +150,7 @@ class cref
public:
cref(const T* object = NULL);
cref(const cref& other);
template<typename T2> explicit cref(const cref<T2>& other);
template<typename T2> cref(const cref<T2>& other);
~cref();
cref& operator=(const T* rhs);

View File

@@ -374,7 +374,7 @@ bool Plane::intersect(const Plane& other, Vec3d* point, Vec3d* direction) const
CVF_ASSERT(point);
double invdet;
double invdet = UNDEFINED_DOUBLE;
Vec3d normal1 = this->normal();
Vec3d normal2 = other.normal();

View File

@@ -72,7 +72,7 @@ namespace cvf {
//--------------------------------------------------------------------------------------------------
/// Write debug text to console, DevStudio output window and file (future)
//--------------------------------------------------------------------------------------------------
void Trace::show(const String& message)
void Trace::show(String message)
{
showTraceOutput(message, true);
}
@@ -88,7 +88,7 @@ void Trace::show(const char* format, ...)
va_list argList;
va_start(argList, format);
constexpr int maxFormatLength = 4000;
const int maxFormatLength = 4000;
char temp[maxFormatLength + 1];
#ifdef WIN32
@@ -96,7 +96,7 @@ void Trace::show(const char* format, ...)
#elif defined(CVF_ANDROID)
__android_log_print(ANDROID_LOG_DEBUG, "CVF_TAG", format, argList);
#else
vsnprintf(temp, maxFormatLength, format, argList);
vsprintf(temp, format, argList);
#endif
va_end(argList);
@@ -124,7 +124,7 @@ void Trace::showFileLineNumber(const String& file, int line, const String& messa
//--------------------------------------------------------------------------------------------------
/// Show the trace output in console and DevStudio output window
//--------------------------------------------------------------------------------------------------
void Trace::showTraceOutput(const String& text, bool addNewLine)
void Trace::showTraceOutput(String text, bool addNewLine)
{
#ifdef WIN32
AllocConsole();

View File

@@ -51,12 +51,12 @@ namespace cvf {
class Trace
{
public:
static void show(const String& message);
static void show(String message);
static void show(const char* format, ...);
static void showFileLineNumber(const String& file, int line, const String& message);
private:
static void showTraceOutput(const String& text, bool addNewLine);
static void showTraceOutput(String text, bool addNewLine);
};

View File

@@ -22,6 +22,7 @@
//##################################################################################################
#include "cvfBase.h"
#include "cvfVector3.h"
namespace external {

View File

@@ -158,11 +158,6 @@ typedef Vector3<int> Vec3i; ///< A vector with int components
typedef Vector3<uint> Vec3ui; ///< A vector with uint components
typedef Vector3<size_t> Vec3st; ///< A vector with size_t components
template<> Vec3d const Vec3d::UNDEFINED;
template<> Vec3f const Vec3f::UNDEFINED;
template<> Vec3i const Vec3i::UNDEFINED;
template<> Vec3st const Vec3st::UNDEFINED;
}
} //namespace external
#include "cvfVector3.inl"

View File

@@ -491,7 +491,7 @@ inline void Vector4<S>::setZero()
template<typename S>
inline bool Vector4<S>::isZero() const
{
return (m_v[0] == 0) && (m_v[1] == 0) && (m_v[2] == 0) && (m_v[3] == 0);
return (m_v[0] == 0) && (m_v[1] == 0) && (m_v[2] == 0) && (m_v[2] == 0);
}

View File

@@ -243,6 +243,7 @@ int largestComponent(const cvf::Vec3d v)
if (v.z() > maxLength)
{
maxLength = v.z();
idx = 2;
}
@@ -786,11 +787,8 @@ void AABBTree::deleteInternalNodesBottomUp(AABBTreeNode* node)
auto internalNode = dynamic_cast<AABBTreeNodeInternal*>(node);
CVF_ASSERT(internalNode);
if (internalNode)
{
AABBTree::deleteInternalNodesBottomUp(internalNode->left());
AABBTree::deleteInternalNodesBottomUp(internalNode->right());
}
AABBTree::deleteInternalNodesBottomUp(internalNode->left());
AABBTree::deleteInternalNodesBottomUp(internalNode->right());
delete internalNode;
}

View File

@@ -283,8 +283,8 @@ bool Ray::boxIntersect(const BoundingBox& box, Vec3d* intersectionPoint) const
// Find candidate planes; this loop can be avoided if rays cast all from the eye(assume perpsective view)
bool inside = true;
char quadrant[3]{};
double candidatePlane[3] = {0.0, 0.0, 0.0};
char quadrant[3];
double candidatePlane[3];
Vec3d min = box.min();
Vec3d max = box.max();
@@ -320,13 +320,17 @@ bool Ray::boxIntersect(const BoundingBox& box, Vec3d* intersectionPoint) const
}
// Calculate T distances to candidate planes
double maxT[3]{-1.0f, -1.0f, -1.0f};
double maxT[3];
for (i = 0; i < 3; i++)
{
if (quadrant[i] != MIDDLE && m_direction[i] !=0.0f)
{
maxT[i] = (candidatePlane[i] - m_origin[i]) / m_direction[i];
}
else
{
maxT[i] = -1.0f;
}
}
// Get largest of the maxT's for final choice of intersection

View File

@@ -30,9 +30,9 @@ namespace external {
//--------------------------------------------------------------------------------------------------
RigWellPath::RigWellPath()
: cvf::Object()
, objectBeingDeleted( this )
, m_hasDatumElevation( false )
, m_datumElevation( 0.0 )
, objectBeingDeleted( this )
, m_uniqueStartIndex( 0u )
, m_uniqueEndIndex( std::numeric_limits<size_t>::max() )
{
@@ -43,13 +43,13 @@ RigWellPath::RigWellPath()
//--------------------------------------------------------------------------------------------------
RigWellPath::RigWellPath( const RigWellPath& rhs )
: cvf::Object()
, objectBeingDeleted( this )
, m_wellPathPoints( rhs.m_wellPathPoints )
, m_measuredDepths( rhs.m_measuredDepths )
, m_hasDatumElevation( rhs.m_hasDatumElevation )
, m_datumElevation( rhs.m_datumElevation )
, m_uniqueStartIndex( rhs.m_uniqueStartIndex )
, m_uniqueEndIndex( rhs.m_uniqueEndIndex )
, objectBeingDeleted( this )
{
CVF_ASSERT( m_wellPathPoints.size() == m_measuredDepths.size() );
}
@@ -59,12 +59,12 @@ RigWellPath::RigWellPath( const RigWellPath& rhs )
//--------------------------------------------------------------------------------------------------
RigWellPath::RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const std::vector<double>& measuredDepths )
: cvf::Object()
, objectBeingDeleted( this )
, m_wellPathPoints( wellPathPoints )
, m_measuredDepths( measuredDepths )
, m_hasDatumElevation( false )
, m_datumElevation( 0.0 )
, m_uniqueStartIndex( 0u )
, objectBeingDeleted( this )
, m_uniqueEndIndex( std::numeric_limits<size_t>::max() )
{
CVF_ASSERT( m_wellPathPoints.size() == m_measuredDepths.size() );

View File

@@ -166,7 +166,7 @@ bool HexGridIntersectionTools::planeTriangleIntersection( const cvf::Plane& plan
if ( onPosSide[2] ) topVx = 3;
// Case 3a: Two negative distances and the last is within tolerance of zero.
if ( topVx > 0 && sqrSignedDistances[topVx - 1] < sqrDistanceTolerance )
if ( sqrSignedDistances[topVx - 1] < sqrDistanceTolerance )
{
return false;
}
@@ -178,7 +178,7 @@ bool HexGridIntersectionTools::planeTriangleIntersection( const cvf::Plane& plan
if ( !onPosSide[2] ) topVx = 3;
// Case 3a: Two positive distances and the last is within tolerance of zero.
if ( topVx > 0 && sqrSignedDistances[topVx - 1] > -sqrDistanceTolerance )
if ( sqrSignedDistances[topVx - 1] > -sqrDistanceTolerance )
{
return false;
}
@@ -1084,7 +1084,7 @@ int HexGridIntersectionTools::planeHexIntersectionMC( const cvf::Plane& plane
}
cvf::Vec3d edgeIntersections[12];
double normDistAlongEdge[12]{};
double normDistAlongEdge[12];
// Compute vertex coordinates on the edges where we have intersections
if ( cubeIdxToCutEdgeBitfield[cubeIndex] & 1 )

View File

@@ -108,7 +108,7 @@ public:
using MemberCallbackAndActiveFlag = std::pair<MemberCallback, bool>;
public:
explicit Signal( const SignalEmitter* emitter )
Signal( const SignalEmitter* emitter )
: m_emitter( emitter )
{
m_emitter->addEmittedSignal( this );

View File

@@ -123,9 +123,9 @@ function build_module {
TESTTHREADS=${TESTTHREADS:-1}
if test -z "$CTEST_CONFIGURATION"
then
ctest -T Test --no-compress-output -j$TESTTHREADS -LE "gpu_.*"
ctest -T Test --no-compress-output -j$TESTTHREADS
else
ctest -j$TESTTHREADS -C $CTEST_CONFIGURATION --timeout 5000 -T Test --no-compress-output -LE "gpu_.*"
ctest -j$TESTTHREADS -C $CTEST_CONFIGURATION --timeout 5000 -T Test --no-compress-output
fi
# Convert to junit format

View File

@@ -45,10 +45,7 @@ private:
void run_step(WellTestState& wtest_state, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, EclipseIO& io);
void run_step(WellTestState& wtest_state, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io);
void output(const WellTestState& wtest_state, const UDQState& udq_state,
size_t report_step, bool substep, double seconds_elapsed,
const data::Solution& sol, const data::Wells& well_data,
const data::GroupAndNetworkValues& group_data, EclipseIO& io);
void output(WellTestState& wtest_state, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_data, EclipseIO& io);
void simulate(data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double seconds_elapsed, double time_step);
EclipseState state;

View File

@@ -33,6 +33,7 @@
#include <opm/input/eclipse/Schedule/Action/SimulatorUpdate.hpp>
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
#include <opm/input/eclipse/Schedule/UDQ/UDQConfig.hpp>
#include <opm/input/eclipse/Schedule/Well/PAvgCalculatorCollection.hpp>
#include <opm/input/eclipse/Schedule/Well/Well.hpp>
#include <opm/input/eclipse/Schedule/Well/WellMatcher.hpp>
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
@@ -121,19 +122,13 @@ void msim::run_step(WellTestState& wtest_state, UDQState& udq_state, data::Solut
report_step,
seconds_elapsed,
well_data,
/* wbp = */ {},
group_nwrk_data,
/* sing_values = */ {},
/* initial_inplace = */ {},
/* inplace = */ {});
{},
{},
{},
{});
this->schedule.getUDQConfig(report_step - 1)
.eval(report_step,
this->schedule,
this->schedule.wellMatcher(report_step),
this->schedule.segmentMatcherFactory(report_step),
this->st,
udq_state);
this->schedule.getUDQConfig( report_step ).eval(report_step, schedule.wellMatcher(report_step), this->st, udq_state);
this->output(wtest_state,
udq_state,
@@ -149,10 +144,7 @@ void msim::run_step(WellTestState& wtest_state, UDQState& udq_state, data::Solut
void msim::output(const WellTestState& wtest_state, const UDQState& udq_state,
size_t report_step, bool substep, double seconds_elapsed,
const data::Solution& sol, const data::Wells& well_data,
const data::GroupAndNetworkValues& group_nwrk_data, EclipseIO& io) {
void msim::output(WellTestState& wtest_state, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_nwrk_data, EclipseIO& io) {
RestartValue value(sol, well_data, group_nwrk_data, {});
io.writeTimeStep(this->action_state,
wtest_state,

View File

@@ -66,13 +66,6 @@ public:
: NumericalProblem(message)
{}
};
class TimeSteppingBreakdown : public NumericalProblem
{
public:
explicit TimeSteppingBreakdown(const std::string &message)
: NumericalProblem(message)
{}
};
}
#endif // OPM_EXCEPTIONS_HPP

View File

@@ -19,27 +19,8 @@
#ifndef OPM_TIMINGMACROS_HPP
#define OPM_TIMINGMACROS_HPP
// This file defines macros
// OPM_TIMEBLOCK - time block of main part of codes which do not effect performance
// OPM_TIMEFUNCTION - time block of main part of codes which do not effect performance with name from function
// OPM_TIMEBLOCK_LOCAL - detailed timing which may effect performance
// OPM_TIMEFUNCTION_LOCAL - detailed timing which may effect performance with name from function
#ifndef DETAILED_PROFILING
#define DETAILED_PROFILING 0 // set to 1 to enable invasive profiling
#endif
#if USE_TRACY
#define TRACY_ENABLE 1
#include <tracy/Tracy.hpp>
#define OPM_TIMEBLOCK(blockname) ZoneNamedN(blockname, #blockname, true)
#define OPM_TIMEFUNCTION() ZoneNamedN(myname, __func__, true)
#if DETAILED_PROFILING
#define OPM_TIMEBLOCK_LOCAL(blockname) ZoneNamedN(blockname, #blockname, true)
#define OPM_TIMEFUNCTION_LOCAL() ZoneNamedN(myname, __func__, true)
#endif
#endif
// macros used to time blocks for example with tracy
// time block of main part of codes which do not effect performance
#ifndef OPM_TIMEBLOCK
#define OPM_TIMEBLOCK(x)\
do { /* nothing */ } while (false)
@@ -51,14 +32,4 @@
do { /* nothing */ } while (false)
#endif
#ifndef OPM_TIMEFUNCTION
#define OPM_TIMEFUNCTION()\
do { /* nothing */ } while (false)
#endif
#ifndef OPM_TIMEFUNCTION_LOCAL
#define OPM_TIMEFUNCTION_LOCAL()\
do { /* nothing */ } while (false)
#endif
#endif // OPM_TIMINGMACROS_HPP

View File

@@ -20,12 +20,11 @@
#ifndef COMMON_UTIL_NUMERIC_CMP
#define COMMON_UTIL_NUMERIC_CMP
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstring>
#include <type_traits>
#include <vector>
#include <type_traits>
#include <cmath>
#include <algorithm>
namespace Opm {
@@ -110,7 +109,7 @@ namespace Opm {
template<typename T>
bool array_equal(const T* p1, const T* p2, size_t num_elements, T abs_eps, T rel_eps) {
if (std::memcmp(p1 , p2 , num_elements * sizeof * p1) == 0)
if (memcmp(p1 , p2 , num_elements * sizeof * p1) == 0)
return true;
else {
size_t index;

View File

@@ -52,7 +52,7 @@ namespace Opm {
/// @brief
/// @todo Doc me!
/// @return
std::string getTag() const override { return ID_xmltag__param; }
virtual std::string getTag() const {return ID_xmltag__param;}
/// @brief
/// @todo Doc me!
/// @param

View File

@@ -93,7 +93,7 @@ namespace Opm {
// From ParameterMapItem
virtual ~ParameterGroup();
std::string getTag() const override;
virtual std::string getTag() const;
/// \brief A constructor typically used to initialize a
/// ParameterGroup from command-line arguments.

View File

@@ -34,7 +34,7 @@ namespace Opm {
typedef std::vector< DeckItem >::const_iterator const_iterator;
DeckRecord() = default;
explicit DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
static DeckRecord serializationTestObject();

View File

@@ -27,7 +27,6 @@
namespace Opm {
class Deck;
class ErrorGuard;
enum class Section {
RUNSPEC,
@@ -64,7 +63,6 @@ class DeckSection : public DeckView {
// the right order
static bool checkSectionTopology(const Deck& deck,
const Parser&,
ErrorGuard& errorGuard,
bool ensureKeywordSectionAffiliation = false);

View File

@@ -38,7 +38,7 @@ namespace Opm {
class DeckTree {
public:
DeckTree() = default;
explicit DeckTree(const std::string&);
DeckTree(const std::string&);
const std::string& parent(const std::string& fname) const;
bool includes(const std::string& parent_file, const std::string& include_file) const;

View File

@@ -33,7 +33,7 @@ public:
struct Iterator : public storage_type::iterator {
explicit Iterator(storage_type::const_iterator inner_iter) :
Iterator(storage_type::const_iterator inner_iter) :
inner(inner_iter)
{}

View File

@@ -124,7 +124,7 @@ namespace Opm {
AquiferCT() = default;
AquiferCT(const TableManager& tables, const Deck& deck);
explicit AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
void loadFromRestart(const RestartIO::RstAquifer& rst,
const TableManager& tables);

View File

@@ -20,15 +20,13 @@
#ifndef OPM_NUMERICALAQUIFERS_HPP
#define OPM_NUMERICALAQUIFERS_HPP
#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/SingleNumericalAquifer.hpp>
#include <cstddef>
#include <map>
#include <unordered_map>
#include <vector>
#include <stddef.h>
#include <opm/input/eclipse/EclipseState/Aquifer/NumericalAquifer/SingleNumericalAquifer.hpp>
namespace Opm {
class Deck;
class EclipseGrid;
@@ -48,7 +46,6 @@ namespace Opm {
bool operator==(const NumericalAquifers& other) const;
std::unordered_map<size_t, const NumericalAquiferCell*> allAquiferCells() const;
std::vector<std::size_t> allAquiferCellIds() const;
std::unordered_map<size_t, double> aquiferCellVolumes() const;

View File

@@ -28,13 +28,11 @@
#include <opm/input/eclipse/EclipseState/EclipseConfig.hpp>
#include <opm/input/eclipse/EclipseState/TracerConfig.hpp>
#include <opm/input/eclipse/EclipseState/MICPpara.hpp>
#include <opm/input/eclipse/EclipseState/WagHysteresisConfig.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FaultCollection.hpp>
#include <opm/input/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/input/eclipse/EclipseState/Grid/TransMult.hpp>
#include <opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
@@ -96,9 +94,6 @@ namespace Opm {
const EclipseConfig& cfg() const;
const GridDims& gridDims() const;
const LgrCollection& getLgrs() const;
bool hasInputLGR() const;
// the unit system used by the deck. note that it is rarely needed
// to convert units because internally to opm-parser everything is
// represented by SI units.
@@ -113,7 +108,6 @@ namespace Opm {
const AquiferConfig& aquifer() const;
const TracerConfig& tracer() const;
const MICPpara& getMICPpara() const;
const WagHysteresisConfig& getWagHysteresis() const;
void reset_actnum(const std::vector<int>& new_actnum);
void pruneDeactivatedAquiferConnections(const std::vector<std::size_t>& deactivated_cells);
@@ -135,7 +129,6 @@ namespace Opm {
serializer(m_deckUnitSystem);
serializer(m_inputNnc);
serializer(m_gridDims);
serializer(m_lgrs);
serializer(m_simulationConfig);
serializer(aquifer_config);
serializer(m_transMult);
@@ -143,7 +136,6 @@ namespace Opm {
serializer(m_title);
serializer(tracer_config);
serializer(m_micppara);
serializer(wag_hyst_config);
}
static bool rst_cmp(const EclipseState& full_state, const EclipseState& rst_state);
@@ -153,13 +145,12 @@ namespace Opm {
void initIOConfigPostSchedule(const Deck& deck);
void assignRunTitle(const Deck& deck);
void reportNumberOfActivePhases() const;
void initLgrs(const Deck& deck);
void conveyNumericalAquiferEffects();
void applyMULTXYZ();
void initFaults(const Deck& deck);
void initPara(const Deck& deck);
void setMULTFLT(const Opm::DeckSection& section, bool edit = false);
void setMULTFLT(const Opm::DeckSection& section);
void complainAboutAmbiguousKeyword(const Deck& deck,
const std::string& keywordName);
@@ -173,13 +164,11 @@ namespace Opm {
NNC m_inputNnc;
GridDims m_gridDims;
FieldPropsManager field_props;
LgrCollection m_lgrs;
SimulationConfig m_simulationConfig;
AquiferConfig aquifer_config;
TransMult m_transMult;
TracerConfig tracer_config;
MICPpara m_micppara;
WagHysteresisConfig wag_hyst_config;
std::string m_title{};
FaultCollection m_faults{};

View File

@@ -55,7 +55,6 @@ namespace Opm
{}
};
Carfin() = default;
explicit Carfin(const GridDims& gridDims,
IsActive isActive,
@@ -94,15 +93,6 @@ namespace Opm
int NY() const;
int NZ() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_dims);
serializer(m_offset);
serializer(m_end_offset);
serializer(name_grid);
}
private:
GridDims m_globalGridDims_{};
IsActive m_globalIsActive_{};

View File

@@ -31,7 +31,6 @@
#include <stdexcept>
#include <unordered_set>
#include <vector>
#include <map>
namespace Opm {
@@ -65,8 +64,7 @@ namespace Opm {
EclipseGrid(const EclipseGrid& src, const double* zcorn, const std::vector<int>& actnum);
EclipseGrid(size_t nx, size_t ny, size_t nz,
double dx = 1.0, double dy = 1.0, double dz = 1.0,
double top = 0.0);
double dx = 1.0, double dy = 1.0, double dz = 1.0);
explicit EclipseGrid(const GridDims& gd);
EclipseGrid(const std::array<int, 3>& dims ,
@@ -77,7 +75,7 @@ namespace Opm {
/// EclipseGrid ignores ACTNUM in Deck, and therefore needs ACTNUM
/// explicitly. If a null pointer is passed, every cell is active.
explicit EclipseGrid(const Deck& deck, const int * actnum = nullptr);
EclipseGrid(const Deck& deck, const int * actnum = nullptr);
static bool hasGDFILE(const Deck& deck);
static bool hasCylindricalKeywords(const Deck& deck);
@@ -256,15 +254,12 @@ namespace Opm {
std::vector<int> m_global_to_active;
// Numerical aquifer cells, needs to be active
std::unordered_set<size_t> m_aquifer_cells;
// Keep track of aquifer cell depths
std::map<size_t, double> m_aquifer_cell_depths;
// Radial grids need this for volume calculations.
std::optional<std::vector<double>> m_thetav;
std::optional<std::vector<double>> m_rv;
void updateNumericalAquiferCells(const Deck&);
double computeCellGeometricDepth(size_t globalIndex) const;
void initGridFromEGridFile(Opm::EclIO::EclFile& egridfile, std::string fileName);
void resetACTNUM( const int* actnum);

View File

@@ -19,33 +19,23 @@
#ifndef FIELDPROPS_HPP
#define FIELDPROPS_HPP
#include <opm/input/eclipse/EclipseState/Grid/Box.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FieldData.hpp>
#include <opm/input/eclipse/EclipseState/Grid/Keywords.hpp>
#include <opm/input/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp>
#include <opm/input/eclipse/EclipseState/Grid/TranCalculator.hpp>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/input/eclipse/Deck/DeckSection.hpp>
#include <opm/input/eclipse/Deck/value_status.hpp>
#include <cstddef>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <opm/input/eclipse/Deck/value_status.hpp>
#include <opm/input/eclipse/Deck/DeckSection.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/input/eclipse/EclipseState/Grid/Box.hpp>
#include <opm/input/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/input/eclipse/EclipseState/Grid/Keywords.hpp>
#include <opm/input/eclipse/EclipseState/Grid/TranCalculator.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FieldData.hpp>
namespace Opm {
class Deck;
@@ -147,12 +137,6 @@ static const std::unordered_map<std::string, keyword_info<double>> double_keywor
{"THCOIL", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
{"THCGAS", keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
{"THCWATER",keyword_info<double>{}.unit_string("Energy/AbsoluteTemperature*Length*Time")},
{"YMODULE", keyword_info<double>{}.unit_string("Giga*Pascal")},
{"PRATIO", keyword_info<double>{}.unit_string("1")},
{"BIOTCOEF", keyword_info<double>{}.unit_string("1")},
{"POELCOEF", keyword_info<double>{}.unit_string("1")},
{"THERMEXR", keyword_info<double>{}.unit_string("1/AbsoluteTemperature")},
{"THELCOEF", keyword_info<double>{}.unit_string("Pressure/AbsoluteTemperature")},
{"MULTX", keyword_info<double>{}.init(1.0).mult(true)},
{"MULTX-", keyword_info<double>{}.init(1.0).mult(true)},
{"MULTY", keyword_info<double>{}.init(1.0).mult(true)},
@@ -191,11 +175,7 @@ static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {
}
namespace PROPS {
static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"SWATINIT", keyword_info<double>{}},
{"PCG", keyword_info<double>{}.unit_string("Pressure")},
{"IPCG", keyword_info<double>{}.unit_string("Pressure")},
{"PCW", keyword_info<double>{}.unit_string("Pressure")},
{"IPCW", keyword_info<double>{}.unit_string("Pressure")}};
static const std::unordered_map<std::string, keyword_info<double>> double_keywords = {{"SWATINIT", keyword_info<double>{}}};
static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {};
#define dirfunc(base) base, base "X", base "X-", base "Y", base "Y-", base "Z", base "Z-"
@@ -217,6 +197,10 @@ static const std::set<std::string> satfunc = {"SWLPC", "ISWLPC", "SGLPC", "ISGLP
dirfunc("ISOGCR"),
dirfunc("SWCR"),
dirfunc("ISWCR"),
dirfunc("PCW"),
dirfunc("IPCW"),
dirfunc("PCG"),
dirfunc("IPCG"),
dirfunc("KRW"),
dirfunc("IKRW"),
dirfunc("KRWR"),
@@ -232,7 +216,21 @@ static const std::set<std::string> satfunc = {"SWLPC", "ISWLPC", "SGLPC", "ISGLP
dirfunc("KRGR"),
dirfunc("IKRGR")};
#undef dirfunc
static const std::map<std::string,std::string> sogcr_shift = {{"SOGCR", "SWL"},
{"SOGCRX", "SWLX"},
{"SOGCRX-", "SWLX-"},
{"SOGCRY", "SWLY"},
{"SOGCRY-", "SWLY-"},
{"SOGCRZ", "SWLZ"},
{"SOGCRZ-", "SWLZ-"},
{"ISOGCR", "ISWL"},
{"ISOGCRX", "ISWLX"},
{"ISOGCRX-", "ISWLX-"},
{"ISOGCRY", "ISWLY"},
{"ISOGCRY-", "ISWLY-"},
{"ISOGCRZ", "ISWLZ"},
{"ISOGCRZ-", "ISWLZ-"}};
}
namespace REGIONS {
@@ -242,7 +240,6 @@ static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {
{"FIPNUM", keyword_info<int>{}.init(1)},
{"IMBNUM", keyword_info<int>{}.init(1)},
{"OPERNUM", keyword_info<int>{}},
{"STRESSEQUILNUM", keyword_info<int>{}.init(1)},
{"MISCNUM", keyword_info<int>{}},
{"MISCNUM", keyword_info<int>{}},
{"PVTNUM", keyword_info<int>{}.init(1)},
@@ -297,7 +294,6 @@ static const std::unordered_map<std::string, keyword_info<int>> int_keywords = {
template <typename T>
keyword_info<T> global_kw_info(const std::string& name, bool allow_unsupported = false);
bool is_oper_keyword(const std::string& name);
} // end namespace keywords
} // end namespace FieldProps
@@ -327,6 +323,8 @@ public:
}
};
enum class GetStatus {
OK = 1,
INVALID_DATA = 2, // std::runtime_error
@@ -334,6 +332,8 @@ public:
NOT_SUPPPORTED_KEYWORD = 4 // std::logic_error
};
template<typename T>
struct FieldDataManager {
const std::string& keyword;
@@ -384,9 +384,10 @@ public:
};
/// Normal constructor for FieldProps.
FieldProps(const Deck& deck, const Phases& phases, const EclipseGrid& grid, const TableManager& table_arg);
/// Special case constructor used to process ACTNUM only.
FieldProps(const Deck& deck, const EclipseGrid& grid);
@@ -408,121 +409,102 @@ public:
template <typename T>
std::vector<std::string> keys() const;
template <typename T>
FieldDataManager<T>
try_get(const std::string& keyword, const bool allow_unsupported = false)
{
if (!allow_unsupported && !FieldProps::template supported<T>(keyword)) {
return { keyword, GetStatus::NOT_SUPPPORTED_KEYWORD, nullptr };
FieldDataManager<T> try_get(const std::string& keyword,
bool allow_unsupported=false) {
if (!allow_unsupported && !FieldProps::supported<T>(keyword))
return FieldDataManager<T>(keyword, GetStatus::NOT_SUPPPORTED_KEYWORD, nullptr);
const Fieldprops::FieldData<T> * field_data;
bool has0 = this->has<T>(keyword);
field_data = std::addressof(this->init_get<T>(keyword,
std::is_same<T,double>::value && allow_unsupported));
if (field_data->valid() || allow_unsupported)
return FieldDataManager<T>(keyword, GetStatus::OK, field_data);
if (!has0) {
this->erase<T>(keyword);
return FieldDataManager<T>(keyword, GetStatus::MISSING_KEYWORD, nullptr);
}
const auto has0 = this->template has<T>(keyword);
return FieldDataManager<T>(keyword, GetStatus::INVALID_DATA, nullptr);
}
const auto& field_data =
this->template init_get<T>(keyword, std::is_same<T,double>::value && allow_unsupported);
if (field_data.valid() || allow_unsupported) {
// Note: FieldDataManager depends on init_get<>() producing a
// long-lived FieldData instance.
return { keyword, GetStatus::OK, &field_data };
}
if (! has0) {
this->template erase<T>(keyword);
return { keyword, GetStatus::MISSING_KEYWORD, nullptr };
}
return { keyword, GetStatus::INVALID_DATA, nullptr };
template <typename T>
const std::vector<T>& get(const std::string& keyword) {
const auto& data = this->try_get<T>(keyword);
return data.data();
}
template <typename T>
const std::vector<T>& get(const std::string& keyword)
{
return this->template try_get<T>(keyword).data();
}
template <typename T>
std::vector<T> get_global(const std::string& keyword)
{
const auto managed_field_data = this->template try_get<T>(keyword);
std::vector<T> get_global(const std::string& keyword) {
const auto& managed_field_data = this->try_get<T>(keyword);
const auto& field_data = managed_field_data.field_data();
const auto& kw_info = Fieldprops::keywords::
template global_kw_info<T>(keyword);
return kw_info.global
? *field_data.global_data
: this->global_copy(field_data.data, kw_info.scalar_init);
const auto& kw_info = Fieldprops::keywords::global_kw_info<T>(keyword);
if (kw_info.global)
return *field_data.global_data;
else
return this->global_copy(field_data.data, kw_info.scalar_init);
}
template <typename T>
std::vector<T> get_copy(const std::string& keyword, bool global)
{
const auto has0 = this->template has<T>(keyword);
// Recall: FieldDataManager::field_data() will throw various
// exception types if the 'status' is anything other than 'OK'.
//
// Get_copy() depends on this behaviour to not proceed to extracting
// values in such cases. In other words, get_copy() uses exceptions
// for control flow, and we cannot move this try_get() call into the
// 'has0' branch even though the actual 'field_data' object returned
// from try_get() is only needed/used there.
const auto& field_data = this->template try_get<T>(keyword).field_data();
template <typename T>
std::vector<T> get_copy(const std::string& keyword, bool global) {
bool has0 = this->has<T>(keyword);
const auto& field_data = this->try_get<T>(keyword).field_data();
if (has0) {
return this->get_copy(field_data.data, field_data.kw_info.scalar_init, global);
if (global)
return this->global_copy(field_data.data, field_data.kw_info.scalar_init);
else
return field_data.data;
} else {
if (global) {
const auto& kw_info = Fieldprops::keywords::global_kw_info<T>(keyword);
return this->global_copy(this->extract<T>(keyword), kw_info.scalar_init);
} else
return this->extract<T>(keyword);
}
const auto initial_value = Fieldprops::keywords::
template global_kw_info<T>(keyword).scalar_init;
return this->get_copy(this->template extract<T>(keyword), initial_value, global);
}
template <typename T>
std::vector<bool> defaulted(const std::string& keyword)
{
const auto& field = this->template init_get<T>(keyword);
std::vector<bool> defaulted(const std::string& keyword) {
const auto& field = this->init_get<T>(keyword);
std::vector<bool> def(field.size());
for (std::size_t i = 0; i < def.size(); ++i) {
def[i] = value::defaulted(field.value_status[i]);
}
for (std::size_t i=0; i < def.size(); i++)
def[i] = value::defaulted( field.value_status[i]);
return def;
}
template <typename T>
std::vector<T> global_copy(const std::vector<T>& data,
const std::optional<T>& default_value) const
{
const T fill_value = default_value.has_value() ? *default_value : 0;
std::vector<T> global_copy(const std::vector<T>& data, const std::optional<T>& default_value) const {
T fill_value = default_value.has_value() ? *default_value : 0;
std::vector<T> global_data(this->global_size, fill_value);
std::size_t i = 0;
for (std::size_t g = 0; g < this->global_size; g++) {
if (this->m_actnum[g]) {
global_data[g] = data[i];
++i;
i++;
}
}
return global_data;
}
std::size_t active_size;
std::size_t global_size;
std::size_t num_int() const
{
std::size_t num_int() const {
return this->int_data.size();
}
std::size_t num_double() const
{
std::size_t num_double() const {
return this->double_data.size();
}
@@ -552,22 +534,6 @@ private:
template <typename T>
std::vector<T> extract(const std::string& keyword);
template <typename T>
std::vector<T> get_copy(const std::vector<T>& x,
const std::optional<T>& initial_value,
const bool global) const
{
return (! global) ? x : this->global_copy(x, initial_value);
}
template <typename T>
std::vector<T> get_copy(std::vector<T>&& x,
const std::optional<T>& initial_value,
const bool global) const
{
return (! global) ? std::move(x) : this->global_copy(x, initial_value);
}
template <typename T>
void operate(const DeckRecord& record, Fieldprops::FieldData<T>& target_data, const Fieldprops::FieldData<T>& src_data, const std::vector<Box::cell_index>& index_list);
@@ -597,8 +563,6 @@ private:
void init_satfunc(const std::string& keyword, Fieldprops::FieldData<double>& satfunc);
void init_porv(Fieldprops::FieldData<double>& porv);
void init_tempi(Fieldprops::FieldData<double>& tempi);
std::string canonical_fipreg_name(const std::string& fipreg);
const std::string& canonical_fipreg_name(const std::string& fipreg) const;
const UnitSystem unit_system;
std::size_t nx,ny,nz;
@@ -614,7 +578,6 @@ private:
std::vector<MultregpRecord> multregp;
std::unordered_map<std::string, Fieldprops::FieldData<int>> int_data;
std::unordered_map<std::string, Fieldprops::FieldData<double>> double_data;
std::unordered_map<std::string, std::string> fipreg_shortname_translation{};
std::unordered_map<std::string,Fieldprops::TranCalculator> tran;
};

View File

@@ -69,7 +69,6 @@ public:
bool operator==(const FieldPropsManager& other) const;
static bool rst_cmp(const FieldPropsManager& full_arg, const FieldPropsManager& rst_arg);
/*
Because the FieldProps class can autocreate properties the semantics of
get() and has() is slightly non intuitve:
@@ -137,8 +136,8 @@ public:
contain said keyword, or if the keyword has not been fully initialized. If
you ask for a totally unknown keyword the method will return nullptr.
*/
template <typename T>
const std::vector<T>* try_get(const std::string& keyword) const;
template <typename T> const std::vector<T>* try_get(const
std::string& keyword) const;
/*
You can ask whether the elements in the keyword have a default value -

View File

@@ -1,65 +0,0 @@
/*
Copyright (C) 2023 Equinor
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_PARSER_LGR_COLLECTION_HPP
#define OPM_PARSER_LGR_COLLECTION_HPP
#include <string>
#include <opm/input/eclipse/EclipseState/Util/OrderedMap.hpp>
#include <opm/input/eclipse/EclipseState/Grid/CarfinManager.hpp>
#include <opm/input/eclipse/EclipseState/Grid/Carfin.hpp>
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
namespace Opm {
class DeckRecord;
class GridDims;
class GRIDSection;
class LgrCollection {
public:
LgrCollection();
LgrCollection(const GRIDSection& gridSection, const EclipseGrid& grid);
static LgrCollection serializationTestObject();
explicit LgrCollection(const Deck& deck);
size_t size() const;
bool hasLgr(const std::string& lgrName) const;
Carfin& getLgr(const std::string& lgrName);
const Carfin& getLgr(const std::string& lgrName) const;
Carfin& getLgr(size_t lgrIndex);
const Carfin& getLgr(size_t lgrIndex) const;
void addLgr(const EclipseGrid& grid, const DeckRecord& lgrRecord);
bool operator==(const LgrCollection& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_lgrs);
}
private:
OrderedMap<Carfin, 8> m_lgrs;
};
}
#endif // OPM_PARSER_LGR_COLLECTION_HPP

View File

@@ -17,31 +17,23 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_PARSER_MULTREGTSCANNER_HPP
#define OPM_PARSER_MULTREGTSCANNER_HPP
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <cstddef>
#include <map>
#include <string>
#include <utility>
#include <vector>
namespace Opm {
class DeckRecord;
class DeckKeyword;
class FieldPropsManager;
} // namespace Opm
namespace Opm {
class GridDims;
namespace MULTREGT {
enum class NNCBehaviourEnum
{
enum NNCBehaviourEnum {
NNC = 1,
NONNC = 2,
ALL = 3,
@@ -50,10 +42,12 @@ namespace Opm {
std::string RegionNameFromDeckValue(const std::string& stringValue);
NNCBehaviourEnum NNCBehaviourFromString(const std::string& stringValue);
} // namespace MULTREGT
}
struct MULTREGTRecord
{
struct MULTREGTRecord {
int src_value;
int target_value;
double trans_mult;
@@ -61,15 +55,13 @@ namespace Opm {
MULTREGT::NNCBehaviourEnum nnc_behaviour;
std::string region_name;
bool operator==(const MULTREGTRecord& data) const
{
return (src_value == data.src_value)
&& (target_value == data.target_value)
&& (trans_mult == data.trans_mult)
&& (directions == data.directions)
&& (nnc_behaviour == data.nnc_behaviour)
&& (region_name == data.region_name)
;
bool operator==(const MULTREGTRecord& data) const {
return src_value == data.src_value &&
target_value == data.target_value &&
trans_mult == data.trans_mult &&
directions == data.directions &&
nnc_behaviour == data.nnc_behaviour &&
region_name == data.region_name;
}
template<class Serializer>
@@ -84,62 +76,58 @@ namespace Opm {
}
};
class MULTREGTScanner
{
typedef std::map< std::pair<int , int> , const MULTREGTRecord * > MULTREGTSearchMap;
typedef std::tuple<size_t , FaceDir::DirEnum , double> MULTREGTConnection;
class MULTREGTScanner {
public:
using ExternalSearchMap = std::map<std::string, std::map<std::pair<int,int>, int>>;
MULTREGTScanner() = default;
MULTREGTScanner(const MULTREGTScanner& data);
MULTREGTScanner(const GridDims& grid,
const FieldPropsManager* fp_arg,
const std::vector<const DeckKeyword*>& keywords);
const std::vector< const DeckKeyword* >& keywords);
static MULTREGTScanner serializationTestObject();
double getRegionMultiplier(size_t globalCellIdx1, size_t globalCellIdx2, FaceDir::DirEnum faceDir) const;
bool operator==(const MULTREGTScanner& data) const;
MULTREGTScanner& operator=(const MULTREGTScanner& data);
void applyNumericalAquifer(const std::vector<std::size_t>& aquifer_cells);
double getRegionMultiplier(std::size_t globalCellIdx1,
std::size_t globalCellIdx2,
FaceDir::DirEnum faceDir) const;
double getRegionMultiplierNNC(std::size_t globalCellIdx1,
std::size_t globalCellIdx2) const;
template <class Serializer>
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(gridDims);
serializer(nx);
serializer(ny);
serializer(nz);
serializer(m_records);
serializer(m_searchMap);
ExternalSearchMap searchMap = getSearchMap();
serializer(searchMap);
if (m_searchMap.empty())
constructSearchMap(searchMap);
serializer(regions);
serializer(aquifer_cells);
serializer(default_region);
}
private:
using MULTREGTSearchMap = std::map<
std::pair<int, int>,
std::vector<MULTREGTRecord>::size_type
>;
ExternalSearchMap getSearchMap() const;
void constructSearchMap(const ExternalSearchMap& searchMap);
GridDims gridDims{};
const FieldPropsManager* fp{nullptr};
std::vector<MULTREGTRecord> m_records{};
std::map<std::string, MULTREGTSearchMap> m_searchMap{};
std::map<std::string, std::vector<int>> regions{};
std::vector<std::size_t> aquifer_cells{};
void addKeyword(const DeckKeyword& deckKeyword);
void addKeyword( const DeckKeyword& deckKeyword, const std::string& defaultRegion);
void assertKeywordSupported(const DeckKeyword& deckKeyword);
bool isAquNNC(std::size_t globalCellIdx1, std::size_t globalCellIdx2) const;
bool isAquCell(std::size_t globalCellIdx) const;
std::size_t nx = 0,ny = 0, nz = 0;
const FieldPropsManager* fp = nullptr;
std::vector< MULTREGTRecord > m_records;
std::map<std::string , MULTREGTSearchMap> m_searchMap;
std::map<std::string, std::vector<int>> regions;
std::string default_region;
};
} // namespace Opm
}
#endif // OPM_PARSER_MULTREGTSCANNER_HPP

View File

@@ -56,11 +56,9 @@ namespace Opm {
double getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const;
double getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const;
double getRegionMultiplier( size_t globalCellIndex1, size_t globalCellIndex2, FaceDir::DirEnum faceDir) const;
double getRegionMultiplierNNC(std::size_t globalCellIndex1, std::size_t globalCellIndex2) const;
void applyMULT(const std::vector<double>& srcMultProp, FaceDir::DirEnum faceDir);
void applyMULTFLT(const FaultCollection& faults);
void applyMULTFLT(const Fault& fault);
void applyNumericalAquifer(const std::vector<std::size_t>& aquifer_cells);
bool operator==(const TransMult& data) const;

View File

@@ -6,21 +6,8 @@
namespace Opm {
class DeckKeyword;
class DeckRecord;
class EquilRecord {
public:
EquilRecord() = default;
EquilRecord(double datum_depth_arg, double datum_depth_pc_arg,
double woc_depth, double woc_pc,
double goc_depth, double goc_pc,
bool live_oil_init,
bool wet_gas_init,
int target_accuracy,
bool humid_gas_init);
explicit EquilRecord(const DeckRecord& record);
static EquilRecord serializationTestObject();
double datumDepth() const;
double datumDepthPressure() const;
double waterOilContactDepth() const;
@@ -33,6 +20,10 @@ namespace Opm {
int initializationTargetAccuracy() const;
bool humidGasInitConstantRvw() const;
EquilRecord();
EquilRecord( double datum_depth_arg, double datum_depth_pc_arg, double woc_depth, double woc_pc, double goc_depth, double goc_pc, bool live_oil_init, bool wet_gas_init, int target_accuracy, bool humid_gas_init);
bool operator==(const EquilRecord& data) const;
template<class Serializer>
@@ -51,75 +42,29 @@ namespace Opm {
}
private:
double datum_depth = 0.0;
double datum_depth_ps = 0.0;
double water_oil_contact_depth = 0.0;
double water_oil_contact_capillary_pressure = 0.0;
double gas_oil_contact_depth = 0.0;
double gas_oil_contact_capillary_pressure = 0.0;
double datum_depth;
double datum_depth_ps;
double water_oil_contact_depth;
double water_oil_contact_capillary_pressure;
double gas_oil_contact_depth;
double gas_oil_contact_capillary_pressure;
bool live_oil_init_proc = false;
bool wet_gas_init_proc = false;
int init_target_accuracy = 0;
bool humid_gas_init_proc = false;
bool live_oil_init_proc;
bool wet_gas_init_proc;
int init_target_accuracy;
bool humid_gas_init_proc;
};
class StressEquilRecord {
class Equil {
public:
StressEquilRecord() = default;
explicit StressEquilRecord(const DeckRecord& record);
using const_iterator = std::vector< EquilRecord >::const_iterator;
static StressEquilRecord serializationTestObject();
Equil() = default;
explicit Equil( const DeckKeyword& );
bool operator==(const StressEquilRecord& data) const;
static Equil serializationTestObject();
double datumDepth() const;
double datumPosX() const;
double datumPosY() const;
double stressXX() const;
double stressXX_grad() const;
double stressYY() const;
double stressYY_grad() const;
double stressZZ() const;
double stressZZ_grad() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(datum_depth);
serializer(datum_posx);
serializer(datum_posy);
serializer(stress_xx);
serializer(stress_xx_grad);
serializer(stress_yy);
serializer(stress_yy_grad);
serializer(stress_zz);
serializer(stress_zz_grad);
}
private:
double datum_depth = 0.0;
double datum_posx = 0.0;
double datum_posy = 0.0;
double stress_xx = 0.0;
double stress_xx_grad = 0.0;
double stress_yy = 0.0;
double stress_yy_grad = 0.0;
double stress_zz = 0.0;
double stress_zz_grad = 0.0;
};
template<class RecordType>
class EquilContainer {
public:
using const_iterator = typename std::vector<RecordType>::const_iterator;
EquilContainer() = default;
explicit EquilContainer( const DeckKeyword& );
static EquilContainer serializationTestObject();
const RecordType& getRecord(std::size_t id) const;
const EquilRecord& getRecord( size_t id ) const;
size_t size() const;
bool empty() const;
@@ -127,7 +72,7 @@ namespace Opm {
const_iterator begin() const;
const_iterator end() const;
bool operator==(const EquilContainer& data) const;
bool operator==(const Equil& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
@@ -136,11 +81,9 @@ namespace Opm {
}
private:
std::vector<RecordType> m_records;
std::vector< EquilRecord > m_records;
};
using Equil = EquilContainer<EquilRecord>;
using StressEquil = EquilContainer<StressEquilRecord>;
}
#endif //OPM_EQUIL_HPP

View File

@@ -45,9 +45,6 @@ namespace Opm {
bool hasEquil() const;
const Equil& getEquil() const;
bool hasStressEquil() const;
const StressEquil& getStressEquil() const;
bool hasGravity() const;
bool hasFoamConfig() const;
@@ -67,7 +64,6 @@ namespace Opm {
void serializeOp(Serializer& serializer)
{
serializer(equil);
serializer(stress_equil);
serializer(foamconfig);
serializer(m_filleps);
serializer(m_gravity);
@@ -78,7 +74,6 @@ namespace Opm {
private:
Equil equil;
StressEquil stress_equil;
FoamConfig foamconfig;
bool m_filleps;
bool m_gravity = true;

View File

@@ -31,6 +31,7 @@
#include <string>
namespace Opm {
class Deck;
class Phases {
@@ -94,8 +95,7 @@ public:
return this->nDynWlistMax;
}
const std::optional<KeywordLocation>& location() const
{
const std::optional<KeywordLocation>& location() const {
return this->m_location;
}
@@ -113,6 +113,7 @@ public:
rst_cmp(*this, data);
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
@@ -142,6 +143,7 @@ public:
static WellSegmentDims serializationTestObject();
int maxSegmentedWells() const
{
return this->nSegWellMax;
@@ -157,11 +159,6 @@ public:
return this->nLatBranchMax;
}
const std::optional<KeywordLocation>& location() const
{
return this->location_;
}
bool operator==(const WellSegmentDims& data) const;
template<class Serializer>
@@ -170,14 +167,12 @@ public:
serializer(nSegWellMax);
serializer(nSegmentMax);
serializer(nLatBranchMax);
serializer(location_);
}
private:
int nSegWellMax;
int nSegmentMax;
int nLatBranchMax;
std::optional<KeywordLocation> location_;
};
class NetworkDims {
@@ -299,11 +294,6 @@ public:
*/
double curvatureCapPrs() const;
/*!
* \brief Wag hysteresis.
*/
bool activeWag() const;
bool operator==(const EclHysterConfig& data) const;
template<class Serializer>
@@ -314,7 +304,6 @@ public:
serializer(krHystMod);
serializer(modParamTrappedValue);
serializer(curvatureCapPrsValue);
serializer(activeWagHyst);
}
private:
@@ -328,9 +317,6 @@ private:
double modParamTrappedValue { 0.1 };
// curvature parameter for capillary pressure
double curvatureCapPrsValue { 0.1 };
// enable WAG hysteresis
bool activeWagHyst { false };
};
class SatFuncControls {
@@ -343,9 +329,8 @@ public:
enum class KeywordFamily {
Family_I, // SGOF, SWOF, SLGOF
Family_II, // SGFN, SOF{2,3}, SWFN, SGWFN
Family_III, // GSF, WSF
Family_II, // SGFN, SOF{2,3}, SWFN
Family_III, // GSF, WSF
Undefined,
};
@@ -470,9 +455,7 @@ public:
const Nupcol& nupcol() const noexcept;
const Tracers& tracers() const;
bool co2Storage() const noexcept;
bool h2Storage() const noexcept;
bool micp() const noexcept;
bool mech() const noexcept;
bool operator==(const Runspec& data) const;
static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state);
@@ -495,9 +478,7 @@ public:
serializer(m_sfuncctrl);
serializer(m_nupcol);
serializer(m_co2storage);
serializer(m_h2storage);
serializer(m_micp);
serializer(m_mech);
}
private:
@@ -517,9 +498,7 @@ private:
Nupcol m_nupcol;
Tracers m_tracers;
bool m_co2storage;
bool m_h2storage;
bool m_micp;
bool m_mech;
};

View File

@@ -33,34 +33,59 @@ namespace Opm {
class Deck;
class DeckRecord;
enum class BCType {
RATE,
FREE,
DIRICHLET,
THERMAL
};
enum class BCComponent {
OIL,
GAS,
WATER,
SOLVENT,
POLYMER,
NONE
};
class BCConfig {
public:
struct BCRegion {
int index;
struct BCFace {
int i1,i2;
int j1,j2;
int k1,k2;
BCType bctype;
FaceDir::DirEnum dir;
BCComponent component;
double rate;
std::optional<double> pressure;
std::optional<double> temperature;
BCRegion() = default;
explicit BCRegion(const DeckRecord& record, const GridDims& grid);
BCFace() = default;
explicit BCFace(const DeckRecord& record, const GridDims& grid);
static BCRegion serializationTestObject();
static BCFace serializationTestObject();
bool operator==(const BCRegion& other) const;
bool operator==(const BCFace& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(index);
serializer(i1);
serializer(i2);
serializer(j1);
serializer(j2);
serializer(k1);
serializer(k2);
serializer(bctype);
serializer(dir);
serializer(component);
serializer(rate);
serializer(pressure);
serializer(temperature);
}
};
@@ -71,8 +96,8 @@ public:
static BCConfig serializationTestObject();
std::size_t size() const;
std::vector<BCRegion>::const_iterator begin() const;
std::vector<BCRegion>::const_iterator end() const;
std::vector<BCFace>::const_iterator begin() const;
std::vector<BCFace>::const_iterator end() const;
bool operator==(const BCConfig& other) const;
template<class Serializer>
@@ -82,7 +107,7 @@ public:
}
private:
std::vector<BCRegion> m_faces;
std::vector<BCFace> m_faces;
};
} //namespace Opm

View File

@@ -20,7 +20,6 @@
#ifndef OPM_ROCK_CONFIG_HPP
#define OPM_ROCK_CONFIG_HPP
#include <cstddef>
#include <string>
#include <vector>
@@ -29,36 +28,36 @@ namespace Opm {
class Deck;
class FieldPropsManager;
class RockConfig
{
class RockConfig {
public:
enum class Hysteresis
enum class Hysteresis {
REVERS = 1,
IRREVERS = 2,
HYSTER = 3,
BOBERG = 4,
REVLIMIT = 5,
PALM_MAN = 6,
NONE = 7
};
struct RockComp {
double pref;
double compressibility;
RockComp() = default;
RockComp(double pref_arg, double comp_arg);
bool operator==(const RockComp& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
REVERS = 1,
IRREVERS = 2,
HYSTER = 3,
BOBERG = 4,
REVLIMIT = 5,
PALM_MAN = 6,
NONE = 7,
};
serializer(pref);
serializer(compressibility);
}
};
struct RockComp
{
double pref{};
double compressibility{};
RockComp() = default;
RockComp(double pref_arg, double comp_arg);
bool operator==(const RockComp& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(pref);
serializer(compressibility);
}
};
RockConfig();
RockConfig(const Deck& deck, const FieldPropsManager& fp);
@@ -96,4 +95,4 @@ private:
} //namespace Opm
#endif // OPM_ROCK_CONFIG_HPP
#endif

View File

@@ -96,6 +96,12 @@ struct GravityTable : public FlatTableWithCopy<GRAVITYRecord>
{
return GravityTable({{1.0, 2.0, 3.0}});
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
}
};
struct DENSITYRecord {
@@ -131,6 +137,12 @@ struct DensityTable : public FlatTableWithCopy<DENSITYRecord>
{
return DensityTable({{1.0, 2.0, 3.0}});
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
}
};
struct DiffCoeffRecord {
@@ -274,6 +286,12 @@ struct PvtwTable : public FlatTableWithCopy<PVTWRecord>
{
return PvtwTable({{1.0, 2.0, 3.0, 4.0, 5.0}});
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
}
};
struct ROCKRecord {
@@ -295,11 +313,8 @@ struct ROCKRecord {
}
};
struct RockTable : public FlatTableWithCopy<ROCKRecord>
{
RockTable() = default;
explicit RockTable(const DeckKeyword& kw);
explicit RockTable(std::initializer_list<ROCKRecord> records);
struct RockTable : public FlatTable< ROCKRecord > {
using FlatTable< ROCKRecord >::FlatTable;
static RockTable serializationTestObject()
{

View File

@@ -24,14 +24,15 @@
namespace Opm {
class Deck;
class DeckItem;
class GasvisctTable : public SimpleTable {
public:
GasvisctTable( const DeckItem& item, const int tableID );
GasvisctTable( const Deck& deck, const DeckItem& deckItem );
const TableColumn& getTemperatureColumn() const;
const TableColumn& getGasViscosityColumn() const;
const TableColumn& getGasViscosityColumn(size_t compIdx) const;
};
}

View File

@@ -28,7 +28,7 @@ namespace Opm {
class PlymaxTable : public SimpleTable {
public:
explicit PlymaxTable(const DeckRecord& record);
PlymaxTable( const DeckRecord& record );
const TableColumn& getPolymerConcentrationColumn() const;
const TableColumn& getMaxPolymerConcentrationColumn() const;

View File

@@ -23,13 +23,13 @@
namespace Opm {
class DeckRecord;
class DeckReckord;
class PlyrockTable : public SimpleTable {
public:
// This is not really a table; every column has only one element.
explicit PlyrockTable(const DeckRecord& record);
PlyrockTable( const DeckRecord& record );
// since this keyword is not necessarily monotonic, it cannot be evaluated!
//using SimpleTable::evaluate;

View File

@@ -1,79 +0,0 @@
/*
Copyright (C) 2023 Equinor
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PPCWMAX_HPP
#define PPCWMAX_HPP
#include <cstddef>
#include <vector>
namespace Opm {
class Deck;
struct PpcwmaxRecord {
double max_cap_pres;
bool option;
PpcwmaxRecord() = default;
PpcwmaxRecord(double pres, bool optn) :
max_cap_pres(pres),
option(optn)
{};
bool operator==(const PpcwmaxRecord& other) const {
return this->max_cap_pres == other.max_cap_pres &&
this->option == other.option;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(max_cap_pres);
serializer(option);
}
};
class Ppcwmax {
public:
Ppcwmax() = default;
explicit Ppcwmax(const Deck& deck);
explicit Ppcwmax(std::initializer_list<PpcwmaxRecord> records);
static Ppcwmax serializationTestObject();
std::size_t size() const;
bool empty() const;
std::vector< PpcwmaxRecord >::const_iterator begin() const;
std::vector< PpcwmaxRecord >::const_iterator end() const;
const PpcwmaxRecord& operator[](const std::size_t index) const;
bool operator==(const Ppcwmax& other) const {
return this->data == other.data;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(data);
}
private:
std::vector<PpcwmaxRecord> data;
};
}
#endif

View File

@@ -57,7 +57,6 @@
#include <opm/input/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/input/eclipse/EclipseState/Tables/Regdims.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TLMixpar.hpp>
#include <opm/input/eclipse/EclipseState/Tables/Ppcwmax.hpp>
namespace Opm {
@@ -79,7 +78,6 @@ namespace Opm {
const Aqudims& getAqudims() const;
const Regdims& getRegdims() const;
const TLMixpar& getTLMixpar() const;
const Ppcwmax& getPpcwmax() const;
/*
WIll return max{ Tabdims::NTFIP , Regdims::NTFIP }.
*/
@@ -262,7 +260,6 @@ namespace Opm {
serializer(m_rtemp);
serializer(m_salinity);
serializer(m_tlmixpar);
serializer(m_ppcwmax);
if (!serializer.isSerializing()) {
m_simpleTables = simpleTables;
if (split.plyshMax > 0) {
@@ -292,6 +289,7 @@ namespace Opm {
void initRTempTables(const Deck& deck);
void initDims(const Deck& deck);
void initRocktabTables(const Deck& deck);
void initGasvisctTables(const Deck& deck);
void initPlymaxTables(const Deck& deck);
void initPlyrockTables(const Deck& deck);
@@ -394,7 +392,6 @@ namespace Opm {
Eqldims m_eqldims;
Aqudims m_aqudims;
TLMixpar m_tlmixpar;
Ppcwmax m_ppcwmax;
bool hasImptvd = false;// if deck has keyword IMPTVD
bool hasEnptvd = false;// if deck has keyword ENPTVD

View File

@@ -20,19 +20,14 @@
#ifndef OPM_ORDERED_MAP_HPP
#define OPM_ORDERED_MAP_HPP
#include <algorithm>
#include <cctype>
#include <cstddef>
#include <functional>
#include <unordered_map>
#include <vector>
#include <string>
#include <stdexcept>
#include <iterator>
#include <set>
#include <stdexcept>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include <cctype>
#include <algorithm>
namespace Opm {
@@ -73,11 +68,11 @@ findSimilarStrings(std::string str,
return concatedStr.substr(0, concatedStr.size()-2);
}
template<std::string_view::size_type MAX_CHARS>
template<std::size_t MAX_CHARS>
class TruncatedStringHash
{
public:
std::size_t operator()(std::string_view key) const
std::size_t operator()(const std::string_view& key) const
{
return hasher(key.substr(0, MAX_CHARS));
}
@@ -87,13 +82,13 @@ private:
template<>
class TruncatedStringHash<std::string_view::npos> : public std::hash<std::string_view>
class TruncatedStringHash<std::string::npos> : public std::hash<std::string_view>
{};
template<std::string_view::size_type MAX_CHARS>
template<std::size_t MAX_CHARS>
struct TruncatedStringEquals
{
bool operator()(std::string_view str1, std::string_view str2) const
bool operator()(const std::string& str1, const std::string& str2) const
{
return str1.substr(0, MAX_CHARS) == str2.substr(0, MAX_CHARS);
}
@@ -107,23 +102,21 @@ struct TruncatedStringEquals<std::string::npos> : public std::equal_to<std::stri
/// \brief A map with iteration in the order of insertion.
///
/// Each entry has an associated index indicating when a value with that key
/// was first inserted. When iterating over the entries, elements with a
/// lower insertion index are traversed before elements with a higher
/// insertion index.
/// Each entry has an associated index indicating when a value with that key was
/// first inserted. When itering over it's entries values with lower insertion index
/// are traversed before ones with an higher insertion index.
///
/// \tparam T Element type. The map's value type is \code pair<string, T> \endcode.
///
/// \tparam MAX_CHARS Maximum number of characters used in key comparisons.
/// Default value honors all characters. Keys with the
/// \tparam MAX_CHARS The maximum number of characters that are use a keys. Default is
/// std::string::npos, which honors all characters. Any keys with the
/// same first MAX_CHARS characters are considered equal.
template <typename T, std::string_view::size_type MAX_CHARS = std::string_view::npos>
///
template <typename T, std::size_t MAX_CHARS = std::string::npos>
class OrderedMap {
public:
using storage_type = std::vector<std::pair<std::string, T>>;
using index_type = std::unordered_map<std::string, typename storage_type::size_type,
OrderedMapDetail::TruncatedStringHash<MAX_CHARS>,
OrderedMapDetail::TruncatedStringEquals<MAX_CHARS>>;
using storage_type = typename std::vector<std::pair<std::string,T>>;
using index_type = typename std::unordered_map<std::string,std::size_t,
Opm::OrderedMapDetail::TruncatedStringHash<MAX_CHARS>,
Opm::OrderedMapDetail::TruncatedStringEquals<MAX_CHARS>>;
using iter_type = typename storage_type::iterator;
using const_iter_type = typename storage_type::const_iterator;

View File

@@ -1,143 +0,0 @@
/*
Copyright 2023 Equinor.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_PARSER_WAGHYSTERSISCONFIG_HPP
#define OPM_PARSER_WAGHYSTERSISCONFIG_HPP
namespace Opm {
class Deck;
class DeckRecord;
class WagHysteresisConfig {
public:
struct WagHysteresisConfigRecord {
private:
// WAG hysteresis Lands parameter
double wagLandsParamValue { 1.0 };
// WAG hysteresis reduction factor
double wagSecondaryDrainageReductionValue { 0.0 };
// WAG gas model flag
bool wagGasFlagValue { true };
// WAG residual oil model flag
bool wagResidualOilFlagValue { false };
// WAG water model flag
bool wagWaterFlagValue { false };
// WAG hysteresis linear fraction
double wagImbCurveLinearFractionValue { 0.1 };
// WAG hysteresis 3-phase threshold
double wagWaterThresholdSaturationValue { 0.001 };
public:
WagHysteresisConfigRecord() = default;
explicit WagHysteresisConfigRecord(const DeckRecord& record);
double wagLandsParam() const {
return wagLandsParamValue;
}
double wagSecondaryDrainageReduction() const {
return wagSecondaryDrainageReductionValue;
}
bool wagGasFlag() const {
return wagGasFlagValue;
}
bool wagResidualOilFlag() const {
return wagResidualOilFlagValue;
}
bool wagWaterFlag() const {
return wagWaterFlagValue;
}
double wagImbCurveLinearFraction() const {
return wagImbCurveLinearFractionValue;
}
double wagWaterThresholdSaturation() const {
return wagWaterThresholdSaturationValue;
}
bool operator==(const WagHysteresisConfigRecord& data) const
{
return this->wagLandsParam() == data.wagLandsParam() &&
this->wagSecondaryDrainageReduction() == data.wagSecondaryDrainageReduction() &&
this->wagGasFlag() == data.wagGasFlag() &&
this->wagResidualOilFlag() == data.wagResidualOilFlag() &&
this->wagWaterFlag() == data.wagWaterFlag() &&
this->wagImbCurveLinearFraction() == data.wagImbCurveLinearFraction() &&
this->wagWaterThresholdSaturation() == data.wagWaterThresholdSaturation();
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(wagLandsParamValue);
serializer(wagSecondaryDrainageReductionValue);
serializer(wagGasFlagValue);
serializer(wagResidualOilFlagValue);
serializer(wagWaterFlagValue);
serializer(wagImbCurveLinearFractionValue);
serializer(wagWaterThresholdSaturationValue);
}
static WagHysteresisConfigRecord serializationTestObject()
{
WagHysteresisConfigRecord result;
result.wagLandsParamValue = 0;
result.wagSecondaryDrainageReductionValue = 1;
result.wagGasFlagValue = true;
result.wagResidualOilFlagValue = false;
result.wagWaterFlagValue = false;
result.wagImbCurveLinearFractionValue = 2;
result.wagWaterThresholdSaturationValue = 3;
return result;
}
};
WagHysteresisConfig();
explicit WagHysteresisConfig(const Deck& deck);
size_t size() const;
bool empty() const;
const std::vector<WagHysteresisConfigRecord>::const_iterator begin() const;
const std::vector<WagHysteresisConfigRecord>::const_iterator end() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(wagrecords);
}
bool operator==(const WagHysteresisConfig& other) const;
const WagHysteresisConfigRecord& operator[](std::size_t index) const;
private:
std::vector<WagHysteresisConfigRecord> wagrecords;
};
}
#endif // OPM_PARSER_WAGHYSTERSISCONFIG_HPP

View File

@@ -30,7 +30,7 @@ namespace Opm {
class KeywordGenerator {
public:
explicit KeywordGenerator(bool verbose);
KeywordGenerator(bool verbose);
static void ensurePath( const std::string& file_name);
static std::string endTest();

View File

@@ -218,18 +218,6 @@ class KeywordLocation;
/// RUNSPEC keyword WELLDIMS (item 4).
const static std::string RUNSPEC_GROUPSIZE_TOO_LARGE;
/// Dynamic number of multi-segmented wells exceeds maximum declared
/// in RUNSPEC keyword WSEGDIMS (item 1).
const static std::string RUNSPEC_NUMMSW_TOO_LARGE;
/// Dynamic number of segments per MS well exceeds maximum declared
/// in RUNSPEC keyword WSEGDIMS (item 2).
const static std::string RUNSPEC_NUMSEG_PER_WELL_TOO_LARGE;
/// Dynamic number of branches exceeds maximum number declared in
/// RUNSPEC keyword WSEGDIMS (item 3).
const static std::string RUNSPEC_NUMBRANCH_TOO_LARGE;
/*
Should we allow keywords of length more than eight characters? If the
keyword is too long it will be internalized using only the eight first
@@ -351,7 +339,6 @@ class KeywordLocation;
const static std::string SCHEDULE_GROUP_ERROR;
const static std::string SCHEDULE_IGNORED_GUIDE_RATE;
const static std::string SCHEDULE_WELL_IN_FIELD_GROUP;
const static std::string SCHEDULE_COMPSEGS_INVALID;
const static std::string SCHEDULE_COMPSEGS_NOT_SUPPORTED;

View File

@@ -97,30 +97,7 @@ namespace Opm {
bool hasKeyword( const std::string& ) const;
const ParserKeyword& getKeyword(const std::string& name) const;
/// Whether or not string is a valid keyword.
///
/// The full keyword recognition process first verifies that the
/// input string looks like a valid keyword and, if so matches that
/// string against the builtin set of known keywords. The function
/// additionally includes those keywords that match against keyword
/// collections, typically the SUMMARY section "meta" keywords in
/// the *_PROBE files.
///
/// \return Whether or not \p deckKeywordName is a builtin deck
/// keyword or a known summary keyword.
bool isRecognizedKeyword(std::string_view deckKeywordName) const;
/// Whether or not string is a valid keyword.
///
/// First checks that the input string looks like a valid keyword
/// and, if so, matches the string against the builtin set of known
/// keywords.
///
/// \param[in] deckKeywordName Potential deck keyword.
///
/// \return Whether or not \p deckKeywordName is a builtin deck keyword.
bool isBaseRecognizedKeyword(std::string_view deckKeywordName) const;
bool isRecognizedKeyword( const std::string_view& deckKeywordName) const;
const ParserKeyword& getParserKeywordFromDeckName(const std::string_view& deckKeywordName) const;
std::vector<std::string> getAllDeckNames () const;

View File

@@ -30,19 +30,19 @@ namespace Opm {
OTHER_KEYWORD_IN_DECK = 2,
UNKNOWN = 3,
FIXED_CODE = 4,
DOUBLE_SLASH_TERMINATED = 5,
SPECIAL_CASE_ROCK = 6,
DOUBLE_SLASH_TERMINATED = 5
};
enum ParserKeywordActionEnum {
INTERNALIZE = 0,
IGNORE = 1,
IGNORE_WARNING = 2,
THROW_EXCEPTION = 3,
THROW_EXCEPTION = 3
};
std::string ParserKeywordActionEnum2String(ParserKeywordActionEnum enumValue);
std::string ParserKeywordSizeEnum2String(ParserKeywordSizeEnum enumValue);
const std::string ParserKeywordActionEnum2String(ParserKeywordActionEnum enumValue);
const std::string ParserKeywordSizeEnum2String(ParserKeywordSizeEnum enumValue);
ParserKeywordSizeEnum ParserKeywordSizeEnumFromString(const std::string& stringValue);
ParserKeywordActionEnum ParserKeywordActionEnumFromString(const std::string& stringValue);

View File

@@ -94,9 +94,7 @@ namespace Opm {
static bool validInternalName(const std::string& name);
static bool validDeckName(const std::string_view& name);
bool hasMatchRegex() const;
bool hasMatchRegexSuffix() const;
void setMatchRegex(const std::string& deckNameRegexp);
void setMatchRegexSuffix(const std::string& deckNameRegexp);
bool matches(const std::string_view& ) const;
bool hasDimension() const;
void addRecord( ParserRecord );
@@ -156,7 +154,6 @@ namespace Opm {
std::unordered_set<std::string> m_validSectionNames;
std::string m_matchRegexString;
std::regex m_matchRegex;
std::string m_matchRegexSuffix{};
std::vector< ParserRecord > m_records;
std::string m_Description;
bool raw_string_keyword = false;
@@ -178,7 +175,6 @@ namespace Opm {
void initSizeKeyword(bool table_collection, const Json::JsonObject& sizeObject);
void addItems( const Json::JsonObject& jsonConfig);
void parseRecords( const Json::JsonObject& recordsConfig);
bool matchesDeckNames(std::string_view name) const;
};
std::ostream& operator<<( std::ostream&, const ParserKeyword& );

View File

@@ -25,27 +25,23 @@
namespace Opm {
/// This struct is used to communicate back from the Schedule::applyAction()
/// what needs to be updated in the simulator when execution is returned to
/// the simulator code.
/*
This struct is used to communicate back from the Schdule::applyAction() what
needs to be updated in the simulator when execution is returned to the
simulator code.
*/
struct SimulatorUpdate
{
// Wells affected by ACTIONX and for which the simulator needs to
struct SimulatorUpdate {
// These wells have been affected by the ACTIONX and the simulator needs to
// reapply rates and state from the newly updated Schedule object.
std::unordered_set<std::string> affected_wells;
// If one of the transmissibility multiplier keywords has been invoked
// as an ACTIONX keyword the simulator needs to recalculate the
// transmissibility.
// If one of the transmissibility multiplier keywords has been invoked as an
// ACTIONX keyword the simulator needs to recalculate the transmissibility.
bool tran_update{false};
/// Whether or not well structure changed in processing an ACTIONX
/// block. Typically because of a keyword like WELSPECS, COMPDAT,
/// and/or WELOPEN.
bool well_structure_changed{false};
};
} // namespace Opm
}
#endif // SIMULATOR_UPDATE_HPP
#endif

View File

@@ -42,7 +42,7 @@ class State {
struct RunState {
RunState() = default;
explicit RunState(std::time_t sim_time)
RunState(std::time_t sim_time)
: run_count(1)
, last_run(sim_time)
{}

View File

@@ -1,148 +0,0 @@
/*
Copyright 2023 Equinor ASA.
Copyright 2023 Norce.
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_BC_PROP_HPP
#define OPM_BC_PROP_HPP
#include <vector>
#include <cstddef>
#include <optional>
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
namespace Opm {
class Deck;
class DeckRecord;
enum class BCType {
RATE,
FREE,
DIRICHLET,
THERMAL,
CLOSED,
NONE
};
enum class BCMECHType {
FREE,
FIXED,
NONE
};
enum class BCComponent {
OIL,
GAS,
WATER,
SOLVENT,
POLYMER,
NONE
};
struct MechBCValue {
std::array<double,3> disp{};
std::array<double,6> stress{};
std::array<bool,3> fixeddir{};
static MechBCValue serializationTestObject()
{
return MechBCValue{{1.0, 2.0, 3.0},
{3.0, 4.0, 5.0, 6.0, 7.0, 8.0},
{true, false, true}};
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(disp);
serializer(stress);
serializer(fixeddir);
}
bool operator==(const MechBCValue& other) const
{
return disp == other.disp &&
stress == other.stress &&
fixeddir == other.fixeddir;
}
};
class BCProp {
public:
struct BCFace {
int index;
BCType bctype;
BCMECHType bcmechtype;
BCComponent component;
double rate;
std::optional<double> pressure;
std::optional<double> temperature;
std::optional<MechBCValue> mechbcvalue;
BCFace() = default;
explicit BCFace(const DeckRecord& record);
static BCFace serializationTestObject();
bool operator==(const BCFace& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(index);
serializer(bctype);
serializer(bcmechtype);
serializer(component);
serializer(rate);
serializer(pressure);
serializer(temperature);
serializer(mechbcvalue);
}
};
BCProp() = default;
static BCProp serializationTestObject();
std::size_t size() const;
std::vector<BCFace>::const_iterator begin() const;
std::vector<BCFace>::const_iterator end() const;
bool operator==(const BCProp& other) const;
const BCFace& operator[](int index) const;
void updateBCProp(const DeckRecord& record);
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_faces);
}
private:
std::vector<BCFace> m_faces;
};
} //namespace Opm
#endif

View File

@@ -121,7 +121,7 @@ public:
};
CompletedCells() = default;
explicit CompletedCells(const GridDims& dims);
CompletedCells(const GridDims& dims);
CompletedCells(std::size_t nx, std::size_t ny, std::size_t nz);
const Cell& get(std::size_t i, std::size_t j, std::size_t k) const;
std::pair<bool, Cell&> try_get(std::size_t i, std::size_t j, std::size_t k);

View File

@@ -31,7 +31,7 @@ class GasLiftGroup {
public:
GasLiftGroup() = default;
explicit GasLiftGroup(const std::string& name) :
GasLiftGroup(const std::string& name) :
m_name(name)
{}

View File

@@ -69,9 +69,7 @@ namespace Opm {
bool has(const std::string& name) const;
const GCONSUMPGroup& get(const std::string& name) const;
const GCONSUMPGroupProp get(const std::string& name, const SummaryState& st) const;
void add(const std::string& name, const UDAValue& consumption_rate,
const UDAValue& import_rate, const std::string& network_node,
double udq_undefined_arg, const UnitSystem& unit_system);
void add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node, double udq_undefined_arg, const UnitSystem& unit_system);
size_t size() const;
bool operator==(const GConSump& data) const;

View File

@@ -174,31 +174,6 @@ struct GroupInjectionProperties {
}
};
struct GroupLimitAction
{
ExceedAction allRates{ExceedAction::NONE};
ExceedAction water{ExceedAction::NONE};
ExceedAction gas{ExceedAction::NONE};
ExceedAction liquid{ExceedAction::NONE};
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(allRates);
serializer(water);
serializer(gas);
serializer(liquid);
}
bool operator==(const GroupLimitAction& other) const
{
return (this->allRates == other.allRates)
&& (this->water == other.water)
&& (this->gas == other.gas)
&& (this->liquid == other.liquid);
}
};
struct InjectionControls {
Phase phase;
InjectionCMode cmode;
@@ -219,7 +194,7 @@ struct GroupProductionProperties {
std::string name;
ProductionCMode cmode = ProductionCMode::NONE;
GroupLimitAction group_limit_action;
ExceedAction exceed_action = ExceedAction::NONE;
UDAValue oil_target;
UDAValue water_target;
UDAValue gas_target;
@@ -241,7 +216,7 @@ struct GroupProductionProperties {
{
serializer(name);
serializer(cmode);
serializer(group_limit_action);
serializer(exceed_action);
serializer(oil_target);
serializer(water_target);
serializer(gas_target);
@@ -257,7 +232,7 @@ struct GroupProductionProperties {
struct ProductionControls {
ProductionCMode cmode;
GroupLimitAction group_limit_action;
ExceedAction exceed_action;
double oil_target;
double water_target;
double gas_target;
@@ -278,7 +253,9 @@ struct ProductionControls {
std::size_t insert_index() const;
const std::string& name() const;
bool is_field() const;
int getGroupNetVFPTable() const;
bool updateNetVFPTable(int vfp_arg);
bool update_gefac(double gefac, bool transfer_gefac);
// [[deprecated("use Group::control_group() or Group::flow_group()")]]
@@ -340,6 +317,7 @@ struct ProductionControls {
serializer(group_type);
serializer(gefac);
serializer(transfer_gefac);
serializer(vfp_table);
serializer(parent_group);
serializer(m_wells);
serializer(m_groups);
@@ -360,6 +338,7 @@ private:
GroupType group_type;
double gefac;
bool transfer_gefac;
int vfp_table;
std::string parent_group;
IOrderSet<std::string> m_wells;

View File

@@ -1,146 +0,0 @@
/*
Copyright 2023 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 GROUP_ECON_PRODUCTION_LIMITS_H
#define GROUP_ECON_PRODUCTION_LIMITS_H
#include <map>
#include <string>
#include <optional>
#include <opm/input/eclipse/Deck/UDAValue.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
#include <opm/common/utility/Serializer.hpp>
#include <opm/common/utility/MemPacker.hpp>
namespace Opm {
class DeckRecord;
class GroupEconProductionLimits {
public:
enum class EconWorkover {
NONE = 0,
CON = 1, // CON
CONP = 2, // +CON
WELL = 3,
PLUG = 4,
ALL = 5
};
class GEconGroup {
public:
GEconGroup() = default;
GEconGroup(const DeckRecord &record, const int report_step);
bool endRun() const;
UDAValue minOilRate() const;
UDAValue minGasRate() const;
UDAValue maxWaterCut() const;
UDAValue maxGasOilRatio() const;
UDAValue maxWaterGasRatio() const;
int maxOpenWells() const;
bool operator==(const GEconGroup& other) const;
int reportStep() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_min_oil_rate);
serializer(m_min_gas_rate);
serializer(m_max_water_cut);
serializer(m_max_gas_oil_ratio);
serializer(m_max_water_gas_ratio);
serializer(m_workover);
serializer(m_end_run);
serializer(m_max_open_wells);
}
static GEconGroup serializationTestObject();
EconWorkover workover() const;
private:
UDAValue m_min_oil_rate;
UDAValue m_min_gas_rate;
UDAValue m_max_water_cut;
UDAValue m_max_gas_oil_ratio;
UDAValue m_max_water_gas_ratio;
EconWorkover m_workover;
bool m_end_run;
int m_max_open_wells;
int m_report_step; // Used to get UDQ undefined value
};
class GEconGroupProp {
/* Same as GEconGroup but with UDA values realized at given report step*/
public:
GEconGroupProp(const double min_oil_rate,
const double min_gas_rate,
const double max_water_cut,
const double max_gas_oil_ratio,
const double max_water_gas_ratio,
EconWorkover workover,
bool end_run,
int max_open_wells);
bool endRun() const;
std::optional<double> minOilRate() const;
std::optional<double> minGasRate() const;
std::optional<double> maxWaterCut() const;
std::optional<double> maxGasOilRatio() const;
std::optional<double> maxWaterGasRatio() const;
int maxOpenWells() const;
EconWorkover workover() const;
private:
std::optional<double> m_min_oil_rate;
std::optional<double> m_min_gas_rate;
std::optional<double> m_max_water_cut;
std::optional<double> m_max_gas_oil_ratio;
std::optional<double> m_max_water_gas_ratio;
EconWorkover m_workover;
bool m_end_run;
int m_max_open_wells;
};
GroupEconProductionLimits() = default;
//explicit GroupEconProductionLimits(const RestartIO::RstWell& rstWell);
void add_group(const int report_step, const std::string &group_name, const DeckRecord &record);
static EconWorkover econWorkoverFromString(const std::string& string_value);
const GEconGroup& get_group(const std::string& gname) const;
GEconGroupProp get_group_prop(
const Schedule &schedule, const SummaryState &st, const std::string& gname) const;
bool has_group(const std::string& gname) const;
bool operator==(const GroupEconProductionLimits& other) const;
bool operator!=(const GroupEconProductionLimits& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer) const
{
serializer(m_groups);
}
static GroupEconProductionLimits serializationTestObject();
size_t size() const;
private:
std::map<std::string, GEconGroup> m_groups;
};
} // namespace Opm
#endif

View File

@@ -111,7 +111,7 @@ public:
GuideRateModel::Target target { GuideRateModel::Target::NONE };
};
explicit GuideRate(const Schedule& schedule);
GuideRate(const Schedule& schedule);
void setSerializationTestData();

View File

@@ -35,7 +35,7 @@ namespace Opm {
class AutoICD : public SICD {
public:
AutoICD() = default;
explicit AutoICD(const DeckRecord& record);
AutoICD(const DeckRecord& record);
static AutoICD serializationTestObject();

View File

@@ -90,7 +90,7 @@ namespace Opm {
const double x_in,
const double y_in);
explicit Segment(const RestartIO::RstSegment& rst_segment);
Segment(const RestartIO::RstSegment& rst_segment);
static Segment serializationTestObject();

View File

@@ -69,7 +69,6 @@ namespace Opm {
// Status: OPEN or SHUT
ICDStatus status() const;
int ecl_status() const;
void setConMaxCrossArea(const double area);

View File

@@ -77,8 +77,6 @@ namespace Opm {
std::size_t size() const;
bool empty() const;
int maxSegmentID() const;
int maxBranchID() const;
double depthTopSegment() const;
double lengthTopSegment() const;
double volumeTopSegment() const;

View File

@@ -37,10 +37,10 @@ class ExtNetwork {
public:
ExtNetwork() = default;
bool active() const;
bool has_node(const std::string& name) const;
void add_node(Node node);
void add_branch(Branch branch);
void drop_branch(const std::string& uptree_node, const std::string& downtree_node);
bool has_node(const std::string& name) const;
void update_node(Node node);
const Node& node(const std::string& name) const;
const Node& root() const;
std::vector<Branch> downtree_branches(const std::string& node) const;
@@ -64,7 +64,7 @@ private:
std::vector<Branch> m_branches;
std::vector<std::string> insert_indexed_node_names;
std::map<std::string, Node> m_nodes;
bool has_indexed_node_name(const std::string& name) const;
bool has_indexed_node_name(const std::string name) const;
void add_indexed_node_name(std::string name);
};

View File

@@ -30,7 +30,7 @@ namespace Network {
class Node {
public:
Node() = default;
explicit Node(const std::string& name);
Node(const std::string& name);
const std::string& name() const;
const std::optional<double>& terminal_pressure() const;

View File

@@ -185,7 +185,6 @@
#include <unordered_map>
#include <map>
#include <optional>
#include <string>
namespace Opm {

View File

@@ -21,11 +21,10 @@
#include <cstddef>
#include <ctime>
#include <functional>
#include <iosfwd>
#include <map>
#include <memory>
#include <optional>
#include <iosfwd>
#include <set>
#include <string>
#include <unordered_map>
@@ -33,14 +32,14 @@
#include <vector>
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
#include <opm/input/eclipse/Schedule/Action/WGNames.hpp>
#include <opm/input/eclipse/Schedule/CompletedCells.hpp>
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
#include <opm/input/eclipse/Schedule/MessageLimits.hpp>
#include <opm/input/eclipse/Schedule/ScheduleDeck.hpp>
#include <opm/input/eclipse/Schedule/ScheduleState.hpp>
#include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
#include <opm/input/eclipse/Schedule/WriteRestartFileEvents.hpp>
#include <opm/input/eclipse/Schedule/CompletedCells.hpp>
#include <opm/input/eclipse/Schedule/Action/WGNames.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
namespace Opm
@@ -66,7 +65,6 @@ namespace Opm
class Python;
class RPTConfig;
class SCHEDULESection;
class SegmentMatcher;
struct SimulatorUpdate;
class SummaryState;
class TracerConfig;
@@ -93,7 +91,6 @@ namespace Opm
double sumthin{-1.0};
bool rptonly{false};
bool gaslift_opt_active{false};
std::optional<OilVaporizationProperties> oilVap;
ScheduleStatic() = default;
@@ -239,7 +236,6 @@ namespace Opm
bool hasWell(const std::string& wellName, std::size_t timeStep) const;
WellMatcher wellMatcher(std::size_t report_step) const;
std::function<std::unique_ptr<SegmentMatcher>()> segmentMatcherFactory(std::size_t report_step) const;
std::vector<std::string> wellNames(const std::string& pattern, std::size_t timeStep, const std::vector<std::string>& matching_wells = {}) const;
std::vector<std::string> wellNames(const std::string& pattern) const;
std::vector<std::string> wellNames(std::size_t timeStep) const;
@@ -353,7 +349,6 @@ namespace Opm
this->template pack_unpack<WellTestConfig>(serializer);
this->template pack_unpack<GConSale>(serializer);
this->template pack_unpack<GConSump>(serializer);
this->template pack_unpack<GroupEconProductionLimits>(serializer);
this->template pack_unpack<WListManager>(serializer);
this->template pack_unpack<Network::ExtNetwork>(serializer);
this->template pack_unpack<Network::Balance>(serializer);
@@ -518,11 +513,11 @@ namespace Opm
const bool actionx_mode;
const ParseContext& parseContext;
ErrorGuard& errors;
SimulatorUpdate* sim_update{nullptr};
const std::unordered_map<std::string, double>* target_wellpi{nullptr};
std::unordered_map<std::string, double>* wpimult_global_factor{nullptr};
WelSegsSet* welsegs_wells{nullptr};
std::set<std::string>* compsegs_wells{nullptr};
SimulatorUpdate * sim_update;
const std::unordered_map<std::string, double> * target_wellpi;
std::unordered_map<std::string, double>* wpimult_global_factor;
WelSegsSet *welsegs_wells;
std::set<std::string>*compsegs_wells;
const ScheduleGrid& grid;
/// \param welsegs_wells All wells with a WELSEGS entry for checks.
@@ -535,8 +530,8 @@ namespace Opm
bool actionx_mode_,
const ParseContext& parseContext_,
ErrorGuard& errors_,
SimulatorUpdate* sim_update_,
const std::unordered_map<std::string, double>* target_wellpi_,
SimulatorUpdate * sim_update_,
const std::unordered_map<std::string, double> * target_wellpi_,
std::unordered_map<std::string, double>* wpimult_global_factor_,
WelSegsSet* welsegs_wells_,
std::set<std::string>* compsegs_wells_)
@@ -556,7 +551,6 @@ namespace Opm
{}
void affected_well(const std::string& well_name);
void record_well_structure_change();
/// \brief Mark that the well occured in a WELSEGS keyword
void welsegs_handled(const std::string& well_name)
@@ -684,14 +678,12 @@ namespace Opm
void handleAQUCT (HandlerContext&);
void handleAQUFETP (HandlerContext&);
void handleAQUFLUX (HandlerContext&);
void handleBCProp (HandlerContext&);
void handleBRANPROP (HandlerContext&);
void handleCOMPDAT (HandlerContext&);
void handleCOMPLUMP (HandlerContext&);
void handleCOMPORD (HandlerContext&);
void handleCOMPSEGS (HandlerContext&);
void handleCOMPTRAJ (HandlerContext&);
void handleCSKIN (HandlerContext&);
void handleDRSDT (HandlerContext&);
void handleDRSDTCON (HandlerContext&);
void handleDRSDTR (HandlerContext&);
@@ -702,7 +694,6 @@ namespace Opm
void handleGCONPROD (HandlerContext&);
void handleGCONSALE (HandlerContext&);
void handleGCONSUMP (HandlerContext&);
void handleGECON (HandlerContext&);
void handleGEFAC (HandlerContext&);
void handleGEOKeyword(HandlerContext&);
void handleGLIFTOPT (HandlerContext&);
@@ -750,14 +741,9 @@ namespace Opm
void handleWMICP (HandlerContext&);
void handleWPAVE (HandlerContext&);
void handleWPAVEDEP (HandlerContext&);
void handleWVFPDP (HandlerContext&);
void handleWVFPEXP (HandlerContext&);
void handleWWPAVE (HandlerContext&);
void handleWPIMULT (HandlerContext&);
void handleWINJCLN (HandlerContext&);
void handleWINJDAM (HandlerContext&);
void handleWINJFCNC (HandlerContext&);
void handleWINJMULT (HandlerContext&);
void handleWPMITAB (HandlerContext&);
void handleWPOLYMER (HandlerContext&);
void handleWRFT (HandlerContext&);

View File

@@ -35,7 +35,6 @@
#include <opm/input/eclipse/Schedule/Tuning.hpp>
#include <opm/input/eclipse/Schedule/OilVaporizationProperties.hpp>
#include <opm/input/eclipse/Schedule/Events.hpp>
#include <opm/input/eclipse/Schedule/BCProp.hpp>
#include <opm/input/eclipse/Schedule/Group/Group.hpp>
#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
#include <opm/input/eclipse/Schedule/MessageLimits.hpp>
@@ -64,7 +63,6 @@ namespace Opm {
class GasLiftOpt;
class GConSale;
class GConSump;
class GroupEconProductionLimits;
class GroupOrder;
class GuideRateConfig;
class NameOrder;
@@ -360,7 +358,6 @@ namespace Opm {
ptr_member<GConSale> gconsale;
ptr_member<GConSump> gconsump;
ptr_member<GroupEconProductionLimits> gecon;
ptr_member<GuideRateConfig> guide_rate;
ptr_member<WListManager> wlist_manager;
@@ -393,8 +390,6 @@ namespace Opm {
return this->gconsale;
else if constexpr ( std::is_same_v<T, GConSump> )
return this->gconsump;
else if constexpr ( std::is_same_v<T, GroupEconProductionLimits> )
return this->gecon;
else if constexpr ( std::is_same_v<T, WListManager> )
return this->wlist_manager;
else if constexpr ( std::is_same_v<T, Network::ExtNetwork> )
@@ -435,8 +430,6 @@ namespace Opm {
return this->gconsale;
else if constexpr ( std::is_same_v<T, GConSump> )
return this->gconsump;
else if constexpr ( std::is_same_v<T, GroupEconProductionLimits> )
return this->gecon;
else if constexpr ( std::is_same_v<T, WListManager> )
return this->wlist_manager;
else if constexpr ( std::is_same_v<T, Network::ExtNetwork> )
@@ -489,7 +482,6 @@ namespace Opm {
map_member<std::string, Well> wells;
// constant flux aquifers
std::unordered_map<int, SingleAquiferFlux> aqufluxs;
BCProp bcprop;
std::unordered_map<std::string, double> target_wellpi;
std::optional<NextStep> next_tstep;
@@ -518,7 +510,6 @@ namespace Opm {
serializer(m_whistctl_mode);
serializer(target_wellpi);
serializer(aqufluxs);
serializer(bcprop);
}

View File

@@ -20,8 +20,6 @@
#ifndef OPM_TUNING_HPP
#define OPM_TUNING_HPP
#include <optional>
namespace Opm {
class NextStep {
@@ -51,7 +49,7 @@ namespace Opm {
static Tuning serializationTestObject();
// Record1
std::optional<double> TSINIT;
double TSINIT;
double TSMAXZ;
double TSMINZ;
double TSMCHP;

View File

@@ -91,9 +91,6 @@ private:
UDQSet eval_group_expression(const std::string& string_value,
const UDQContext& context) const;
UDQSet eval_segment_expression(const std::string& string_value,
const UDQContext& context) const;
UDQSet eval_scalar_function(const UDQVarType target_type,
const UDQContext& context) const;

View File

@@ -45,15 +45,13 @@ public:
struct RstRecord {
RstRecord(UDAControl control_arg, UDAValue value_arg,
const std::string& wgname_arg)
RstRecord(UDAControl control_arg, UDAValue value_arg, std::string wgname_arg)
: control(control_arg)
, value(value_arg)
, wgname(wgname_arg)
{};
RstRecord(UDAControl control_arg, UDAValue value_arg,
const std::string& wgname_arg, Phase phase)
RstRecord(UDAControl control_arg, UDAValue value_arg, std::string wgname_arg, Phase phase)
: RstRecord(control_arg, value_arg, wgname_arg)
{
this->ig_phase = phase;

View File

@@ -31,9 +31,7 @@
#include <opm/input/eclipse/EclipseState/Util/IOrderSet.hpp>
#include <cstddef>
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
@@ -42,11 +40,9 @@
namespace Opm {
class DeckRecord;
class KeywordLocation;
class Schedule;
class SegmentMatcher;
class SummaryState;
class UDQState;
class KeywordLocation;
class WellMatcher;
} // namespace Opm
@@ -60,8 +56,6 @@ namespace Opm {
class UDQConfig
{
public:
using SegmentMatcherFactory = std::function<std::unique_ptr<SegmentMatcher>()>;
UDQConfig() = default;
explicit UDQConfig(const UDQParams& params);
UDQConfig(const UDQParams& params, const RestartIO::RstState& rst_state);
@@ -71,55 +65,18 @@ namespace Opm {
const std::string& unit(const std::string& key) const;
bool has_unit(const std::string& keyword) const;
bool has_keyword(const std::string& keyword) const;
void add_record(const DeckRecord& record, const KeywordLocation& location, std::size_t report_step);
void add_record(SegmentMatcherFactory create_segment_matcher,
const DeckRecord& record,
const KeywordLocation& location,
std::size_t report_step);
void add_unit(const std::string& keyword,
const std::string& unit);
void add_update(const std::string& keyword,
std::size_t report_step,
const KeywordLocation& location,
const std::vector<std::string>& data);
void add_assign(const std::string& quantity,
SegmentMatcherFactory create_segment_matcher,
const std::vector<std::string>& selector,
double value,
std::size_t report_step);
void add_assign(const std::string& quantity,
const std::unordered_set<std::string>& selector,
double value,
std::size_t report_step);
void add_define(const std::string& quantity,
const KeywordLocation& location,
const std::vector<std::string>& expression,
std::size_t report_step);
bool clear_pending_assignments();
void eval_assign(std::size_t report_step,
const Schedule& sched,
const WellMatcher& wm,
SegmentMatcherFactory create_segment_matcher,
SummaryState& st,
UDQState& udq_state) const;
void eval(std::size_t report_step,
const Schedule& sched,
const WellMatcher& wm,
SegmentMatcherFactory create_segment_matcher,
SummaryState& st,
UDQState& udq_state) const;
void add_unit(const std::string& keyword, const std::string& unit);
void add_update(const std::string& keyword, std::size_t report_step, const KeywordLocation& location, const std::vector<std::string>& data);
void add_assign(const std::string& quantity, const std::vector<std::string>& selector, double value, std::size_t report_step);
void add_assign(const std::string& quantity, const std::unordered_set<std::string>& selector, double value, std::size_t report_step);
void add_define(const std::string& quantity, const KeywordLocation& location, const std::vector<std::string>& expression, std::size_t report_step);
void eval_assign(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const;
void eval(std::size_t report_step, const WellMatcher& wm, SummaryState& st, UDQState& udq_state) const;
const UDQDefine& define(const std::string& key) const;
const UDQAssign& assign(const std::string& key) const;
std::vector<UDQDefine> definitions() const;
std::vector<UDQDefine> definitions(UDQVarType var_type) const;
std::vector<UDQInput> input() const;
@@ -127,7 +84,7 @@ namespace Opm {
// The size() method will return the number of active DEFINE and ASSIGN
// statements; this will correspond to the length of the vector returned
// from input().
std::size_t size() const;
size_t size() const;
UDQInput operator[](const std::string& keyword) const;
UDQInput operator[](std::size_t insert_index) const;
@@ -149,16 +106,18 @@ namespace Opm {
serializer(units);
serializer(input_index);
serializer(type_count);
serializer(pending_assignments_);
// The UDQFunction table is constant up to udq_params, so we can
// just construct a new instance here.
if (!serializer.isSerializing()) {
// The UDQFunction table is constant up to udq_params.
// So we can just construct a new instance here.
if (!serializer.isSerializing())
udqft = UDQFunctionTable(udq_params);
}
}
private:
void add_node(const std::string& quantity, UDQAction action);
UDQAction action_type(const std::string& udq_key) const;
void eval_assign(std::size_t report_step, SummaryState& st, UDQState& udq_state, UDQContext& context) const;
void eval_define(std::size_t report_step, UDQState& udq_state, UDQContext& context) const;
UDQParams udq_params;
UDQFunctionTable udqft;
@@ -176,32 +135,9 @@ namespace Opm {
IOrderSet<std::string> define_order;
OrderedMap<UDQIndex> input_index;
std::map<UDQVarType, std::size_t> type_count;
mutable std::vector<std::string> pending_assignments_{};
void add_node(const std::string& quantity, UDQAction action);
UDQAction action_type(const std::string& udq_key) const;
void eval_assign(std::size_t report_step,
const Schedule& sched,
UDQContext& context) const;
void eval_define(std::size_t report_step,
UDQState& udq_state,
UDQContext& context) const;
void add_named_assign(const std::string& quantity,
const std::vector<std::string>& selector,
double value,
std::size_t report_step);
void add_enumerated_assign(const std::string& quantity,
SegmentMatcherFactory create_segment_matcher,
const std::vector<std::string>& selector,
double value,
std::size_t report_step);
};
}
} // namespace Opm
#endif // UDQINPUT_HPP_
#endif

View File

@@ -17,74 +17,49 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UDQ_CONTEXT_HPP
#define UDQ_CONTEXT_HPP
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
#include <opm/input/eclipse/Schedule/UDQ/UDQParams.hpp>
namespace Opm {
class SegmentMatcher;
class SegmentSet;
class SummaryState;
class UDQFunctionTable;
class UDQSet;
class UDQState;
class WellMatcher;
} // namespace Opm
namespace Opm {
class UDQContext
{
class UDQContext {
public:
using SegmentMatcherFactory = std::function<std::unique_ptr<SegmentMatcher>()>;
UDQContext(const UDQFunctionTable& udqft,
const WellMatcher& wm,
SegmentMatcherFactory create_segment_matcher,
SummaryState& summary_state,
UDQState& udq_state);
UDQContext(const UDQFunctionTable& udqft, const WellMatcher& wm, SummaryState& summary_state, UDQState& udq_state);
std::optional<double> get(const std::string& key) const;
std::optional<double> get_well_var(const std::string& well, const std::string& var) const;
std::optional<double> get_group_var(const std::string& group, const std::string& var) const;
std::optional<double> get_segment_var(const std::string& well, const std::string& var, std::size_t segment) const;
void add(const std::string& key, double value);
void update_assign(const std::string& keyword, const UDQSet& udq_result);
void update_assign(std::size_t report_step, const std::string& keyword, const UDQSet& udq_result);
void update_define(std::size_t report_step, const std::string& keyword, const UDQSet& udq_result);
const UDQFunctionTable& function_table() const;
std::vector<std::string> wells() const;
std::vector<std::string> wells(const std::string& pattern) const;
std::vector<std::string> groups() const;
SegmentSet segments() const;
SegmentSet segments(const std::vector<std::string>& set_descriptor) const;
private:
const UDQFunctionTable& udqft;
const WellMatcher& well_matcher;
SegmentMatcherFactory create_segment_matcher;
mutable std::unique_ptr<SegmentMatcher> segment_matcher;
SummaryState& summary_state;
UDQState& udq_state;
//std::unordered_map<std::string, UDQSet> udq_results;
std::unordered_map<std::string, double> values;
void ensure_segment_matcher_exists() const;
};
}
} // namespace Opm
#endif // UDQ_CONTEXT_HPP
#endif

View File

@@ -94,7 +94,6 @@ public:
void serializeOp(Serializer& serializer)
{
serializer(m_keyword);
serializer(m_tokens);
serializer(ast);
serializer(m_var_type);
serializer(m_location);
@@ -116,7 +115,6 @@ private:
UDQSet scatter_scalar_value(UDQSet&& res, const UDQContext& context) const;
UDQSet scatter_scalar_well_value(const UDQContext& context, const std::optional<double>& value) const;
UDQSet scatter_scalar_group_value(const UDQContext& context, const std::optional<double>& value) const;
UDQSet scatter_scalar_segment_value(const UDQContext& context, const std::optional<double>& value) const;
};
} // Namespace Opm

View File

@@ -29,10 +29,6 @@
#include <unordered_map>
#include <vector>
namespace Opm {
class SegmentSet;
} // namespace Opm
namespace Opm {
class UDQScalar
@@ -201,9 +197,6 @@ public:
}
};
static std::vector<EnumeratedWellItems>
getSegmentItems(const SegmentSet& segmentSet);
/// Construct empty, named UDQ set of specific variable type
///
/// \param[in] name UDQ set name
@@ -311,11 +304,6 @@ public:
/// this UDQ set. Non-finite value leaves the UDQ set element
/// undefined.
static UDQSet field(const std::string& name, double scalar_value);
static UDQSet segments(const std::string& name,
const std::vector<EnumeratedWellItems>& segments);
static UDQSet segments(const std::string& name,
const std::vector<EnumeratedWellItems>& segments,
const double scalar_value);
/// Assign value to every element of the UDQ set
///

View File

@@ -38,7 +38,7 @@ class UDQState
{
public:
UDQState() = default;
explicit UDQState(double undefined);
UDQState(double undefined);
bool has(const std::string& key) const;
void load_rst(const RestartIO::RstState& rst_state);
@@ -53,7 +53,8 @@ public:
double get_segment_var(const std::string& well, const std::string& var, const std::size_t segment) const;
void add_define(std::size_t report_step, const std::string& udq_key, const UDQSet& result);
void add_assign(const std::string& udq_key, const UDQSet& result);
void add_assign(std::size_t report_step, const std::string& udq_key, const UDQSet& result);
bool assign(std::size_t report_step, const std::string& udq_key) const;
bool define(const std::string& udq_key, const std::pair<UDQUpdate, std::size_t>& update_status) const;
double undefined_value() const;
@@ -69,6 +70,7 @@ public:
serializer(this->well_values);
serializer(this->group_values);
serializer(this->segment_values);
serializer(this->assignments);
serializer(this->defines);
}
@@ -85,6 +87,7 @@ private:
// [var][well][segment] -> double
std::unordered_map<std::string, std::unordered_map<std::string, std::unordered_map<std::size_t, double>>> segment_values{};
std::unordered_map<std::string, std::size_t> assignments;
std::unordered_map<std::string, std::size_t> defines;
void add(const std::string& udq_key, const UDQSet& result);

View File

@@ -30,29 +30,15 @@ namespace Opm {
class UDQToken {
public:
UDQToken() = default;
UDQToken(const std::string& string_token, UDQTokenType token_type);
UDQToken(const std::string& string_token, const std::vector<std::string>& selector);
static UDQToken serializationTestObject();
const std::vector<std::string>& selector() const;
const std::variant<std::string, double>& value() const;
UDQTokenType type() const;
std::string str() const;
bool operator==(const UDQToken&) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(token_type);
serializer(m_value);
serializer(m_selector);
}
private:
UDQTokenType token_type{UDQTokenType::error};
UDQTokenType token_type;
std::variant<std::string,double> m_value;
std::vector<std::string> m_selector;
};

View File

@@ -28,10 +28,6 @@
#include <string>
#include <vector>
#include <optional>
#include <limits>
#include <opm/input/eclipse/Schedule/Well/FilterCake.hpp>
#include <opm/input/eclipse/Schedule/Well/WINJMULT.hpp>
namespace Opm {
@@ -80,6 +76,7 @@ namespace RestartIO {
Defaulted,
};
Connection();
Connection(int i, int j , int k ,
std::size_t global_index,
@@ -116,7 +113,6 @@ namespace RestartIO {
int complnum() const;
int segment() const;
double CF() const;
double wpimult() const;
double Kh() const;
double rw() const;
double r0() const;
@@ -124,19 +120,9 @@ namespace RestartIO {
double connectionLength() const;
double skinFactor() const;
CTFKind kind() const;
const InjMult& injmult() const;
bool activeInjMult() const;
void setInjMult(const InjMult& inj_mult);
void setFilterCake(const FilterCake& filter_cake);
const FilterCake& getFilterCake() const;
bool filterCakeActive() const;
double getFilterCakeRadius() const;
double getFilterCakeArea() const;
void setState(State state);
void setComplnum(int compnum);
void setSkinFactor(double skin_factor);
void setCF(double CF);
void scaleWellPi(double wellPi);
bool prepareWellPIScaling();
bool applyWellPIScaling(const double scaleFactor);
@@ -177,13 +163,11 @@ namespace RestartIO {
serializer(ijk);
serializer(m_global_index);
serializer(m_ctfkind);
serializer(m_injmult);
serializer(m_sort_value);
serializer(m_perf_range);
serializer(m_defaultSatTabId);
serializer(segment_number);
serializer(m_subject_to_welpi);
serializer(m_filter_cake);
}
private:
@@ -202,7 +186,6 @@ namespace RestartIO {
std::array<int,3> ijk;
CTFKind m_ctfkind;
std::optional<InjMult> m_injmult;
std::size_t m_global_index;
/*
The sort_value member is a peculiar quantity. The connections are
@@ -267,11 +250,6 @@ namespace RestartIO {
// Whether or not this Connection is subject to WELPI scaling.
bool m_subject_to_welpi = false;
// For applying last known WPIMULT to when calculating connection transmissibilty factor in CSKIN
double m_wpimult = 1.0;
std::optional<FilterCake> m_filter_cake;
static std::string CTFKindToString(const CTFKind);
};
}

View File

@@ -1,76 +0,0 @@
/*
Copyright 2023 Equinor.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_FILTERCAKE_HPP
#define OPM_FILTERCAKE_HPP
#include <string>
#include <optional>
namespace Opm {
class DeckRecord;
class KeywordLocation;
struct FilterCake {
enum class FilterCakeGeometry {
LINEAR,
RADIAL,
NONE,
};
static FilterCakeGeometry filterCakeGeometryFromString(const std::string& str, const KeywordLocation& location);
static std::string filterCakeGeometryToString(const FilterCakeGeometry& geometry);
FilterCakeGeometry geometry{FilterCakeGeometry::NONE};
double perm{0.};
double poro{0.};
std::optional<double> radius;
std::optional<double> flow_area;
// skin factor multiplier
// it is controlled by keyword WINJCLN
double sf_multiplier{1.};
FilterCake() = default;
explicit FilterCake(const DeckRecord& record, const KeywordLocation& location);
template<class Serializer>
void serializeOp(Serializer& serializer) {
serializer(geometry);
serializer(perm);
serializer(poro);
serializer(radius);
serializer(flow_area);
serializer(sf_multiplier);
}
static FilterCake serializationTestObject();
bool operator==(const FilterCake& other) const;
void applyCleanMultiplier(const double factor);
static std::string filterCakeToString(const FilterCake& fc);
};
}
#endif //OPM_FILTERCAKE_HPP

View File

@@ -17,65 +17,43 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAVE_HPP
#define PAVE_HPP
namespace Opm {
class DeckRecord;
} // Namespace Opm
namespace Opm {
class DeckRecord;
class PAvg
{
class PAvg {
public:
enum class DepthCorrection
{
enum class DepthCorrection {
WELL = 1,
RES = 2,
NONE = 3,
NONE = 3
};
PAvg();
explicit PAvg(const DeckRecord& record);
PAvg(double inner_weight,
double conn_weight,
DepthCorrection depth_correction,
bool use_open_connections);
PAvg(double inner_weight, double conn_weight, DepthCorrection depth_correction, bool use_open_connections);
double inner_weight() const;
double conn_weight() const;
bool use_porv() const;
bool open_connections() const;
DepthCorrection depth_correction() const;
template<class Serializer>
void serializeOp(Serializer& serializer) {
serializer(m_inner_weight);
serializer(m_conn_weight);
serializer(m_depth_correction);
serializer(m_open_connections);
}
static PAvg serializationTestObject();
double inner_weight() const
{
return this->m_inner_weight;
}
double conn_weight() const
{
return this->m_conn_weight;
}
bool open_connections() const
{
return this->m_open_connections;
}
DepthCorrection depth_correction() const
{
return this->m_depth_correction;
}
bool use_porv() const;
template <class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->m_inner_weight);
serializer(this->m_conn_weight);
serializer(this->m_depth_correction);
serializer(this->m_open_connections);
}
bool operator==(const PAvg& other) const;
bool operator!=(const PAvg& other) const;
@@ -86,6 +64,5 @@ private:
bool m_open_connections;
};
} // namespace Opm
#endif // PAVE_HPP
}
#endif

View File

@@ -1,5 +1,5 @@
/*
Copyright 2020, 2023 Equinor ASA.
Copyright 2020 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
@@ -17,787 +17,93 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAVG_CALCULATOR_HPP
#define PAVG_CALCULATOR_HPP
#include <array>
#include <cstddef>
#ifndef PAVE_CALC_HPP
#define PAVE_CALC_HPP
#include <functional>
#include <memory>
#include <map>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
#include <opm/input/eclipse/Schedule/Well/Connection.hpp>
namespace Opm {
class Connection;
class GridDims;
class PAvg;
class PAvgDynamicSourceData;
class WellConnections;
class EclipseGrid;
} // namespace Opm
namespace Opm {
/// Facility for deriving well-level pressure values from selected
/// block-averaging procedures. Applicable to stopped wells which don't
/// have a flowing bottom-hole pressure. Mainly useful for reporting.
class PAvgCalculator
{
protected:
class Accumulator;
class PAvgCalculator {
public:
/// Result of block-averaging well pressure procedure
class Result
{
private:
/// Enclosing type's accumulator object can access internal data
/// members.
friend class Accumulator;
/// Grant internal data member access to combination function.
friend Result
linearCombination(const double alpha, Result x,
const double beta , const Result& y);
PAvgCalculator(const std::string& well, double well_ref_depth, const EclipseGrid& grid, const std::vector<double>& porv, const WellConnections& connections, const PAvg& pavg);
public:
/// Kind of block-averaged well pressure
enum class WBPMode
{
WBP, //< Connecting cells
WBP4, //< Immediate neighbours
WBP5, //< Connecting cells and immediate neighbours
WBP9, //< Connecting cells, immediate, and diagonal neighbours
};
/// Retrieve numerical value of specific block-averaged well pressure.
///
/// \param[in] type Block-averaged pressure kind.
/// \return Block-averaged pressure.
double value(const WBPMode type) const
{
return this->wbp_[this->index(type)];
}
private:
/// Number of block-averaged pressure kinds/modes.
static constexpr auto NumModes =
static_cast<std::size_t>(WBPMode::WBP9) + 1;
/// Storage type for block-averaged well pressure results.
using WBPStore = std::array<double, NumModes>;
/// Block-averaged well pressure results.
WBPStore wbp_{};
/// Assign single block-averaged pressure result.
///
/// \param[in] type Block-averaged pressure kind.
/// \param[in] wbp Block-averaged pressure value.
/// \return \code *this \endcode.
Result& set(const WBPMode type, const double wbp)
{
this->wbp_[this->index(type)] = wbp;
return *this;
}
/// Convert block-averaged pressure kind to linear index
///
/// \param[in] mode Block-averaged pressure kind.
/// \return Linear index corresponding to \p mode.
constexpr WBPStore::size_type index(const WBPMode mode) const
{
return static_cast<WBPStore::size_type>(mode);
}
enum class WBPMode {
WBP,
WBP4,
WBP5,
WBP9
};
/// References to source contributions owned by other party
class Sources
{
public:
/// Provide reference to cell-level contributions (pressure,
/// pore-volume, mixture density) owned by other party.
///
/// \param[in] wbSrc Cell-level contributions
/// \return \code *this \endcode.
Sources& wellBlocks(const PAvgDynamicSourceData& wbSrc)
{
this->wb_ = &wbSrc;
return *this;
}
/// Provide reference to connection-level contributions (pressure,
/// pore-volume, mixture density) owned by other party.
///
/// \param[in] wcSrc Connection-level contributions
/// \return \code *this \endcode.
Sources& wellConns(const PAvgDynamicSourceData& wcSrc)
{
this->wc_ = &wcSrc;
return *this;
}
/// Get read-only access to cell-level contributions.
const PAvgDynamicSourceData& wellBlocks() const
{
return *this->wb_;
}
/// Get read-only access to connection-level contributions.
const PAvgDynamicSourceData& wellConns() const
{
return *this->wc_;
}
private:
/// Cell-level contributions.
const PAvgDynamicSourceData* wb_{nullptr};
/// Connection-level contributions.
const PAvgDynamicSourceData* wc_{nullptr};
};
/// Constructor
///
/// \param[in] cellIndexMap Cell index triple map ((I,J,K) <-> global).
///
/// \param[in] connections List of reservoir connections for single
/// well.
PAvgCalculator(const GridDims& cellIndexMap,
const WellConnections& connections);
/// Destructor.
virtual ~PAvgCalculator();
/// Finish construction by pruning inactive cells.
///
/// \param[in] isActive Linearised predicate for whether or not given
/// cell amongst \code allWBPCells() \endcode is actually active in
/// the model.
///
/// Assumed to have the same size--number of elements--as the return
/// value from member function \code allWBPCells() \endcode, and
/// organise its elements such that \code isActive[i] \endcode holds
/// the active status of \code allWBPCells()[i] \endcode.
void pruneInactiveWBPCells(const std::vector<bool>& isActive);
/// Compute block-average well-level pressure values from collection of
/// source contributions and user-defined averaging procedure controls.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] gravity Strength of gravity in SI units [m/s^2].
///
/// \param[in] refDepth Well's reference depth for block-average
/// pressure calculation. Often, but not always, equal to the well's
/// bottom-hole pressure reference depth.
void inferBlockAveragePressures(const Sources& sources,
const PAvg& controls,
const double gravity,
const double refDepth);
/// List of all cells, global indices in natural ordering, that
/// contribute to the block-average pressures in this well.
const std::vector<std::size_t>& allWBPCells() const
{
return this->contributingCells_;
}
/// List all reservoir connections that potentially contribute to this
/// block-averaging pressure calculation.
///
/// Convenience method only. Mainly intended to aid in constructing
/// PAvgDynamicSourceData objects for the current well's reservoir
/// connections.
///
/// \return Vector of the numbers 0 .. n-1 in increasing order with n
/// being the number of connections in the input set provided to the
/// object constructor.
std::vector<std::size_t> allWellConnections() const;
/// Block-average pressure derived from selection of source cells.
///
/// \param[in] mode Source cell selection.
///
/// \return Block-average pressure
const Result& averagePressures() const
{
return this->averagePressures_;
}
protected:
/// Accumulate weighted running averages of cell contributions to WBP
class Accumulator
{
public:
/// Collection of running averages and their associate weights.
///
/// Intended primarily as a means of exchanging intermediate results
/// in a parallel run.
using LocalRunningAverages = std::array<double, 8>;
/// Constructor
Accumulator();
/// Destructor
~Accumulator();
/// Copy constructor
///
/// \param[in] rhs Source object
Accumulator(const Accumulator& rhs);
/// Move constructor
///
/// \param[inout] rhs Source object. Nullified on exit.
Accumulator(Accumulator&& rhs);
/// Assignment operator
///
/// \param[in] rhs Source object
Accumulator& operator=(const Accumulator& rhs);
/// Move assignment operator
///
/// \param[inout] rhs Source object. Nullified on exit.
Accumulator& operator=(Accumulator&& rhs);
/// Add contribution from centre/connecting cell
///
/// \param[in] weight Pressure weighting factor
/// \param[in] press Pressure value
/// \return \code *this \endcode
Accumulator& addCentre(const double weight,
const double press);
/// Add contribution from direct, rectangular, level 1 neighbouring
/// cell
///
/// \param[in] weight Pressure weighting factor
/// \param[in] press Pressure value
/// \return \code *this \endcode
Accumulator& addRectangular(const double weight,
const double press);
/// Add contribution from diagonal, level 2 neighbouring cell
///
/// \param[in] weight Pressure weighting factor
/// \param[in] press Pressure value
/// \return \code *this \endcode
Accumulator& addDiagonal(const double weight,
const double press);
/// Add contribution from other accumulator
///
/// This typically incorporates a set of results from a single
/// reservoir connection into a larger sum across all connections.
///
/// \param[in] weight Pressure weighting factor
/// \param[in] other Contribution from other accumulation process.
/// \return \code *this \endcode
Accumulator& add(const double weight,
const Accumulator& other);
/// Zero out/clear WBP result buffer
void prepareAccumulation();
/// Zero out/clear WBP term buffer
void prepareContribution();
/// Accumulate current source term into result buffer whilst
/// applying any user-prescribed term weighting.
///
/// \param[in] innerWeight Weighting factor for inner/connecting
/// cell contributions. Outer cells weighted by 1-innerWeight
/// where applicable. If inner weight factor is negative, no
/// weighting is applied. Typically the F1 weighting factor from
/// the WPAVE keyword. Default value (-1) mainly applicable to
/// PV-weighted accumulations.
void commitContribution(const double innerWeight = -1.0);
// Please note that member functions \c getRunningAverages() and \c
// assignRunningAverages() are concessions to parallel/MPI runs, and
// especially for simulation runs with distributed wells. In this
// situation we need a way to access, communicate/collect/sum, and
// assign partial results. Moreover, the \c LocalRunningAverages
// should be treated opaquely apart from applying a global reduction
// operation. In other words, the intended/expected use case is
//
// Accumulator a{}
// ...
// auto avg = a.getRunningAverages()
// MPI_Allreduce(avg, MPI_SUM)
// a.assignRunningAverages(avg)
//
// Any other use is probably a bug and the above is the canonical
// implementation of member function collectGlobalContributions() in
// MPI aware sub classes of PAvgCalculator.
/// Get buffer of intermediate, local results.
LocalRunningAverages getRunningAverages() const;
/// Assign coalesced/global contributions
///
/// \param[in] avg Buffer of coalesced global contributions.
void assignRunningAverages(const LocalRunningAverages& avg);
/// Calculate final WBP results from individual contributions
///
/// \return New result object.
Result getFinalResult() const;
private:
/// Implementation class
class Impl;
/// Pointer to implementation object.
std::unique_ptr<Impl> pImpl_;
};
/// Average pressures weighted by connection transmissibility factor.
Accumulator accumCTF_{};
/// Average pressures weighted by pore-volume
Accumulator accumPV_{};
private:
/// Type representing enumeration of locally contributing cells.
using ContrIndexType = std::vector<std::size_t>::size_type;
/// Type for translating (linearised) global cell indices to enumerated
/// local, contributing cells.
///
/// Only used during construction/setup.
using SetupMap = std::unordered_map<std::size_t, ContrIndexType>;
/// Type of neighbour of connection's connecting cell.
enum class NeighbourKind
{
/// Neighbour is of the direct, rectangular, level 1 kind.
Rectangular,
/// Neighbour is of the diagonal level 2 kind.
Diagonal,
};
/// Well's reservoir connection, stripped to hold only information
/// necessary to infer block-averaged pressures.
struct PAvgConnection
{
/// Constructor.
///
/// \param[in] ctf_arg Connection's transmissiblity factor
///
/// \param[in] depth_arg Connection's depth
///
/// \param[in] cell_arg Connection's connecting cell. Enumerated
/// local contributing cell.
PAvgConnection(const double ctf_arg,
const double depth_arg,
const ContrIndexType cell_arg)
: ctf (ctf_arg)
, depth(depth_arg)
, cell (cell_arg)
struct Neighbour {
Neighbour(double porv_arg, std::size_t index_arg) :
porv(porv_arg),
global_index(index_arg)
{}
/// Connection transmissiblity factor.
double ctf{};
/// Connection's depth.
double depth{};
/// Index into \c contributingCells_ of connection's cell.
ContrIndexType cell{};
/// Connecting cell's immediate (level-1) neighbours
/// ((i-1,j), (i+1,j), (i,j-1), and (i,j+1))
/// Indices into \c contributingCells_.
std::vector<ContrIndexType> rectNeighbours{};
/// Connecting cell's diagnoal (level-2) neighbours
/// ((i-1,j-1), (i+1,j-1), (i-1,j+1), and (i+1,j+1))
/// Indices into \c contributingCells_.
std::vector<ContrIndexType> diagNeighbours{};
double porv;
std::size_t global_index;
};
/// Set of well/reservoir connections from which the block-average
/// pressures derive.
std::vector<PAvgConnection> connections_{};
/// List of indices into \c connections_ that represent open connections.
std::vector<std::vector<PAvgConnection>::size_type> openConns_{};
struct Connection {
Connection(double porv_arg, double cf, ::Opm::Connection::Direction dir_arg, std::size_t index_arg) :
porv(porv_arg),
cfactor(cf),
dir(dir_arg),
global_index(index_arg)
{
}
/// Collection of all (global) cell indices that potentially contribute
/// to this block-average well pressure calculation.
std::vector<std::size_t> contributingCells_{};
double porv;
double cfactor;
::Opm::Connection::Direction dir;
std::size_t global_index;
std::vector<Neighbour> rect_neighbours;
std::vector<Neighbour> diag_neighbours;
};
/// Well level pressure values derived from block-averaging procedures.
///
/// Cached end result from \code inferBlockAveragePressures() \endcode.
Result averagePressures_{};
/// Include reservoir connection and all direction-dependent level 1 and
/// level 2 neighbours of connection's connecting cell into known cell
/// set.
///
/// Writes to \c connections_, \c openConns_, and \c contributingCells_.
///
/// \param[in] grid Collection of active cells.
///
/// \param[in] conn Specific reservoir connection
///
/// \param[inout] setupHelperMap Translation between linearised global
/// cell indices and enumerated local contributing cells. Updated as
/// new contributing cells are discovered.
void addConnection(const GridDims& cellIndexMap,
const Connection& conn,
SetupMap& setupHelperMap);
const std::string& wname() const;
double wbp() const;
double wbp4() const;
double wbp5() const;
double wbp9() const;
double wbp(WBPMode mode) const;
bool add_pressure(std::size_t global_index, double pressure);
const std::vector< std::size_t >& index_list() const;
std::pair< std::reference_wrapper<const std::vector<double>>, std::reference_wrapper<const std::vector<bool>> > data() const;
/// Top-level entry point for accumulating local WBP contributions.
///
/// Will dispatch to lower-level entry points depending on control's
/// flag for whether to average over the set of open or the set of all
/// reservoir connections. Writes to \c accumCTF_ and \c accumPV_.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] gravity Strength of gravity in SI units [m/s^2].
///
/// \param[in] refDepth Well's reference depth for block-average
/// pressure calculation. Often, but not always, equal to the well's
/// bottom-hole pressure reference depth.
void accumulateLocalContributions(const Sources& sources,
const PAvg& controls,
const double gravity,
const double refDepth);
private:
void update(const std::vector<double>& p, const std::vector<char>& m);
void add_connection(const PAvgCalculator::Connection& conn);
void add_neighbour(std::size_t global_index, std::optional<PAvgCalculator::Neighbour> neighbour, bool rect_neighbour);
double get_pressure(std::size_t global_index) const;
double cf_avg(const std::vector<std::optional<double>>& block_pressure) const;
std::pair<double,double> porv_pressure(std::size_t global_index) const;
std::vector<std::optional<double>> block_pressures(PAvgCalculator::WBPMode mode) const;
/// Communicate local contributions and collect global (off-rank)
/// contributions.
///
/// Intended as an MPI-aware customisation point. Typically a no-op in
/// a sequential run.
///
/// Reads from and writes to data members \c accumCTF_ and \c accumPV_.
virtual void collectGlobalContributions();
/// Form final result object from all accumulated contributions.
///
/// Writes to \c averagePressures_.
///
/// \param[in] controls Averaging procedure controls. Needed for
/// weighting factor F2 (== conn_weight()) between CTF-weighted
/// average (\c accumCTF_) and PV-weighted average (\c accumPV_).
void assignResults(const PAvg& controls);
/// Include individual neighbour of currently latest connection's
/// connecting cell into known cell set.
///
/// Writes to \code connections_.back() \endcode and \c
/// contributingCells_.
///
/// \param[in] neighbour Global, linearised cell index. Nullopt if
/// neighbour happens to be in an inactive cell or outside the
/// model's Cartesian dimensions. In that case, no change is made to
/// any data member.
///
/// \param[in] neighbourKind Classification for \p neighbour.
///
/// \param[inout] setupHelperMap Translation between linearised global
/// cell indices and enumerated local contributing cells. Updated as
/// new contributing cells are discovered.
void addNeighbour(std::optional<std::size_t> neighbour,
NeighbourKind neighbourKind,
SetupMap& setupHelperMap);
/// Global index of currently latest connection's connecting cell.
///
/// Convenience function for inferring connecting cell's IJK index.
std::size_t lastConnsCell() const;
/// Include all level 1 and level 2 neighbours orthogonal to X axis of
/// currently latest connection's connecting cell into known cell set.
///
/// Writes to \code connections_.back() \endcode and \c
/// contributingCells_.
///
/// \param[in] grid Collection of active cells.
///
/// \param[inout] setupHelperMap Translation between linearised global
/// cell indices and enumerated local contributing cells. Updated as
/// new contributing cells are discovered.
void addNeighbours_X(const GridDims& grid, SetupMap& setupHelperMap);
/// Include all level 1 and level 2 neighbours orthogonal to Y axis of
/// currently latest connection's connecting cell into known cell set.
///
/// Writes to \code connections_.back() \endcode and \c
/// contributingCells_.
///
/// \param[in] grid Collection of active cells.
///
/// \param[inout] setupHelperMap Translation between linearised global
/// cell indices and enumerated local contributing cells. Updated as
/// new contributing cells are discovered.
void addNeighbours_Y(const GridDims& grid, SetupMap& setupHelperMap);
/// Include all level 1 and level 2 neighbours orthogonal to Z axis of
/// currently latest connection's connecting cell into known cell set.
///
/// Writes to \code connections_.back() \endcode and \c
/// contributingCells_.
///
/// \param[in] grid Collection of active cells.
///
/// \param[inout] setupHelperMap Translation between linearised global
/// cell indices and enumerated local contributing cells. Updated as
/// new contributing cells are discovered.
void addNeighbours_Z(const GridDims& grid, SetupMap& setupHelperMap);
/// Calculation routine for accumulating local WBP contributions.
///
/// \tparam ConnIndexMap Callable type translating from requested set of
/// connections to linear index into all known reservoir connections.
/// Must provide a call operator such that
/// \code
/// connections_[ix(i)]
/// \endcode
/// is well formed for an object \c ix of type \p ConnIndexMap and an
/// index \c i in 0 .. n-1, with 'n' being the number of connections
/// in the current connection subset. Will typically just be the
/// identity mapping \code [](i){return i} \endcode or the open
/// connection mapping \code [](i){return openConns_[i]} \endcode.
///
/// \tparam CTFPressureWeightFunction Callable type generating term
/// weighting values for the CTF-weighted connection contributions.
/// Must provide a call operator such that
/// \code
/// double w = weight(src)
/// \endcode
/// is well formed for an object \c weight of type \p
/// CTFPressureWeightFunction and a \c src object of type \code
/// PAvgDynamicSourceData::SourceDataSpan<const double> \endcode.
/// Will typically be a lambda that returns the pore volume in \c src
/// if the weighting factor F1 in WPAVE is negative, or a lambda that
/// just returns the number one (1.0) otherwise.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] connDP Pressure correction term for each reservoir
/// connection.
///
/// \param[in] connIndex Translation method from active connection index
/// to index into all known reservoir connections.
///
/// \param[in] ctfPressWeight Pressure weighting method for CTF term's
/// individual contributions.
template <typename ConnIndexMap, typename CTFPressureWeightFunction>
void accumulateLocalContributions(const Sources& sources,
const PAvg& controls,
const std::vector<double>& connDP,
ConnIndexMap connIndex,
CTFPressureWeightFunction ctfPressWeight);
/// Final dispatch level before going to calculation routine which
/// accumulates the local WBP contributions.
///
/// Dispatches based on sign of averaging procedure's F1 weighting term
/// (== inner_weight()). If F1 < 0, then invoke calculation routine
/// with a pore-volume based weighting of the individual cell
/// contributions. Otherwise, use unit weighting of the individual cell
/// contributions and weight the accumulated CTF contributions for a
/// single reservoir connection according to F1.
///
/// \tparam ConnIndexMap Callable type translating from requested set of
/// connections to linear index into all known reservoir connections.
/// Must provide a call operator such that
/// \code
/// connections_[ix(i)]
/// \endcode
/// is well formed for an object \c ix of type \p ConnIndexMap and an
/// index \c i in 0 .. n-1, with 'n' being the number of connections
/// in the current connection subset. Will typically just be the
/// identity mapping \code [](i){return i} \endcode or the open
/// connection mapping \code [](i){return openConns_[i]} \endcode.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] connDP Pressure correction term for each reservoir
/// connection.
///
/// \param[in] connIndex Translation method from active connection index
/// to index into all known reservoir connections.
template <typename ConnIndexMap>
void accumulateLocalContributions(const Sources& sources,
const PAvg& controls,
const std::vector<double>& connDP,
ConnIndexMap&& connIndex);
/// First dispatch level before going to calculation routine which
/// accumulates the local WBP contributions.
///
/// Invokes final dispatch level on set of open connections only.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] connDP Pressure correction term for each reservoir
/// connection.
void accumulateLocalContribOpen(const Sources& sources,
const PAvg& controls,
const std::vector<double>& connDP);
/// First dispatch level before going to calculation routine which
/// accumulates the local WBP contributions.
///
/// Invokes final dispatch level on set of all known connections.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls.
///
/// \param[in] connDP Pressure correction term for each reservoir
/// connection.
void accumulateLocalContribAll(const Sources& sources,
const PAvg& controls,
const std::vector<double>& connDP);
/// Compute pressure correction term/offset using Well method
///
/// Uses mixture density from well bore.
///
/// \tparam ConnIndexMap Callable type translating from requested set of
/// connections to linear index into all known reservoir connections.
/// Must provide a call operator such that
/// \code
/// connections_[ix(i)]
/// \endcode
/// is well formed for an object \c ix of type \p ConnIndexMap and an
/// index \c i in 0 .. n-1, with 'n' being the number of connections
/// in the current connection subset. Will typically just be the
/// identity mapping \code [](i){return i} \endcode or the open
/// connection mapping \code [](i){return openConns_[i]} \endcode.
///
/// \param[in] nconn Number of elements in active connection subset.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] gravity Strength of gravity in SI units [m/s^2].
///
/// \param[in] refDepth Well's reference depth for block-average
/// pressure calculation. Often, but not always, equal to the well's
/// bottom-hole pressure reference depth.
///
/// \param[in] connIndex Translation method from active connection index
/// to index into all known reservoir connections.
///
/// \return Pressure correction term for each active connection.
template <typename ConnIndexMap>
std::vector<double>
connectionPressureOffsetWell(const std::size_t nconn,
const Sources& sources,
const double gravity,
const double refDepth,
ConnIndexMap connIndex) const;
/// Compute pressure correction term/offset using Reservoir method
///
/// Uses pore-volume weighted mixture density from connecting cell and
/// its level 1 and level 2 neighbours.
///
/// \tparam ConnIndexMap Callable type translating from requested set of
/// connections to linear index into all known reservoir connections.
/// Must provide a call operator such that
/// \code
/// connections_[ix(i)]
/// \endcode
/// is well formed for an object \c ix of type \p ConnIndexMap and an
/// index \c i in 0 .. n-1, with 'n' being the number of connections
/// in the current connection subset. Will typically just be the
/// identity mapping \code [](i){return i} \endcode or the open
/// connection mapping \code [](i){return openConns_[i]} \endcode.
///
/// \param[in] nconn Number of elements in active connection subset.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] gravity Strength of gravity in SI units [m/s^2].
///
/// \param[in] refDepth Well's reference depth for block-average
/// pressure calculation. Often, but not always, equal to the well's
/// bottom-hole pressure reference depth.
///
/// \param[in] connIndex Translation method from active connection index
/// to index into all known reservoir connections.
///
/// \return Pressure correction term for each active connection.
template <typename ConnIndexMap>
std::vector<double>
connectionPressureOffsetRes(const std::size_t nconn,
const Sources& sources,
const double gravity,
const double refDepth,
ConnIndexMap connIndex) const;
/// Top-level entry point for computing the pressure correction
/// term/offset of each active reservoir connection
///
/// Will dispatch to lower level calculation routines based on algorithm
/// selection parameter in procedure controls.
///
/// \param[in] sources Connection and cell-level raw data.
///
/// \param[in] controls Averaging procedure controls. This function uses
/// the depth correction and open connections flags.
///
/// \param[in] gravity Strength of gravity in SI units [m/s^2].
///
/// \param[in] refDepth Well's reference depth for block-average
/// pressure calculation. Often, but not always, equal to the well's
/// bottom-hole pressure reference depth.
///
/// \return Pressure correction term for each active connection.
std::vector<double>
connectionPressureOffset(const Sources& sources,
const PAvg& controls,
const double gravity,
const double refDepth) const;
std::string well_name;
PAvg m_pavg;
std::vector<Connection> m_connections;
std::map<std::size_t, std::size_t> m_index_map;
std::vector<std::size_t> m_index_list;
std::vector<double> pressure;
std::vector<char> valid_pressure;
double ref_depth;
};
/// Form linear combination of WBP result objects.
///
/// Typically the very last step of computing the block-averaged well
/// pressure values; namely a weighted averaged of the CTF-weighted and the
/// PV-weighted contributions.
///
/// \param[in] alpha Coefficient in linear combination. Typically the F2
/// weighting factor from the WPAVE (or WWPAVE) keyword.
///
/// \param[in] x First WBP result. Typically the CTF-weighted WBP result.
///
/// \param[in] beta Coefficient in linear combination. Typically 1-F2, with
/// F2 from WPAVE.
///
/// \param[in] y Second WBP result. Typically the PV-weighted WBP result.
///
/// \return \code alpha*x + beta*y \endcode.
PAvgCalculator::Result
linearCombination(const double alpha, PAvgCalculator::Result x,
const double beta , const PAvgCalculator::Result& y);
} // namespace Opm
#endif // PAVG_CALCULATOR_HPP
}
#endif

View File

@@ -1,5 +1,5 @@
/*
Copyright 2020, 2023 Equinor ASA.
Copyright 2020 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
@@ -17,125 +17,33 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAVE_CALC_COLLECTIONHPP
#define PAVE_CALC_COLLECTIONHPP
#include <cstddef>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm {
class PAvgCalculator;
} // namespace Opm
#include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
#include <opm/input/eclipse/Schedule/Well/PAvgCalculator.hpp>
namespace Opm {
/// Collection of WBPn calculation objects, one for each well.
class PAvgCalculatorCollection
{
class PAvgCalculatorCollection {
public:
/// Wrapper for a WBPn calclation object.
///
/// We use a pointer here to enable polymorphic behaviour at runtime,
/// e.g., parallel calculation in an MPI-enabled simulation run.
using CalculatorPtr = std::unique_ptr<PAvgCalculator>;
/// Predicate for whether or not a particular source location is active.
///
/// One typical use case is determining whether or not a particular cell
/// defined by its Cartesian (I,J,K) index triple is actually amongst
/// the model's active cells.
///
/// This predicate will be called with a vector of source location
/// indices and must return a vector of the same size that holds the
/// value 'true' if the corresponding source location is active and
/// 'false' otherwise.
using ActivePredicate = std::function<
std::vector<bool>(const std::vector<std::size_t>&)>;
/// Default constructor.
PAvgCalculatorCollection() = default;
/// Destructor.
~PAvgCalculatorCollection() = default;
/// Copy constructor.
PAvgCalculatorCollection(const PAvgCalculatorCollection&) = delete;
/// Move constructor.
PAvgCalculatorCollection(PAvgCalculatorCollection&&) = default;
/// Assignment operator.
PAvgCalculatorCollection& operator=(const PAvgCalculatorCollection&) = delete;
/// Move-assignment operator.
PAvgCalculatorCollection& operator=(PAvgCalculatorCollection&&) = default;
/// Assign/register a WBPn calculation object for a single well.
///
/// \param[in] wellID Unique numeric ID representing a single well.
/// Typically the \code seqIndex() \endcode of a \c Well object.
///
/// \param[in] calculator Calculation object specific to a single well.
///
/// \return Index by which to refer to the calculation object later,
/// e.g., when calculating the WBPn values for a single well. No
/// relation to \p wellID.
std::size_t setCalculator(const std::size_t wellID, CalculatorPtr calculator);
/// Discard inactive source locations from all WBPn calculation objects.
///
/// At the end of this call, no source location deemed to be "inactive"
/// will be amongst those later used for collection of source term
/// contributions.
///
/// \param[in] isActive Predicate for whether or not a source location
/// is "active". The caller determines what "active" means. Must
/// abide by the protocol outlined above.
void pruneInactiveWBPCells(ActivePredicate isActive);
/// Access mutable WBPn calculation object.
///
/// \param[in] i WBPn calculation object index. Must be one returned
/// from a previous call to \c setCalculator.
///
/// \return Mutable WBPn calculation object.
PAvgCalculator& operator[](const std::size_t i);
/// Access immutable WBPn calculation object.
///
/// \param[in] i WBPn calculation object index. Must be one returned
/// from a previous call to \c setCalculator.
///
/// \return Immutable WBPn calculation object.
const PAvgCalculator& operator[](const std::size_t i) const;
/// Whether or not this collection has any WBPn calculation objects.
bool empty() const;
/// Number of WBPn calculation objects owned by this collection.
std::size_t numCalculators() const;
/// Union of all distinct/unique cells/source locations contributing to
/// this complete collection of WBPn calculation objects.
///
/// Mainly intended to configure \c PAvgDynamicSourceData objects.
std::vector<std::size_t> allWBPCells() const;
void add(const PAvgCalculator& calculator);
bool has(const std::string& wname) const;
const PAvgCalculator& get(const std::string& wname) const;
const std::vector<std::size_t>& index_list() const;
void add_pressure(std::size_t index, double pressure);
private:
/// Representation of calculator indices.
using CalcIndex = std::vector<CalculatorPtr>::size_type;
/// Translation table for mapping Well IDs to calculator indices.
std::unordered_map<std::size_t, CalcIndex> index_{};
/// Collection of WBPn calculation objects.
std::vector<CalculatorPtr> calculators_{};
std::unordered_map<std::string, PAvgCalculator> calculators;
mutable std::optional<std::vector<std::size_t>> indexlist;
};
} // namespace Opm
#endif // PAVE_CALC_COLLECTIONHPP
}
#endif

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