Compare commits
343 Commits
testing/20
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa165c0d7 | ||
|
|
8ff950227f | ||
|
|
bc5aeaf4bf | ||
|
|
0108437201 | ||
|
|
828fe797f0 | ||
|
|
8f24032612 | ||
|
|
ee6bfbd76f | ||
|
|
54ee583112 | ||
|
|
b69010cfc9 | ||
|
|
2859980cb4 | ||
|
|
3ffefd8098 | ||
|
|
852fdd7ac4 | ||
|
|
47a43daeac | ||
|
|
b562bef1af | ||
|
|
414b6820b4 | ||
|
|
5dbc22484e | ||
|
|
8b838264dd | ||
|
|
c533e1206f | ||
|
|
d87f9edf60 | ||
|
|
dbff25f79b | ||
|
|
4b657fc4cf | ||
|
|
a4e66a5484 | ||
|
|
226bfbe524 | ||
|
|
164ab30fa1 | ||
|
|
d5ce2b6a76 | ||
|
|
2997338eb2 | ||
|
|
ebedc9b0b6 | ||
|
|
ac58d8428c | ||
|
|
ba58cbc166 | ||
|
|
bd0c0f6356 | ||
|
|
de9a93377c | ||
|
|
55057540e2 | ||
|
|
fe1272a2e6 | ||
|
|
c25275d0ee | ||
|
|
ffba48d7f2 | ||
|
|
dbfad81253 | ||
|
|
a0aafc5d5b | ||
|
|
9afaa32ca7 | ||
|
|
68a254ffdc | ||
|
|
4dafe9456a | ||
|
|
8e49c35c18 | ||
|
|
25d7b538aa | ||
|
|
877ff028be | ||
|
|
c5eca4b1e4 | ||
|
|
b4915e7b55 | ||
|
|
b2a37d1e54 | ||
|
|
466341fa0f | ||
|
|
c279184229 | ||
|
|
bd73bb6c55 | ||
|
|
78170ccfce | ||
|
|
7852e584f9 | ||
|
|
a9bb73559d | ||
|
|
be36439600 | ||
|
|
9e40f3be4f | ||
|
|
0d172c9a1c | ||
|
|
ad6c98e0da | ||
|
|
8fb0e1e222 | ||
|
|
d7bd8d25cd | ||
|
|
d0d6d57472 | ||
|
|
0923ffeef2 | ||
|
|
7a158fc45c | ||
|
|
fdac0f576c | ||
|
|
e6aecbd7ac | ||
|
|
5083db3715 | ||
|
|
1247309b3f | ||
|
|
a1365ffc99 | ||
|
|
4b62303f36 | ||
|
|
d7249ea6e6 | ||
|
|
810aa6970b | ||
|
|
598b5b1ff4 | ||
|
|
5734923b1e | ||
|
|
4eb41c569e | ||
|
|
85f13c3e64 | ||
|
|
01090a8722 | ||
|
|
2b4212bac0 | ||
|
|
4bee03be6f | ||
|
|
7360755c63 | ||
|
|
f7cf50830d | ||
|
|
21dbd82bb9 | ||
|
|
0a730d949f | ||
|
|
ba1f9e882b | ||
|
|
745720ef99 | ||
|
|
3595eb7c82 | ||
|
|
75d28fc6ce | ||
|
|
ade0cd059e | ||
|
|
daf9337599 | ||
|
|
9bff0094f1 | ||
|
|
c3e992f996 | ||
|
|
d9c81da18c | ||
|
|
94fae0da30 | ||
|
|
6cd420ed9b | ||
|
|
19dde5e6d3 | ||
|
|
5b1065df45 | ||
|
|
e452058b4e | ||
|
|
e84edae209 | ||
|
|
a3f08ca6ea | ||
|
|
858e06044e | ||
|
|
1812acccec | ||
|
|
1d402bdca3 | ||
|
|
d24c327a90 | ||
|
|
fe12e48b5c | ||
|
|
088f8ff9e0 | ||
|
|
57c1c2d984 | ||
|
|
7335d72e8b | ||
|
|
b741a73957 | ||
|
|
bf971c0ede | ||
|
|
c910a51359 | ||
|
|
a73e82110c | ||
|
|
daa67dc8d6 | ||
|
|
eb15695ed0 | ||
|
|
75e196cdd8 | ||
|
|
00cc2b9075 | ||
|
|
53c29e56d4 | ||
|
|
205c4a94db | ||
|
|
25522dc424 | ||
|
|
5421efd79d | ||
|
|
c5935c97f6 | ||
|
|
fa77187871 | ||
|
|
345452109f | ||
|
|
4d8f75e24d | ||
|
|
c9821faddc | ||
|
|
ef5f90c12b | ||
|
|
066dca43ba | ||
|
|
16c9d7d04d | ||
|
|
2a07a2e8a2 | ||
|
|
118f4dd3de | ||
|
|
7a2c1157a0 | ||
|
|
0caf039bcb | ||
|
|
f80b220b44 | ||
|
|
3542d43c72 | ||
|
|
8c6cfdc704 | ||
|
|
f38e1511b5 | ||
|
|
130208b20e | ||
|
|
094f17532d | ||
|
|
f4196ff25e | ||
|
|
25d7e99413 | ||
|
|
b4edd0acda | ||
|
|
9c5acbb304 | ||
|
|
1ecd62d98d | ||
|
|
f293bcfc3c | ||
|
|
7e70d85c83 | ||
|
|
595efe7e48 | ||
|
|
04d42c2f4e | ||
|
|
f700053736 | ||
|
|
ccba767b24 | ||
|
|
568506627e | ||
|
|
585447fd22 | ||
|
|
fa2e0efd17 | ||
|
|
c244625865 | ||
|
|
15a7d7597d | ||
|
|
c7368949dd | ||
|
|
9b383db145 | ||
|
|
201978c9b2 | ||
|
|
8058167310 | ||
|
|
dcdbf36ec3 | ||
|
|
3e03a7d93f | ||
|
|
db0139e842 | ||
|
|
6df9cf66ea | ||
|
|
8967c13d3e | ||
|
|
167b344506 | ||
|
|
6b8e04460c | ||
|
|
184ba02df8 | ||
|
|
6eff5158df | ||
|
|
af7693ef6b | ||
|
|
03a2bbdf80 | ||
|
|
43cc132651 | ||
|
|
f55d3e1578 | ||
|
|
3dc347f894 | ||
|
|
275cf03f0d | ||
|
|
6ff4d8b136 | ||
|
|
010dd03c6d | ||
|
|
6bf64b18fe | ||
|
|
a91d47f191 | ||
|
|
228aacd390 | ||
|
|
40aad6d64e | ||
|
|
7425f8b988 | ||
|
|
945438b210 | ||
|
|
f0eed83b12 | ||
|
|
b02578655d | ||
|
|
19988494c0 | ||
|
|
b5542c4e56 | ||
|
|
40bd7b86b0 | ||
|
|
ab737ab4d3 | ||
|
|
732c5ae4d2 | ||
|
|
999b06b0eb | ||
|
|
e27933270a | ||
|
|
e00a5d5fa9 | ||
|
|
785d80b677 | ||
|
|
ef19a67617 | ||
|
|
10a225785e | ||
|
|
4e8352dabb | ||
|
|
1617d2b434 | ||
|
|
946d1cb877 | ||
|
|
a1b8303ac3 | ||
|
|
4c0c394b77 | ||
|
|
5b86ef115c | ||
|
|
1fee73481e | ||
|
|
c914b7e07c | ||
|
|
ff68195c4f | ||
|
|
a1c7e8f5d4 | ||
|
|
a27b39ff05 | ||
|
|
1be3e88f58 | ||
|
|
7c3aacd118 | ||
|
|
159ffeaef3 | ||
|
|
c345aa3f4e | ||
|
|
a51d18cab0 | ||
|
|
0d0b8b257f | ||
|
|
c9331d7fed | ||
|
|
849eb80e41 | ||
|
|
e685eccdc9 | ||
|
|
169ec76605 | ||
|
|
b311fbb9d0 | ||
|
|
bfe2507184 | ||
|
|
466693f1d0 | ||
|
|
ecca78af85 | ||
|
|
551f1f8c76 | ||
|
|
9e97dde466 | ||
|
|
b3cfb4ee78 | ||
|
|
bed76c330b | ||
|
|
8f2a36593d | ||
|
|
5736dd6e9c | ||
|
|
ff1b245b8f | ||
|
|
e77bd172c5 | ||
|
|
0301d402a4 | ||
|
|
fde95a69d1 | ||
|
|
75d93f196d | ||
|
|
62b826e14f | ||
|
|
96c02c9d35 | ||
|
|
3d4b467a2f | ||
|
|
7451e6618f | ||
|
|
cf0b7db534 | ||
|
|
7986e99e61 | ||
|
|
6cc65ada59 | ||
|
|
7bf635ef59 | ||
|
|
c138e78ddb | ||
|
|
1bca0f6480 | ||
|
|
16f6e3ee0c | ||
|
|
d6a9ea162d | ||
|
|
b900441ac6 | ||
|
|
65b629e423 | ||
|
|
76f709aa70 | ||
|
|
57d19c9cdb | ||
|
|
e9756c3ee5 | ||
|
|
19c81fad9c | ||
|
|
ecca175ccd | ||
|
|
2caf82baff | ||
|
|
d82be29745 | ||
|
|
8eb10b33ce | ||
|
|
42d08db25b | ||
|
|
d7d3d2538a | ||
|
|
e0fad15f0a | ||
|
|
4c2105f85c | ||
|
|
981e6c9b22 | ||
|
|
4e83b63a0d | ||
|
|
4c1333fb4f | ||
|
|
6db8a45d88 | ||
|
|
c33f69fd1b | ||
|
|
92b1b34dca | ||
|
|
bb5b2f4232 | ||
|
|
ebe2f28c67 | ||
|
|
414661b898 | ||
|
|
4e00897117 | ||
|
|
98133f44fc | ||
|
|
1574d7714d | ||
|
|
3c41d4c17a | ||
|
|
ef606711f2 | ||
|
|
ed9827bfcf | ||
|
|
fcadc69e49 | ||
|
|
27eaeb2ec9 | ||
|
|
420b66822b | ||
|
|
9913cb8600 | ||
|
|
c874c8b6ea | ||
|
|
6ca6f27640 | ||
|
|
bd4e872230 | ||
|
|
3a9bab6285 | ||
|
|
30e2577f31 | ||
|
|
959502e8cd | ||
|
|
4a3c6b2058 | ||
|
|
29db657757 | ||
|
|
91734f13c4 | ||
|
|
b4c86e73af | ||
|
|
f3a82ddd70 | ||
|
|
4174602da2 | ||
|
|
749353a4b0 | ||
|
|
a8db1f155c | ||
|
|
59b4ca4b20 | ||
|
|
261f7c3c03 | ||
|
|
a1214ba49e | ||
|
|
d9585d6585 | ||
|
|
a668248aa1 | ||
|
|
d40177dacb | ||
|
|
67acaaa637 | ||
|
|
33c5b79d98 | ||
|
|
7790fe743e | ||
|
|
40a2e848cb | ||
|
|
7f6fd34fd3 | ||
|
|
586f296de0 | ||
|
|
8a2c2304e7 | ||
|
|
9df659370c | ||
|
|
66650a20fb | ||
|
|
eae4a080cd | ||
|
|
eb5454aeaf | ||
|
|
dc0ccc010a | ||
|
|
aa63d772d7 | ||
|
|
91afb0b656 | ||
|
|
666cc9210b | ||
|
|
bdd82445d2 | ||
|
|
bf9a142b6d | ||
|
|
9bbacfe710 | ||
|
|
982b221753 | ||
|
|
a4d0bb685b | ||
|
|
3429db8fc1 | ||
|
|
fc0e61518b | ||
|
|
b7eefe8b18 | ||
|
|
0d5b3a5285 | ||
|
|
3eef43b904 | ||
|
|
db90ecd88c | ||
|
|
68769e5b1d | ||
|
|
85949d44ac | ||
|
|
690e00a079 | ||
|
|
cf42146d84 | ||
|
|
23cbe9035b | ||
|
|
2cd6fa2f49 | ||
|
|
1b1f7b807d | ||
|
|
bf52e6d123 | ||
|
|
c6bbe5d24b | ||
|
|
ad001df804 | ||
|
|
69e921b33a | ||
|
|
875626b738 | ||
|
|
7e05d51e6f | ||
|
|
0dc80689c0 | ||
|
|
ae8b81c7ae | ||
|
|
ba0675997a | ||
|
|
15c473e3bb | ||
|
|
6465b5b23c | ||
|
|
9e93dc5af2 | ||
|
|
481123ed25 | ||
|
|
4968c35ad8 | ||
|
|
f6136e69fe | ||
|
|
6832788eef | ||
|
|
4c0776e3d2 | ||
|
|
00d1607347 | ||
|
|
25fbff2632 |
@@ -7,7 +7,12 @@ set(OPM_MACROS_ROOT ${PROJECT_SOURCE_DIR})
|
||||
|
||||
option(ENABLE_ECL_INPUT "Enable eclipse input support?" ON)
|
||||
option(ENABLE_ECL_OUTPUT "Enable eclipse output support?" ON)
|
||||
option(ENABLE_MOCKSIM "Build the mock simulator for io testing" OFF)
|
||||
option(ENABLE_MOCKSIM "Build the mock simulator for io testing" ON)
|
||||
option(ENABLE_WELL_TEST "Enable testing of well code when building Schedule object" OFF)
|
||||
|
||||
if (ENABLE_WELL_TEST)
|
||||
add_definitions(-DWELL_TEST)
|
||||
endif()
|
||||
|
||||
# Output implies input
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
@@ -143,16 +148,10 @@ if (ENABLE_MOCKSIM)
|
||||
set(_libs mocksim opmcommon
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
|
||||
foreach( test test_msim)
|
||||
add_executable(${test} "tests/msim/${test}")
|
||||
target_link_libraries(${test} ${_libs})
|
||||
add_test(NAME ${test} COMMAND ${test})
|
||||
set_tests_properties(${test} PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
|
||||
|
||||
if(HAVE_DYNAMIC_BOOST_TEST)
|
||||
set_target_properties(${test} PROPERTIES
|
||||
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
|
||||
endif()
|
||||
foreach( test test_msim test_msim_ACTIONX )
|
||||
opm_add_test(${test} SOURCES tests/msim/${test}
|
||||
LIBRARIES ${_libs}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -172,16 +171,10 @@ if(ENABLE_ECL_INPUT)
|
||||
# Add the tests
|
||||
set(_libs testutil opmcommon
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
opm_add_test(test_compareSummary CONDITION ENABLE_ECL_INPUT
|
||||
LIBRARIES ${_libs})
|
||||
opm_add_test(test_EclFilesComparator CONDITION ENABLE_ECL_INPUT
|
||||
LIBRARIES ${_libs})
|
||||
if(HAVE_DYNAMIC_BOOST_TEST)
|
||||
set_target_properties(test_compareSummary PROPERTIES
|
||||
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
|
||||
set_target_properties(test_EclFilesComparator PROPERTIES
|
||||
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
|
||||
endif()
|
||||
foreach(test test_compareSummary test_EclFilesComparator)
|
||||
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT
|
||||
LIBRARIES ${_libs})
|
||||
endforeach()
|
||||
install(TARGETS compareECL DESTINATION bin)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
# the library needs it.
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
examples/test_util/EclFile.cpp
|
||||
src/opm/common/data/SimulationDataContainer.cpp
|
||||
src/opm/common/OpmLog/CounterLog.cpp
|
||||
src/opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
@@ -75,34 +76,42 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Runspec.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ActionAST.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ActionContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Actions.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ActionX.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Connection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellConnections.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actions.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionParser.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/GroupTree.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/injection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Tuning.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellTracerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/WellTestState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WList.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp
|
||||
@@ -117,11 +126,23 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableSchema.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp
|
||||
src/opm/parser/eclipse/EclipseState/UDQConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQExpression.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParser.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.cpp
|
||||
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
|
||||
src/opm/parser/eclipse/Parser/ParseContext.cpp
|
||||
src/opm/parser/eclipse/Parser/Parser.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserEnums.cpp
|
||||
@@ -169,6 +190,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
endif()
|
||||
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_EclFile.cpp
|
||||
tests/test_calculateCellVol.cpp
|
||||
tests/test_cmp.cpp
|
||||
tests/test_cubic.cpp
|
||||
@@ -214,9 +236,11 @@ if(ENABLE_ECL_INPUT)
|
||||
tests/parser/MULTREGTScannerTests.cpp
|
||||
tests/parser/OrderedMapTests.cpp
|
||||
tests/parser/ParseContextTests.cpp
|
||||
tests/parser/ParseContext_EXIT1.cpp
|
||||
tests/parser/PORVTests.cpp
|
||||
tests/parser/RawKeywordTests.cpp
|
||||
tests/parser/RestartConfigTests.cpp
|
||||
tests/parser/RockTableTests.cpp
|
||||
tests/parser/RunspecTests.cpp
|
||||
tests/parser/SatfuncPropertyInitializersTests.cpp
|
||||
tests/parser/ScheduleTests.cpp
|
||||
@@ -241,13 +265,16 @@ if(ENABLE_ECL_INPUT)
|
||||
tests/parser/WellSolventTests.cpp
|
||||
tests/parser/WellTracerTests.cpp
|
||||
tests/parser/WellTests.cpp
|
||||
tests/parser/WLIST.cpp
|
||||
tests/parser/WTEST.cpp)
|
||||
endif()
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_AggregateWellData.cpp
|
||||
#The unit tests are not finished yet, will be added in a separate pullrequest soon
|
||||
#tests/test_AggregateMSWData.cpp
|
||||
tests/test_AggregateGroupData.cpp
|
||||
tests/test_AggregateMSWData.cpp
|
||||
tests/test_AggregateConnectionData.cpp
|
||||
tests/test_ArrayDimChecker.cpp
|
||||
tests/test_CharArrayNullTerm.cpp
|
||||
tests/test_EclipseIO.cpp
|
||||
tests/test_DoubHEAD.cpp
|
||||
@@ -273,6 +300,7 @@ list (APPEND TEST_DATA_FILES
|
||||
)
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/expect-wdims.err.out
|
||||
tests/FIRST_SIM.DATA
|
||||
tests/FIRST_SIM_THPRES.DATA
|
||||
tests/summary_deck.DATA
|
||||
@@ -283,6 +311,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
tests/summary_deck_non_constant_porosity.DATA
|
||||
tests/SUMMARY_EFF_FAC.DATA
|
||||
tests/SPE1CASE1.DATA
|
||||
tests/SPE1CASE1.SMSPEC
|
||||
tests/SPE9_CP_PACKED.DATA
|
||||
tests/SOFR_TEST.DATA
|
||||
)
|
||||
@@ -294,6 +323,7 @@ if(ENABLE_ECL_INPUT)
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -305,10 +335,13 @@ if(ENABLE_ECL_INPUT)
|
||||
list (APPEND PROGRAM_SOURCE_FILES
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list( APPEND PUBLIC_HEADER_FILES
|
||||
examples/test_util/EclFile.hpp
|
||||
examples/test_util/data/EclIOdata.hpp
|
||||
opm/common/ErrorMacros.hpp
|
||||
opm/common/Exceptions.hpp
|
||||
opm/common/data/SimulationDataContainer.hpp
|
||||
@@ -354,6 +387,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/Units/UnitSystem.hpp
|
||||
opm/parser/eclipse/Units/Units.hpp
|
||||
opm/parser/eclipse/Units/Dimension.hpp
|
||||
opm/parser/eclipse/Parser/ErrorGuard.hpp
|
||||
opm/parser/eclipse/Parser/ParserItem.hpp
|
||||
opm/parser/eclipse/Parser/Parser.hpp
|
||||
opm/parser/eclipse/Parser/ParserRecord.hpp
|
||||
@@ -439,6 +473,10 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Tables/SgwfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvdsTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RockwnodTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/OverburdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PmiscTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp
|
||||
@@ -452,21 +490,30 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Aquancon.hpp
|
||||
opm/parser/eclipse/EclipseState/AquiferCT.hpp
|
||||
opm/parser/eclipse/EclipseState/Aquifetp.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ActionAST.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ActionContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Actions.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ActionX.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellTracerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp
|
||||
@@ -474,24 +521,27 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Connection.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellTestState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/checkDeck.hpp
|
||||
opm/parser/eclipse/EclipseState/Runspec.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp
|
||||
opm/parser/eclipse/EclipseState/UDQConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQExpression.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp
|
||||
opm/parser/eclipse/Deck/DeckItem.hpp
|
||||
opm/parser/eclipse/Deck/Deck.hpp
|
||||
opm/parser/eclipse/Deck/Section.hpp
|
||||
@@ -510,7 +560,9 @@ if(ENABLE_ECL_OUTPUT)
|
||||
opm/output/data/Solution.hpp
|
||||
opm/output/data/Wells.hpp
|
||||
opm/output/eclipse/VectorItems/connection.hpp
|
||||
opm/output/eclipse/VectorItems/group.hpp
|
||||
opm/output/eclipse/VectorItems/intehead.hpp
|
||||
opm/output/eclipse/VectorItems/msw.hpp
|
||||
opm/output/eclipse/VectorItems/well.hpp
|
||||
opm/output/eclipse/AggregateGroupData.hpp
|
||||
opm/output/eclipse/AggregateConnectionData.hpp
|
||||
|
||||
@@ -7,6 +7,7 @@ set(genkw_SOURCES src/opm/json/JsonObject.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckOutput.cpp
|
||||
src/opm/parser/eclipse/Generator/KeywordGenerator.cpp
|
||||
src/opm/parser/eclipse/Generator/KeywordLoader.cpp
|
||||
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
|
||||
src/opm/parser/eclipse/Parser/ParseContext.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserEnums.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserItem.cpp
|
||||
|
||||
@@ -192,6 +192,7 @@ endmacro (opm_data satellite target dirname files)
|
||||
# Parameters:
|
||||
# TestName Name of test
|
||||
# ONLY_COMPILE Only build test but do not run it (optional)
|
||||
# DEFAULT_ENABLE_IF Only enable by default if a given condition is true (optional)
|
||||
# ALWAYS_ENABLE Force enabling test even if -DBUILD_TESTING=OFF was set (optional)
|
||||
# EXE_NAME Name of test executable (optional, default: ./bin/${TestName})
|
||||
# CONDITION Condition to enable test (optional, cmake code)
|
||||
@@ -218,7 +219,7 @@ macro(opm_add_test TestName)
|
||||
cmake_parse_arguments(CURTEST
|
||||
"NO_COMPILE;ONLY_COMPILE;ALWAYS_ENABLE" # flags
|
||||
"EXE_NAME;PROCESSORS;WORKING_DIRECTORY" # one value args
|
||||
"CONDITION;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
|
||||
"CONDITION;DEFAULT_ENABLE_IF;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
|
||||
${ARGN})
|
||||
|
||||
set(BUILD_TESTING "${BUILD_TESTING}")
|
||||
@@ -266,6 +267,11 @@ macro(opm_add_test TestName)
|
||||
# case. They can still be build using 'make test-suite' and they can
|
||||
# be build and run using 'make check'
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "")
|
||||
if (NOT "AND OR ${CURTEST_DEFAULT_ENABLE_IF}" STREQUAL "AND OR ")
|
||||
if (NOT ${CURTEST_DEFAULT_ENABLE_IF})
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT BUILD_TESTING AND NOT CURTEST_ALWAYS_ENABLE)
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
|
||||
2
debian/changelog
vendored
2
debian/changelog
vendored
@@ -1,4 +1,4 @@
|
||||
opm-common (2019.04-pre~xenial) xenial; urgency=medium
|
||||
opm-common (2019.04-rfinal-1~xenial) xenial; urgency=medium
|
||||
|
||||
* New release
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
Module: opm-common
|
||||
Description: Open Porous Media Initiative shared infrastructure
|
||||
Version: 2019.04-pre
|
||||
Label: 2019.04-pre
|
||||
Version: 2019.04
|
||||
Label: 2019.04
|
||||
Maintainer: opm@opm-project.org
|
||||
MaintainerName: OPM community
|
||||
Url: http://opm-project.org
|
||||
|
||||
@@ -11,7 +11,7 @@ _ewoms_parameter_completor()
|
||||
|
||||
cmd="${COMP_WORDS[0]}"
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
fullcmd="$(which "$cmd")"
|
||||
fullcmd="$(which "$cmd" 2> /dev/null)"
|
||||
ALL_OPTS=$("$fullcmd" --help 2> /dev/null | grep '^ *--' | sed 's/ *\(--[a-zA-Z0-9\-]*\)=.*/\1=/')
|
||||
ALL_OPTS=$(echo "$ALL_OPTS" | sed 's/^ *--help.*/--help/')
|
||||
COMPREPLY=( $(compgen -A file -W "$ALL_OPTS" -- "${cur}") )
|
||||
@@ -32,7 +32,7 @@ _ewoms_generic_parameter_completor()
|
||||
cmd="${COMP_WORDS[0]}"
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
fullcmd="$(which "$cmd")"
|
||||
fullcmd="$(which "$cmd" 2> /dev/null)"
|
||||
if test -z "$fullcmd" || \
|
||||
! test -x "$fullcmd" || \
|
||||
(! test -f "$fullcmd" && ! test -h "$fullcmd" ) || \
|
||||
|
||||
@@ -17,12 +17,37 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
#include <opm/msim/msim.hpp>
|
||||
|
||||
|
||||
int main(int /* argc */, char** argv) {
|
||||
std::string deck_file = argv[1];
|
||||
Opm::Parser parser;
|
||||
Opm::ParseContext parse_context;
|
||||
Opm::ErrorGuard error_guard;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Opm::msim msim(argv[1]);
|
||||
msim.run();
|
||||
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
|
||||
Opm::EclipseState state(deck, parse_context, error_guard);
|
||||
Opm::Schedule schedule(deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parse_context, error_guard);
|
||||
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), parse_context, error_guard);
|
||||
|
||||
if (error_guard) {
|
||||
error_guard.dump();
|
||||
error_guard.terminate();
|
||||
}
|
||||
|
||||
Opm::msim msim(state);
|
||||
Opm::EclipseIO io(state, state.getInputGrid(), schedule, summary_config);
|
||||
msim.run(schedule, io);
|
||||
}
|
||||
|
||||
|
||||
157
examples/opmhash.cpp
Normal file
157
examples/opmhash.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <getopt.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
|
||||
|
||||
struct keyword {
|
||||
keyword(const std::string& name, const std::string& filename, std::size_t line_number, std::size_t content_hash) :
|
||||
name(name),
|
||||
filename(filename),
|
||||
line_number(line_number),
|
||||
content_hash(content_hash)
|
||||
{}
|
||||
|
||||
|
||||
std::string name;
|
||||
std::string filename;
|
||||
std::size_t line_number;
|
||||
std::size_t content_hash;
|
||||
};
|
||||
|
||||
|
||||
std::vector<keyword> load_deck(const char * deck_file) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
std::vector<keyword> keywords;
|
||||
|
||||
/* Use the same default ParseContext as flow. */
|
||||
parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE);
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN);
|
||||
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN);
|
||||
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN);
|
||||
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
for (const auto& kw : deck) {
|
||||
std::stringstream ss;
|
||||
ss << kw;
|
||||
|
||||
keywords.emplace_back(kw.name(), kw.getFileName(), kw.getLineNumber(), std::hash<std::string>{}(ss.str()));
|
||||
}
|
||||
return keywords;
|
||||
}
|
||||
|
||||
|
||||
std::size_t deck_hash(const std::vector<keyword>& keywords) {
|
||||
std::stringstream ss;
|
||||
for (const auto& kw : keywords)
|
||||
ss << kw.content_hash;
|
||||
|
||||
return std::hash<std::string>{}(ss.str());
|
||||
}
|
||||
|
||||
|
||||
void print_keywords(const std::vector<keyword>& keywords, bool location_info) {
|
||||
for (const auto& kw : keywords) {
|
||||
if (location_info)
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.filename << ":" << kw.line_number << " " << kw.content_hash << std::endl;
|
||||
else
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.content_hash << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::setw(8) << std::left << "Total" << " : " << deck_hash(keywords) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void print_help_and_exit() {
|
||||
const char * help_text = R"(The purpose of the opmhash program is to load a deck and create a summary, by
|
||||
diffing two such summaries it is simple to determine if two decks are similar.
|
||||
For each keyword a hash of the normalized content is calculated. The output of
|
||||
the program will look like this:
|
||||
|
||||
RUNSPEC : 13167205945009276792
|
||||
TITLE : 16047371705964514902
|
||||
DIMENS : 1264233216877515756
|
||||
NONNC : 10052807539267647959
|
||||
OIL : 6013609912232720008
|
||||
WATER : 14106203893673265964
|
||||
|
||||
Total : 7362809723723482303
|
||||
|
||||
Where the 'random' integer following each keyword is the hash of the content of
|
||||
that keyword. The hashing is insensitive to changes in white-space and comments
|
||||
and file location. At the bottom comes a total hash of the complete content. The
|
||||
hash of each keyword is insensitive to shuffling of keywords, but the total hash
|
||||
depends on the keyword order.
|
||||
|
||||
Options:
|
||||
|
||||
-l : Add filename and linenumber information to each keyword.
|
||||
-s : Short form - only print the hash of the complete deck.
|
||||
|
||||
)";
|
||||
std::cerr << help_text << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int arg_offset = 1;
|
||||
bool location_info = false;
|
||||
bool short_form = false;
|
||||
|
||||
while (true) {
|
||||
int c;
|
||||
c = getopt(argc, argv, "ls");
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch(c) {
|
||||
case 'l':
|
||||
location_info = true;
|
||||
break;
|
||||
case 's':
|
||||
short_form = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
arg_offset = optind;
|
||||
if (arg_offset >= argc)
|
||||
print_help_and_exit();
|
||||
|
||||
auto keywords = load_deck(argv[arg_offset]);
|
||||
if (short_form)
|
||||
std::cout << deck_hash(keywords) << std::endl;
|
||||
else
|
||||
print_keywords(keywords, location_info);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
@@ -30,16 +31,16 @@
|
||||
|
||||
inline void loadDeck( const char * deck_file) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
|
||||
std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
|
||||
auto deck = parser.parseFile(deck_file, parseContext);
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
std::cout << "parse complete - creating EclipseState .... "; std::cout.flush();
|
||||
Opm::EclipseState state( deck, parseContext );
|
||||
Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parseContext);
|
||||
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext );
|
||||
Opm::EclipseState state( deck, parseContext, errors );
|
||||
Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parseContext, errors);
|
||||
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext, errors );
|
||||
std::cout << "complete." << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
@@ -29,9 +30,10 @@
|
||||
|
||||
inline void pack_deck( const char * deck_file, std::ostream& os) {
|
||||
Opm::ParseContext parseContext(Opm::InputError::WARN);
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
|
||||
auto deck = parser.parseFile(deck_file, parseContext);
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
os << deck;
|
||||
|
||||
}
|
||||
|
||||
505
examples/test_util/EclFile.cpp
Normal file
505
examples/test_util/EclFile.cpp
Normal file
@@ -0,0 +1,505 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include "EclFile.hpp"
|
||||
|
||||
|
||||
// anonymous namespace for EclFile
|
||||
|
||||
namespace {
|
||||
|
||||
bool isEOF(std::fstream *fileH){
|
||||
|
||||
/* try to read 4 byte (integer), if passed eof of, return true.
|
||||
if not, seek back to current file possition */
|
||||
|
||||
int num;
|
||||
long int pos=fileH->tellg();
|
||||
fileH->read((char *)&num, sizeof(num));
|
||||
|
||||
if (fileH->eof()){
|
||||
return true;
|
||||
} else {
|
||||
fileH->seekg (pos);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int flipEndianInt(const int &num) {
|
||||
|
||||
unsigned int tmp=__builtin_bswap32(num);
|
||||
|
||||
return (int)tmp;
|
||||
}
|
||||
|
||||
float flipEndianFloat(const float &num) {
|
||||
|
||||
float value=num;
|
||||
|
||||
char *floatToConvert = reinterpret_cast<char*>(&value);
|
||||
std::reverse(floatToConvert, floatToConvert+4);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
double flipEndianDouble(const double &num) {
|
||||
double value=num;
|
||||
|
||||
char *doubleToConvert = reinterpret_cast<char*>(&value);
|
||||
std::reverse(doubleToConvert, doubleToConvert+8);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
std::tuple<const int, const int> block_size_data(EIOD::eclArrType arrType){
|
||||
|
||||
switch(arrType) {
|
||||
case EIOD::INTE : return std::make_tuple(EIOD::sizeOfInte,EIOD::MaxBlockSizeInte); break;
|
||||
case EIOD::REAL : return std::make_tuple(EIOD::sizeOfReal,EIOD::MaxBlockSizeReal); break;
|
||||
case EIOD::DOUB : return std::make_tuple(EIOD::sizeOfDoub,EIOD::MaxBlockSizeDoub); break;
|
||||
case EIOD::LOGI : return std::make_tuple(EIOD::sizeOfLogi,EIOD::MaxBlockSizeLogi); break;
|
||||
case EIOD::CHAR : return std::make_tuple(EIOD::sizeOfChar,EIOD::MaxBlockSizeChar); break;
|
||||
case EIOD::MESS : throw std::invalid_argument("Type 'MESS' have not assosiated data") ; break;
|
||||
default : throw std::invalid_argument("Unknown type"); break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string trimr(const std::string &str1) {
|
||||
|
||||
std::string tmpStr=str1;
|
||||
|
||||
while (tmpStr.back()==' '){
|
||||
tmpStr.pop_back();
|
||||
}
|
||||
|
||||
return std::move(tmpStr);
|
||||
}
|
||||
|
||||
|
||||
void readBinaryHeader(std::fstream &fileH, std::string &arrName, int &size, EIOD::eclArrType &arrType){
|
||||
|
||||
int bhead;
|
||||
std::string tmpStrName(8,' ');
|
||||
std::string tmpStrType(4,' ');
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&bhead, sizeof(bhead));
|
||||
bhead=flipEndianInt(bhead);
|
||||
|
||||
if (bhead!=16){
|
||||
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read(&tmpStrName[0], 8);
|
||||
|
||||
fileH.read((char *)&size, sizeof(size));
|
||||
size=flipEndianInt(size);
|
||||
|
||||
fileH.read(&tmpStrType[0], 4);
|
||||
|
||||
fileH.read((char *)&bhead, sizeof(bhead));
|
||||
bhead=flipEndianInt(bhead);
|
||||
|
||||
if (bhead!=16){
|
||||
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
arrName=tmpStrName;
|
||||
|
||||
if (tmpStrType=="INTE")
|
||||
arrType=EIOD::INTE;
|
||||
else if (tmpStrType=="REAL")
|
||||
arrType=EIOD::REAL;
|
||||
else if (tmpStrType=="DOUB")
|
||||
arrType=EIOD::DOUB;
|
||||
else if (tmpStrType=="CHAR")
|
||||
arrType=EIOD::CHAR;
|
||||
else if (tmpStrType=="LOGI")
|
||||
arrType=EIOD::LOGI;
|
||||
else if (tmpStrType=="MESS")
|
||||
arrType=EIOD::MESS;
|
||||
else
|
||||
throw std::runtime_error("Error, unknown array type '" + tmpStrType +"'");
|
||||
|
||||
}
|
||||
|
||||
|
||||
unsigned long int sizeOnDisk(const int num, const EIOD::eclArrType &arrType){
|
||||
|
||||
unsigned long int size=0;
|
||||
|
||||
if (arrType==EIOD::MESS){
|
||||
if (num>0) {
|
||||
std::string message="In routine calcSizeOfArray, type MESS can not have size > 0";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
} else {
|
||||
|
||||
auto sizeData = block_size_data(arrType);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
size=num*sizeOfElement;
|
||||
size=size + ((num-1) / maxNumberOfElements)*2*EIOD::sizeOfInte; // 8 byte (two integers) every 1000 element
|
||||
|
||||
if (num>0){
|
||||
size=size+2*EIOD::sizeOfInte;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
std::vector<int> readBinaryInteArray(std::fstream &fileH, const int size){
|
||||
|
||||
std::vector<int> arr;
|
||||
int rest=size;
|
||||
|
||||
auto sizeData = block_size_data(EIOD::INTE);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
arr.reserve(size);
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
while (rest > 0) {
|
||||
|
||||
int num,dhead,dtail;
|
||||
|
||||
fileH.read((char *)&dhead, sizeof(dhead));
|
||||
dhead=flipEndianInt(dhead);
|
||||
|
||||
num=dhead/sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)){
|
||||
std::string message="Error reading binary inte data, inconsistent header data or incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (int i=0;i<num;i++){
|
||||
int value;
|
||||
fileH.read((char *)&value, sizeOfElement);
|
||||
value=flipEndianInt(value);
|
||||
arr.push_back(value);
|
||||
}
|
||||
|
||||
rest=rest-num;
|
||||
|
||||
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
|
||||
std::string message="Error reading binary integer data, incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&dtail, sizeof(dtail));
|
||||
dtail=flipEndianInt(dtail);
|
||||
|
||||
if (dhead!=dtail){
|
||||
std::string message="Error reading binary real data, tail not matching header.";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
std::vector<float> readBinaryRealArray(std::fstream &fileH, const int size){
|
||||
|
||||
std::vector<float> arr;
|
||||
arr.reserve(size);
|
||||
|
||||
auto sizeData = block_size_data(EIOD::REAL);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
int rest=size;
|
||||
|
||||
while (rest > 0) {
|
||||
|
||||
int num,dhead,dtail;
|
||||
|
||||
fileH.read((char *)&dhead, sizeof(dhead));
|
||||
dhead=flipEndianInt(dhead);
|
||||
|
||||
num=dhead/sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)){
|
||||
std::string message="Error reading binary real data, inconsistent header data or incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (int i=0;i<num;i++){
|
||||
float value;
|
||||
fileH.read((char *)&value, sizeOfElement);
|
||||
value=flipEndianFloat(value);
|
||||
arr.push_back(value);
|
||||
}
|
||||
|
||||
rest=rest-num;
|
||||
|
||||
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
|
||||
std::string message="Error reading binary real data, incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&dtail, sizeof(dtail));
|
||||
dtail=flipEndianInt(dtail);
|
||||
|
||||
if (dhead!=dtail){
|
||||
std::string message="Error reading binary real data, tail not matching header.";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
std::vector<double> readBinaryDoubArray(std::fstream &fileH, const int size){
|
||||
|
||||
std::vector<double> arr;
|
||||
arr.reserve(size);
|
||||
|
||||
auto sizeData = block_size_data(EIOD::DOUB);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
int rest=size;
|
||||
|
||||
while (rest > 0) {
|
||||
|
||||
int num,dhead,dtail;
|
||||
|
||||
fileH.read((char *)&dhead, sizeof(dhead));
|
||||
dhead=flipEndianInt(dhead);
|
||||
|
||||
num=dhead/sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)){
|
||||
std::string message="Error reading binary doub data, inconsistent header data or incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (int i=0;i<num;i++){
|
||||
double value;
|
||||
fileH.read((char *)&value, sizeOfElement);
|
||||
value=flipEndianDouble(value);
|
||||
arr.push_back(value);
|
||||
}
|
||||
|
||||
rest=rest-num;
|
||||
|
||||
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
|
||||
std::string message="Error reading binary doub data, incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&dtail, sizeof(dtail));
|
||||
dtail=flipEndianInt(dtail);
|
||||
|
||||
if (dhead!=dtail){
|
||||
std::string message="Error reading binary doub data, tail not matching header.";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
std::vector<bool> readBinaryLogiArray(std::fstream &fileH, const int size){
|
||||
|
||||
std::vector<bool> arr;
|
||||
arr.reserve(size);
|
||||
|
||||
int rest=size;
|
||||
|
||||
auto sizeData = block_size_data(EIOD::LOGI);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
while (rest > 0) {
|
||||
|
||||
int num,dhead,dtail;
|
||||
|
||||
fileH.read((char *)&dhead, sizeof(dhead));
|
||||
dhead=flipEndianInt(dhead);
|
||||
|
||||
num=dhead/sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)){
|
||||
std::string message="This ?? Error reading binary logi data, inconsistent header data or incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (int i=0;i<num;i++){
|
||||
|
||||
bool value;
|
||||
unsigned int intVal;
|
||||
|
||||
fileH.read((char *)&intVal, sizeOfElement);
|
||||
|
||||
if (intVal==EIOD::true_value){
|
||||
value=true;
|
||||
} else if (intVal==EIOD::false_value){
|
||||
value=false;
|
||||
} else {
|
||||
std::string message="Error reading log value from element " + std::to_string(i);
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
arr.push_back(value);
|
||||
}
|
||||
|
||||
rest=rest-num;
|
||||
|
||||
if (((num < maxNumberOfElements) && (rest!=0)) || ((num==maxNumberOfElements) && (rest < 0))) {
|
||||
std::string message="Error reading binary logi data, incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&dtail, sizeof(dtail));
|
||||
dtail=flipEndianInt(dtail);
|
||||
|
||||
if (dhead!=dtail){
|
||||
std::string message="Error reading binary logi data, tail not matching header.";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> readBinaryCharArray(std::fstream &fileH, const int size){
|
||||
|
||||
std::vector<std::string> arr;
|
||||
arr.reserve(size);
|
||||
|
||||
int rest=size;
|
||||
|
||||
auto sizeData = block_size_data(EIOD::CHAR);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements=maxBlockSize/sizeOfElement;
|
||||
|
||||
if (!fileH.is_open()){
|
||||
std::string message="fstream fileH not open for reading";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
while (rest > 0) {
|
||||
|
||||
int num,dhead,dtail;
|
||||
|
||||
fileH.read((char *)&dhead, sizeof(dhead));
|
||||
dhead=flipEndianInt(dhead);
|
||||
|
||||
num=dhead/sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)){
|
||||
std::string message="Error reading binary char data, inconsistent header data or incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
for (int i=0;i<num;i++){
|
||||
std::string str8(8,' ');
|
||||
fileH.read(&str8[0], sizeOfElement);
|
||||
arr.push_back(trimr(str8));
|
||||
}
|
||||
|
||||
rest=rest-num;
|
||||
|
||||
if ((num < maxNumberOfElements) && (rest!=0)){
|
||||
std::string message="Error reading binary char data, incorrect number of elements";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.read((char *)&dtail, sizeof(dtail));
|
||||
dtail=flipEndianInt(dtail);
|
||||
|
||||
if (dhead!=dtail){
|
||||
std::string message="Error reading binary char data, tail not matching header.";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
EclFile::EclFile(const std::string& filename){
|
||||
|
||||
std::fstream fileH;
|
||||
|
||||
fileH.open(filename, std::ios::in | std::ios::binary);
|
||||
|
||||
if (!fileH.good()) {
|
||||
std::string message="Could not open file";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
|
||||
fileH.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
41
examples/test_util/EclFile.hpp
Normal file
41
examples/test_util/EclFile.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
//#include "EclIO.hpp"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
#include <examples/test_util/data/EclIOdata.hpp>
|
||||
|
||||
namespace EIOD = Opm::ecl;
|
||||
|
||||
class EclFile
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
explicit EclFile(const std::string& filename);
|
||||
|
||||
};
|
||||
|
||||
|
||||
54
examples/test_util/data/EclIOdata.hpp
Normal file
54
examples/test_util/data/EclIOdata.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_ECLIO_DATA_HPP
|
||||
#define OPM_ECLIO_DATA_HPP
|
||||
|
||||
#include <tuple>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
namespace ecl {
|
||||
|
||||
// type MESS have no assisiated data
|
||||
|
||||
enum eclArrType {
|
||||
INTE, REAL, DOUB, CHAR, LOGI, MESS
|
||||
};
|
||||
|
||||
const unsigned int true_value = 0xffffffff;
|
||||
const unsigned int false_value = 0x00000000;
|
||||
|
||||
const int sizeOfInte = 4; // number of bytes pr integer (inte) element
|
||||
const int sizeOfReal = 4; // number of bytes pr float (real) element
|
||||
const int sizeOfDoub = 8; // number of bytes pr double (doub) element
|
||||
const int sizeOfLogi = 4; // number of bytes pr bool (logi) element
|
||||
const int sizeOfChar = 8; // number of bytes pr string (char) element
|
||||
|
||||
const int MaxBlockSizeInte = 4000; // Maximum block size for INTE arrays in binary files
|
||||
const int MaxBlockSizeReal = 4000; // Maximum block size for REAL arrays in binary files
|
||||
const int MaxBlockSizeDoub = 8000; // Maximum block size for DOUB arrays in binary files
|
||||
const int MaxBlockSizeLogi = 4000; // Maximum block size for LOGI arrays in binary files
|
||||
const int MaxBlockSizeChar = 840; // Maximum block size for CHAR arrays in binary files
|
||||
|
||||
} // ecl
|
||||
} // Opm
|
||||
|
||||
#endif // OPM_ECLIO_DATA_HPP
|
||||
4
external/cjson/README.opm
vendored
4
external/cjson/README.opm
vendored
@@ -1,4 +1,2 @@
|
||||
This directory contains the cJSON package downloaded unchanged from:
|
||||
http://sourceforge.net/projects/cjson/. The cJSON package is plain C,
|
||||
the JsonObject class provides a minimal C++ wrapping of this.
|
||||
This directory contains the the 1.7.10 version of the cJSON package from https://github.com/DaveGamble/cJSON
|
||||
|
||||
|
||||
3177
external/cjson/cJSON.c
vendored
3177
external/cjson/cJSON.c
vendored
File diff suppressed because it is too large
Load Diff
290
external/cjson/cJSON.h
vendored
290
external/cjson/cJSON.h
vendored
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -23,118 +23,260 @@
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 3 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
#define CJSON_CDECL __cdecl
|
||||
#define CJSON_STDCALL __stdcall
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type CJSON_STDCALL
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type CJSON_STDCALL
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type CJSON_STDCALL
|
||||
#endif
|
||||
#else /* !__WINDOWS__ */
|
||||
#define CJSON_CDECL
|
||||
#define CJSON_STDCALL
|
||||
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 7
|
||||
#define CJSON_VERSION_PATCH 10
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_False 0
|
||||
#define cJSON_True 1
|
||||
#define cJSON_NULL 2
|
||||
#define cJSON_Number 3
|
||||
#define cJSON_String 4
|
||||
#define cJSON_Array 5
|
||||
#define cJSON_Object 6
|
||||
|
||||
#define cJSON_Invalid (0)
|
||||
#define cJSON_False (1 << 0)
|
||||
#define cJSON_True (1 << 1)
|
||||
#define cJSON_NULL (1 << 2)
|
||||
#define cJSON_Number (1 << 3)
|
||||
#define cJSON_String (1 << 4)
|
||||
#define cJSON_Array (1 << 5)
|
||||
#define cJSON_Object (1 << 6)
|
||||
#define cJSON_Raw (1 << 7) /* raw json */
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON {
|
||||
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
typedef struct cJSON
|
||||
{
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
struct cJSON *child;
|
||||
|
||||
int type; /* The type of the item, as above. */
|
||||
/* The type of the item, as above. */
|
||||
int type;
|
||||
|
||||
char *valuestring; /* The item's string, if type==cJSON_String */
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||
char *valuestring;
|
||||
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||
int valueint;
|
||||
/* The item's number, if type==cJSON_Number */
|
||||
double valuedouble;
|
||||
|
||||
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
/* malloc/free are CDECL on Windows regardless of the default calling convention of the compiler, so ensure the hooks allow passing those functions directly. */
|
||||
void *(CJSON_CDECL *malloc_fn)(size_t sz);
|
||||
void (CJSON_CDECL *free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
#define CJSON_NESTING_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "index" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
|
||||
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||
|
||||
/* Check if the item is a string and return its valuestring */
|
||||
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
extern cJSON *cJSON_CreateFalse(void);
|
||||
extern cJSON *cJSON_CreateBool(int b);
|
||||
extern cJSON *cJSON_CreateNumber(double num);
|
||||
extern cJSON *cJSON_CreateString(const char *string);
|
||||
extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(double num);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||
/* raw json */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||
|
||||
/* Create a string where valuestring references a string so
|
||||
* it will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||
/* Create an object/arrray that only references it's elements so
|
||||
* they will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(int *numbers,int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(float *numbers,int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(double *numbers,int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||
* writing to `item->string` */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
|
||||
|
||||
/* Macros for creating things quickly. */
|
||||
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||
|
||||
/* Helper functions for creating and adding items to an object at the same time.
|
||||
* They return the added item or NULL on failure. */
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const double number);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valuedouble = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(double) cJSON_SetNumberHelper(cJSON *object, double number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (double)number) : (number))
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
declare -A configurations
|
||||
|
||||
declare -A EXTRA_MODULE_FLAGS
|
||||
EXTRA_MODULE_FLAGS[opm-common]="-DENABLE_WELL_TEST=ON"
|
||||
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON"
|
||||
|
||||
# Parse revisions from trigger comment and setup arrays
|
||||
# Depends on: 'upstreams', upstreamRev',
|
||||
# 'downstreams', 'downstreamRev',
|
||||
@@ -79,10 +83,26 @@ function printHeader {
|
||||
# $2 = 0 to build and install module, 1 to build and test module
|
||||
# $3 = Source root of module to build
|
||||
function build_module {
|
||||
cmake $3 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$2 -DCMAKE_TOOLCHAIN_FILE=${configurations[$configuration]} $1
|
||||
CMAKE_PARAMS="$1"
|
||||
DO_TEST_FLAG="$2"
|
||||
MOD_SRC_DIR="$3"
|
||||
cmake "$MOD_SRC_DIR" -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=$DO_TEST_FLAG -DCMAKE_TOOLCHAIN_FILE=${configurations[$configuration]} $CMAKE_PARAMS
|
||||
test $? -eq 0 || exit 1
|
||||
if test $2 -eq 1
|
||||
if test $DO_TEST_FLAG -eq 1
|
||||
then
|
||||
|
||||
pushd "$CWD"
|
||||
cd "$MOD_SRC_DIR"
|
||||
if test -x "./jenkins/pre-build.sh"; then
|
||||
echo "Running pre-build script"
|
||||
if ! "./jenkins/pre-build.sh"; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No pre-build script detected"
|
||||
fi
|
||||
popd
|
||||
|
||||
if [ ! -z $BUILDTHREADS ]
|
||||
then
|
||||
cmake --build . -- -j$BUILDTHREADS
|
||||
@@ -164,7 +184,7 @@ function build_upstreams {
|
||||
do
|
||||
echo "Building upstream $upstream=${upstreamRev[$upstream]} configuration=$configuration"
|
||||
# Build upstream and execute installation
|
||||
clone_and_build_module $upstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install" ${upstreamRev[$upstream]} $WORKSPACE/$configuration
|
||||
clone_and_build_module $upstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install ${EXTRA_MODULE_FLAGS[$upstream]}" ${upstreamRev[$upstream]} $WORKSPACE/$configuration
|
||||
test $? -eq 0 || exit 1
|
||||
done
|
||||
test $? -eq 0 || exit 1
|
||||
@@ -179,7 +199,7 @@ function build_downstreams {
|
||||
do
|
||||
echo "Building downstream $downstream=${downstreamRev[$downstream]} configuration=$configuration"
|
||||
# Build downstream and execute installation
|
||||
clone_and_build_module $downstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT" ${downstreamRev[$downstream]} $WORKSPACE/$configuration 1
|
||||
clone_and_build_module $downstream "-DCMAKE_PREFIX_PATH=$WORKSPACE/$configuration/install -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT ${EXTRA_MODULE_FLAGS[$downstream]}" ${downstreamRev[$downstream]} $WORKSPACE/$configuration 1
|
||||
test $? -eq 0 || exit 1
|
||||
|
||||
# Installation for downstream
|
||||
@@ -216,7 +236,7 @@ function build_module_full {
|
||||
mkdir -p $configuration/build-$1
|
||||
cd $configuration/build-$1
|
||||
echo "Building main module $1=$sha1 configuration=$configuration"
|
||||
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT" 1 $WORKSPACE
|
||||
build_module "-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$configuration/install -DOPM_TESTS_ROOT=$OPM_TESTS_ROOT ${EXTRA_MODULE_FLAGS[$1]}" 1 $WORKSPACE
|
||||
test $? -eq 0 || exit 1
|
||||
cmake --build . --target install
|
||||
test $? -eq 0 || exit 1
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
@@ -18,7 +19,8 @@
|
||||
namespace Opm {
|
||||
|
||||
class EclipseIO;
|
||||
|
||||
class ParseContext;
|
||||
class Parser;
|
||||
|
||||
class msim {
|
||||
|
||||
@@ -26,23 +28,20 @@ public:
|
||||
using well_rate_function = double(const EclipseState&, const Schedule&, const data::Solution&, size_t report_step, double seconds_elapsed);
|
||||
using solution_function = void(const EclipseState&, const Schedule&, data::Solution&, size_t report_step, double seconds_elapsed);
|
||||
|
||||
msim(const std::string& deck_file);
|
||||
msim(const std::string& deck_file, const Parser& parser, const ParseContext& parse_context);
|
||||
msim(const EclipseState& state);
|
||||
|
||||
void well_rate(const std::string& well, data::Rates::opt rate, std::function<well_rate_function> func);
|
||||
void solution(const std::string& field, std::function<solution_function> func);
|
||||
void run();
|
||||
void run(Schedule& schedule, EclipseIO& io);
|
||||
void post_step(Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
|
||||
private:
|
||||
|
||||
void run_step(data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
|
||||
void run_step(data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const;
|
||||
void run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
|
||||
void run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const;
|
||||
void output(size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const;
|
||||
void simulate(data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const;
|
||||
void simulate(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const;
|
||||
|
||||
Deck deck;
|
||||
EclipseState state;
|
||||
Schedule schedule;
|
||||
SummaryConfig summary_config;
|
||||
|
||||
std::map<std::string, std::map<data::Rates::opt, std::function<well_rate_function>>> well_rates;
|
||||
std::map<std::string, std::function<solution_function>> solutions;
|
||||
|
||||
@@ -24,48 +24,59 @@
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/msim/msim.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
msim::msim(const std::string& deck_file, const Parser& parser, const ParseContext& parse_context) :
|
||||
deck(parser.parseFile(deck_file, parse_context)),
|
||||
state(deck, parse_context),
|
||||
schedule(deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parse_context),
|
||||
summary_config(deck, schedule, state.getTableManager(), parse_context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
msim::msim(const std::string& deck_file) :
|
||||
msim(deck_file, Parser(), ParseContext())
|
||||
msim::msim(const EclipseState& state) :
|
||||
state(state)
|
||||
{}
|
||||
|
||||
|
||||
void msim::run() {
|
||||
void msim::run(Schedule& schedule, EclipseIO& io) {
|
||||
const double week = 7 * 86400;
|
||||
EclipseIO io(this->state, this->state.getInputGrid(), this->schedule, this->summary_config);
|
||||
data::Solution sol;
|
||||
data::Wells well_data;
|
||||
|
||||
io.writeInitial();
|
||||
for (size_t report_step = 1; report_step < this->schedule.size(); report_step++) {
|
||||
double time_step = std::min(week, 0.5*this->schedule.stepLength(report_step - 1));
|
||||
run_step(sol, well_data, report_step, time_step, io);
|
||||
for (size_t report_step = 1; report_step < schedule.size(); report_step++) {
|
||||
double time_step = std::min(week, 0.5*schedule.stepLength(report_step - 1));
|
||||
run_step(schedule, sol, well_data, report_step, time_step, io);
|
||||
post_step(schedule, sol, well_data, report_step, io);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void msim::run_step(data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
|
||||
this->run_step(sol, well_data, report_step, this->schedule.stepLength(report_step - 1), io);
|
||||
void msim::post_step(Schedule& schedule, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step, EclipseIO& io) const {
|
||||
const auto& actions = schedule.actions();
|
||||
if (actions.empty())
|
||||
return;
|
||||
|
||||
const SummaryState& summary_state = io.summaryState();
|
||||
ActionContext context( summary_state );
|
||||
std::vector<std::string> matching_wells;
|
||||
|
||||
auto sim_time = schedule.simTime(report_step);
|
||||
for (const auto& action : actions.pending(sim_time)) {
|
||||
if (action->eval(sim_time, context, matching_wells))
|
||||
schedule.applyAction(report_step, *action, matching_wells);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void msim::run_step(data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const {
|
||||
double start_time = this->schedule.seconds(report_step - 1);
|
||||
double end_time = this->schedule.seconds(report_step);
|
||||
|
||||
void msim::run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
|
||||
this->run_step(schedule, sol, well_data, report_step, schedule.stepLength(report_step - 1), io);
|
||||
}
|
||||
|
||||
|
||||
void msim::run_step(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const {
|
||||
double start_time = schedule.seconds(report_step - 1);
|
||||
double end_time = schedule.seconds(report_step);
|
||||
double seconds_elapsed = start_time;
|
||||
|
||||
while (seconds_elapsed < end_time) {
|
||||
@@ -73,7 +84,7 @@ void msim::run_step(data::Solution& sol, data::Wells& well_data, size_t report_s
|
||||
if ((seconds_elapsed + time_step) > end_time)
|
||||
time_step = end_time - seconds_elapsed;
|
||||
|
||||
this->simulate(sol, well_data, report_step, seconds_elapsed, time_step);
|
||||
this->simulate(schedule, sol, well_data, report_step, seconds_elapsed, time_step);
|
||||
|
||||
seconds_elapsed += time_step;
|
||||
this->output(report_step,
|
||||
@@ -87,7 +98,7 @@ void msim::run_step(data::Solution& sol, data::Wells& well_data, size_t report_s
|
||||
|
||||
|
||||
|
||||
void msim::output(size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
|
||||
void msim::output(size_t report_step, bool /* substep */, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
|
||||
RestartValue value(sol, well_data);
|
||||
io.writeTimeStep(report_step,
|
||||
false,
|
||||
@@ -99,10 +110,10 @@ void msim::output(size_t report_step, bool substep, double seconds_elapsed, cons
|
||||
}
|
||||
|
||||
|
||||
void msim::simulate(data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const {
|
||||
void msim::simulate(const Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const {
|
||||
for (const auto& sol_pair : this->solutions) {
|
||||
auto func = sol_pair.second;
|
||||
func(this->state, this->schedule, sol, report_step, seconds_elapsed + time_step);
|
||||
func(this->state, schedule, sol, report_step, seconds_elapsed + time_step);
|
||||
}
|
||||
|
||||
for (const auto& well_pair : this->well_rates) {
|
||||
@@ -112,8 +123,12 @@ void msim::simulate(data::Solution& sol, data::Wells& well_data, size_t report_s
|
||||
auto rate = rate_pair.first;
|
||||
auto func = rate_pair.second;
|
||||
|
||||
well.rates.set(rate, func(this->state, this->schedule, sol, report_step, seconds_elapsed + time_step));
|
||||
well.rates.set(rate, func(this->state, schedule, sol, report_step, seconds_elapsed + time_step));
|
||||
}
|
||||
|
||||
// This is complete bogus; a temporary fix to pass an assert() in the
|
||||
// the restart output.
|
||||
well.connections.resize(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,12 +89,16 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
const std::vector<std::string> restart_group_keys = {"GOPP", "GWPP", "GOPR", "GWPR", "GGPR",
|
||||
"GVPR", "GWIR", "GGIR", "GWCT", "GGOR",
|
||||
"GOPT", "GWPT", "GGPT", "GVPT", "GWIT",
|
||||
"GGIT"};
|
||||
"GGIT",
|
||||
"GOPTH", "GWPTH", "GGPTH",
|
||||
"GWITH", "GGITH"};
|
||||
|
||||
const std::vector<std::string> restart_field_keys = {"FOPP", "FWPP", "FOPR", "FWPR", "FGPR",
|
||||
"FVPR", "FWIR", "FGIR", "FWCT", "FGOR",
|
||||
"FOPT", "FWPT", "FGPT", "FVPT", "FWIT",
|
||||
"FGIT"};
|
||||
"FGIT",
|
||||
"FOPTH", "FWPTH", "FGPTH",
|
||||
"FWITH", "FGITH"};
|
||||
|
||||
const std::map<std::string, size_t> groupKeyToIndex = {
|
||||
{"GOPR", 0},
|
||||
@@ -113,6 +117,11 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
{"GGIT", 16},
|
||||
{"GOPP", 22},
|
||||
{"GWPP", 23},
|
||||
{"GOPTH", 135},
|
||||
{"GWPTH", 139},
|
||||
{"GWITH", 140},
|
||||
{"GGPTH", 143},
|
||||
{"GGITH", 144},
|
||||
};
|
||||
|
||||
const std::map<std::string, size_t> fieldKeyToIndex = {
|
||||
@@ -132,6 +141,11 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
{"FGIT", 16},
|
||||
{"FOPP", 22},
|
||||
{"FWPP", 23},
|
||||
{"FOPTH", 135},
|
||||
{"FWPTH", 139},
|
||||
{"FWITH", 140},
|
||||
{"FGPTH", 143},
|
||||
{"FGITH", 144},
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -53,9 +53,11 @@ namespace Opm { namespace RestartIO {
|
||||
const double cnvT);
|
||||
|
||||
DoubHEAD& timeStamp(const TimeStamp& ts);
|
||||
DoubHEAD& nextStep(const double nextTimeStep);
|
||||
|
||||
DoubHEAD& drsdt(const Schedule& sched,
|
||||
const std::size_t lookup_step);
|
||||
const std::size_t lookup_step,
|
||||
const double cnvT);
|
||||
|
||||
const std::vector<double>& data() const
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Opm {
|
||||
class EclipseState;
|
||||
class SummaryConfig;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
|
||||
/*!
|
||||
* \brief A class to write the reservoir state and the well state of a
|
||||
@@ -224,6 +225,8 @@ public:
|
||||
EclipseIO( const EclipseIO& ) = delete;
|
||||
~EclipseIO();
|
||||
|
||||
const SummaryState& summaryState() const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr< Impl > impl;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Equinor.
|
||||
Copyright 2017 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
@@ -35,6 +36,8 @@ namespace Opm {
|
||||
public:
|
||||
/// Constructor.
|
||||
///
|
||||
/// Padded table entries set to +1.0e+20.
|
||||
///
|
||||
/// \param[in] numTables Number of tables managed by internal
|
||||
/// buffer. Typically corresponds to maximum value of a region
|
||||
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
|
||||
@@ -57,6 +60,33 @@ namespace Opm {
|
||||
const std::size_t numRows,
|
||||
const std::size_t numCols);
|
||||
|
||||
/// Constructor.
|
||||
///
|
||||
/// \param[in] numTables Number of tables managed by internal
|
||||
/// buffer. Typically corresponds to maximum value of a region
|
||||
/// ID vector such as SATNUM, IMBNUM, or PVTNUM.
|
||||
///
|
||||
/// \param[in] numPrimary Number of primary look-up keys for the
|
||||
/// tabular data managed by the internal buffer. Mostly relevant
|
||||
/// (i.e., greater than one) for miscible oil ("PVTO") or
|
||||
/// miscible gas ("PVTG") tables and typically corresponds to the
|
||||
/// number of Rs/Rv entries from the TABDIMS keyword.
|
||||
///
|
||||
/// \param[in] numRows Number of rows in each sub-table
|
||||
/// corresponding to a single primary look-up key. Typically the
|
||||
/// number of nodes (e.g., NSSFUN or NPPVT) of the corresponding
|
||||
/// input keyword.
|
||||
///
|
||||
/// \param[in] numCols Number of columns in each sub-table (and main
|
||||
/// table). Typically 5.
|
||||
///
|
||||
/// \param[in] fillValue Data element value for padded table entries.
|
||||
LinearisedOutputTable(const std::size_t numTables,
|
||||
const std::size_t numPrimary,
|
||||
const std::size_t numRows,
|
||||
const std::size_t numCols,
|
||||
const double fillValue);
|
||||
|
||||
/// Retrieve iterator to start of \c numRows (contiguous) column
|
||||
/// elements of a particular sub-table of a particular main table.
|
||||
///
|
||||
|
||||
@@ -38,7 +38,9 @@ namespace Opm { namespace RestartIO {
|
||||
|
||||
LogiHEAD& variousParam(const bool e300_radial,
|
||||
const bool e100_radial,
|
||||
const int nswlmx);
|
||||
const int nswlmx,
|
||||
const bool enableHyster
|
||||
);
|
||||
|
||||
const std::vector<bool>& data() const
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2018 Equinor ASA
|
||||
Copyright (c) 2016 Statoil ASA
|
||||
Copyright (c) 2013-2015 Andreas Lauser
|
||||
Copyright (c) 2013 SINTEF ICT, Applied Mathematics.
|
||||
@@ -23,36 +24,38 @@
|
||||
#ifndef RESTART_IO_HPP
|
||||
#define RESTART_IO_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
|
||||
#include <opm/output/data/Cells.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <ert/ecl/EclKW.hpp>
|
||||
#include <ert/ecl/ecl_rsthead.h>
|
||||
#include <ert/ecl/ecl_rst_file.h>
|
||||
#include <ert/util/util.h>
|
||||
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class EclipseGrid;
|
||||
class EclipseState;
|
||||
class Phases;
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class EclipseGrid;
|
||||
class EclipseState;
|
||||
class Phases;
|
||||
class Schedule;
|
||||
|
||||
namespace RestartIO {
|
||||
} // namespace Opm
|
||||
|
||||
|
||||
/*
|
||||
The two loose functions RestartIO::save() and RestartIO::load() can
|
||||
The two free functions RestartIO::save() and RestartIO::load() can
|
||||
be used to save and load reservoir and well state from restart
|
||||
files. Observe that these functions 'just do it', i.e. the checking
|
||||
of which report step to load from, if output is enabled at all and
|
||||
@@ -69,39 +72,30 @@ namespace RestartIO {
|
||||
load("CASE.X0010" , 99 , ...)
|
||||
save("CASE.X0010" , 99 , ...)
|
||||
|
||||
will read and write to the file "CASE.X0010" - completely ignoring
|
||||
will read from and write to the file "CASE.X0010" - completely ignoring
|
||||
the report step argument '99'.
|
||||
*/
|
||||
namespace Opm { namespace RestartIO {
|
||||
|
||||
/*void save(const std::string& filename,
|
||||
int report_step,
|
||||
double seconds_elapsed,
|
||||
data::Solution cells,
|
||||
data::Wells wells,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
std::map<std::string, std::vector<double>> extra_data = {},
|
||||
bool write_double = false);
|
||||
*/
|
||||
void save(const std::string& filename,
|
||||
int report_step,
|
||||
double seconds_elapsed,
|
||||
RestartValue value,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& sumState,
|
||||
bool write_double = false);
|
||||
void save(const std::string& filename,
|
||||
int report_step,
|
||||
double seconds_elapsed,
|
||||
RestartValue value,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const SummaryState& sumState,
|
||||
bool write_double = false);
|
||||
|
||||
RestartValue load( const std::string& filename,
|
||||
int report_step,
|
||||
const std::vector<RestartKey>& solution_keys,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const std::vector<RestartKey>& extra_keys = {});
|
||||
std::pair<RestartValue, SummaryState>
|
||||
load(const std::string& filename,
|
||||
int report_step,
|
||||
const std::vector<RestartKey>& solution_keys,
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const std::vector<RestartKey>& extra_keys = {});
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}} // namespace Opm::RestartIO
|
||||
|
||||
#endif // RESTART_IO_HPP
|
||||
|
||||
@@ -63,6 +63,8 @@ class Summary {
|
||||
|
||||
const SummaryState& get_restart_vectors() const;
|
||||
|
||||
void reset_cumulative_quantities(const SummaryState& rstrt);
|
||||
|
||||
private:
|
||||
class keyword_handlers;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/*
|
||||
Copyright 2019 Equinor.
|
||||
Copyright 2017 Statoil ASA.
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
@@ -42,6 +44,15 @@ namespace Opm {
|
||||
void addPVTW(const PvtwTable& pvtwTable);
|
||||
void addDensity(const DensityTable& density);
|
||||
|
||||
/// Add normalised PVT function tables to INIT file's TAB vector.
|
||||
///
|
||||
/// \param[in] es Valid \c EclipseState object with accurate RUNSPEC
|
||||
/// information on active phases and table dimensions ("TABDIMS").
|
||||
///
|
||||
/// \param[in] logihead Flag specifications identifying which tables
|
||||
/// to output.
|
||||
void addPVTTables(const EclipseState& es);
|
||||
|
||||
/// Add normalised saturation function tables to INIT file's TAB
|
||||
/// vector.
|
||||
///
|
||||
@@ -101,6 +112,30 @@ namespace Opm {
|
||||
const bool gas,
|
||||
const bool oil,
|
||||
const bool wat);
|
||||
|
||||
/// Add gas PVT tables (keywords PVDG and PVTG) to the tabular data
|
||||
/// (TABDIMS and TAB vectors).
|
||||
///
|
||||
/// \param[in] es Valid \c EclipseState object with accurate table
|
||||
/// dimensions ("TABDIMS" keyword) and an initialised \c
|
||||
/// TableManager sub-object.
|
||||
void addGasPVTTables(const EclipseState& es);
|
||||
|
||||
/// Add oil PVT tables (keywords PVCDO, PVDO and PVTO) to the
|
||||
/// tabular data (TABDIMS and TAB vectors).
|
||||
///
|
||||
/// \param[in] es Valid \c EclipseState object with accurate table
|
||||
/// dimensions ("TABDIMS" keyword) and an initialised \c
|
||||
/// TableManager sub-object.
|
||||
void addOilPVTTables(const EclipseState& es);
|
||||
|
||||
/// Add water PVT tables (keyword PVTW) to the tabular data (TABDIMS
|
||||
/// and TAB vectors).
|
||||
///
|
||||
/// \param[in] es Valid \c EclipseState object with accurate table
|
||||
/// dimensions ("TABDIMS" keyword) and an initialised \c
|
||||
/// TableManager sub-object.
|
||||
void addWaterPVTTables(const EclipseState& es);
|
||||
};
|
||||
|
||||
/// Emit normalised tabular information (TABDIMS and TAB vectors) to
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
|
||||
EffectiveKH = 3, // Effective Kh product of connection
|
||||
|
||||
item12 = 11, // Unknown
|
||||
item12 = 11, // Connection transmissibility factor
|
||||
|
||||
SegDistEnd = 20, // Distance to end of connection in segment
|
||||
SegDistStart = 21, // Distance to start of connection in segment
|
||||
@@ -66,6 +66,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
WaterRate = 1, // Surface flow rate (water)
|
||||
GasRate = 2, // Surface Flow rate (gas)
|
||||
|
||||
Pressure = 34, // Connection pressure value
|
||||
|
||||
ResVRate = 49, // Reservoir voidage rate
|
||||
};
|
||||
} // XConn
|
||||
|
||||
37
opm/output/eclipse/VectorItems/doubhead.hpp
Normal file
37
opm/output/eclipse/VectorItems/doubhead.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright (c) 2018 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP
|
||||
#define OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
|
||||
|
||||
// This is a subset of the items in src/opm/output/eclipse/DoubHEAD.cpp .
|
||||
// Promote items from that list to this in order to make them public.
|
||||
enum doubhead : std::vector<double>::size_type {
|
||||
TsInit = 1, // Maximum Length of Next Timestep
|
||||
TsMaxz = 2, // Maximum Length of Timestep After Next
|
||||
TsMinz = 3, // Minumum Length of All Timesteps
|
||||
};
|
||||
|
||||
}}}} // Opm::RestartIO::Helpers::VectorItems
|
||||
|
||||
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_DOUBHEAD_HPP
|
||||
67
opm/output/eclipse/VectorItems/group.hpp
Normal file
67
opm/output/eclipse/VectorItems/group.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (c) 2018 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP
|
||||
#define OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
|
||||
|
||||
namespace XGroup {
|
||||
enum index : std::vector<double>::size_type {
|
||||
OilPrRate = 0, // Group's oil production rate
|
||||
WatPrRate = 1, // Group's water production rate
|
||||
GasPrRate = 2, // Group's gas production rate
|
||||
LiqPrRate = 3, // Group's liquid production rate
|
||||
|
||||
WatInjRate = 5, // Group's water injection rate
|
||||
GasInjRate = 6, // Group's gas injection rate
|
||||
|
||||
WatCut = 8, // Group's producing water cut
|
||||
GORatio = 9, // Group's producing gas/oil ratio
|
||||
|
||||
OilPrTotal = 10, // Group's total cumulative oil production
|
||||
WatPrTotal = 11, // Group's total cumulative water production
|
||||
GasPrTotal = 12, // Group's total cumulative gas production
|
||||
VoidPrTotal = 13, // Group's total cumulative reservoir
|
||||
// voidage production
|
||||
|
||||
WatInjTotal = 15, // Group's total cumulative water injection
|
||||
GasInjTotal = 16, // Group's total cumulative gas injection
|
||||
|
||||
OilPrPot = 22, // Group's oil production potential
|
||||
WatPrPot = 23, // Group's water production potential
|
||||
|
||||
HistOilPrTotal = 135, // Group's total cumulative oil
|
||||
// production (observed/historical rates)
|
||||
HistWatPrTotal = 139, // Group's total cumulative water
|
||||
// production (observed/historical rates)
|
||||
HistWatInjTotal = 140, // Group's total cumulative water
|
||||
// injection (observed/historical rates)
|
||||
HistGasPrTotal = 143, // Group's total cumulative gas
|
||||
// production (observed/historical rates)
|
||||
HistGasInjTotal = 144, // Group's total cumulative gas injection
|
||||
// (observed/historical rates)
|
||||
};
|
||||
} // XGroup
|
||||
|
||||
}}}} // Opm::RestartIO::Helpers::VectorItems
|
||||
|
||||
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_GROUP_HPP
|
||||
64
opm/output/eclipse/VectorItems/msw.hpp
Normal file
64
opm/output/eclipse/VectorItems/msw.hpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2018 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP
|
||||
#define OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
|
||||
|
||||
namespace ISeg {
|
||||
enum index : std::vector<int>::size_type {
|
||||
SegNo = 0, // Segment number (one-based)
|
||||
OutSeg = 1, // Outlet segment (one-based)
|
||||
InSegCurBranch = 2, // Inflow segment current branch (one-based)
|
||||
BranchNo = 3, // Branch number (one-based)
|
||||
};
|
||||
} // ISeg
|
||||
|
||||
namespace RSeg {
|
||||
enum index : std::vector<double>::size_type {
|
||||
DistOutlet = 0, // Segment's distance to outlet
|
||||
OutletDepthDiff = 1, // Segment's depth differential to outlet
|
||||
SegDiam = 2, // Internal diameter of segment
|
||||
SegRough = 3, // Roughness parameter of segment
|
||||
SegArea = 4, // Cross-sectional area of segment
|
||||
SegVolume = 5, // Physical volume of segment
|
||||
DistBHPRef = 6, // Segment's distance to BHP reference node
|
||||
DepthBHPRef = 7, // Segment's depth differential to BHP ref. node
|
||||
|
||||
TotFlowRate = 8, // Normalised total segment flow rate
|
||||
WatFlowFract = 9, // Normalised Water flow rate fraction
|
||||
GasFlowFract = 10, // Normalised Gas flow rate fraction
|
||||
Pressure = 11, // Segment pressure
|
||||
|
||||
item40 = 39, // Unknown
|
||||
item106 = 105, // Unknown
|
||||
item107 = 106, // Unknown
|
||||
item108 = 107, // Unknown
|
||||
item109 = 108, // Unknown
|
||||
item110 = 109, // Unknown
|
||||
item111 = 110, // Unknown
|
||||
};
|
||||
} // RSeg
|
||||
|
||||
}}}} // Opm::RestartIO::Helpers::VectorItems
|
||||
|
||||
#endif // OPM_OUTPUT_ECLIPSE_VECTOR_MSW_HPP
|
||||
@@ -26,25 +26,30 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
|
||||
namespace IWell {
|
||||
enum index : std::vector<int>::size_type {
|
||||
IHead = 0, // I-location (one-based) of well head
|
||||
JHead = 1, // J-location (one-based) of well head
|
||||
FirstK = 2, // Layer ID (one-based) of top/first connection
|
||||
LastK = 3, // Layer ID (one-based) of bottom/last connection
|
||||
NConn = 4, // Number of active cells connected to well
|
||||
Group = 5, // Index (one-based) of well's current group
|
||||
WType = 6, // Well type
|
||||
WCtrl = 7, // Well control
|
||||
IHead = 0, // I-location (one-based) of well head
|
||||
JHead = 1, // J-location (one-based) of well head
|
||||
FirstK = 2, // Layer ID (one-based) of top/first connection
|
||||
LastK = 3, // Layer ID (one-based) of bottom/last connection
|
||||
NConn = 4, // Number of active cells connected to well
|
||||
Group = 5, // Index (one-based) of well's current group
|
||||
WType = 6, // Well type (producer vs. injector)
|
||||
ActWCtrl = 7, // Well's active target control mode (constraint).
|
||||
|
||||
item9 = 8, // Unknown
|
||||
item11 = 10, // Unknown
|
||||
item9 = 8, // Unknown
|
||||
item11 = 10, // Unknown
|
||||
VFPTab = 11, // ID (one-based) of well's current VFP table.
|
||||
|
||||
VFPTab = 11, // ID (one-based) of well's current VFP table
|
||||
PredReqWCtrl = 15, // Well's requested control mode from
|
||||
// simulation deck (WCONINJE, WCONPROD).
|
||||
|
||||
item18 = 17, // Unknown
|
||||
XFlow = 22,
|
||||
item25 = 24, // Unknown
|
||||
item32 = 31, // Unknown
|
||||
item48 = 47, // Unknown
|
||||
item50 = 49, // Unknown
|
||||
|
||||
HistReqWCtrl = 49, // Well's requested control mode from
|
||||
// simulation deck (WCONHIST, WCONINJH)
|
||||
|
||||
MsWID = 70, // Multisegment well ID
|
||||
// Value 0 for regular wells
|
||||
@@ -115,6 +120,15 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
BHPTarget = 6, // Well's bottom hole pressure target
|
||||
|
||||
DatumDepth = 9, // Well's reference depth for BHP
|
||||
|
||||
HistLiqRateTarget = 33, // Well's historical/observed liquid
|
||||
// rate target/limit
|
||||
|
||||
HistGasRateTarget = 54, // Well's historical/observed gas rate
|
||||
// target/limit
|
||||
|
||||
HistBHPTarget = 55, // Well's historical/observed bottom
|
||||
// hole pressure target/limit
|
||||
};
|
||||
} // SWell
|
||||
|
||||
@@ -141,13 +155,22 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
|
||||
GasFVF = 34, // Well's producing gas formation volume factor.
|
||||
|
||||
item37 = 36, // Unknown
|
||||
item38 = 37, // Unknown
|
||||
item37 = 36, // Unknown
|
||||
item38 = 37, // Unknown
|
||||
|
||||
BHPTarget = 41, // Well's current BHP Target/Limit
|
||||
BHPTarget = 41, // Well's current BHP Target/Limit
|
||||
|
||||
item82 = 81, // Unknown
|
||||
item83 = 82, // Unknown
|
||||
HistOilPrTotal = 75, // Well's total cumulative oil production
|
||||
// (observed/historical rates)
|
||||
HistWatPrTotal = 76, // Well's total cumulative water
|
||||
// production (observed/historical rates)
|
||||
HistGasPrTotal = 77, // Well's total cumulative gas production
|
||||
// (observed(historical rates)
|
||||
|
||||
HistWatInjTotal = 81, // Well's total cumulative water injection
|
||||
// (observed/historical rates)
|
||||
HistGasInjTotal = 82, // Well's total cumulative gas injection
|
||||
// (observed/historical rates)
|
||||
|
||||
WatVoidPrRate = 122, // Well's voidage production rate
|
||||
GasVoidPrRate = 123, // Well's voidage production rate
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
createDoubHead(const EclipseState& es,
|
||||
const Schedule& sched,
|
||||
const std::size_t lookup_step,
|
||||
const double simTime);
|
||||
const double simTime,
|
||||
const double nextTimeStep);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
//jal - comment on the following include to avoid duplication
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
|
||||
#include <opm/output/data/Cells.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Opm {
|
||||
*/
|
||||
bool operator==(const DeckItem& other) const;
|
||||
bool operator!=(const DeckItem& other) const;
|
||||
|
||||
static bool to_bool(std::string string_value);
|
||||
private:
|
||||
std::vector< double > dval;
|
||||
std::vector< int > ival;
|
||||
|
||||
@@ -53,13 +53,13 @@ namespace Opm {
|
||||
Aquancon(const EclipseGrid& grid, const Deck& deck);
|
||||
|
||||
const std::vector<Aquancon::AquanconOutput>& getAquOutput() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::vector<Aquancon::AquanconOutput> logic_application(const std::vector<Aquancon::AquanconOutput> original_vector);
|
||||
std::vector<Aquancon::AquanconOutput> logic_application(const std::vector<Aquancon::AquanconOutput>& original_vector);
|
||||
|
||||
void collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
|
||||
std::vector<Opm::AquanconRecord>& m_aqurecord,
|
||||
void collate_function(std::vector<Aquancon::AquanconOutput>& output_vector,
|
||||
std::vector<Opm::AquanconRecord>& m_aqurecord,
|
||||
std::vector<int> m_aquiferID_per_record, int m_maxAquID);
|
||||
|
||||
void convert_record_id_to_aquifer_id(std::vector<int>& record_indices_matching_id, int i,
|
||||
|
||||
@@ -25,21 +25,22 @@
|
||||
This includes the logic for parsing as well as the associated tables. It is meant to be used by opm-grid and opm-simulators in order to
|
||||
implement the Carter Tracy analytical aquifer model in OPM Flow.
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserKeywords/A.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/AqutabTable.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class EclipseState;
|
||||
|
||||
class AquiferCT {
|
||||
public:
|
||||
|
||||
@@ -70,23 +71,23 @@ namespace Opm {
|
||||
const std::vector<AquiferCT::AQUCT_data>& getAquifers() const;
|
||||
int getAqInflTabID(size_t aquiferIndex);
|
||||
int getAqPvtTabID(size_t aquiferIndex);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
std::vector<AquiferCT::AQUCT_data> m_aquct;
|
||||
|
||||
//Set the default Pd v/s Td tables (constant terminal rate case for an infinite aquifer) as described in
|
||||
//Van Everdingen, A. & Hurst, W., December, 1949.The Application of the Laplace Transformation to Flow Problems in Reservoirs.
|
||||
|
||||
//Set the default Pd v/s Td tables (constant terminal rate case for an infinite aquifer) as described in
|
||||
//Van Everdingen, A. & Hurst, W., December, 1949.The Application of the Laplace Transformation to Flow Problems in Reservoirs.
|
||||
//Petroleum Transactions, AIME.
|
||||
inline void set_default_tables(std::vector<double>& td, std::vector<double>& pi)
|
||||
{
|
||||
std::vector<double> default_pressure_ = { 0.112, 0.229, 0.315, 0.376, 0.424, 0.469, 0.503, 0.564, 0.616, 0.659, 0.702, 0.735,
|
||||
0.772, 0.802, 0.927, 1.02, 1.101, 1.169, 1.275, 1.362, 1.436, 1.5, 1.556, 1.604,
|
||||
1.651, 1.829, 1.96, 2.067, 2.147, 2.282, 2.388, 2.476, 2.55, 2.615, 2.672, 2.723,
|
||||
{
|
||||
std::vector<double> default_pressure_ = { 0.112, 0.229, 0.315, 0.376, 0.424, 0.469, 0.503, 0.564, 0.616, 0.659, 0.702, 0.735,
|
||||
0.772, 0.802, 0.927, 1.02, 1.101, 1.169, 1.275, 1.362, 1.436, 1.5, 1.556, 1.604,
|
||||
1.651, 1.829, 1.96, 2.067, 2.147, 2.282, 2.388, 2.476, 2.55, 2.615, 2.672, 2.723,
|
||||
2.921, 3.064, 3.173, 3.263, 3.406, 3.516, 3.608, 3.684, 3.75, 3.809, 3.86 };
|
||||
|
||||
std::vector<double> default_time_ = { 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
|
||||
1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70,
|
||||
std::vector<double> default_time_ = { 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
|
||||
1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40, 50, 60, 70,
|
||||
80, 90, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000 };
|
||||
|
||||
td = default_time_;
|
||||
|
||||
@@ -29,11 +29,13 @@
|
||||
namespace Opm {
|
||||
|
||||
class Deck;
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
|
||||
class EclipseConfig
|
||||
{
|
||||
public:
|
||||
EclipseConfig(const Deck& deck);
|
||||
EclipseConfig(const Deck& deck, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
|
||||
const InitConfig& init() const;
|
||||
const IOConfig& io() const;
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
@@ -32,7 +34,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/TransMult.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -65,9 +66,11 @@ namespace Opm {
|
||||
AllProperties = IntProperties | DoubleProperties
|
||||
};
|
||||
|
||||
EclipseState(const Deck& deck , ParseContext parseContext = ParseContext());
|
||||
template<typename T>
|
||||
EclipseState(const Deck& deck , const ParseContext& parseContext, T&& errors);
|
||||
EclipseState(const Deck& deck , const ParseContext& parseContext, ErrorGuard& errors);
|
||||
EclipseState(const Deck& deck);
|
||||
|
||||
const ParseContext& getParseContext() const;
|
||||
const IOConfig& getIOConfig() const;
|
||||
IOConfig& getIOConfig();
|
||||
|
||||
@@ -118,7 +121,6 @@ namespace Opm {
|
||||
void complainAboutAmbiguousKeyword(const Deck& deck,
|
||||
const std::string& keywordName);
|
||||
|
||||
ParseContext m_parseContext;
|
||||
const TableManager m_tables;
|
||||
Runspec m_runspec;
|
||||
EclipseConfig m_eclipseConfig;
|
||||
|
||||
@@ -52,7 +52,7 @@ private:
|
||||
void addFaultFaces(const GridDims& grid,
|
||||
const DeckRecord& faultRecord,
|
||||
const std::string& faultName);
|
||||
OrderedMap<Fault> m_faults;
|
||||
OrderedMap<std::string, Fault> m_faults;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -200,7 +200,8 @@ namespace Opm {
|
||||
class SOLUTIONSection;
|
||||
class TimeMap;
|
||||
class Schedule;
|
||||
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
|
||||
/*The IOConfig class holds data about input / ouput configurations
|
||||
|
||||
@@ -317,9 +318,17 @@ namespace Opm {
|
||||
public:
|
||||
|
||||
RestartConfig();
|
||||
explicit RestartConfig( const Deck& );
|
||||
|
||||
template<typename T>
|
||||
RestartConfig( const Deck&, const ParseContext& parseContext, T&& errors );
|
||||
|
||||
RestartConfig( const Deck&, const ParseContext& parseContext, ErrorGuard& errors );
|
||||
RestartConfig( const Deck& );
|
||||
|
||||
RestartConfig( const SCHEDULESection& schedule,
|
||||
const SOLUTIONSection& solution,
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors,
|
||||
TimeMap timemap );
|
||||
|
||||
|
||||
@@ -329,7 +338,7 @@ namespace Opm {
|
||||
int getKeyword( const std::string& keyword, size_t timeStep) const;
|
||||
|
||||
void overrideRestartWriteInterval(size_t interval);
|
||||
void handleSolutionSection(const SOLUTIONSection& solutionSection);
|
||||
void handleSolutionSection(const SOLUTIONSection& solutionSection, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void setWriteInitialRestartFile(bool writeInitialRestartFile);
|
||||
|
||||
RestartSchedule getNode( size_t timestep ) const;
|
||||
@@ -356,7 +365,7 @@ namespace Opm {
|
||||
int m_first_restart_step;
|
||||
bool m_write_initial_RST_file = false;
|
||||
|
||||
void handleScheduleSection( const SCHEDULESection& schedule);
|
||||
void handleScheduleSection( const SCHEDULESection& schedule, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void update( size_t step, const RestartSchedule& rs);
|
||||
static RestartSchedule rptsched( const DeckKeyword& );
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EndpointScaling.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class Deck;
|
||||
@@ -112,27 +112,73 @@ private:
|
||||
int nLatBranchMax;
|
||||
};
|
||||
|
||||
class Runspec {
|
||||
public:
|
||||
explicit Runspec( const Deck& );
|
||||
class EclHysterConfig
|
||||
{
|
||||
public:
|
||||
explicit EclHysterConfig(const Deck& deck);
|
||||
|
||||
const UDQConfig& udqConfig() const noexcept;
|
||||
const Phases& phases() const noexcept;
|
||||
const Tabdims& tabdims() const noexcept;
|
||||
const EndpointScaling& endpointScaling() const noexcept;
|
||||
const Welldims& wellDimensions() const noexcept;
|
||||
const WellSegmentDims& wellSegmentDimensions() const noexcept;
|
||||
int eclPhaseMask( ) const noexcept;
|
||||
|
||||
private:
|
||||
Phases active_phases;
|
||||
Tabdims m_tabdims;
|
||||
EndpointScaling endscale;
|
||||
Welldims welldims;
|
||||
WellSegmentDims wsegdims;
|
||||
UDQConfig udq_config;
|
||||
/*!
|
||||
* \brief Specify whether hysteresis is enabled or not.
|
||||
*/
|
||||
//void setActive(bool yesno);
|
||||
|
||||
/*!
|
||||
* \brief Returns whether hysteresis is enabled (active).
|
||||
*/
|
||||
bool active() const;
|
||||
|
||||
/*!
|
||||
* \brief Return the type of the hysteresis model which is used for capillary pressure.
|
||||
*
|
||||
* -1: capillary pressure hysteresis is disabled
|
||||
* 0: use the Killough model for capillary pressure hysteresis
|
||||
*/
|
||||
int pcHysteresisModel() const;
|
||||
|
||||
/*!
|
||||
* \brief Return the type of the hysteresis model which is used for relative permeability.
|
||||
*
|
||||
* -1: relperm hysteresis is disabled
|
||||
* 0: use the Carlson model for relative permeability hysteresis
|
||||
*/
|
||||
int krHysteresisModel() const;
|
||||
|
||||
private:
|
||||
// enable hysteresis at all
|
||||
bool activeHyst { false };
|
||||
|
||||
// the capillary pressure and the relperm hysteresis models to be used
|
||||
int pcHystMod { 0 };
|
||||
int krHystMod { 0 };
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Runspec {
|
||||
public:
|
||||
explicit Runspec( const Deck& );
|
||||
|
||||
const UDQParams& udqParams() const noexcept;
|
||||
const Phases& phases() const noexcept;
|
||||
const Tabdims& tabdims() const noexcept;
|
||||
const EndpointScaling& endpointScaling() const noexcept;
|
||||
const Welldims& wellDimensions() const noexcept;
|
||||
const WellSegmentDims& wellSegmentDimensions() const noexcept;
|
||||
int eclPhaseMask( ) const noexcept;
|
||||
const EclHysterConfig& hysterPar() const noexcept;
|
||||
|
||||
private:
|
||||
Phases active_phases;
|
||||
Tabdims m_tabdims;
|
||||
EndpointScaling endscale;
|
||||
Welldims welldims;
|
||||
WellSegmentDims wsegdims;
|
||||
UDQParams udq_params;
|
||||
EclHysterConfig hystpar;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // OPM_RUNSPEC_HPP
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2018 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ActionAST_HPP
|
||||
#define ActionAST_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class ActionContext;
|
||||
class ASTNode;
|
||||
|
||||
|
||||
|
||||
class ActionAST{
|
||||
public:
|
||||
ActionAST() = default;
|
||||
explicit ActionAST(const std::vector<std::string>& tokens);
|
||||
bool eval(const ActionContext& context, std::vector<std::string>& matching_wells) const;
|
||||
private:
|
||||
/*
|
||||
The use of a pointer here is to be able to create this class with only a
|
||||
forward declaration of the ASTNode class. Would have prefered to use a
|
||||
unique_ptr, but that requires writing custom destructors - the use of a
|
||||
shared_ptr does not imply any shared ownership.
|
||||
*/
|
||||
std::shared_ptr<ASTNode> condition;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
double get(const std::string& func) const;
|
||||
void add(const std::string& func, double value);
|
||||
|
||||
std::vector<std::string> wells(const std::string& func) const;
|
||||
|
||||
private:
|
||||
SummaryState summary_state;
|
||||
std::map<std::string, double> values;
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ctime>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ActionAST.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp>
|
||||
|
||||
namespace Opm {
|
||||
/*
|
||||
@@ -64,14 +64,16 @@ public:
|
||||
|
||||
void addKeyword(const DeckKeyword& kw);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
bool eval(std::time_t sim_time, const ActionContext& context);
|
||||
bool eval(std::time_t sim_time, const ActionContext& context, std::vector<std::string>& wells) const;
|
||||
|
||||
|
||||
std::string name() const { return this->m_name; }
|
||||
size_t max_run() const { return this->m_max_run; }
|
||||
double min_wait() const { return this->m_min_wait; }
|
||||
std::time_t start_time() const { return this->m_start_time; }
|
||||
|
||||
std::vector<DeckKeyword>::const_iterator begin() const;
|
||||
std::vector<DeckKeyword>::const_iterator end() const;
|
||||
static bool valid_keyword(const std::string& keyword);
|
||||
private:
|
||||
std::string m_name;
|
||||
size_t m_max_run = 0;
|
||||
@@ -79,9 +81,9 @@ private:
|
||||
std::time_t m_start_time;
|
||||
|
||||
std::vector<DeckKeyword> keywords;
|
||||
ActionAST ast;
|
||||
size_t run_count = 0;
|
||||
std::time_t last_run = 0;
|
||||
ActionAST condition;
|
||||
mutable size_t run_count = 0;
|
||||
mutable std::time_t last_run = 0;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ActionX.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -37,8 +37,7 @@ public:
|
||||
void add(const ActionX& action);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
ActionX& at(const std::string& name);
|
||||
std::vector<ActionX *> pending(std::time_t sim_time);
|
||||
|
||||
std::vector<const ActionX *> pending(std::time_t sim_time) const;
|
||||
private:
|
||||
std::map<std::string, ActionX> actions;
|
||||
};
|
||||
@@ -1,143 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ActionAST_HPP
|
||||
#define ActionAST_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class ActionContext;
|
||||
|
||||
enum TokenType {
|
||||
number, // 0
|
||||
ecl_expr, // 1
|
||||
open_paren, // 2
|
||||
close_paren, // 3
|
||||
op_gt, // 4
|
||||
op_ge, // 5
|
||||
op_lt, // 6
|
||||
op_le, // 7
|
||||
op_eq, // 8
|
||||
op_ne, // 9
|
||||
op_and, // 10
|
||||
op_or, // 11
|
||||
end, // 12
|
||||
error // 13
|
||||
};
|
||||
|
||||
struct ParseNode {
|
||||
ParseNode(TokenType type_arg, const std::string& value_arg) :
|
||||
type(type_arg),
|
||||
value(value_arg)
|
||||
{}
|
||||
|
||||
// Implicit converting constructor.
|
||||
ParseNode(TokenType type_arg) : ParseNode(type_arg, "")
|
||||
{}
|
||||
|
||||
|
||||
TokenType type;
|
||||
std::string value;
|
||||
};
|
||||
|
||||
|
||||
class ASTNode {
|
||||
public:
|
||||
|
||||
ASTNode() :
|
||||
type(TokenType::error)
|
||||
{}
|
||||
|
||||
|
||||
// Implicit converting constructor.
|
||||
ASTNode(TokenType type_arg):
|
||||
type(type_arg)
|
||||
{}
|
||||
|
||||
|
||||
// Implicit converting constructor.
|
||||
ASTNode(double value) :
|
||||
type(TokenType::number),
|
||||
number(value)
|
||||
{}
|
||||
|
||||
|
||||
ASTNode(TokenType type_arg, const std::string& func_arg, const std::vector<std::string>& arg_list_arg):
|
||||
type(type_arg),
|
||||
func(func_arg),
|
||||
arg_list(arg_list_arg)
|
||||
{}
|
||||
|
||||
bool eval(const ActionContext& context) const;
|
||||
double value(const ActionContext& context) const;
|
||||
TokenType type;
|
||||
void add_child(const ASTNode& child);
|
||||
size_t size() const;
|
||||
|
||||
private:
|
||||
std::string func;
|
||||
std::vector<std::string> arg_list;
|
||||
double number = 0.0;
|
||||
|
||||
/*
|
||||
To have a memmber std::vector<ASTNode> inside the ASTNode class is
|
||||
supposedly borderline undefined behaviour; it compiles without warnings
|
||||
and works. Good for enough for me.
|
||||
*/
|
||||
std::vector<ASTNode> children;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ActionParser {
|
||||
public:
|
||||
ActionParser(const std::vector<std::string>& tokens);
|
||||
TokenType get_type(const std::string& arg) const;
|
||||
ParseNode current() const;
|
||||
ParseNode next();
|
||||
size_t pos() const;
|
||||
void print() const;
|
||||
private:
|
||||
const std::vector<std::string>& tokens;
|
||||
ssize_t current_pos = -1;
|
||||
};
|
||||
|
||||
|
||||
class ActionAST{
|
||||
public:
|
||||
ActionAST() = default;
|
||||
explicit ActionAST(const std::vector<std::string>& tokens);
|
||||
ASTNode parse_right(ActionParser& parser);
|
||||
ASTNode parse_left(ActionParser& parser);
|
||||
ASTNode parse_op(ActionParser& parser);
|
||||
ASTNode parse_cmp(ActionParser& parser);
|
||||
ASTNode parse_or(ActionParser& parser);
|
||||
ASTNode parse_and(ActionParser& parser);
|
||||
|
||||
bool eval(const ActionContext& context) const;
|
||||
private:
|
||||
ASTNode tree;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
42
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
Normal file
42
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (c) 2019 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_ARRAYDIM_CHECKER_HPP
|
||||
#define OPM_ARRAYDIM_CHECKER_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Opm {
|
||||
class ErrorGuard;
|
||||
class EclipseState;
|
||||
class ParseContext;
|
||||
class Schedule;
|
||||
} // Opm
|
||||
|
||||
namespace Opm {
|
||||
int maxGroupSize(const Schedule& sched,
|
||||
const std::size_t step);
|
||||
|
||||
void checkConsistentArrayDimensions(const EclipseState& es,
|
||||
const Schedule& sched,
|
||||
const ParseContext& ctxt,
|
||||
ErrorGuard& guard);
|
||||
} // Opm
|
||||
|
||||
#endif // OPM_ARRAYDIM_CHECKER_HPP
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
|
||||
@@ -143,25 +144,41 @@ class DynamicState {
|
||||
}
|
||||
}
|
||||
|
||||
/// Will return the index of the first occurence of @value, or
|
||||
/// -1 if @value is not found.
|
||||
int find(const T& value) const {
|
||||
auto iter = std::find( m_data.begin() , m_data.end() , value);
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
/// Will return the index of the first occurence of @value, or
|
||||
/// -1 if @value is not found.
|
||||
int find(const T& value) const {
|
||||
auto iter = std::find( m_data.begin() , m_data.end() , value);
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
int find_if(P&& pred) const {
|
||||
auto iter = std::find_if(m_data.begin(), m_data.end(), std::forward<P>(pred));
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
/// Will return the index of the first value which is != @value, or -1
|
||||
/// if all values are == @value
|
||||
int find_not(const T& value) const {
|
||||
auto iter = std::find_if_not( m_data.begin() , m_data.end() , [&value] (const T& elm) { return value == elm; });
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
iterator begin() {
|
||||
return this->m_data.begin();
|
||||
}
|
||||
|
||||
|
||||
iterator end() {
|
||||
return this->m_data.end();
|
||||
}
|
||||
|
||||
iterator begin() {
|
||||
return this->m_data.begin();
|
||||
}
|
||||
|
||||
|
||||
iterator end() {
|
||||
return this->m_data.end();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector< T > m_data;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Opm
|
||||
WELL_WELSPECS_UPDATE = 2,
|
||||
|
||||
|
||||
WELL_POLYMER_UPDATE = 4,
|
||||
//WELL_POLYMER_UPDATE = 4,
|
||||
/*
|
||||
The NEW_GROUP event is triggered by the WELSPECS and
|
||||
GRUPTREE keywords.
|
||||
@@ -61,7 +61,7 @@ namespace Opm
|
||||
*/
|
||||
PRODUCTION_UPDATE = 16,
|
||||
INJECTION_UPDATE = 32,
|
||||
POLYMER_UPDATES = 64,
|
||||
//POLYMER_UPDATES = 64,
|
||||
|
||||
/*
|
||||
This event is triggered if the well status is changed
|
||||
|
||||
@@ -36,7 +36,6 @@ class GroupTree {
|
||||
std::vector< std::string > children( const std::string& parent ) const;
|
||||
const std::map<std::string , size_t>& nameSeqIndMap() const;
|
||||
const std::map<size_t, std::string >& seqIndNameMap() const;
|
||||
size_t groupTreeSize();
|
||||
bool operator==( const GroupTree& ) const;
|
||||
bool operator!=( const GroupTree& ) const;
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
|
||||
namespace Opm {
|
||||
WellConnections * newConnectionsWithSegments(const DeckKeyword& compsegs, const WellConnections& input_connections,
|
||||
const WellSegments& segments, const EclipseGrid& grid, std::size_t& totNC);
|
||||
const WellSegments& segments, const EclipseGrid& grid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
57
opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp
Normal file
57
opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef RFT_CONFIG_HPP
|
||||
#define RFT_CONFIG_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class TimeMap;
|
||||
class RFTConfig {
|
||||
public:
|
||||
explicit RFTConfig(const TimeMap& time_map);
|
||||
bool rft(const std::string& well, std::size_t report_step) const;
|
||||
bool plt(const std::string& well, std::size_t report_step) const;
|
||||
bool getWellOpenRFT(const std::string& well_name, std::size_t report_step) const;
|
||||
void setWellOpenRFT(std::size_t report_step);
|
||||
void setWellOpenRFT(const std::string& well_name);
|
||||
|
||||
bool active(std::size_t report_step) const;
|
||||
std::size_t firstRFTOutput() const;
|
||||
void updateRFT(const std::string& well, std::size_t report_step, RFTConnections::RFTEnum value);
|
||||
void updatePLT(const std::string& well, std::size_t report_step, PLTConnections::PLTEnum value);
|
||||
void addWellOpen(const std::string& well, std::size_t report_step);
|
||||
private:
|
||||
const TimeMap& tm;
|
||||
std::pair<bool, std::size_t> well_open_rft_time;
|
||||
std::unordered_set<std::string> well_open_rft_name;
|
||||
std::unordered_map<std::string, std::size_t> well_open;
|
||||
std::unordered_map<std::string, DynamicState<std::pair<RFTConnections::RFTEnum, std::size_t>>> rft_config;
|
||||
std::unordered_map<std::string, DynamicState<std::pair<PLTConnections::PLTEnum, std::size_t>>> plt_config;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
@@ -32,15 +33,15 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Actions.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
@@ -57,6 +58,9 @@ namespace Opm
|
||||
class SummaryState;
|
||||
class TimeMap;
|
||||
class UnitSystem;
|
||||
class ErrorGuard;
|
||||
class WListManager;
|
||||
class UDQInput;
|
||||
|
||||
class Schedule {
|
||||
public:
|
||||
@@ -64,11 +68,35 @@ namespace Opm
|
||||
const EclipseGrid& grid,
|
||||
const Eclipse3DProperties& eclipseProperties,
|
||||
const Runspec &runspec,
|
||||
const ParseContext& parseContext = ParseContext());
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors);
|
||||
|
||||
template<typename T>
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseGrid& grid,
|
||||
const Eclipse3DProperties& eclipseProperties,
|
||||
const Runspec &runspec,
|
||||
const ParseContext& parseContext,
|
||||
T&& errors);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseGrid& grid,
|
||||
const Eclipse3DProperties& eclipseProperties,
|
||||
const Runspec &runspec);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseState& es,
|
||||
const ParseContext& parseContext = ParseContext());
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors);
|
||||
|
||||
template <typename T>
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseState& es,
|
||||
const ParseContext& parseContext,
|
||||
T&& errors);
|
||||
|
||||
Schedule(const Deck& deck,
|
||||
const EclipseState& es);
|
||||
|
||||
/*
|
||||
* If the input deck does not specify a start time, Eclipse's 1. Jan
|
||||
@@ -77,6 +105,7 @@ namespace Opm
|
||||
time_t getStartTime() const;
|
||||
time_t posixStartTime() const;
|
||||
time_t posixEndTime() const;
|
||||
time_t simTime(size_t timeStep) const;
|
||||
double seconds(size_t timeStep) const;
|
||||
double stepLength(size_t timeStep) const;
|
||||
|
||||
@@ -86,6 +115,12 @@ namespace Opm
|
||||
size_t numWells(size_t timestep) const;
|
||||
size_t getMaxNumConnectionsForWells(size_t timestep) const;
|
||||
bool hasWell(const std::string& wellName) const;
|
||||
|
||||
std::vector<std::string> wellNames(const std::string& pattern, size_t timeStep, const std::vector<std::string>& matching_wells = {}) const;
|
||||
std::vector<std::string> wellNames(const std::string& pattern) const;
|
||||
std::vector<std::string> wellNames(size_t timeStep) const;
|
||||
std::vector<std::string> wellNames() const;
|
||||
|
||||
const Well* getWell(const std::string& wellName) const;
|
||||
std::vector< const Well* > getOpenWells(size_t timeStep) const;
|
||||
std::vector< const Well* > getWells() const;
|
||||
@@ -104,11 +139,12 @@ namespace Opm
|
||||
std::vector< const Group* > getChildGroups(const std::string& group_name, size_t timeStep) const;
|
||||
std::vector< const Well* > getWells(const std::string& group, size_t timeStep) const;
|
||||
std::vector< const Well* > getChildWells(const std::string& group_name, size_t timeStep) const;
|
||||
std::vector< const Well* > getWellsMatching( const std::string& ) const;
|
||||
const OilVaporizationProperties& getOilVaporizationProperties(size_t timestep) const;
|
||||
|
||||
const WellTestConfig& wtestConfig(size_t timestep) const;
|
||||
const Actions& actionConfig() const;
|
||||
const WListManager& getWListManager(size_t timeStep) const;
|
||||
const UDQInput& getUDQConfig(size_t timeStep) const;
|
||||
const Actions& actions() const;
|
||||
void evalAction(const SummaryState& summary_state, size_t timeStep);
|
||||
|
||||
const GroupTree& getGroupTree(size_t t) const;
|
||||
@@ -120,9 +156,12 @@ namespace Opm
|
||||
std::vector< const Group* > getGroups(size_t timeStep) const;
|
||||
const Tuning& getTuning() const;
|
||||
const MessageLimits& getMessageLimits() const;
|
||||
void invalidNamePattern (const std::string& namePattern, const ParseContext& parseContext, const DeckKeyword& keyword) const;
|
||||
void invalidNamePattern (const std::string& namePattern, const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& keyword) const;
|
||||
|
||||
const RFTConfig& rftConfig() const;
|
||||
const Events& getEvents() const;
|
||||
const Events& getWellEvents(const std::string& well) const;
|
||||
bool hasWellEvent(const std::string& well, uint64_t event_mask, size_t reportStep) const;
|
||||
const Deck& getModifierDeck(size_t timeStep) const;
|
||||
bool hasOilVaporizationProperties() const;
|
||||
const VFPProdTable& getVFPProdTable(int table_id, size_t timeStep) const;
|
||||
@@ -135,10 +174,12 @@ namespace Opm
|
||||
*/
|
||||
void filterConnections(const EclipseGrid& grid);
|
||||
size_t size() const;
|
||||
|
||||
void applyAction(size_t reportStep, const ActionX& action, const std::vector<std::string>& matching_wells);
|
||||
private:
|
||||
TimeMap m_timeMap;
|
||||
OrderedMap< Well > m_wells;
|
||||
OrderedMap< Group > m_groups;
|
||||
OrderedMap< std::string, Well > m_wells;
|
||||
OrderedMap< std::string, Group > m_groups;
|
||||
DynamicState< GroupTree > m_rootGroupTree;
|
||||
DynamicState< OilVaporizationProperties > m_oilvaporizationproperties;
|
||||
Events m_events;
|
||||
@@ -149,50 +190,56 @@ namespace Opm
|
||||
std::map<int, DynamicState<std::shared_ptr<VFPProdTable>>> vfpprod_tables;
|
||||
std::map<int, DynamicState<std::shared_ptr<VFPInjTable>>> vfpinj_tables;
|
||||
DynamicState<std::shared_ptr<WellTestConfig>> wtest_config;
|
||||
DynamicState<std::shared_ptr<WListManager>> wlist_manager;
|
||||
DynamicState<std::shared_ptr<UDQInput>> udq_config;
|
||||
DynamicState<WellProducer::ControlModeEnum> global_whistctl_mode;
|
||||
RFTConfig rft_config;
|
||||
|
||||
WellProducer::ControlModeEnum m_controlModeWHISTCTL;
|
||||
Actions actions;
|
||||
Actions m_actions;
|
||||
|
||||
std::vector< Well* > getWells(const std::string& wellNamePattern);
|
||||
std::vector< Well* > getWells(const std::string& wellNamePattern, const std::vector<std::string>& matching_wells = {});
|
||||
std::vector< Group* > getGroups(const std::string& groupNamePattern);
|
||||
std::map<std::string,Events> well_events;
|
||||
|
||||
void updateWellStatus( Well& well, size_t reportStep , WellCommon::StatusEnum status);
|
||||
void addWellToGroup( Group& newGroup , Well& well , size_t timeStep);
|
||||
void iterateScheduleSection(const ParseContext& parseContext , const SCHEDULESection& , const EclipseGrid& grid,
|
||||
void iterateScheduleSection(const ParseContext& parseContext , ErrorGuard& errors, const SCHEDULESection& , const EclipseGrid& grid,
|
||||
const Eclipse3DProperties& eclipseProperties);
|
||||
bool handleGroupFromWELSPECS(const std::string& groupName, GroupTree& newTree) const;
|
||||
void addGroup(const std::string& groupName , size_t timeStep);
|
||||
void addWell(const std::string& wellName, const DeckRecord& record, size_t timeStep, WellCompletion::CompletionOrderEnum wellCompletionOrder);
|
||||
void handleCOMPORD(const ParseContext& parseContext, const DeckKeyword& compordKeyword, size_t currentStep);
|
||||
void handleUDQ(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWLIST(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleCOMPORD(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& compordKeyword, size_t currentStep);
|
||||
void handleWELSPECS( const SCHEDULESection&, size_t, size_t );
|
||||
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext);
|
||||
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWCONProducer( const DeckKeyword& keyword, size_t currentStep, bool isPredictionMode, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWCONHIST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWGRUPCON( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext);
|
||||
void handleCOMPDAT( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleCOMPLUMP( const DeckKeyword& keyword, size_t currentStep );
|
||||
void handleWELSEGS( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleCOMPSEGS( const DeckKeyword& keyword, size_t currentStep, const EclipseGrid& grid);
|
||||
void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWTRACER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext );
|
||||
void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWPOLYMER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWSOLVENT( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWTRACER( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWPMITAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWSKPTAB( const DeckKeyword& keyword, const size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWINJTEMP( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWCONINJH( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWELOPEN( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors, const std::vector<std::string>& matching_wells = {});
|
||||
void handleWELTARG( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleGCONINJE( const SCHEDULESection&, const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleGCONPROD( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleGEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleTUNING( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWRFT( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWTEST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWTEST( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWRFTPLT( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWPIMULT( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleDRSDT( const DeckKeyword& keyword, size_t currentStep);
|
||||
@@ -200,8 +247,8 @@ namespace Opm
|
||||
void handleDRSDTR( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleDRVDTR( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleVAPPARS( const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext);
|
||||
void handleWHISTCTL(const ParseContext& parseContext, const DeckKeyword& keyword);
|
||||
void handleWECON( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleWHISTCTL(const DeckKeyword& keyword, std::size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors);
|
||||
void handleMESSAGES(const DeckKeyword& keyword, size_t currentStep);
|
||||
void handleVFPPROD(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
|
||||
void handleVFPINJ(const DeckKeyword& vfpprodKeyword, const UnitSystem& unit_system, size_t currentStep);
|
||||
@@ -211,16 +258,17 @@ namespace Opm
|
||||
const SCHEDULESection& section,
|
||||
size_t keywordIdx,
|
||||
const DeckKeyword& keyword,
|
||||
const ParseContext& parseContext,
|
||||
const ParseContext& parseContext, ErrorGuard& errors,
|
||||
const EclipseGrid& grid,
|
||||
const Eclipse3DProperties& eclipseProperties,
|
||||
const UnitSystem& unit_system,
|
||||
std::vector<std::pair<const DeckKeyword*, size_t > >& rftProperties);
|
||||
|
||||
static double convertInjectionRateToSI(double rawRate, WellInjector::TypeEnum wellType, const Opm::UnitSystem &unitSystem);
|
||||
static double convertInjectionRateToSI(double rawRate, Phase wellPhase, const Opm::UnitSystem &unitSystem);
|
||||
void addWellEvent(const std::string& well, ScheduleEvents::Events event, size_t reportStep);
|
||||
static bool convertEclipseStringToBool(const std::string& eclipseString);
|
||||
|
||||
#ifdef CHECK_WELLS
|
||||
bool checkWells(const ParseContext& parseContext, ErrorGuard& errors) const;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,31 @@ namespace Opm {
|
||||
|
||||
}
|
||||
|
||||
namespace WellTarget {
|
||||
enum ControlModeEnum {
|
||||
ORAT = 1,
|
||||
WRAT = 2,
|
||||
GRAT = 3,
|
||||
LRAT = 4,
|
||||
CRAT = 5, // Not supported
|
||||
RESV = 6,
|
||||
BHP = 7,
|
||||
THP = 8,
|
||||
VFP = 9,
|
||||
LIFT = 10, // Not supported
|
||||
GUID = 11
|
||||
};
|
||||
/*
|
||||
There are unfortuntaley separate enums for production controls,
|
||||
injection controls and also for WELTARG control arguments. Since the
|
||||
WELTARG control arguments are *not* used to enumerate available
|
||||
controls the numerical values are - conciously - not in 2^n range.
|
||||
*/
|
||||
|
||||
ControlModeEnum ControlModeFromString(const std::string& string_value);
|
||||
}
|
||||
|
||||
|
||||
namespace WellInjector {
|
||||
enum TypeEnum {
|
||||
WATER = 1,
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
#define SUMMARY_STATE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <ert/ecl/smspec_node.hpp>
|
||||
|
||||
@@ -73,11 +75,16 @@ public:
|
||||
bool has_well_var(const std::string& well, const std::string& var) const;
|
||||
double get_well_var(const std::string& well, const std::string& var) const;
|
||||
|
||||
std::vector<std::string> wells() const;
|
||||
std::vector<std::string> wells(const std::string& var) const;
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
private:
|
||||
std::unordered_map<std::string,double> values;
|
||||
|
||||
// The first key is the variable and the second key is the well.
|
||||
std::unordered_map<std::string, std::unordered_map<std::string, double>> well_values;
|
||||
std::unordered_set<std::string> m_wells;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
Normal file
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQASSIGN_HPP_
|
||||
#define UDQASSIGN_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQAssign{
|
||||
public:
|
||||
UDQAssign(const std::string& keyword, const std::vector<std::string>& selector, double value);
|
||||
const std::string& keyword() const;
|
||||
double value() const;
|
||||
UDQVarType var_type() const;
|
||||
const std::vector<std::string>& selector() const;
|
||||
UDQWellSet eval_wells(const std::vector<std::string>& wells) const;
|
||||
private:
|
||||
std::string m_keyword;
|
||||
UDQVarType m_var_type;
|
||||
std::vector<std::string> m_selector;
|
||||
double m_value;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
Normal file
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQ_CONTEXT_HPP
|
||||
#define UDQ_CONTEXT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
class SummaryState;
|
||||
class UDQFunctionTable;
|
||||
|
||||
class UDQContext{
|
||||
public:
|
||||
UDQContext(const UDQFunctionTable& udqft, const SummaryState& summary_state);
|
||||
double get(const std::string& key) const;
|
||||
double get_well_var(const std::string& well, const std::string& var) const;
|
||||
void add(const std::string& key, double value);
|
||||
const UDQFunctionTable& function_table() const;
|
||||
std::vector<std::string> wells() const;
|
||||
private:
|
||||
const UDQFunctionTable& udqft;
|
||||
const SummaryState& summary_state;
|
||||
std::unordered_map<std::string, double> values;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
74
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
Normal file
74
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQ_DEFINE_HPP
|
||||
#define UDQ_DEFINE_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQASTNode;
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
|
||||
class UDQDefine{
|
||||
public:
|
||||
UDQDefine(const UDQParams& udq_params,
|
||||
const std::string& keyword,
|
||||
const std::vector<std::string>& deck_data);
|
||||
|
||||
UDQDefine(const UDQParams& udq_params,
|
||||
const std::string& keyword,
|
||||
const std::vector<std::string>& deck_data,
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors);
|
||||
|
||||
template <typename T>
|
||||
UDQDefine(const UDQParams& udq_params,
|
||||
const std::string& keyword,
|
||||
const std::vector<std::string>& deck_data,
|
||||
const ParseContext& parseContext,
|
||||
T&& errors);
|
||||
|
||||
|
||||
UDQWellSet eval_wells(const UDQContext& context) const;
|
||||
UDQSet eval(const UDQContext& context) const;
|
||||
const std::string& keyword() const;
|
||||
const std::vector<std::string>& tokens() const;
|
||||
UDQVarType var_type() const;
|
||||
private:
|
||||
std::vector<std::string> input_tokens;
|
||||
const UDQParams& udq_params; // Beacuse of the shared RNG stream this must be a reference.
|
||||
std::string m_keyword;
|
||||
std::shared_ptr<UDQASTNode> ast;
|
||||
UDQVarType m_var_type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
114
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
Normal file
114
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQ_ENUMS_HPP
|
||||
#define UDQ_ENUMS_HPP
|
||||
|
||||
namespace Opm {
|
||||
|
||||
enum class UDQVarType {
|
||||
WELL_VAR = 1,
|
||||
CONNECTION_VAR= 2,
|
||||
FIELD_VAR = 3,
|
||||
GROUP_VAR = 4,
|
||||
REGION_VAR = 5,
|
||||
SEGMENT_VAR = 6,
|
||||
AQUIFER_VAR = 7,
|
||||
BLOCK_VAR = 8
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum class UDQTokenType{
|
||||
error = 0,
|
||||
number = 1,
|
||||
open_paren = 2,
|
||||
close_paren = 3,
|
||||
ecl_expr = 7,
|
||||
//
|
||||
binary_op_add = 8,
|
||||
binary_op_sub = 9,
|
||||
binary_op_div = 10,
|
||||
binary_op_mul = 11,
|
||||
binary_op_pow = 12,
|
||||
binary_op_uadd = 13,
|
||||
binary_op_umul = 14,
|
||||
binary_op_umin = 15,
|
||||
binary_op_umax = 16,
|
||||
binary_cmp_eq = 17,
|
||||
binary_cmp_ne = 18,
|
||||
binary_cmp_le = 19,
|
||||
binary_cmp_ge = 20,
|
||||
binary_cmp_lt = 21,
|
||||
binary_cmp_gt = 22,
|
||||
//
|
||||
elemental_func_randn = 23,
|
||||
elemental_func_randu = 24,
|
||||
elemental_func_rrandn = 25,
|
||||
elemental_func_rrandu = 26,
|
||||
elemental_func_abs = 27,
|
||||
elemental_func_def = 28,
|
||||
elemental_func_exp = 29,
|
||||
elemental_func_idv = 30,
|
||||
elemental_func_ln = 31,
|
||||
elemental_func_log = 32,
|
||||
elemental_func_nint = 33,
|
||||
elemental_func_sorta = 34,
|
||||
elemental_func_sortd = 35,
|
||||
elemental_func_undef = 36,
|
||||
//
|
||||
scalar_func_sum = 37,
|
||||
scalar_func_avea = 38,
|
||||
scalar_func_aveg = 39,
|
||||
scalar_func_aveh = 40,
|
||||
scalar_func_max = 41,
|
||||
scalar_func_min = 42,
|
||||
scalar_func_norm1 = 43,
|
||||
scalar_func_norm2 = 44,
|
||||
scalar_func_normi = 45,
|
||||
scalar_func_prod = 46,
|
||||
//
|
||||
table_lookup = 47,
|
||||
//
|
||||
end = 100
|
||||
};
|
||||
|
||||
|
||||
enum class UDQAction {
|
||||
ASSIGN,
|
||||
DEFINE,
|
||||
UNITS,
|
||||
UPDATE};
|
||||
|
||||
|
||||
|
||||
namespace UDQ {
|
||||
|
||||
UDQVarType varType(const std::string& keyword);
|
||||
UDQAction actionType(const std::string& action_string);
|
||||
UDQTokenType funcType(const std::string& func_name);
|
||||
bool binaryFunc(UDQTokenType token_type);
|
||||
bool elementalUnaryFunc(UDQTokenType token_type);
|
||||
bool scalarFunc(UDQTokenType token_type);
|
||||
bool cmpFunc(UDQTokenType token_type);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,21 +24,23 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
enum class UDQAction {ASSIGN, DEFINE, UNITS, UPDATE};
|
||||
|
||||
|
||||
class UDQExpression {
|
||||
public:
|
||||
UDQExpression(const std::string& action, const std::string& keyword, const std::vector<std::string>& data);
|
||||
UDQExpression(UDQAction action, const std::string& keyword, const std::vector<std::string>& data);
|
||||
explicit UDQExpression(const DeckRecord& expression);
|
||||
const std::vector<std::string>& tokens() const;
|
||||
UDQAction action() const;
|
||||
const std::string& keyword() const;
|
||||
private:
|
||||
UDQAction action;
|
||||
std::string keyword;
|
||||
UDQAction m_action;
|
||||
std::string m_keyword;
|
||||
UDQVarType m_var_type;
|
||||
std::vector<std::string> data;
|
||||
};
|
||||
}
|
||||
117
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp
Normal file
117
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UDQFUNCTION_HPP
|
||||
#define UDQFUNCTION_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
||||
class UDQFunction {
|
||||
public:
|
||||
UDQFunction(const std::string& name);
|
||||
virtual ~UDQFunction() = default;
|
||||
const std::string& name() const;
|
||||
UDQTokenType type() const;
|
||||
private:
|
||||
std::string m_name;
|
||||
UDQTokenType func_type;
|
||||
};
|
||||
|
||||
class UDQScalarFunction : public UDQFunction {
|
||||
public:
|
||||
UDQScalarFunction(const std::string&name, std::function<UDQScalar(const UDQSet& arg)> f);
|
||||
UDQScalar eval(const UDQSet& arg) const;
|
||||
|
||||
static UDQScalar SUM(const UDQSet& arg);
|
||||
static UDQScalar AVEA(const UDQSet& arg);
|
||||
static UDQScalar AVEG(const UDQSet& arg);
|
||||
static UDQScalar AVEH(const UDQSet& arg);
|
||||
static UDQScalar MIN(const UDQSet& arg);
|
||||
static UDQScalar MAX(const UDQSet& arg);
|
||||
static UDQScalar NORM1(const UDQSet& arg);
|
||||
static UDQScalar NORM2(const UDQSet& arg);
|
||||
static UDQScalar NORMI(const UDQSet& arg);
|
||||
static UDQScalar PROD(const UDQSet& arg);
|
||||
|
||||
private:
|
||||
std::function<UDQScalar(const UDQSet& arg)> func;
|
||||
};
|
||||
|
||||
|
||||
class UDQUnaryElementalFunction : public UDQFunction {
|
||||
public:
|
||||
UDQUnaryElementalFunction(const std::string&name, std::function<UDQSet(const UDQSet& arg)> f);
|
||||
UDQSet eval(const UDQSet& arg) const;
|
||||
|
||||
static UDQSet ABS(const UDQSet& arg);
|
||||
static UDQSet DEF(const UDQSet& arg);
|
||||
static UDQSet EXP(const UDQSet& arg);
|
||||
static UDQSet IDV(const UDQSet& arg);
|
||||
static UDQSet LN(const UDQSet& arg);
|
||||
static UDQSet LOG(const UDQSet& arg);
|
||||
static UDQSet NINT(const UDQSet& arg);
|
||||
static UDQSet SORTA(const UDQSet& arg);
|
||||
static UDQSet SORTD(const UDQSet& arg);
|
||||
static UDQSet UNDEF(const UDQSet& arg);
|
||||
|
||||
static UDQSet RANDN(std::mt19937& rng, const UDQSet& arg);
|
||||
static UDQSet RANDU(std::mt19937& rng, const UDQSet& arg);
|
||||
|
||||
private:
|
||||
std::function<UDQSet(const UDQSet& arg)> func;
|
||||
};
|
||||
|
||||
|
||||
class UDQBinaryFunction : public UDQFunction {
|
||||
public:
|
||||
UDQBinaryFunction(const std::string& name, std::function<UDQSet(const UDQSet& lhs, const UDQSet& rhs)> f);
|
||||
UDQSet eval(const UDQSet&, const UDQSet& arg) const;
|
||||
|
||||
static UDQSet EQ(double eps, const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet NE(double eps, const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet LE(double eps, const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet GE(double eps, const UDQSet& lhs, const UDQSet& rhs);
|
||||
|
||||
static UDQSet POW(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet LT(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet GT(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet ADD(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet MUL(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet SUB(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet DIV(const UDQSet& lhs, const UDQSet& rhs);
|
||||
|
||||
static UDQSet UADD(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet UMUL(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet UMAX(const UDQSet& lhs, const UDQSet& rhs);
|
||||
static UDQSet UMIN(const UDQSet& lhs, const UDQSet& rhs);
|
||||
private:
|
||||
|
||||
std::function<UDQSet(const UDQSet& lhs, const UDQSet& rhs)> func;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UDQFUNCTIONTABLE_HPP
|
||||
#define UDQFUNCTIONTABLE_HPP
|
||||
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQFunctionTable {
|
||||
public:
|
||||
explicit UDQFunctionTable(const UDQParams& params);
|
||||
UDQFunctionTable();
|
||||
bool has_function(const std::string& name) const;
|
||||
const UDQFunction& get(const std::string& name) const;
|
||||
private:
|
||||
void insert_function(std::shared_ptr<const UDQFunction> func);
|
||||
UDQParams params;
|
||||
std::unordered_map<std::string, std::shared_ptr<const UDQFunction>> function_table;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
68
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
Normal file
68
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQINPUT_HPP_
|
||||
#define UDQINPUT_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckRecord;
|
||||
class Deck;
|
||||
|
||||
class UDQInput {
|
||||
public:
|
||||
explicit UDQInput(const Deck& deck);
|
||||
const std::string& unit(const std::string& key) const;
|
||||
bool has_unit(const std::string& keyword) const;
|
||||
bool has_keyword(const std::string& keyword) const;
|
||||
void add_record(const DeckRecord& record);
|
||||
void assign_unit(const std::string& keyword, const std::string& unit);
|
||||
|
||||
const std::vector<UDQDefine>& definitions() const;
|
||||
std::vector<UDQDefine> definitions(UDQVarType var_type) const;
|
||||
|
||||
const std::vector<UDQAssign>& assignments() const;
|
||||
std::vector<UDQAssign> assignments(UDQVarType var_type) const;
|
||||
|
||||
const UDQFunctionTable& function_table() const;
|
||||
private:
|
||||
UDQParams udq_params;
|
||||
UDQFunctionTable udqft;
|
||||
std::vector<UDQDefine> m_definitions;
|
||||
std::vector<UDQAssign> m_assignments;
|
||||
std::unordered_map<std::string, std::string> units;
|
||||
std::unordered_set<std::string> keywords;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -17,32 +17,37 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_UDQ_CONFIG_HPP
|
||||
#define OPM_UDQ_CONFIG_HPP
|
||||
#ifndef OPM_UDQ_PARAMS_HPP
|
||||
#define OPM_UDQ_PARAMS_HPP
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class Deck;
|
||||
|
||||
class UDQConfig
|
||||
class UDQParams
|
||||
{
|
||||
public:
|
||||
explicit UDQConfig(const Deck& deck);
|
||||
UDQConfig();
|
||||
explicit UDQParams(const Deck& deck);
|
||||
UDQParams();
|
||||
|
||||
bool reseedRNG() const noexcept;
|
||||
int randomSeed() const noexcept;
|
||||
void reseedRNG(int seed);
|
||||
double range() const noexcept;
|
||||
double undefinedValue() const noexcept;
|
||||
double cmpEpsilon() const noexcept;
|
||||
|
||||
std::mt19937& sim_rng();
|
||||
std::mt19937& true_rng();
|
||||
private:
|
||||
bool reseed_rng;
|
||||
int random_seed;
|
||||
double value_range;
|
||||
double undefined_value;
|
||||
double cmp_eps;
|
||||
|
||||
std::mt19937 m_sim_rng; // The sim_rng is seeded deterministiaclly at simulation start.
|
||||
std::mt19937 m_true_rng; // The true_rng is seeded with a "true" random seed; this rng can be reset with reseedRNG()
|
||||
};
|
||||
}
|
||||
|
||||
118
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp
Normal file
118
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UDQSET_HPP
|
||||
#define UDQSET_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQScalar {
|
||||
public:
|
||||
UDQScalar() = default;
|
||||
UDQScalar(double value);
|
||||
|
||||
void operator+=(const UDQScalar& rhs);
|
||||
void operator+=(double rhs);
|
||||
void operator*=(const UDQScalar& rhs);
|
||||
void operator*=(double rhs);
|
||||
void operator/=(const UDQScalar& rhs);
|
||||
void operator/=(double rhs);
|
||||
void operator-=(const UDQScalar& rhs);
|
||||
void operator-=(double rhs);
|
||||
|
||||
operator bool() const;
|
||||
void assign(double value);
|
||||
bool defined() const;
|
||||
double value() const;
|
||||
public:
|
||||
double m_value;
|
||||
bool m_defined = false;
|
||||
};
|
||||
|
||||
|
||||
class UDQSet {
|
||||
public:
|
||||
UDQSet(const std::string& name, std::size_t size);
|
||||
void assign(double value);
|
||||
void assign(std::size_t index, double value);
|
||||
|
||||
std::size_t size() const;
|
||||
void operator+=(const UDQSet& rhs);
|
||||
void operator+=(double rhs);
|
||||
void operator-=(const UDQSet& rhs);
|
||||
void operator-=(double rhs);
|
||||
void operator*=(const UDQSet& rhs);
|
||||
void operator*=(double rhs);
|
||||
void operator/=(const UDQSet& rhs);
|
||||
void operator/=(double rhs);
|
||||
|
||||
const UDQScalar& operator[](std::size_t index) const;
|
||||
std::vector<UDQScalar>::const_iterator begin() const;
|
||||
std::vector<UDQScalar>::const_iterator end() const;
|
||||
|
||||
std::vector<double> defined_values() const;
|
||||
std::size_t defined_size() const;
|
||||
const std::string& name() const;
|
||||
private:
|
||||
std::string m_name;
|
||||
std::vector<UDQScalar> values;
|
||||
};
|
||||
|
||||
|
||||
UDQScalar operator+(const UDQScalar&lhs, const UDQScalar& rhs);
|
||||
UDQScalar operator+(const UDQScalar&lhs, double rhs);
|
||||
UDQScalar operator+(double lhs, const UDQScalar& rhs);
|
||||
|
||||
UDQScalar operator-(const UDQScalar&lhs, const UDQScalar& rhs);
|
||||
UDQScalar operator-(const UDQScalar&lhs, double rhs);
|
||||
UDQScalar operator-(double lhs, const UDQScalar& rhs);
|
||||
|
||||
UDQScalar operator*(const UDQScalar&lhs, const UDQScalar& rhs);
|
||||
UDQScalar operator*(const UDQScalar&lhs, double rhs);
|
||||
UDQScalar operator*(double lhs, const UDQScalar& rhs);
|
||||
|
||||
UDQScalar operator/(const UDQScalar&lhs, const UDQScalar& rhs);
|
||||
UDQScalar operator/(const UDQScalar&lhs, double rhs);
|
||||
UDQScalar operator/(double lhs, const UDQScalar& rhs);
|
||||
|
||||
UDQSet operator+(const UDQSet&lhs, const UDQSet& rhs);
|
||||
UDQSet operator+(const UDQSet&lhs, double rhs);
|
||||
UDQSet operator+(double lhs, const UDQSet& rhs);
|
||||
|
||||
UDQSet operator-(const UDQSet&lhs, const UDQSet& rhs);
|
||||
UDQSet operator-(const UDQSet&lhs, double rhs);
|
||||
UDQSet operator-(double lhs, const UDQSet& rhs);
|
||||
|
||||
UDQSet operator*(const UDQSet&lhs, const UDQSet& rhs);
|
||||
UDQSet operator*(const UDQSet&lhs, double rhs);
|
||||
UDQSet operator*(double lhs, const UDQSet& rhs);
|
||||
|
||||
UDQSet operator/(const UDQSet&lhs, const UDQSet& rhs);
|
||||
UDQSet operator/(const UDQSet&lhs, double rhs);
|
||||
UDQSet operator/(double lhs, const UDQSet&rhs);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp
Normal file
50
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UDQWELLSET_HPP
|
||||
#define UDQWELLSET_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQWellSet : public UDQSet {
|
||||
public:
|
||||
UDQWellSet(const std::string& name, const std::vector<std::string>& wells);
|
||||
UDQWellSet(const std::string& name, const std::vector<std::string>& wells, const UDQSet& values);
|
||||
UDQWellSet(const std::string& name, const std::vector<std::string>& wells, double scalar_value);
|
||||
void assign(const std::string& well, double value);
|
||||
void assign(double value);
|
||||
const UDQScalar& operator[](const std::string& well) const;
|
||||
private:
|
||||
std::size_t wellIndex(const std::string& well) const;
|
||||
std::unordered_map<std::string, std::size_t> well_index;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
41
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
Normal file
41
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cstddef>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class WList {
|
||||
public:
|
||||
using storage = std::unordered_set<std::string>;
|
||||
std::size_t size() const;
|
||||
void add(const std::string& well);
|
||||
void del(const std::string& well);
|
||||
bool has(const std::string& well) const;
|
||||
|
||||
std::vector<std::string> wells() const;
|
||||
storage::const_iterator begin() const;
|
||||
storage::const_iterator end() const;
|
||||
private:
|
||||
storage well_list;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class WList;
|
||||
|
||||
class WListManager {
|
||||
public:
|
||||
bool hasList(const std::string&) const;
|
||||
WList& getList(const std::string& name);
|
||||
const WList& getList(const std::string& name) const;
|
||||
WList& newList(const std::string& name);
|
||||
void delWell(const std::string& well);
|
||||
private:
|
||||
std::map<std::string, WList> wlists;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -26,14 +26,13 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellEconProductionLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellInjectionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellPolymerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellTracerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellProductionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
@@ -53,13 +52,13 @@ namespace Opm {
|
||||
public:
|
||||
Well(const std::string& name, const size_t& seqIndex, int headI,
|
||||
int headJ, double refDepth, double drainageRadius, Phase preferredPhase,
|
||||
WellProducer::ControlModeEnum whist_ctl,
|
||||
const TimeMap& timeMap, size_t creationTimeStep,
|
||||
WellCompletion::CompletionOrderEnum completionOrdering = WellCompletion::TRACK,
|
||||
bool allowCrossFlow = true, bool automaticShutIn = true);
|
||||
const std::string& name() const;
|
||||
const size_t& seqIndex() const;
|
||||
std::size_t getTotNoConn() const;
|
||||
void setTotNoConn(std::size_t noConn);
|
||||
const size_t& seqIndex() const;
|
||||
std::size_t getTotNoConn() const;
|
||||
bool hasBeenDefined(size_t timeStep) const;
|
||||
const std::string getGroupName(size_t timeStep) const;
|
||||
void setGroupName(size_t timeStep , const std::string& groupName);
|
||||
@@ -160,11 +159,6 @@ namespace Opm {
|
||||
bool setEconProductionLimits(const size_t timeStep, const WellEconProductionLimits& productionlimits);
|
||||
const WellEconProductionLimits& getEconProductionLimits(const size_t timeStep) const;
|
||||
|
||||
int firstRFTOutput( ) const;
|
||||
bool getRFTActive(size_t time_step) const;
|
||||
void updateRFTActive(size_t time_step, RFTConnections::RFTEnum mode);
|
||||
bool getPLTActive(size_t time_step) const;
|
||||
void updatePLTActive(size_t time_step, PLTConnections::PLTEnum mode);
|
||||
int findWellFirstOpen(int startTimeStep) const;
|
||||
|
||||
/*
|
||||
@@ -172,7 +166,6 @@ namespace Opm {
|
||||
WELSPECS, actually opening the well might be later.
|
||||
*/
|
||||
size_t firstTimeStep( ) const;
|
||||
void setRFTForWellWhenFirstOpen(size_t currentStep);
|
||||
|
||||
static bool wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern);
|
||||
|
||||
@@ -189,9 +182,6 @@ namespace Opm {
|
||||
|
||||
void addWellSegments(size_t time_step, WellSegments new_segmentset);
|
||||
|
||||
const Events& getEvents() const;
|
||||
void addEvent(ScheduleEvents::Events event, size_t reportStep);
|
||||
bool hasEvent(uint64_t eventMask, size_t reportStep) const;
|
||||
void handleCOMPLUMP(const DeckRecord& record, size_t time_step);
|
||||
void handleCOMPDAT(size_t time_step, const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties);
|
||||
void handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, size_t time_step);
|
||||
@@ -199,7 +189,6 @@ namespace Opm {
|
||||
void handleWPIMULT(const DeckRecord& record, size_t time_step);
|
||||
void handleWELSEGS(const DeckKeyword& keyword, size_t time_step);
|
||||
|
||||
|
||||
/*
|
||||
Will remove all completions which are attached to inactive cells. Will
|
||||
scan through all timesteps.
|
||||
@@ -208,9 +197,8 @@ namespace Opm {
|
||||
private:
|
||||
size_t m_creationTimeStep;
|
||||
std::string m_name;
|
||||
std::size_t m_seqIndex;
|
||||
std::size_t m_totNoConn=0;
|
||||
|
||||
std::size_t m_seqIndex;
|
||||
|
||||
DynamicState< WellCommon::StatusEnum > m_status;
|
||||
|
||||
DynamicState< int > m_isAvailableForGroupControl;
|
||||
@@ -228,8 +216,6 @@ namespace Opm {
|
||||
DynamicState< double > m_solventFraction;
|
||||
DynamicState< WellTracerProperties > m_tracerProperties;
|
||||
DynamicState< std::string > m_groupName;
|
||||
DynamicState< int > m_rft;
|
||||
DynamicState< int > m_plt;
|
||||
|
||||
DynamicState< int > m_headI;
|
||||
DynamicState< int > m_headJ;
|
||||
@@ -244,7 +230,6 @@ namespace Opm {
|
||||
// flag indicating if the well is a multi-segment well
|
||||
DynamicState< WellSegments > m_segmentset;
|
||||
size_t timesteps;
|
||||
Events events;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef CONNECTIONSET_HPP_
|
||||
#define CONNECTIONSET_HPP_
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Connection.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class EclipseGrid;
|
||||
@@ -46,12 +46,13 @@ namespace Opm {
|
||||
const double segDistStart= 0.0,
|
||||
const double segDistEnd= 0.0,
|
||||
const bool defaultSatTabId = true);
|
||||
void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties, std::size_t& totNC);
|
||||
void loadCOMPDAT(const DeckRecord& record, const EclipseGrid& grid, const Eclipse3DProperties& eclipseProperties);
|
||||
|
||||
using const_iterator = std::vector< Connection >::const_iterator;
|
||||
|
||||
void add( Connection );
|
||||
size_t size() const;
|
||||
size_t inputSize() const;
|
||||
const Connection& operator[](size_t index) const;
|
||||
const Connection& get(size_t index) const;
|
||||
const Connection& getFromIJK(const int i, const int j, const int k) const;
|
||||
@@ -59,9 +60,6 @@ namespace Opm {
|
||||
|
||||
const_iterator begin() const { return this->m_connections.begin(); }
|
||||
const_iterator end() const { return this->m_connections.end(); }
|
||||
|
||||
std::size_t totNoConn() const { return this->m_connections.size(); }
|
||||
|
||||
void filter(const EclipseGrid& grid);
|
||||
bool allConnectionsShut() const;
|
||||
/// Order connections irrespective of input order.
|
||||
@@ -101,6 +99,7 @@ namespace Opm {
|
||||
size_t findClosestConnection(int oi, int oj, double oz, size_t start_pos);
|
||||
|
||||
int headI, headJ;
|
||||
size_t num_removed = 0;
|
||||
std::vector< Connection > m_connections;
|
||||
};
|
||||
}
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckRecord;
|
||||
class UnitSystem;
|
||||
|
||||
struct WellInjectionProperties {
|
||||
double surfaceInjectionRate;
|
||||
double reservoirInjectionRate;
|
||||
@@ -44,6 +47,9 @@ namespace Opm {
|
||||
bool operator!=(const WellInjectionProperties& other) const;
|
||||
|
||||
WellInjectionProperties();
|
||||
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
|
||||
void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name, const UnitSystem& unit_system);
|
||||
void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name, const UnitSystem& unit_system);
|
||||
bool hasInjectionControl(WellInjector::ControlModeEnum controlModeArg) const {
|
||||
if (injectionControls & controlModeArg)
|
||||
return true;
|
||||
@@ -60,6 +66,10 @@ namespace Opm {
|
||||
if ((injectionControls & controlModeArg) == 0)
|
||||
injectionControls += controlModeArg;
|
||||
}
|
||||
|
||||
void resetDefaultHistoricalBHPLimit();
|
||||
|
||||
void setBHPLimit(const double limit);
|
||||
};
|
||||
|
||||
std::ostream& operator<<( std::ostream&, const WellInjectionProperties& );
|
||||
@@ -48,19 +48,13 @@ namespace Opm {
|
||||
int VFPTableNumber = 0;
|
||||
double ALQValue = 0.0;
|
||||
bool predictionMode = false;
|
||||
|
||||
WellProducer::ControlModeEnum controlMode = WellProducer::CMODE_UNDEFINED;
|
||||
WellProducer::ControlModeEnum whistctl_cmode = WellProducer::CMODE_UNDEFINED;
|
||||
|
||||
bool operator==(const WellProductionProperties& other) const;
|
||||
bool operator!=(const WellProductionProperties& other) const;
|
||||
WellProductionProperties();
|
||||
|
||||
static WellProductionProperties history(const WellProductionProperties& prevProperties,
|
||||
const DeckRecord& record,
|
||||
const WellProducer::ControlModeEnum controlModeWHISTCL);
|
||||
|
||||
static WellProductionProperties prediction( const DeckRecord& record, bool addGroupProductionControl );
|
||||
|
||||
bool hasProductionControl(WellProducer::ControlModeEnum controlModeArg) const {
|
||||
return (m_productionControls & controlModeArg) != 0;
|
||||
}
|
||||
@@ -77,11 +71,22 @@ namespace Opm {
|
||||
|
||||
// this is used to check whether the specified control mode is an effective history matching production mode
|
||||
static bool effectiveHistoryProductionControl(const WellProducer::ControlModeEnum cmode);
|
||||
void handleWCONPROD( const DeckRecord& record);
|
||||
void handleWCONHIST( const DeckRecord& record);
|
||||
void handleWELTARG(WellTarget::ControlModeEnum cmode, double newValue, double siFactorG, double siFactorL, double siFactorP);
|
||||
void resetDefaultBHPLimit();
|
||||
|
||||
private:
|
||||
int m_productionControls = 0;
|
||||
void init_rates( const DeckRecord& record );
|
||||
|
||||
void init_history(const DeckRecord& record);
|
||||
|
||||
WellProductionProperties(const DeckRecord& record);
|
||||
|
||||
void setBHPLimit(const double limit);
|
||||
|
||||
double getBHPLimit() const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<( std::ostream&, const WellProductionProperties& );
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellTestConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Opm {
|
||||
class EclipseState;
|
||||
class ParserKeyword;
|
||||
class Schedule;
|
||||
class ErrorGuard;
|
||||
class ParseContext;
|
||||
class GridDims;
|
||||
|
||||
@@ -108,12 +109,28 @@ namespace Opm {
|
||||
typedef std::vector< keyword_type > keyword_list;
|
||||
typedef keyword_list::const_iterator const_iterator;
|
||||
|
||||
SummaryConfig( const Deck&, const Schedule&,
|
||||
const TableManager&, const ParseContext&);
|
||||
SummaryConfig( const Deck&,
|
||||
const Schedule&,
|
||||
const TableManager&,
|
||||
const ParseContext&,
|
||||
ErrorGuard&);
|
||||
|
||||
template <typename T>
|
||||
SummaryConfig( const Deck&,
|
||||
const Schedule&,
|
||||
const TableManager&,
|
||||
const ParseContext&,
|
||||
T&&);
|
||||
|
||||
SummaryConfig( const Deck&,
|
||||
const Schedule&,
|
||||
const TableManager&);
|
||||
|
||||
|
||||
|
||||
const_iterator begin() const;
|
||||
const_iterator end() const;
|
||||
|
||||
size_t size() const;
|
||||
SummaryConfig& merge( const SummaryConfig& );
|
||||
SummaryConfig& merge( SummaryConfig&& );
|
||||
|
||||
@@ -141,6 +158,7 @@ namespace Opm {
|
||||
const Schedule& schedule,
|
||||
const TableManager& tables,
|
||||
const ParseContext& parseContext,
|
||||
ErrorGuard& errors,
|
||||
const GridDims& dims);
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
Copyright (C) 2019 by Norce
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@@ -15,27 +15,24 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UDQState_HPP_
|
||||
#define UDQState_HPP_
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQExpression.hpp>
|
||||
*/
|
||||
#ifndef OPM_PARSER_OVERBURD_TABLE_HPP
|
||||
#define OPM_PARSER_OVERBURD_TABLE_HPP
|
||||
|
||||
#include "SimpleTable.hpp"
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class UDQ{
|
||||
class DeckItem;
|
||||
|
||||
class OverburdTable : public SimpleTable {
|
||||
public:
|
||||
UDQ(const UDQConfig& config, const Deck& deck);
|
||||
const std::vector<UDQExpression>& expressions() const noexcept;
|
||||
private:
|
||||
std::vector<UDQExpression> m_expressions;
|
||||
OverburdTable( const DeckItem& item );
|
||||
|
||||
const TableColumn& getDepthColumn() const;
|
||||
const TableColumn& getOverburdenPressureColumn() const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
46
opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp
Normal file
46
opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2019 by 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_PARSER_ROCK2D_TABLE_HPP
|
||||
#define OPM_PARSER_ROCK2D_TABLE_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckKeyword;
|
||||
|
||||
class Rock2dTable {
|
||||
public:
|
||||
Rock2dTable();
|
||||
void init(const Opm::DeckRecord& record, size_t tableIdx);
|
||||
size_t size() const;
|
||||
size_t sizeMultValues() const;
|
||||
double getPressureValue(size_t index) const;
|
||||
double getPvmultValue(size_t pressureIndex, size_t saturationIndex ) const;
|
||||
|
||||
|
||||
protected:
|
||||
std::vector< std::vector <double> > m_pvmultValues;
|
||||
std::vector< double > m_pressureValues;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
45
opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp
Normal file
45
opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (C) 2019 by 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_PARSER_ROCK2DTR_TABLE_HPP
|
||||
#define OPM_PARSER_ROCK2DTR_TABLE_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class DeckKeyword;
|
||||
|
||||
class Rock2dtrTable {
|
||||
public:
|
||||
Rock2dtrTable();
|
||||
void init(const Opm::DeckRecord& record, size_t tableIdx);
|
||||
size_t size() const;
|
||||
size_t sizeMultValues() const;
|
||||
double getPressureValue(size_t index) const;
|
||||
double getTransMultValue(size_t pressureIndex, size_t saturationIndex ) const;
|
||||
|
||||
protected:
|
||||
std::vector< std::vector <double> > m_transMultValues;
|
||||
std::vector< double > m_pressureValues;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
Copyright (C) 2019 Norce
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@@ -16,23 +16,21 @@
|
||||
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_ROCKWNOD_TABLE_HPP
|
||||
#define OPM_PARSER_ROCKWNOD_TABLE_HPP
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ.hpp>
|
||||
#include "SimpleTable.hpp"
|
||||
|
||||
namespace Opm {
|
||||
|
||||
UDQ::UDQ(const UDQConfig& /* config */, const Deck& deck) {
|
||||
if (deck.hasKeyword("UDQ")) {
|
||||
const auto& kw = deck.getKeyword("UDQ");
|
||||
for (const auto& record : kw)
|
||||
this->m_expressions.emplace_back( record );
|
||||
}
|
||||
}
|
||||
class DeckItem;
|
||||
|
||||
const std::vector<UDQExpression>& UDQ::expressions() const noexcept {
|
||||
return this->m_expressions;
|
||||
}
|
||||
class RockwnodTable : public SimpleTable {
|
||||
public:
|
||||
RockwnodTable( const DeckItem& item );
|
||||
|
||||
const TableColumn& getSaturationColumn() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -65,7 +65,7 @@ namespace Opm {
|
||||
|
||||
protected:
|
||||
TableSchema m_schema;
|
||||
OrderedMap<TableColumn> m_columns;
|
||||
OrderedMap<std::string, TableColumn> m_columns;
|
||||
bool m_jfunc = false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp> // Phase::PhaseEnum
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/SorwmisTable.hpp>
|
||||
@@ -118,6 +120,11 @@ namespace Opm {
|
||||
|
||||
const std::vector<PvtgTable>& getPvtgTables() const;
|
||||
const std::vector<PvtoTable>& getPvtoTables() const;
|
||||
const std::vector<Rock2dTable>& getRock2dTables() const;
|
||||
const std::vector<Rock2dtrTable>& getRock2dtrTables() const;
|
||||
const TableContainer& getRockwnodTables() const;
|
||||
const TableContainer& getOverburdTables() const;
|
||||
|
||||
const PvtwTable& getPvtwTable() const;
|
||||
const PvcdoTable& getPvcdoTable() const;
|
||||
const DensityTable& getDensityTable() const;
|
||||
@@ -161,7 +168,42 @@ namespace Opm {
|
||||
void initSkprwatTables(const Deck& deck);
|
||||
void initSkprpolyTables(const Deck& deck);
|
||||
|
||||
//void initRockTables(const Deck& deck, const std::string& keywordName);
|
||||
|
||||
template <class TableType>
|
||||
void initRockTables(const Deck& deck, const std::string& keywordName, std::vector<TableType>& rocktable ) {
|
||||
|
||||
if (!deck.hasKeyword(keywordName))
|
||||
return;
|
||||
|
||||
if (!deck.hasKeyword("ROCKCOMP")) {
|
||||
OpmLog::error("ROCKCOMP must be present if ROCK2DTR is used");
|
||||
}
|
||||
|
||||
if (!deck.hasKeyword("ROCKWNOD")) {
|
||||
OpmLog::error("ROCKWNOD must be present if ROCK2DTR is used");
|
||||
}
|
||||
|
||||
const auto& rockcompKeyword = deck.getKeyword("ROCKCOMP");
|
||||
const auto& record = rockcompKeyword.getRecord( 0 );
|
||||
size_t numTables = record.getItem("NTROCC").get< int >(0);
|
||||
rocktable.resize(numTables);
|
||||
|
||||
const auto& keyword = deck.getKeyword(keywordName);
|
||||
size_t numEntries = keyword.size();
|
||||
size_t regionIdx = 0;
|
||||
size_t tableIdx = 0;
|
||||
for (unsigned lineIdx = 0; lineIdx < numEntries; ++lineIdx) {
|
||||
if (keyword.getRecord(lineIdx).getItem("PRESSURE").size() > 0) {
|
||||
rocktable[regionIdx].init(keyword.getRecord(lineIdx), tableIdx);
|
||||
tableIdx++;
|
||||
} else { // next region
|
||||
tableIdx = 0;
|
||||
regionIdx++;
|
||||
}
|
||||
}
|
||||
assert(regionIdx == numTables - 1 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -291,7 +333,9 @@ namespace Opm {
|
||||
std::map<std::string , TableContainer> m_simpleTables;
|
||||
std::vector<PvtgTable> m_pvtgTables;
|
||||
std::vector<PvtoTable> m_pvtoTables;
|
||||
PvtwTable m_pvtwTable;
|
||||
std::vector<Rock2dTable> m_rock2dTables;
|
||||
std::vector<Rock2dtrTable> m_rock2dtrTables;
|
||||
PvtwTable m_pvtwTable;
|
||||
PvcdoTable m_pvcdoTable;
|
||||
DensityTable m_densityTable;
|
||||
RockTable m_rockTable;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Opm {
|
||||
/* Number of columns */
|
||||
size_t size() const;
|
||||
private:
|
||||
OrderedMap<ColumnSchema> m_columns;
|
||||
OrderedMap<std::string, ColumnSchema> m_columns;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,128 +24,157 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template <typename T>
|
||||
template <typename K, typename T>
|
||||
class OrderedMap {
|
||||
|
||||
using storage_type = typename std::vector<std::pair<K,T>>;
|
||||
using index_type = typename std::unordered_map<K,std::size_t>;
|
||||
using iter_type = typename storage_type::iterator;
|
||||
using const_iter_type = typename storage_type::const_iterator;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string , size_t> m_map;
|
||||
std::vector<T> m_vector;
|
||||
index_type m_map;
|
||||
storage_type m_vector;
|
||||
|
||||
public:
|
||||
bool hasKey(const std::string& key) const {
|
||||
auto iter = m_map.find(key);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
std::size_t count(const K& key) const {
|
||||
return this->m_map.count(key);
|
||||
}
|
||||
|
||||
|
||||
void insert(std::string key, T value) {
|
||||
if (hasKey(key)) {
|
||||
auto iter = m_map.find( key );
|
||||
|
||||
T& operator[](const K& key) {
|
||||
if (this->count(key) == 0)
|
||||
this->insert( std::make_pair(key, T()));
|
||||
|
||||
return this->at(key);
|
||||
}
|
||||
|
||||
|
||||
std::size_t erase(const K& key) {
|
||||
if (this->count(key) == 0)
|
||||
return 0;
|
||||
|
||||
std::size_t index = this->m_map.at(key);
|
||||
this->m_map.erase(key);
|
||||
this->m_vector.erase(this->m_vector.begin() + index);
|
||||
|
||||
for (const auto& index_pair : this->m_map) {
|
||||
auto target_index = index_pair.second;
|
||||
if (target_index > index)
|
||||
target_index--;
|
||||
|
||||
this->m_map[index_pair.first] = target_index;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void insert(std::pair<K,T> key_value_pair) {
|
||||
if (this->count(key_value_pair.first) > 0) {
|
||||
auto iter = m_map.find( key_value_pair.first );
|
||||
size_t index = iter->second;
|
||||
m_vector[index] = value;
|
||||
m_vector[index] = key_value_pair;
|
||||
} else {
|
||||
size_t index = m_vector.size();
|
||||
m_vector.push_back( std::move( value ) );
|
||||
m_map.insert( std::pair<std::string, size_t>(key , index));
|
||||
this->m_map.emplace(key_value_pair.first, index);
|
||||
this->m_vector.push_back( std::move( key_value_pair ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
T& get(const std::string& key) {
|
||||
T& get(const K& key) {
|
||||
auto iter = m_map.find( key );
|
||||
if (iter == m_map.end())
|
||||
throw std::invalid_argument("Key not found:" + key);
|
||||
throw std::invalid_argument("Key not found:");
|
||||
else {
|
||||
size_t index = iter->second;
|
||||
return get(index);
|
||||
return iget(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
T& get(size_t index) {
|
||||
T& iget(size_t index) {
|
||||
if (index >= m_vector.size())
|
||||
throw std::invalid_argument("Invalid index");
|
||||
return m_vector[index];
|
||||
return m_vector[index].second;
|
||||
}
|
||||
|
||||
const T& get(const std::string& key) const {
|
||||
auto iter = m_map.find( key );
|
||||
const T& get(const K& key) const {
|
||||
const auto& iter = this->m_map.find( key );
|
||||
if (iter == m_map.end())
|
||||
throw std::invalid_argument("Key not found:" + key);
|
||||
throw std::invalid_argument("Key not found: ??");
|
||||
else {
|
||||
size_t index = iter->second;
|
||||
return get(index);
|
||||
return iget(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const T& get(size_t index) const {
|
||||
const T& iget(size_t index) const {
|
||||
if (index >= m_vector.size())
|
||||
throw std::invalid_argument("Invalid index");
|
||||
return m_vector[index];
|
||||
return m_vector[index].second;
|
||||
}
|
||||
|
||||
const T& at(size_t index) const {
|
||||
return this->get(index);
|
||||
return this->iget(index);
|
||||
}
|
||||
|
||||
const T& at(const std::string &key) const {
|
||||
const T& at(const K& key) const {
|
||||
return this->get(key);
|
||||
}
|
||||
|
||||
T& at(size_t index) {
|
||||
return this->get(index);
|
||||
return this->iget(index);
|
||||
}
|
||||
|
||||
T& at(const std::string& key) {
|
||||
T& at(const K& key) {
|
||||
return this->get(key);
|
||||
}
|
||||
|
||||
|
||||
T* getPtr(const std::string& key) const {
|
||||
auto iter = m_map.find( key );
|
||||
if (iter == m_map.end())
|
||||
throw std::invalid_argument("Key not found:" + key);
|
||||
else {
|
||||
size_t index = iter->second;
|
||||
return getPtr(index);
|
||||
}
|
||||
}
|
||||
|
||||
T* getPtr(size_t index) const {
|
||||
if (index >= m_vector.size())
|
||||
throw std::invalid_argument("Invalid index");
|
||||
return &m_vector[index];
|
||||
}
|
||||
|
||||
|
||||
size_t size() const {
|
||||
return m_vector.size();
|
||||
}
|
||||
|
||||
|
||||
typename std::vector<T>::const_iterator begin() const {
|
||||
const_iter_type begin() const {
|
||||
return m_vector.begin();
|
||||
}
|
||||
|
||||
|
||||
typename std::vector<T>::const_iterator end() const {
|
||||
const_iter_type end() const {
|
||||
return m_vector.end();
|
||||
}
|
||||
|
||||
typename std::vector<T>::iterator begin() {
|
||||
iter_type begin() {
|
||||
return m_vector.begin();
|
||||
}
|
||||
|
||||
typename std::vector<T>::iterator end() {
|
||||
iter_type end() {
|
||||
return m_vector.end();
|
||||
}
|
||||
|
||||
iter_type find(const K& key) {
|
||||
const auto map_iter = this->m_map.find(key);
|
||||
if (map_iter == this->m_map.end())
|
||||
return this->m_vector.end();
|
||||
|
||||
return std::next(this->m_vector.begin(), map_iter->second);
|
||||
}
|
||||
|
||||
const_iter_type find(const K& key) const {
|
||||
const auto map_iter = this->m_map.find(key);
|
||||
if (map_iter == this->m_map.end())
|
||||
return this->m_vector.end();
|
||||
|
||||
return std::next(this->m_vector.begin(), map_iter->second);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Opm {
|
||||
|
||||
class Deck;
|
||||
class Parser;
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
|
||||
enum DeckChecks {
|
||||
SectionTopology = 0x0001,
|
||||
@@ -40,7 +42,7 @@ enum DeckChecks {
|
||||
|
||||
// some semantical correctness checks of the deck. this method adds a warning to
|
||||
// the deck object if any issue is found ...
|
||||
bool checkDeck( Deck& deck, const Parser&, size_t enabledChecks = AllChecks);
|
||||
bool checkDeck( const Deck& deck, const Parser& parser, const ParseContext& parseContext, ErrorGuard& errorGuard, size_t enabledChecks = AllChecks);
|
||||
|
||||
}
|
||||
|
||||
|
||||
54
opm/parser/eclipse/Parser/ErrorGuard.hpp
Normal file
54
opm/parser/eclipse/Parser/ErrorGuard.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright 2019 Joakim Hove/datagr
|
||||
|
||||
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 ERROR_GUARD_HPP
|
||||
#define ERROR_GUARD_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class ErrorGuard {
|
||||
public:
|
||||
void addError(const std::string& errorKey, const std::string& msg);
|
||||
void addWarning(const std::string& errorKey, const std::string &msg);
|
||||
void clear();
|
||||
|
||||
explicit operator bool() const { return !this->error_list.empty(); }
|
||||
|
||||
/*
|
||||
Observe that this desctructor has a somewhat special semantics. If there
|
||||
are errors in the error list it will print all warnings and errors on
|
||||
stderr and throw std::runtime_error.
|
||||
*/
|
||||
~ErrorGuard();
|
||||
void terminate() const;
|
||||
void dump() const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> error_list;
|
||||
std::vector<std::pair<std::string, std::string>> warning_list;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -37,7 +37,8 @@ namespace Opm {
|
||||
THROW_EXCEPTION = 0,
|
||||
WARN = 1,
|
||||
IGNORE = 2,
|
||||
EXIT1 = 3
|
||||
EXIT1 = 3,
|
||||
DELAYED_EXIT1 = 4
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,14 +79,16 @@ namespace Opm {
|
||||
recognizd keys will be allowed.
|
||||
*/
|
||||
|
||||
class ErrorGuard;
|
||||
|
||||
class ParseContext {
|
||||
public:
|
||||
ParseContext();
|
||||
explicit ParseContext(InputError::Action default_action);
|
||||
explicit ParseContext(const std::vector<std::pair<std::string , InputError::Action>>& initial);
|
||||
|
||||
void handleError( const std::string& errorKey, const std::string& msg ) const;
|
||||
void handleUnknownKeyword(const std::string& keyword) const;
|
||||
void handleError( const std::string& errorKey, const std::string& msg, ErrorGuard& errors ) const;
|
||||
void handleUnknownKeyword(const std::string& keyword, ErrorGuard& errors) const;
|
||||
bool hasKey(const std::string& key) const;
|
||||
ParseContext withKey(const std::string& key, InputError::Action action = InputError::WARN) const;
|
||||
ParseContext& withKey(const std::string& key, InputError::Action action = InputError::WARN);
|
||||
@@ -105,9 +107,9 @@ namespace Opm {
|
||||
*/
|
||||
void addKey(const std::string& key, InputError::Action default_action);
|
||||
/*
|
||||
The PARSE_EXTRA_RECORDS field regulates how the parser
|
||||
responds to keywords whose size has been defined in the
|
||||
previous keyword.
|
||||
The PARSE_EXTRA_RECORDS field regulates how the parser
|
||||
responds to keywords whose size has been defined in the
|
||||
previous keyword.
|
||||
Example:
|
||||
EQLDIMS
|
||||
2 100 20 1 1 /
|
||||
@@ -115,11 +117,11 @@ namespace Opm {
|
||||
2469 382.4 1705.0 0.0 500 0.0 1 1 20 /
|
||||
2469 382.4 1705.0 0.0 500 0.0 1 1 20 /
|
||||
2470 382.4 1705.0 0.0 500 0.0 1 1 20 /
|
||||
EQLDIMS's first entry is 2 and defines the record size of the
|
||||
EQUIL keyword. Since there are 3 records in EQUIL, this results
|
||||
in an error that needs to be handled by the parser. By default,
|
||||
an exception is thrown, or it may be specified in the
|
||||
PARSE_EXTRA_RECORDS field that this error is to be ignored.
|
||||
EQLDIMS's first entry is 2 and defines the record size of the
|
||||
EQUIL keyword. Since there are 3 records in EQUIL, this results
|
||||
in an error that needs to be handled by the parser. By default,
|
||||
an exception is thrown, or it may be specified in the
|
||||
PARSE_EXTRA_RECORDS field that this error is to be ignored.
|
||||
*/
|
||||
const static std::string PARSE_EXTRA_RECORDS;
|
||||
/*
|
||||
@@ -192,6 +194,34 @@ namespace Opm {
|
||||
*/
|
||||
const static std::string PARSE_MISSING_INCLUDE;
|
||||
|
||||
/// Dynamic number of wells exceeds maximum declared in
|
||||
/// RUNSPEC keyword WELLDIMS (item 1).
|
||||
const static std::string RUNSPEC_NUMWELLS_TOO_LARGE;
|
||||
|
||||
/// Dynamic number of connections per well exceeds maximum
|
||||
/// declared in RUNSPEC keyword WELLDIMS (item 2).
|
||||
const static std::string RUNSPEC_CONNS_PER_WELL_TOO_LARGE;
|
||||
|
||||
/// Dynamic number of groups exceeds maximum number declared in
|
||||
/// RUNSPEC keyword WELLDIMS (item 3).
|
||||
const static std::string RUNSPEC_NUMGROUPS_TOO_LARGE;
|
||||
|
||||
/// Dynamic group size exceeds maximum number declared in
|
||||
/// RUNSPEC keyword WELLDIMS (item 4).
|
||||
const static std::string RUNSPEC_GROUPSIZE_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
|
||||
characters.
|
||||
*/
|
||||
const static std::string PARSE_LONG_KEYWORD;
|
||||
|
||||
/*
|
||||
The unit system specified via the FILEUNIT keyword is different from the unit
|
||||
system used by the deck.
|
||||
*/
|
||||
const static std::string UNIT_SYSTEM_MISMATCH;
|
||||
|
||||
/*
|
||||
Some property modfiers can be modified in the Schedule
|
||||
@@ -223,6 +253,7 @@ namespace Opm {
|
||||
*/
|
||||
const static std::string UNSUPPORTED_TERMINATE_IF_BHP;
|
||||
|
||||
const static std::string UDQ_PARSE_ERROR;
|
||||
|
||||
/*
|
||||
If the third item in the THPRES keyword is defaulted the
|
||||
@@ -247,6 +278,8 @@ namespace Opm {
|
||||
const static std::string SUMMARY_UNKNOWN_WELL;
|
||||
const static std::string SUMMARY_UNKNOWN_GROUP;
|
||||
const static std::string SUMMARY_UNHANDLED_KEYWORD;
|
||||
const static std::string SUMMARY_UNDEFINED_UDQ;
|
||||
const static std::string SUMMARY_UDQ_MISSING_UNIT;
|
||||
|
||||
/*
|
||||
A well must be specified (e.g. WELSPECS) and have completions
|
||||
@@ -264,14 +297,60 @@ namespace Opm {
|
||||
const static std::string ACTIONX_ILLEGAL_KEYWORD;
|
||||
|
||||
|
||||
/*
|
||||
The RPTSCH, RPTSOL and RPTSCHED keywords have two alternative forms,
|
||||
in the old style all the items are set as integers, i.e. the RPTRST
|
||||
keyword can be configured as:
|
||||
|
||||
RPTRST
|
||||
0 0 0 1 0 1 0 2 0 0 0 0 0 1 0 0 2/
|
||||
|
||||
The new way is based on string mneomnics which can optionally have an
|
||||
integer value, i.e something like:
|
||||
|
||||
RPTRST
|
||||
BASIC=2 FLOWS ALLPROS /
|
||||
|
||||
It is strictly illegal to mix the two ways to configure keywords. A
|
||||
situation with mixed input style is identified if any of the items are
|
||||
integers. To avoid that the values in the assignments like BASIC=2 are
|
||||
interpreted as integers it is essential that there are no spaces
|
||||
around the '=', and that is also documented in the manual. However -
|
||||
it turns out that Eclipse actually handles e.g.
|
||||
|
||||
RPTRST
|
||||
BASIC = 2 /
|
||||
|
||||
So we have introduced a error mode RPT_MIXED_STYLE which tries to
|
||||
handle this situation. Observe that really mixed input style is
|
||||
impossible to handle, and will lead to a hard exception, but with the
|
||||
RPT_MIXED_STYLE error mode it is possible to configure lenient
|
||||
behavior towards interpreting the input as new style string mneomnics.
|
||||
*/
|
||||
const static std::string RPT_MIXED_STYLE;
|
||||
|
||||
const static std::string RPT_UNKNOWN_MNEMONIC;
|
||||
|
||||
|
||||
/*
|
||||
The SIMULATOR_KEYWORD_ errormodes are for the situation where the
|
||||
parser recognizes, and correctly parses a keyword, but we know that
|
||||
the simulator does not support the intended use of the keyword. These
|
||||
errormodes are invoked from the simulator.
|
||||
*/
|
||||
const static std::string SIMULATOR_KEYWORD_NOT_SUPPORTED;
|
||||
const static std::string SIMULATOR_KEYWORD_ITEM_NOT_SUPPORTED;
|
||||
|
||||
private:
|
||||
void initDefault();
|
||||
void initEnv();
|
||||
void envUpdate( const std::string& envVariable , InputError::Action action );
|
||||
void patternUpdate( const std::string& pattern , InputError::Action action);
|
||||
|
||||
std::map<std::string , InputError::Action> m_errorContexts;
|
||||
std::set<std::string> ignore_keywords;
|
||||
}; }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Opm {
|
||||
|
||||
class Deck;
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
class RawKeyword;
|
||||
|
||||
/// The hub of the parsing process.
|
||||
@@ -53,10 +54,17 @@ namespace Opm {
|
||||
|
||||
/// The starting point of the parsing process. The supplied file is parsed, and the resulting Deck is returned.
|
||||
Deck parseFile(const std::string &dataFile,
|
||||
const ParseContext& = ParseContext()) const;
|
||||
const ParseContext&,
|
||||
ErrorGuard& errors) const;
|
||||
|
||||
Deck parseFile(const std::string& datafile);
|
||||
|
||||
Deck parseString(const std::string &data,
|
||||
const ParseContext& = ParseContext()) const;
|
||||
Deck parseStream(std::unique_ptr<std::istream>&& inputStream , const ParseContext& parseContext) const;
|
||||
const ParseContext&,
|
||||
ErrorGuard& errors) const;
|
||||
Deck parseString(const std::string &data) const;
|
||||
|
||||
Deck parseStream(std::unique_ptr<std::istream>&& inputStream , const ParseContext& parseContext, ErrorGuard& errors) const;
|
||||
|
||||
/// Method to add ParserKeyword instances, these holding type and size information about the keywords and their data.
|
||||
void addParserKeyword(const Json::JsonObject& jsonKeyword);
|
||||
@@ -90,27 +98,30 @@ namespace Opm {
|
||||
addParserKeyword( std::unique_ptr< ParserKeyword >( new T ) );
|
||||
}
|
||||
|
||||
static EclipseState parse(const Deck& deck, const ParseContext& context = ParseContext());
|
||||
static EclipseState parse(const std::string &filename, const ParseContext& context = ParseContext());
|
||||
static EclipseState parseData(const std::string &data, const ParseContext& context = ParseContext());
|
||||
static EclipseState parse(const Deck& deck, const ParseContext& context, ErrorGuard& errors);
|
||||
static EclipseState parse(const std::string &filename, const ParseContext& context, ErrorGuard& errors);
|
||||
static EclipseState parseData(const std::string &data, const ParseContext& context, ErrorGuard& errors);
|
||||
|
||||
/// Parses the deck specified in filename. If context contains ParseContext::PARSE_PARTIAL_DECK,
|
||||
/// we construct only a lean grid, otherwise, we construct a full EclipseState and return the
|
||||
/// fully constructed InputGrid
|
||||
static EclipseGrid parseGrid(const std::string &filename,
|
||||
const ParseContext& context = ParseContext());
|
||||
const ParseContext& context,
|
||||
ErrorGuard& errors);
|
||||
|
||||
/// Parses the provided deck. If context contains ParseContext::PARSE_PARTIAL_DECK,
|
||||
/// we construct only a lean grid, otherwise, we construct a full EclipseState and return the
|
||||
/// fully constructed InputGrid
|
||||
static EclipseGrid parseGrid(const Deck& deck,
|
||||
const ParseContext& context = ParseContext());
|
||||
const ParseContext& context,
|
||||
ErrorGuard& errors);
|
||||
|
||||
/// Parses the provided deck string. If context contains ParseContext::PARSE_PARTIAL_DECK,
|
||||
/// we construct only a lean grid, otherwise, we construct a full EclipseState and return the
|
||||
/// fully constructed InputGrid
|
||||
static EclipseGrid parseGridData(const std::string &data,
|
||||
const ParseContext& context = ParseContext());
|
||||
const ParseContext& context,
|
||||
ErrorGuard& errors);
|
||||
|
||||
private:
|
||||
// associative map of the parser internal name and the corresponding ParserKeyword object
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Utility/Typetools.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
||||
|
||||
namespace Json {
|
||||
class JsonObject;
|
||||
@@ -34,22 +35,44 @@ namespace Opm {
|
||||
|
||||
class RawRecord;
|
||||
|
||||
|
||||
/*
|
||||
The ParserItem class describes one item handled by the parser. A parser
|
||||
item is the schema for parsing values from the deck, when configuring the
|
||||
ParserItem *two* types are in action:
|
||||
|
||||
InputType: These are the types specified when instantiating a
|
||||
ParserItem, the available types are currently: INT, DOUBLE, STRING,
|
||||
RAW_STRING and UDA.
|
||||
|
||||
DataType: This the C++ type of items generated when parsing the deck,
|
||||
currently the available datatypes are int, double and std::string.
|
||||
The mapping from input type to data type is many-to-one, and
|
||||
currently both STRING and RAW_STRING map to std::string and both
|
||||
DOUBLE and UDA map to double.
|
||||
|
||||
Splitting the type treatment in two layers in this way enables
|
||||
properties/transformations to be added to the data before they are
|
||||
internalized as data in a DataType instance; e.g. the difference between
|
||||
STRING and RAW_STRING is that for the latter quotes and '*' tokens are
|
||||
retained.
|
||||
*/
|
||||
|
||||
|
||||
class ParserItem {
|
||||
public:
|
||||
enum class item_size { ALL, SINGLE };
|
||||
static item_size size_from_string( const std::string& );
|
||||
static std::string string_from_size( item_size );
|
||||
|
||||
explicit ParserItem( const std::string& name );
|
||||
ParserItem( const std::string& name, item_size );
|
||||
template< typename T >
|
||||
ParserItem( const std::string& item_name, T val ) :
|
||||
ParserItem( item_name, item_size::SINGLE, std::move( val ) ) {}
|
||||
ParserItem( const std::string& name, item_size, int defaultValue );
|
||||
ParserItem( const std::string& name, item_size, double defaultValue );
|
||||
ParserItem( const std::string& name, item_size, std::string defaultValue );
|
||||
enum class itype {UNKNOWN, DOUBLE, INT, STRING, RAW_STRING, UDA};
|
||||
static itype from_string(const std::string& string_value);
|
||||
static std::string to_string(itype input_type);
|
||||
std::string type_literal() const;
|
||||
|
||||
explicit ParserItem(const Json::JsonObject& jsonConfig);
|
||||
|
||||
explicit ParserItem( const std::string& name, ParserItem::itype input_type );
|
||||
explicit ParserItem( const Json::JsonObject& jsonConfig );
|
||||
|
||||
void push_backDimension( const std::string& );
|
||||
const std::string& getDimension(size_t index) const;
|
||||
@@ -57,14 +80,14 @@ namespace Opm {
|
||||
size_t numDimensions() const;
|
||||
const std::string& name() const;
|
||||
item_size sizeType() const;
|
||||
void setSizeType(item_size size_type);
|
||||
std::string getDescription() const;
|
||||
bool scalar() const;
|
||||
void setDescription(std::string helpText);
|
||||
void setDescription(const std::string& helpText);
|
||||
|
||||
template< typename T > void setDefault( T );
|
||||
/* set type without a default value. will reset dimension etc. */
|
||||
template< typename T > void setType( T );
|
||||
template< typename T > void setType( T , bool raw);
|
||||
void setInputType( itype input_type );
|
||||
bool parseRaw() const;
|
||||
bool hasDefault() const;
|
||||
template< typename T > const T& getDefault() const;
|
||||
@@ -73,8 +96,10 @@ namespace Opm {
|
||||
bool operator!=( const ParserItem& ) const;
|
||||
|
||||
DeckItem scan( RawRecord& rawRecord ) const;
|
||||
|
||||
std::string size_literal() const;
|
||||
const std::string className() const;
|
||||
std::string createCode() const;
|
||||
std::string createCode(const std::string& indent) const;
|
||||
std::ostream& inlineClass(std::ostream&, const std::string& indent) const;
|
||||
std::string inlineClassInit(const std::string& parentClass,
|
||||
const std::string* defaultValue = nullptr ) const;
|
||||
@@ -83,18 +108,19 @@ namespace Opm {
|
||||
double dval;
|
||||
int ival;
|
||||
std::string sval;
|
||||
bool raw_string = false;
|
||||
std::vector< std::string > dimensions;
|
||||
|
||||
std::string m_name;
|
||||
item_size m_sizeType;
|
||||
item_size m_sizeType = item_size::SINGLE;
|
||||
std::string m_description;
|
||||
|
||||
type_tag type = type_tag::unknown;
|
||||
type_tag data_type = type_tag::unknown;
|
||||
itype input_type = itype::UNKNOWN;
|
||||
bool m_defaultSet;
|
||||
|
||||
template< typename T > T& value_ref();
|
||||
template< typename T > const T& value_ref() const;
|
||||
template< typename T > void setDataType( T );
|
||||
friend std::ostream& operator<<( std::ostream&, const ParserItem& );
|
||||
};
|
||||
|
||||
|
||||
@@ -37,9 +37,11 @@ namespace Opm {
|
||||
class Deck;
|
||||
class DeckKeyword;
|
||||
class ParseContext;
|
||||
class ErrorGuard;
|
||||
class ParserDoubleItem;
|
||||
class RawKeyword;
|
||||
class string_view;
|
||||
class ErrorGuard;
|
||||
|
||||
/*
|
||||
Small helper struct to assemble the information needed to infer the size
|
||||
@@ -122,10 +124,11 @@ namespace Opm {
|
||||
SectionNameSet::const_iterator validSectionNamesBegin() const;
|
||||
SectionNameSet::const_iterator validSectionNamesEnd() const;
|
||||
|
||||
DeckKeyword parse(const ParseContext& parseContext , std::shared_ptr< RawKeyword > rawKeyword) const;
|
||||
DeckKeyword parse(const ParseContext& parseContext, ErrorGuard& errors, std::shared_ptr< RawKeyword > rawKeyword) const;
|
||||
enum ParserKeywordSizeEnum getSizeType() const;
|
||||
const KeywordSize& getKeywordSize() const;
|
||||
bool isDataKeyword() const;
|
||||
bool slashTerminatedRecords() const;
|
||||
|
||||
std::string createDeclaration(const std::string& indent) const;
|
||||
std::string createDecl() const;
|
||||
@@ -147,6 +150,7 @@ namespace Opm {
|
||||
size_t m_fixedSize;
|
||||
bool m_isTableCollection;
|
||||
std::string m_Description;
|
||||
bool slash_terminated_records = true;
|
||||
|
||||
static bool validNameStart(const string_view& name);
|
||||
void initDeckNames( const Json::JsonObject& jsonConfig );
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Opm {
|
||||
class ParseContext;
|
||||
class ParserItem;
|
||||
class RawRecord;
|
||||
class ErrorGuard;
|
||||
|
||||
class ParserRecord {
|
||||
public:
|
||||
@@ -42,7 +43,7 @@ namespace Opm {
|
||||
void addDataItem( ParserItem item );
|
||||
const ParserItem& get(size_t index) const;
|
||||
const ParserItem& get(const std::string& itemName) const;
|
||||
DeckRecord parse( const ParseContext&, RawRecord& ) const;
|
||||
DeckRecord parse( const ParseContext&, ErrorGuard&, RawRecord&) const;
|
||||
bool isDataRecord() const;
|
||||
bool equal(const ParserRecord& other) const;
|
||||
bool hasDimension() const;
|
||||
@@ -53,10 +54,12 @@ namespace Opm {
|
||||
|
||||
bool operator==( const ParserRecord& ) const;
|
||||
bool operator!=( const ParserRecord& ) const;
|
||||
bool slashTerminatedRecords() const;
|
||||
|
||||
private:
|
||||
bool m_dataRecord;
|
||||
std::vector< ParserItem > m_items;
|
||||
bool slash_terminated_records = true;
|
||||
};
|
||||
|
||||
std::ostream& operator<<( std::ostream&, const ParserRecord& );
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Opm {
|
||||
iterator end();
|
||||
|
||||
bool is_title() const;
|
||||
|
||||
bool slash_terminated_records = true;
|
||||
private:
|
||||
Raw::KeywordSizeEnum m_sizeType;
|
||||
bool m_isFinished = false;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
%define tag final
|
||||
|
||||
Name: opm-common
|
||||
Version: 2018.10
|
||||
Version: 2019.04
|
||||
Release: 0
|
||||
Summary: Open Porous Media - common helpers and buildsystem
|
||||
License: GPL-3.0
|
||||
@@ -138,11 +138,13 @@ make install-html DESTDIR=${RPM_BUILD_ROOT}
|
||||
cd ..
|
||||
cd openmpi
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
mkdir -p ${RPM_BUILD_ROOT}/usr/include/openmpi-x86_64/
|
||||
mv ${RPM_BUILD_ROOT}/usr/lib64/openmpi/include/* ${RPM_BUILD_ROOT}/usr/include/openmpi-x86_64/
|
||||
cd ..
|
||||
|
||||
cd mpich
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
mkdir -p ${RPM_BUILD_ROOT}/usr/include/mpich-x86_64/
|
||||
mv ${RPM_BUILD_ROOT}/usr/lib64/mpich/include/* ${RPM_BUILD_ROOT}/usr/include/mpich-x86_64/
|
||||
|
||||
%clean
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
@@ -246,6 +246,8 @@ namespace {
|
||||
using Ix = ::Opm::RestartIO::Helpers::VectorItems::XConn::index;
|
||||
using R = ::Opm::data::Rates::opt;
|
||||
|
||||
xConn[Ix::Pressure] = units.from_si(M::pressure, x.pressure);
|
||||
|
||||
// Note flow rate sign. Treat production rates as positive.
|
||||
const auto& Q = x.rates;
|
||||
|
||||
@@ -313,7 +315,7 @@ captureDeclaredConnData(const Schedule& sched,
|
||||
allWellConnections.insert(std::make_pair(wl->name(), initConn));
|
||||
const auto it = allWellConnections.find(wl->name());
|
||||
const auto xr = xw.find(wl->name());
|
||||
int rCInd = 0;
|
||||
size_t rCInd = 0;
|
||||
if ((it != allWellConnections.end()) && (xr != xw.end())) {
|
||||
for (auto nConn = conns.size(), connID = 0*nConn; connID < nConn; connID++) {
|
||||
//
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user