Compare commits

...

12 Commits

Author SHA1 Message Date
Arne Morten Kvarving
e17284a90d bump version to 2021.10 2021-11-08 08:23:03 +01:00
Arne Morten Kvarving
65dd2b1eb9 bump version to 2021.10-rc2 2021-11-03 08:47:25 +01:00
Atgeirr Flø Rasmussen
d27d01a8a8
Merge pull request #2793 from atgeirr/backport-of-pr-2761
Backport of pr 2761
2021-10-28 10:06:14 +02:00
Bård Skaflestad
98388a7a7e Initialize RPTONLY/SUMTHIN Settings From SUMMARY Section 2021-10-28 10:05:31 +02:00
Bård Skaflestad
173a404725 Sort Includes in Schedule.hpp 2021-10-28 10:05:31 +02:00
Atgeirr Flø Rasmussen
f16fd2f662
Merge pull request #2792 from atgeirr/backport-of-pr-2774
Backport of pr 2774
2021-10-28 09:50:43 +02:00
Markus Blatt
bed2250cb5 Search for GMP if dune-common is used.
We do suggest dune-fem for opm-models and that one links to it
if available.
2021-10-28 09:47:44 +02:00
Markus Blatt
832a30a4d5 dune-fem uses QuadMath if available, search for it.
One still has to set USE_QUADMATH to true otherwise no
search will happen.
2021-10-28 09:47:44 +02:00
Markus Blatt
4ba3d16cfe Introduced DUNE-2.8 compatible imported targets where needed.
I.e. in the find_package files for PTScotch ParMETIS, Quadmath,
SuiteSparse, and SuperLU.
2021-10-28 09:47:44 +02:00
Markus Blatt
ef659cbfd3 Adds a rudimentary FindTBB.cmake to make DUNE 2.8 with TBB work
Fixes errors like

Target "test_communication_utils" links to target
"PkgConfig::PkgConfigTBB" but the target
was not found.  Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
2021-10-28 09:47:44 +02:00
Markus Blatt
9cb632d4be Search for TBB in Finddune-common.cmake
When configured with TBB dune-common-targets.cmake lists the
imported TBB::tbb or PkgConfig::PkgConfigTBB target
in INTERFACE_LINK_LIBRARIES. Hence we need to be able to resolve
this target in opm. We do this by searching for TBB id dune-common
is a prerequisite.

This commit fixes the problem only for newer versions of TBB shipping a
TBBConfig.cmake file.

The error fixed is along these lines:

Target "test_communication_utils" links to target "TBB::tbb" but the target
was not found.  Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
2021-10-28 09:47:44 +02:00
Arne Morten Kvarving
4e413a3aa7 bump version to 2021.10-rc1 2021-10-18 08:22:23 +02:00
15 changed files with 329 additions and 15 deletions

View File

@ -0,0 +1,31 @@
# - Find the GNU Multiprecision library.
#
# Will define the following imported target for usage:
# - GMP::gmp Target for linking/compiling with C library
# - GMP::gmpxx Target for linking/compiling with C++ library
find_path(GMP_INCLUDE_DIR gmp.h)
find_library(GMP_LIBRARY gmp)
find_path(GMPXX_INCLUDE_DIR gmpxx.h)
find_library(GMPXX_LIBRARY gmpxx)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMP
DEFAULT_MSG
GMPXX_LIBRARY GMPXX_INCLUDE_DIR GMP_INCLUDE_DIR GMP_LIBRARY)
if(GMP_FOUND)
if(NOT TARGET GMP::gmp)
add_library(GMP::gmp UNKNOWN IMPORTED GLOBAL)
set_target_properties(GMP::gmp PROPERTIES
IMPORTED_LOCATION ${GMP_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR})
endif()
if(NOT TARGET GMP::gmpxx)
add_library(GMP::gmpxx UNKNOWN IMPORTED GLOBAL)
set_target_properties(GMP::gmpxx PROPERTIES
IMPORTED_LOCATION ${GMPXX_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${GMPXX_INCLUDE_DIR}
TARGET_LINK_LIBRARIES GMP::gmp)
endif()
endif()

View File

@ -70,6 +70,20 @@ if(PTSCOTCH_FOUND)
set(PTSCOCH_LINK_FLAGS "${DUNE_MPI_LINK_FLAGS}"
CACHE STRING "PT-Scotch link flags")
set(HAVE_PTSCOTCH 1)
if(NOT TARGET PTScotch::Scotch)
add_library(PTScotch::Scotch UNKNOWN IMPORTED GLOBAL)
set_target_properties(PTScotch::Scotch PROPERTIES
IMPORTED_LOCATION "${SCOTCH_LIBRARY}"
INCLUDE_DIRECTORIES "${PTSCOTCH_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${PTSCOTCHERR_LIBRARY}")
endif()
if(NOT TARGET PTScotch::PTScotch)
add_library(PTScotch::PTScotch UNKNOWN IMPORTED GLOBAL)
set_target_properties(PTScotch::PTScotch PROPERTIES
IMPORTED_LOCATION "${PTSCOTCH_LIBRARY}"
INCLUDE_DIRECTORIES "${PTSCOTCH_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "PTScotch::Scotch;${MPI_DUNE_LIBRARIES}")
endif()
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determing location of PT-Scotch succeded:\n"

View File

@ -102,6 +102,13 @@ if(PARMETIS_FOUND)
"Include directory: ${PARMETIS_INCLUDE_DIRS}\n"
"Library directory: ${PARMETIS_LIBRARIES}\n\n")
if(NOT TARGET ParMETIS::ParMETIS)
add_library(ParMETIS::ParMETIS UNKNOWN IMPORTED GLOBAL)
set_target_properties(ParMETIS::ParMETIS PROPERTIES
IMPORTED_LOCATION ${PARMETIS_LIBRARY}
INCLUDE_DIRECTORIES "${PARMETIS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES};${MPI_C_LIBRARIES}")
endif()
endif(PARMETIS_FOUND)
mark_as_advanced(PARMETIS_INCLUDE_DIRS PARMETIS_LIBRARIES HAVE_PARMETIS)

View File

@ -34,6 +34,11 @@ int main(void){
if (QUADMATH_FOUND)
set(QUADMATH_LIBRARIES "quadmath")
set(HAVE_QUAD "${QUADMATH_FOUND}")
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
set_target_properties(QuadMath::QuadMath PROPERTIES
INTERFACE_LINK_LIBRARIES quadmath
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
endif()
endif()

View File

@ -280,6 +280,32 @@ if (SuiteSparse_LIBRARIES)
list (REVERSE SuiteSparse_LIBRARIES)
endif (SuiteSparse_LIBRARIES)
if(SuiteSparse_FOUND)
if(NOT TARGET SuiteSparse::SuiteSparse)
add_library(SuiteSparse::SuiteSparse INTERFACE IMPORTED GLOBAL)
set_property(TARGET SuiteSparse::SuiteSparse PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SuiteSparse_INCLUDE_DIRS})
if(config_LIBRARY)
set_property(TARGET SuiteSparse::SuiteSparse PROPERTY
INTERFACE_LINK_LIBRARIES ${config_LIBRARY})
endif()
endif()
foreach(_module ${SuiteSparse_MODULES})
string (TOUPPER ${_module} _MODULE)
if(SuiteSparse_${_MODULE}_FOUND)
if(NOT TARGET SuiteSparse::${_module})
message(STATUS "Creating target SuitSparse::${_module}")
add_library(SuiteSparse::${_module} UNKNOWN IMPORTED GLOBAL)
set_target_properties(SuiteSparse::${_module} PROPERTIES
IMPORTED_LOCATION ${${_MODULE}_LIBRARY}
INCLUDE_DIRECTORIES ${${_MODULE}_INCLUDE_DIRS}
INTERFACE_LINK_LIBRARIES "${config_LIBRARY}")
target_link_libraries(SuiteSparse::SuiteSparse
INTERFACE SuiteSparse::${_module})
endif()
endif()
endforeach(_module)
endif()
# print a message to indicate status of this package
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (SuiteSparse

View File

@ -180,6 +180,16 @@ if(SUPERLU_FOUND)
if (SUPERLU_BLAS_LIBRARY)
list(APPEND SUPERLU_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
endif()
if(NOT TARGET SuperLU::SuperLU)
add_library(SuperLU::SuperLU UNKNOWN IMPORTED GLOBAL)
set_target_properties(SuperLU::SuperLU PROPERTIES
IMPORTED_LOCATION ${SUPERLU_LIBRARY}
INCLUDE_DIRECTORIES ${SUPERLU_INCLUDE_DIRS})
if(SUPERLU_BLAS_LIBRARY)
set_property(TARGET SuperLU::SuperLU PROPERTY
INTERFACE_LINK_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
endif()
endif()
endif()
cmake_pop_check_state()

View File

@ -0,0 +1,34 @@
# Poor man's FindTBB that will create the CMake targets
# used by DUNE.
# If the TBB version is new enough it will ship its own
# TBBConfig.cmake and we are good
find_package(TBB QUIET CONFIG)
if(NOT TBB_FOUND)
# Fall back to using pkgconfig
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PkgConfigTBB IMPORTED_TARGET GLOBAL tbb QUIET)
if(NOT TARGET PkgConfig::PkgConfigTBB)
# workaround bug in old FindPkgConfig.cmake which adds
# pkgcfg_lib_PkgConfigTBB_atomic-NOTFOUND because it cannot
# find the atomic lib of the compiler (not in platforms default
# library path. It will therefore not create the target and we
# try that manually.
string(REPLACE ";pkgcfg_lib_PkgConfigTBB_atomic-NOTFOUND" "" _find_tbb_libs "${PkgConfigTBB_LINK_LIBRARIES}")
if(_find_tbb_libs)
add_library(PkgConfig::PkgConfigTBB INTERFACE IMPORTED GLOBAL)
set_property(TARGET PkgConfig::PkgConfigTBB PROPERTY
INTERFACE_LINK_LIBRARIES "${_find_tbb_libs}")
endif()
endif()
if(TARGET PkgConfig::PkgConfigTBB)
if(NOT TARGET TBB::tbb)
message(STATUS "Found TBB library using pkg config")
add_library(TBB::tbb ALIAS PkgConfig::PkgConfigTBB)
endif()
endif()
endif(PKG_CONFIG_FOUND)
else()
message(STATUS "Found TBB library using config mode")
endif(NOT TBB_FOUND)

View File

@ -19,7 +19,9 @@ find_opm_package (
"BLAS REQUIRED;
LAPACK REQUIRED;
CxaDemangle;
MPI
MPI;
TBB;
GMP
"
# header to search for
"dune/common/fvector.hh"

View File

@ -24,7 +24,8 @@ find_opm_package (
dune-alugrid;
ZLIB;
ZOLTAN;
METIS
METIS;
Quadmath
"
# header to search for
"dune/fem/space/shapefunctionset/legendre.hh"

2
debian/changelog vendored
View File

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

View File

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

View File

@ -19,29 +19,37 @@
#ifndef SCHEDULE_HPP
#define SCHEDULE_HPP
#include <cstddef>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <time.h>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GasLiftOpt.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Network/ExtNetwork.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/PAvg.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/Well/WellMatcher.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WriteRestartFileEvents.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RPTConfig.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
namespace Opm
{
@ -57,6 +65,7 @@ namespace Opm
class SummaryState;
class ErrorGuard;
class UDQConfig;
namespace RestartIO { struct RstState; }
@ -69,6 +78,8 @@ namespace Opm
Runspec m_runspec;
RSTConfig rst_config;
std::optional<int> output_interval;
double sumthin{-1.0};
bool rptonly{false};
ScheduleStatic() = default;

View File

@ -5,7 +5,7 @@
%define tag final
Name: opm-common
Version: 2018.10
Version: 2021.10
Release: 0
Summary: Open Porous Media - common helpers and buildsystem
License: GPL-3.0

View File

@ -48,6 +48,7 @@
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/E.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/P.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/R.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/S.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/W.hpp>
@ -84,9 +85,6 @@
#include "Well/injection.hpp"
#include "MSW/Compsegs.hpp"
namespace Opm {
namespace {
bool name_match(const std::string& pattern, const std::string& name) {
@ -94,8 +92,36 @@ namespace {
return (fnmatch(pattern.c_str(), name.c_str(), flags) == 0);
}
double sumthin_summary_section(const Opm::SUMMARYSection& section) {
const auto entries = section.getKeywordList<Opm::ParserKeywords::SUMTHIN>();
// Care only about the last SUMTHIN entry in the SUMMARY
// section if keyword is present here at all.
return entries.empty()
? -1.0 // (<= 0.0)
: entries.back()->getRecord(0).getItem(0).getSIDouble(0);
}
bool rptonly_summary_section(const Opm::SUMMARYSection& section) {
auto rptonly = false;
using On = Opm::ParserKeywords::RPTONLY;
using Off = Opm::ParserKeywords::RPTONLYO;
// Last on/off keyword entry "wins".
for (const auto& keyword : section) {
if (keyword.name() == On::keywordName)
rptonly = true;
else if (keyword.name() == Off::keywordName)
rptonly = false;
}
return rptonly;
}
}
namespace Opm {
ScheduleStatic::ScheduleStatic(std::shared_ptr<const Python> python_handle,
const ScheduleRestartInfo& restart_info,
const Deck& deck,
@ -110,7 +136,9 @@ namespace {
m_unit_system( deck.getActiveUnitSystem() ),
m_runspec( runspec ),
rst_config( SOLUTIONSection(deck), parseContext, errors ),
output_interval(output_interval_)
output_interval(output_interval_),
sumthin(sumthin_summary_section(SUMMARYSection{ deck })),
rptonly(rptonly_summary_section(SUMMARYSection{ deck }))
{
}
@ -1786,6 +1814,8 @@ void Schedule::create_first(const time_point& start_time, const std::optional<ti
sched_state.rft_config.update( RFTConfig() );
sched_state.rst_config.update( RSTConfig::first( this->m_static.rst_config ) );
sched_state.network_balance.update( Network::Balance() );
sched_state.update_sumthin(this->m_static.sumthin);
sched_state.rptonly(this->m_static.rptonly);
//sched_state.update_date( start_time );
this->addGroup("FIELD", 0);
}

View File

@ -4618,3 +4618,146 @@ WCONPROD
}
BOOST_AUTO_TEST_CASE(SUMTHIN_IN_SUMMARY) {
const auto deck = Parser{}.parseString(R"(RUNSPEC
DIMENS
10 10 10 /
START -- 0
10 MAI 2007 /
GRID
DXV
10*100.0 /
DYV
10*100.0 /
DZV
10*10.0 /
DEPTHZ
121*2000.0 /
SUMMARY
SUMTHIN
10.0 /
SCHEDULE
WELSPECS
'W_1' 'OP' 30 37 3.33 'OIL' 7* /
/
DATES -- 1, 2, 3
10 'JUN' 2007 /
10 JLY 2007 /
10 AUG 2007 /
/
SUMTHIN
100.0 /
WELSPECS
'WX2' 'OP' 30 37 3.33 'OIL' 7* /
'W_3' 'OP' 20 51 3.92 'OIL' 7* /
/
DATES -- 4,5
10 SEP 2007 /
10 OCT 2007 /
/
SUMTHIN
0.0 /
DATES -- 6,7
10 SEP 2007 /
10 OCT 2007 /
/
END
)");
const auto es = EclipseState { deck };
const auto sched = Schedule { deck, es, std::make_shared<const Python>() };
BOOST_REQUIRE_MESSAGE(sched[0].sumthin().has_value(),
R"("SUMTHIN" must be configured on report step 1)");
BOOST_CHECK_CLOSE(sched[0].sumthin().value(), 10.0 * 86'400.0, 1.0e-10);
BOOST_REQUIRE_MESSAGE(sched[1].sumthin().has_value(),
R"("SUMTHIN" must be configured on report step 2)");
BOOST_CHECK_CLOSE(sched[1].sumthin().value(), 10.0 * 86'400.0, 1.0e-10);
BOOST_REQUIRE_MESSAGE(sched[2].sumthin().has_value(),
R"("SUMTHIN" must be configured on report step 3)");
BOOST_CHECK_CLOSE(sched[2].sumthin().value(), 10.0 * 86'400.0, 1.0e-10);
BOOST_REQUIRE_MESSAGE(sched[3].sumthin().has_value(),
R"("SUMTHIN" must be configured on report step 4)");
BOOST_CHECK_CLOSE(sched[3].sumthin().value(), 100.0 * 86'400.0, 1.0e-10);
BOOST_REQUIRE_MESSAGE(sched[4].sumthin().has_value(),
R"("SUMTHIN" must be configured on report step 5)");
BOOST_CHECK_CLOSE(sched[4].sumthin().value(), 100.0 * 86'400.0, 1.0e-10);
BOOST_REQUIRE_MESSAGE(!sched[5].sumthin().has_value(),
R"("SUMTHIN" must NOT be configured on report step 6)");
BOOST_CHECK_THROW(sched[5].sumthin().value(), std::bad_optional_access);
BOOST_REQUIRE_MESSAGE(!sched[6].sumthin().has_value(),
R"("SUMTHIN" must NOT be configured on report step 7)");
}
BOOST_AUTO_TEST_CASE(RPTONLY_IN_SUMMARY) {
const auto deck = Parser{}.parseString(R"(RUNSPEC
DIMENS
10 10 10 /
START -- 0
10 MAI 2007 /
GRID
DXV
10*100.0 /
DYV
10*100.0 /
DZV
10*10.0 /
DEPTHZ
121*2000.0 /
SUMMARY
RPTONLY
SCHEDULE
WELSPECS
'W_1' 'OP' 30 37 3.33 'OIL' 7* /
/
DATES -- 1, 2
10 'JUN' 2007 /
10 JLY 2007 /
/
WELSPECS
'WX2' 'OP' 30 37 3.33 'OIL' 7* /
'W_3' 'OP' 20 51 3.92 'OIL' 7* /
/
RPTONLYO
DATES -- 3, 4
10 AUG 2007 /
10 SEP 2007 /
/
END
)");
const auto es = EclipseState { deck };
const auto sched = Schedule { deck, es, std::make_shared<const Python>() };
BOOST_CHECK_MESSAGE(sched[0].rptonly(),
R"("RPTONLY" must be configured on report step 1)");
BOOST_CHECK_MESSAGE(sched[1].rptonly(),
R"("RPTONLY" must be configured on report step 2)");
BOOST_CHECK_MESSAGE(! sched[2].rptonly(),
R"("RPTONLY" must NOT be configured on report step 3)");
BOOST_CHECK_MESSAGE(! sched[3].rptonly(),
R"("RPTONLY" must NOT be configured on report step 4)");
}