diff --git a/dumux/implicit/cornerpoint/fvelementgeometry.hh b/dumux/implicit/cornerpoint/fvelementgeometry.hh index f32af5f38ecae0520db9abd4021df0a415de81fd..27ad099485067b5693a73e62c83f4a8cff2c5f05 100644 --- a/dumux/implicit/cornerpoint/fvelementgeometry.hh +++ b/dumux/implicit/cornerpoint/fvelementgeometry.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_CP_FV_ELEMENTGEOMETRY_HH #define DUMUX_CP_FV_ELEMENTGEOMETRY_HH +#include <dune/geometry/affinegeometry.hh> #include <dune/geometry/referenceelements.hh> #include <dune/grid/common/intersectioniterator.hh> @@ -58,6 +59,7 @@ class CpFVElementGeometry typedef typename Element::Geometry Geometry; typedef Dune::FieldVector<CoordScalar,dimWorld> GlobalPosition; typedef Dune::FieldVector<CoordScalar,dim> LocalPosition; + typedef typename Dune::AffineGeometry<CoordScalar, dim, dimWorld> AffineGeometry; public: struct SubControlVolume //! FV intersected with element @@ -88,6 +90,7 @@ public: GlobalPosition elementGlobal; //!< global coordinate of element center Scalar elementVolume; //!< element volume SubControlVolume subContVol[1]; //!< data of the sub control volumes + std::vector<AffineGeometry> subContVolGeometries; //!< geometries of the subcontrol volumes SubControlVolumeFace subContVolFace[maxNE]; //!< data of the sub control volume faces BoundaryFace boundaryFace[maxBF]; //!< data of the boundary faces int numScv; //!< number of subcontrol volumes diff --git a/dumux/io/cpgridcreator.hh b/dumux/io/cpgridcreator.hh index 11e7ff92b0fa92e2a004a0bd3bed87b53bcfed55..871bc77a39b937a4f3364013b1baa20713d8d4d2 100644 --- a/dumux/io/cpgridcreator.hh +++ b/dumux/io/cpgridcreator.hh @@ -27,6 +27,7 @@ #if (HAVE_DUNE_CORNERPOINT && HAVE_OPM_PARSER) #include <dune/grid/CpGrid.hpp> #include <opm/parser/eclipse/Parser/Parser.hpp> +#include <opm/parser/eclipse/Parser/ParseMode.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp> #include <dumux/common/basicproperties.hh> @@ -59,7 +60,8 @@ public: std::string fileName = GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Grid, File); Opm::ParserPtr parser(new Opm::Parser()); - deck() = *(new Opm::DeckConstPtr(parser->parseFile(fileName))); + Opm::ParseMode parseMode; + deck() = *(new Opm::DeckConstPtr(parser->parseFile(fileName, parseMode))); gridPtr() = std::make_shared<Grid>(*(new Grid())); gridPtr()->processEclipseFormat(deck(), 0.0, false, false); diff --git a/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh b/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh index 7a56d40abef95467e7e2a06588cd8599457dea31..3ab13c6d72bfb70adcfc85dd6a8bf71f0d3dbfea 100644 --- a/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh +++ b/dumux/porousmediumflow/implicit/cpdarcyfluxvariables.hh @@ -77,7 +77,7 @@ class CpDarcyFluxVariables public: /*! - * \brief The constructor + * \brief The old constructor * * \param problem The problem * \param element The finite element @@ -87,14 +87,51 @@ public: * \param onBoundary A boolean variable to specify whether the flux variables * are calculated for interior SCV faces or boundary faces, default=false */ + DUNE_DEPRECATED_MSG("FluxVariables now have to be default constructed and updated.") CpDarcyFluxVariables(const Problem &problem, - const Element &element, - const FVElementGeometry &fvGeometry, - const int fIdx, - const ElementVolumeVariables &elemVolVars, - const bool onBoundary = false) - : fvGeometry_(fvGeometry), faceIdx_(fIdx), onBoundary_(onBoundary) + const Element &element, + const FVElementGeometry &fvGeometry, + const int fIdx, + const ElementVolumeVariables &elemVolVars, + const bool onBoundary = false) { + DUNE_THROW(Dune::InvalidStateException, "The FluxVariables now have to be default contructed. " + << "In case you have your own FluxVariables you have to make them default " + << " constructable too. All calls to the old constructor will throw this error. " + << "Everywhere you instantiate FluxVariables do this now by default constructing " + << "a FluxVariables object (FluxVariables fluxVars;) and then updating it where " + << "the update method has the same signature as the old constructor (fluxVars.update(...).)"); + } + + /*! + * \brief Default constructor + * \note This can be removed when the deprecated constructor is removed. + */ + CpDarcyFluxVariables() = default; + + /*! + * \brief Compute / update the flux variables + * + * \param problem The problem + * \param element The finite element + * \param fvGeometry The finite-volume geometry + * \param fIdx The local index of the SCV (sub-control-volume) face + * \param elemVolVars The volume variables of the current element + * \param onBoundary A boolean variable to specify whether the flux variables + * are calculated for interior SCV faces or boundary faces, default=false + * \todo The fvGeometry should be better initialized, passed and stored as an std::shared_ptr + */ + void update(const Problem &problem, + const Element &element, + const FVElementGeometry &fvGeometry, + const int fIdx, + const ElementVolumeVariables &elemVolVars, + const bool onBoundary = false) + { + fvGeometryPtr_ = &fvGeometry; + onBoundary_ = onBoundary; + faceIdx_ = fIdx; + mobilityUpwindWeight_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MobilityUpwindWeight); calculateVolumeFlux_(problem, element, elemVolVars); } @@ -149,9 +186,9 @@ public: const SCVFace &face() const { if (onBoundary_) - return fvGeometry_.boundaryFace[faceIdx_]; + return fvGeometry_().boundaryFace[faceIdx_]; else - return fvGeometry_.subContVolFace[faceIdx_]; + return fvGeometry_().subContVolFace[faceIdx_]; } protected: @@ -169,7 +206,7 @@ protected: // calculate the transmissibilities const SpatialParams &spatialParams = problem.spatialParams(); - const Element& elementI = fvGeometry_.neighbors[face().i]; + const Element& elementI = fvGeometry_().neighbors[face().i]; FVElementGeometry fvGeometryI; fvGeometryI.subContVol[0].global = elementI.geometry().center(); auto ki = spatialParams.intrinsicPermeability(elementI, fvGeometryI, 0); @@ -180,10 +217,10 @@ protected: di -= elementI.geometry().center(); auto ti = std::abs(di*kin*face().area/(2*di.two_norm2())); - auto tij = ti; + auto tij = 2*ti; if (!onBoundary_) { - const Element& elementJ = fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_().neighbors[face().j]; FVElementGeometry fvGeometryJ; fvGeometryJ.subContVol[0].global = elementJ.geometry().center(); auto kj = spatialParams.intrinsicPermeability(elementJ, fvGeometryJ, 0); @@ -230,7 +267,7 @@ protected: } else { - const Element& elementJ = fvGeometry_.neighbors[face().j]; + const Element& elementJ = fvGeometry_().neighbors[face().j]; auto globalPosJ = elementJ.geometry().center(); potentialJ -= density*(problem.gravityAtPos(globalPosJ)*globalPosJ); } @@ -264,13 +301,19 @@ protected: } // over loop all phases } - const FVElementGeometry &fvGeometry_; //!< Information about the geometry of discretization - const unsigned int faceIdx_; //!< The index of the sub control volume face - const bool onBoundary_; //!< Specifying whether we are currently on the boundary of the simulation domain + // return const reference to the fvGeometry + const FVElementGeometry& fvGeometry_() const + { return *fvGeometryPtr_; } + + unsigned int faceIdx_; //!< The index of the sub control volume face + bool onBoundary_; //!< Specifying whether we are currently on the boundary of the simulation domain unsigned int upstreamIdx_[numPhases] , downstreamIdx_[numPhases]; //!< local index of the upstream / downstream vertex Scalar volumeFlux_[numPhases] ; //!< Velocity multiplied with normal (magnitude=area) GlobalPosition velocity_[numPhases] ; //!< The velocity as determined by Darcy's law or by the Forchheimer relation Scalar mobilityUpwindWeight_; //!< Upwind weight for mobility. Set to one for full upstream weighting + +private: + const FVElementGeometry* fvGeometryPtr_; //!< Information about the geometry of discretization }; } // end namespace diff --git a/patches/README b/patches/README index fba0373651811ddbd315170802219cf0d9ce385f..f958447d7ed309ba0c7cb74dc68cc7f5dd609e80 100644 --- a/patches/README +++ b/patches/README @@ -19,15 +19,14 @@ so the patch is not needed. - If dune-cornerpoint has to be used for, e.g., employing the CpGridCreator, - a set of patches is needed for the build system. The patches have to be - applied in the directories of the OPM modules: - * opm-parser: patch -p1 <../dumux/patches/opm-parser-2015.04.patch - * opm-core: patch -p1 <../dumux/patches/opm-core-2015.04.patch - * dune-cornerpoint: patch -p1 <../dumux/patches/dune-cornerpoint-2015.04.patch - In addition to applying the patches, it is necessary to set manually some - CMake variables in the CMAKE_FLAGS section of the .opts-file: + and Opm is compiled from source, it might be necessary to patch opm-parser: + patch -p1 <../dumux/patches/opm-parser-2015.10.patch + In addition, it might be necessary to set manually some CMake variables in the + CMAKE_FLAGS section of the .opts-file: -Ddune-cornerpoint_PREFIX=/path/to/dune-cornerpoint \ + -Dopm-common_PREFIX=/path/to/opm-common \ -Dopm-core_PREFIX=/path/to/opm-core \ + -Dopm-material_PREFIX=/path/to/opm-material \ -Dopm-parser_PREFIX=/path/to/opm-parser \ -DHAVE_DUNE_CORNERPOINT=1 \ - + Currently, Dumux is supposed to be compatible with the Opm 2015.10 release. diff --git a/patches/dune-cornerpoint-2015.04.patch b/patches/dune-cornerpoint-2015.04.patch deleted file mode 100644 index a91f4740fca89fc1a4e334643cb93a0bb97c1495..0000000000000000000000000000000000000000 --- a/patches/dune-cornerpoint-2015.04.patch +++ /dev/null @@ -1,305 +0,0 @@ -From 6ec556b8521bf04cc46e00425bef2f911d93850a Mon Sep 17 00:00:00 2001 -From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> -Date: Tue, 4 Aug 2015 17:33:00 +0200 -Subject: adapt dune-cornerpoint such that it can be used by Dumux - ---- - cmake/Modules/Findopm-parser.cmake | 179 +++++---------------------- - cmake/Modules/OpmFind.cmake | 1 + - cmake/Modules/dune-cornerpoint-prereqs.cmake | 2 +- - cmake/Modules/opm-core-prereqs.cmake | 2 +- - cmake/Modules/opm-parser-prereqs.cmake | 20 +++ - dune/grid/cpgrid/CpGridData.hpp | 7 -- - 6 files changed, 55 insertions(+), 156 deletions(-) - create mode 100644 cmake/Modules/opm-parser-prereqs.cmake - -diff --git a/cmake/Modules/Findopm-parser.cmake b/cmake/Modules/Findopm-parser.cmake -index f69a491..fe721a0 100644 ---- a/cmake/Modules/Findopm-parser.cmake -+++ b/cmake/Modules/Findopm-parser.cmake -@@ -1,159 +1,44 @@ --# Find the OPM Eclipse input parser. -+# - Find OPM parser library - # --# Set the cache variable OPM_PARSER_ROOT to the install location of the --# library, or OPM_ROOT to the parent directory of the build tree. --# --# If found, it sets these variables: --# --# HAVE_OPM_PARSER Defined if a test program compiled --# OPM_PARSER_INCLUDE_DIRS Header file directories --# OPM_PARSER_LIBRARIES Archives and shared objects -- --include (FindPackageHandleStandardArgs) -- --# variables to pass on to other packages --if (FIND_QUIETLY) -- set (OPM_PARSER_QUIET "QUIET") --else () -- set (OPM_PARSER_QUIET "") --endif () -- --# use lowercase versions of the variables if those are set --if (opm-parser_ROOT) -- set (OPM_PARSER_ROOT ${opm-parser_ROOT}) --endif () --if (opm_ROOT) -- set (OPM_ROOT ${opm_ROOT}) --endif () -- --# inherit "suite" root if not specifically set for this library --if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT) -- set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser") --endif () -- --# Detect the build dir suffix or subdirectory --string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}") -- --# if a root is specified, then don't search in system directories --# or in relative directories to this one --if (OPM_PARSER_ROOT) -- set (_no_default_path "NO_DEFAULT_PATH") -- set (_opm_parser_source "") -- set (_opm_parser_build "") --else () -- set (_no_default_path "") -- set (_opm_parser_source -- "${PROJECT_SOURCE_DIR}/../opm-parser") -- set (_opm_parser_build -- "${PROJECT_BINARY_DIR}/../opm-parser" -- "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}" -- "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}") --endif () -+# Defines the following variables: -+# opm-parser_INCLUDE_DIRS Directory of header files -+# opm-parser_LIBRARIES Directory of shared object files -+# opm-parser_DEFINITIONS Defines that must be set to compile -+# opm-parser_CONFIG_VARS List of defines that should be in config.h -+# HAVE_OPM_CORE Binary value to use in config.h - --# use this header as signature --find_path (OPM_PARSER_INCLUDE_DIR -- NAMES "opm/parser/eclipse/Parser/Parser.hpp" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_source} -- PATH_SUFFIXES "include" -- DOC "Path to OPM parser header files" -- ${_no_default_path} ) -+# Copyright (C) 2012 Uni Research AS -+# This code is licensed under The GNU General Public License v3.0 - --# backup: if we didn't find any headers there, but a CMakeCache.txt, --# then it is probably a build directory; read the CMake cache of --# opm-parser to figure out where the source directory is --if ((NOT OPM_PARSER_INCLUDE_DIR) AND -- (OPM_PARSER_ROOT AND (EXISTS "${OPM_PARSER_ROOT}/CMakeCache.txt"))) -- set (_regex "^OPMParser_SOURCE_DIR:STATIC=\(.*\)$") -- file (STRINGS -- "${OPM_PARSER_ROOT}/CMakeCache.txt" -- _cache_entry -- REGEX "${_regex}") -- string(REGEX REPLACE "${_regex}" "\\1" -- OPM_PARSER_INCLUDE_DIR -- "${_cache_entry}") -- if (OPM_PARSER_INCLUDE_DIR) -- set (OPM_PARSER_INCLUDE_DIR "${OPM_PARSER_INCLUDE_DIR}" -- CACHE PATH "Path to OPM parser header files" FORCE) -- endif () --endif () -+# use the generic find routine -+include (opm-parser-prereqs) -+include (OpmPackage) -+find_opm_package ( -+ # module name -+ "opm-parser" - --# find out the size of a pointer. this is required to only search for --# libraries in the directories relevant for the architecture --if (CMAKE_SIZEOF_VOID_P) -- math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") --endif () -+ # dependencies -+ "${opm-parser_DEPS}" - --# these libraries constitute the parser core --find_library (OPM_PARSER_LIBRARY -- NAMES "Parser" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_build} -- PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -- "opm/parser/eclipse" -- DOC "Path to OPM parser library archive/shared object files" -- ${_no_default_path} ) -+ # header to search for -+ "opm/parser/eclipse/Parser/Parser.hpp" - --# find the OPM-parser wrapper library around cJSON --find_library (OPM_JSON_LIBRARY -- NAMES "opm-json" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_build} -- PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -- "opm/json" -- DOC "Path to OPM JSON library archive/shared object files" -- ${_no_default_path} ) -+ # library to search for -+ "Parser;opm-json" - --# get the prerequisite ERT libraries --if (NOT ERT_FOUND) -- find_package(ERT ${OPM_PARSER_QUIET}) --endif () -+ # defines to be added to compilations -+ "HAVE_OPM_PARSER" - --# get the prerequisite Boost libraries --find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET}) -- --if (ERT_FOUND AND Boost_FOUND AND -- OPM_PARSER_LIBRARY AND OPM_JSON_LIBRARY AND OPM_PARSER_INCLUDE_DIR) -- # setup list of all required libraries to link with opm-parser. notice that -- # we use the plural form to get *all* the libraries needed by cjson -- set (opm-parser_INCLUDE_DIRS -- ${OPM_PARSER_INCLUDE_DIR} -- ${Boost_INCLUDE_DIRS} -- ${ERT_INCLUDE_DIRS}) -- -- set (opm-parser_LIBRARIES -- ${OPM_PARSER_LIBRARY} -- ${OPM_JSON_LIBRARY} -- ${Boost_LIBRARIES} -- ${ERT_LIBRARIES}) -- -- # see if we can compile a minimum example -- # CMake logical test doesn't handle lists (sic) -- include (CMakePushCheckState) -- include (CheckCSourceCompiles) -- cmake_push_check_state () -- set (CMAKE_REQUIRED_INCLUDES ${opm-parser_INCLUDE_DIRS}) -- set (CMAKE_REQUIRED_LIBRARIES ${opm-parser_LIBRARIES}) -- -- check_cxx_source_compiles ( -- "#include <cstdlib> -+ # test program -+"#include <cstdlib> - #include <opm/parser/eclipse/Deck/Deck.hpp> - - int main (void) { - return EXIT_SUCCESS; --}" HAVE_OPM_PARSER) -- cmake_pop_check_state () --endif() -- --# if the test program didn't compile, but was required to do so, bail --# out now and display an error; otherwise limp on --set (OPM_PARSER_FIND_REQUIRED ${opm-parser_FIND_REQUIRED}) --find_package_handle_standard_args (opm-parser -- DEFAULT_MSG -- opm-parser_INCLUDE_DIRS opm-parser_LIBRARIES HAVE_OPM_PARSER -- ) -- --set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER;HAVE_REGEX") --set (opm-parser_FOUND ${OPM-PARSER_FOUND}) -- --mark_as_advanced(opm-parser_LIBRARIES opm-parser_INCLUDE_DIRS OPM-PARSER_FOUND) -+} -+" -+ # config variables -+ "${opm-parser_CONFIG_VAR}" -+ ) -+include (UseDynamicBoost) -+#debug_find_vars ("opm-parser") -diff --git a/cmake/Modules/OpmFind.cmake b/cmake/Modules/OpmFind.cmake -index 592a983..91314f3 100644 ---- a/cmake/Modules/OpmFind.cmake -+++ b/cmake/Modules/OpmFind.cmake -@@ -60,6 +60,7 @@ set (_opm_proj_exemptions - dune-grid - dune-geometry - opm-parser -+ opm-core - ) - - # although a DUNE module, it is delivered in the OPM suite -diff --git a/cmake/Modules/dune-cornerpoint-prereqs.cmake b/cmake/Modules/dune-cornerpoint-prereqs.cmake -index f4924ca..6a1c114 100644 ---- a/cmake/Modules/dune-cornerpoint-prereqs.cmake -+++ b/cmake/Modules/dune-cornerpoint-prereqs.cmake -@@ -19,7 +19,7 @@ set (dune-cornerpoint_DEPS - "CXX11Features" - # various runtime library enhancements - "Boost 1.44.0 -- COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED" -+ COMPONENTS date_time filesystem system iostreams unit_test_framework regex REQUIRED" - # DUNE dependency - "dune-common REQUIRED; - dune-grid REQUIRED; -diff --git a/cmake/Modules/opm-core-prereqs.cmake b/cmake/Modules/opm-core-prereqs.cmake -index ec118c5..ed35dcb 100644 ---- a/cmake/Modules/opm-core-prereqs.cmake -+++ b/cmake/Modules/opm-core-prereqs.cmake -@@ -18,7 +18,7 @@ set (opm-core_DEPS - "CXX11Features REQUIRED" - # various runtime library enhancements - "Boost 1.44.0 -- COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED" -+ COMPONENTS date_time filesystem system iostreams unit_test_framework regex REQUIRED" - # matrix library - "BLAS REQUIRED" - "LAPACK REQUIRED" -diff --git a/cmake/Modules/opm-parser-prereqs.cmake b/cmake/Modules/opm-parser-prereqs.cmake -new file mode 100644 -index 0000000..309e12e ---- /dev/null -+++ b/cmake/Modules/opm-parser-prereqs.cmake -@@ -0,0 +1,20 @@ -+# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- -+# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: -+ -+# defines that must be present in config.h for our headers -+set (opm-parser_CONFIG_VAR -+ HAVE_REGEX -+ ) -+ -+# dependencies -+set (opm-parser_DEPS -+ # compile with C99 support if available -+ "C99" -+ # compile with C++0x/11 support if available -+ "CXX11Features REQUIRED" -+ # various runtime library enhancements -+ "Boost 1.44.0 -+ COMPONENTS filesystem date_time system unit_test_framework regex REQUIRED" -+ # Ensembles-based Reservoir Tools (ERT) -+ "ERT REQUIRED" -+ ) -diff --git a/dune/grid/cpgrid/CpGridData.hpp b/dune/grid/cpgrid/CpGridData.hpp -index 682302b..abc945a 100644 ---- a/dune/grid/cpgrid/CpGridData.hpp -+++ b/dune/grid/cpgrid/CpGridData.hpp -@@ -56,9 +56,6 @@ - #else - #include <dune/common/mpihelper.hh> - #endif --#ifdef HAVE_DUNE_ISTL --#include <dune/istl/owneroverlapcopy.hh> --#endif - - #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - #include <dune/common/parallel/collectivecommunication.hh> -@@ -386,12 +383,8 @@ private: - // Boundary information (optional). - bool use_unique_boundary_ids_; - --#ifdef HAVE_DUNE_ISTL -- typedef Dune::OwnerOverlapCopyAttributeSet::AttributeSet AttributeSet; --#else - /// \brief The type of the set of the attributes - enum AttributeSet{owner, overlap}; --#endif - - #if HAVE_MPI && DUNE_VERSION_NEWER(DUNE_GRID, 2, 3) - --- -2.1.4 - diff --git a/patches/opm-core-2015.04.patch b/patches/opm-core-2015.04.patch deleted file mode 100644 index cf8aa82f45c800758547a2ae1edc7ccaad4bb93d..0000000000000000000000000000000000000000 --- a/patches/opm-core-2015.04.patch +++ /dev/null @@ -1,289 +0,0 @@ -From b30c947ee7b40f6e58e6d03e682c92c535568366 Mon Sep 17 00:00:00 2001 -From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> -Date: Tue, 4 Aug 2015 17:09:53 +0200 -Subject: adapt opm-core such that it can be used by Dumux - ---- - cmake/Modules/Findopm-parser.cmake | 179 ++++++--------------------------- - cmake/Modules/opm-core-prereqs.cmake | 2 +- - cmake/Modules/opm-parser-prereqs.cmake | 20 ++++ - opm/core/linalg/call_umfpack.c | 12 +-- - 4 files changed, 59 insertions(+), 154 deletions(-) - create mode 100644 cmake/Modules/opm-parser-prereqs.cmake - -diff --git a/cmake/Modules/Findopm-parser.cmake b/cmake/Modules/Findopm-parser.cmake -index f69a491..fe721a0 100644 ---- a/cmake/Modules/Findopm-parser.cmake -+++ b/cmake/Modules/Findopm-parser.cmake -@@ -1,159 +1,44 @@ --# Find the OPM Eclipse input parser. -+# - Find OPM parser library - # --# Set the cache variable OPM_PARSER_ROOT to the install location of the --# library, or OPM_ROOT to the parent directory of the build tree. --# --# If found, it sets these variables: --# --# HAVE_OPM_PARSER Defined if a test program compiled --# OPM_PARSER_INCLUDE_DIRS Header file directories --# OPM_PARSER_LIBRARIES Archives and shared objects -- --include (FindPackageHandleStandardArgs) -- --# variables to pass on to other packages --if (FIND_QUIETLY) -- set (OPM_PARSER_QUIET "QUIET") --else () -- set (OPM_PARSER_QUIET "") --endif () -- --# use lowercase versions of the variables if those are set --if (opm-parser_ROOT) -- set (OPM_PARSER_ROOT ${opm-parser_ROOT}) --endif () --if (opm_ROOT) -- set (OPM_ROOT ${opm_ROOT}) --endif () -- --# inherit "suite" root if not specifically set for this library --if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT) -- set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser") --endif () -- --# Detect the build dir suffix or subdirectory --string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}") -- --# if a root is specified, then don't search in system directories --# or in relative directories to this one --if (OPM_PARSER_ROOT) -- set (_no_default_path "NO_DEFAULT_PATH") -- set (_opm_parser_source "") -- set (_opm_parser_build "") --else () -- set (_no_default_path "") -- set (_opm_parser_source -- "${PROJECT_SOURCE_DIR}/../opm-parser") -- set (_opm_parser_build -- "${PROJECT_BINARY_DIR}/../opm-parser" -- "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}" -- "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}") --endif () -+# Defines the following variables: -+# opm-parser_INCLUDE_DIRS Directory of header files -+# opm-parser_LIBRARIES Directory of shared object files -+# opm-parser_DEFINITIONS Defines that must be set to compile -+# opm-parser_CONFIG_VARS List of defines that should be in config.h -+# HAVE_OPM_CORE Binary value to use in config.h - --# use this header as signature --find_path (OPM_PARSER_INCLUDE_DIR -- NAMES "opm/parser/eclipse/Parser/Parser.hpp" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_source} -- PATH_SUFFIXES "include" -- DOC "Path to OPM parser header files" -- ${_no_default_path} ) -+# Copyright (C) 2012 Uni Research AS -+# This code is licensed under The GNU General Public License v3.0 - --# backup: if we didn't find any headers there, but a CMakeCache.txt, --# then it is probably a build directory; read the CMake cache of --# opm-parser to figure out where the source directory is --if ((NOT OPM_PARSER_INCLUDE_DIR) AND -- (OPM_PARSER_ROOT AND (EXISTS "${OPM_PARSER_ROOT}/CMakeCache.txt"))) -- set (_regex "^OPMParser_SOURCE_DIR:STATIC=\(.*\)$") -- file (STRINGS -- "${OPM_PARSER_ROOT}/CMakeCache.txt" -- _cache_entry -- REGEX "${_regex}") -- string(REGEX REPLACE "${_regex}" "\\1" -- OPM_PARSER_INCLUDE_DIR -- "${_cache_entry}") -- if (OPM_PARSER_INCLUDE_DIR) -- set (OPM_PARSER_INCLUDE_DIR "${OPM_PARSER_INCLUDE_DIR}" -- CACHE PATH "Path to OPM parser header files" FORCE) -- endif () --endif () -+# use the generic find routine -+include (opm-parser-prereqs) -+include (OpmPackage) -+find_opm_package ( -+ # module name -+ "opm-parser" - --# find out the size of a pointer. this is required to only search for --# libraries in the directories relevant for the architecture --if (CMAKE_SIZEOF_VOID_P) -- math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") --endif () -+ # dependencies -+ "${opm-parser_DEPS}" - --# these libraries constitute the parser core --find_library (OPM_PARSER_LIBRARY -- NAMES "Parser" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_build} -- PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -- "opm/parser/eclipse" -- DOC "Path to OPM parser library archive/shared object files" -- ${_no_default_path} ) -+ # header to search for -+ "opm/parser/eclipse/Parser/Parser.hpp" - --# find the OPM-parser wrapper library around cJSON --find_library (OPM_JSON_LIBRARY -- NAMES "opm-json" -- HINTS "${OPM_PARSER_ROOT}" -- PATHS ${_opm_parser_build} -- PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" -- "opm/json" -- DOC "Path to OPM JSON library archive/shared object files" -- ${_no_default_path} ) -+ # library to search for -+ "Parser;opm-json" - --# get the prerequisite ERT libraries --if (NOT ERT_FOUND) -- find_package(ERT ${OPM_PARSER_QUIET}) --endif () -+ # defines to be added to compilations -+ "HAVE_OPM_PARSER" - --# get the prerequisite Boost libraries --find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET}) -- --if (ERT_FOUND AND Boost_FOUND AND -- OPM_PARSER_LIBRARY AND OPM_JSON_LIBRARY AND OPM_PARSER_INCLUDE_DIR) -- # setup list of all required libraries to link with opm-parser. notice that -- # we use the plural form to get *all* the libraries needed by cjson -- set (opm-parser_INCLUDE_DIRS -- ${OPM_PARSER_INCLUDE_DIR} -- ${Boost_INCLUDE_DIRS} -- ${ERT_INCLUDE_DIRS}) -- -- set (opm-parser_LIBRARIES -- ${OPM_PARSER_LIBRARY} -- ${OPM_JSON_LIBRARY} -- ${Boost_LIBRARIES} -- ${ERT_LIBRARIES}) -- -- # see if we can compile a minimum example -- # CMake logical test doesn't handle lists (sic) -- include (CMakePushCheckState) -- include (CheckCSourceCompiles) -- cmake_push_check_state () -- set (CMAKE_REQUIRED_INCLUDES ${opm-parser_INCLUDE_DIRS}) -- set (CMAKE_REQUIRED_LIBRARIES ${opm-parser_LIBRARIES}) -- -- check_cxx_source_compiles ( -- "#include <cstdlib> -+ # test program -+"#include <cstdlib> - #include <opm/parser/eclipse/Deck/Deck.hpp> - - int main (void) { - return EXIT_SUCCESS; --}" HAVE_OPM_PARSER) -- cmake_pop_check_state () --endif() -- --# if the test program didn't compile, but was required to do so, bail --# out now and display an error; otherwise limp on --set (OPM_PARSER_FIND_REQUIRED ${opm-parser_FIND_REQUIRED}) --find_package_handle_standard_args (opm-parser -- DEFAULT_MSG -- opm-parser_INCLUDE_DIRS opm-parser_LIBRARIES HAVE_OPM_PARSER -- ) -- --set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER;HAVE_REGEX") --set (opm-parser_FOUND ${OPM-PARSER_FOUND}) -- --mark_as_advanced(opm-parser_LIBRARIES opm-parser_INCLUDE_DIRS OPM-PARSER_FOUND) -+} -+" -+ # config variables -+ "${opm-parser_CONFIG_VAR}" -+ ) -+include (UseDynamicBoost) -+#debug_find_vars ("opm-parser") -diff --git a/cmake/Modules/opm-core-prereqs.cmake b/cmake/Modules/opm-core-prereqs.cmake -index ec118c5..ed35dcb 100644 ---- a/cmake/Modules/opm-core-prereqs.cmake -+++ b/cmake/Modules/opm-core-prereqs.cmake -@@ -18,7 +18,7 @@ set (opm-core_DEPS - "CXX11Features REQUIRED" - # various runtime library enhancements - "Boost 1.44.0 -- COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED" -+ COMPONENTS date_time filesystem system iostreams unit_test_framework regex REQUIRED" - # matrix library - "BLAS REQUIRED" - "LAPACK REQUIRED" -diff --git a/cmake/Modules/opm-parser-prereqs.cmake b/cmake/Modules/opm-parser-prereqs.cmake -new file mode 100644 -index 0000000..309e12e ---- /dev/null -+++ b/cmake/Modules/opm-parser-prereqs.cmake -@@ -0,0 +1,20 @@ -+# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*- -+# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap: -+ -+# defines that must be present in config.h for our headers -+set (opm-parser_CONFIG_VAR -+ HAVE_REGEX -+ ) -+ -+# dependencies -+set (opm-parser_DEPS -+ # compile with C99 support if available -+ "C99" -+ # compile with C++0x/11 support if available -+ "CXX11Features REQUIRED" -+ # various runtime library enhancements -+ "Boost 1.44.0 -+ COMPONENTS filesystem date_time system unit_test_framework regex REQUIRED" -+ # Ensembles-based Reservoir Tools (ERT) -+ "ERT REQUIRED" -+ ) -diff --git a/opm/core/linalg/call_umfpack.c b/opm/core/linalg/call_umfpack.c -index 8290009..f673dbc 100644 ---- a/opm/core/linalg/call_umfpack.c -+++ b/opm/core/linalg/call_umfpack.c -@@ -43,11 +43,11 @@ - #include <opm/core/linalg/call_umfpack.h> - - struct CSCMatrix { -- UF_long n; -- UF_long nnz; -+ long n; -+ long nnz; - -- UF_long *p; -- UF_long *i; -+ long *p; -+ long *i; - double *x; - }; - -@@ -69,7 +69,7 @@ csc_deallocate(struct CSCMatrix *csc) - - /* ---------------------------------------------------------------------- */ - static struct CSCMatrix * --csc_allocate(UF_long n, UF_long nnz) -+csc_allocate(long n, long nnz) - /* ---------------------------------------------------------------------- */ - { - struct CSCMatrix *new; -@@ -102,7 +102,7 @@ csr_to_csc(const int *ia, - struct CSCMatrix *csc) - /* ---------------------------------------------------------------------- */ - { -- UF_long i, nz; -+ long i, nz; - - /* Clear garbage, prepare for counting */ - for (i = 0; i <= csc->n; i++) { csc->p[i] = 0; } --- -2.1.4 - diff --git a/patches/opm-parser-2015.04.patch b/patches/opm-parser-2015.04.patch deleted file mode 100644 index 241ac02ea911c09b2083736bb8e469b06730be3b..0000000000000000000000000000000000000000 --- a/patches/opm-parser-2015.04.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5a6df3dced371302cd4361a35f21e141d8162d1b Mon Sep 17 00:00:00 2001 -From: Bernd Flemisch <bernd@iws.uni-stuttgart.de> -Date: Tue, 28 Jul 2015 14:02:32 +0200 -Subject: adapt opm-parser such that it can be used by Dumux - ---- - CMakeLists.txt | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cdac561..7cb1534 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -81,8 +81,8 @@ include(ConfigVars) - set(OPM_MACROS_ROOT ${PROJECT_SOURCE_DIR}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) - set(opm-parser_NAME opm-parser) --set(opm-parser_LIBRARIES Parser opm-json) --if(NOT BUILD_SHARED_LIBS) -- list(APPEND opm-parser_LIBRARIES cjson) --endif() -+#set(opm-parser_LIBRARIES Parser opm-json) -+#if(NOT BUILD_SHARED_LIBS) -+# list(APPEND opm-parser_LIBRARIES cjson) -+#endif() - opm_cmake_config(opm-parser) --- -2.1.4 - diff --git a/patches/opm-parser-2015.10.patch b/patches/opm-parser-2015.10.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ee98b021c211de5a8385c533fd2db7f2f79518b --- /dev/null +++ b/patches/opm-parser-2015.10.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4158c9e..fdf5903 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,8 +157,8 @@ include(OpmProject) + include(ConfigVars) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + set(opm-parser_NAME opm-parser) +-set(opm-parser_LIBRARIES opmparser opmjson) +-if(NOT BUILD_SHARED_LIBS) +- list(APPEND opm-parser_LIBRARIES cjson) +-endif() ++#set(opm-parser_LIBRARIES opmparser opmjson) ++#if(NOT BUILD_SHARED_LIBS) ++# list(APPEND opm-parser_LIBRARIES cjson) ++#endif() + opm_cmake_config(opm-parser) diff --git a/test/porousmediumflow/2p/implicit/cc2pcornerpointproblem.hh b/test/porousmediumflow/2p/implicit/cc2pcornerpointproblem.hh index e84dc1933c0661c9d49e034fa0d9b80d4effe717..4cde0c4f1682a43b4a1f2606c23e8ac844d0a7e8 100644 --- a/test/porousmediumflow/2p/implicit/cc2pcornerpointproblem.hh +++ b/test/porousmediumflow/2p/implicit/cc2pcornerpointproblem.hh @@ -76,9 +76,6 @@ private: public: typedef Dumux::LiquidPhase<Scalar, Dumux::DNAPL<Scalar> > type; }; - -// Linear solver settings -SET_TYPE_PROP(CC2PCornerPointProblem, LinearSolver, Dumux::AMGBackend<TypeTag> ); } template <class TypeTag > diff --git a/test/porousmediumflow/2p/implicit/test_cc2pcornerpoint.cc b/test/porousmediumflow/2p/implicit/test_cc2pcornerpoint.cc index 54b4b21099adbd61b7c68fd81ccd484b12652853..790d826193d1e607f805f63544c06ab37dbaab5c 100644 --- a/test/porousmediumflow/2p/implicit/test_cc2pcornerpoint.cc +++ b/test/porousmediumflow/2p/implicit/test_cc2pcornerpoint.cc @@ -64,6 +64,7 @@ int main(int argc, char** argv) { typedef TTAG(CC2PCornerPointProblem) TypeTag; return Dumux::start<TypeTag>(argc, argv, usage); +} #else int main(int argc, char** argv) { diff --git a/test/references/cc2pcornerpoint-reference.vtu b/test/references/cc2pcornerpoint-reference.vtu index 4359a194a19e22789d64f965592e17e5bcebd746..4a5c8f7cd814f55abe5811656dd80e227abeb177 100644 --- a/test/references/cc2pcornerpoint-reference.vtu +++ b/test/references/cc2pcornerpoint-reference.vtu @@ -4,19 +4,19 @@ <Piece NumberOfCells="4" NumberOfPoints="22"> <CellData Scalars="Sn"> <DataArray type="Float32" Name="Sn" NumberOfComponents="1" format="ascii"> - 0.715235 0.417373 0.37465 0.0907236 + 0.714401 0.349245 0.297318 0.0336473 </DataArray> <DataArray type="Float32" Name="Sw" NumberOfComponents="1" format="ascii"> - 0.284765 0.582627 0.62535 0.909276 + 0.285599 0.650755 0.702682 0.966353 </DataArray> <DataArray type="Float32" Name="pn" NumberOfComponents="1" format="ascii"> - 237785 141696 137020 123617 + 186999 121275 123879 117922 </DataArray> <DataArray type="Float32" Name="pw" NumberOfComponents="1" format="ascii"> - 235170 139516 134894 121962 + 184385 119183 121856 116490 </DataArray> <DataArray type="Float32" Name="pc" NumberOfComponents="1" format="ascii"> - 2615.61 2180.24 2125.57 1655.35 + 2614.03 2092.72 2023.74 1432.07 </DataArray> <DataArray type="Float32" Name="rhoW" NumberOfComponents="1" format="ascii"> 1000 1000 1000 1000 @@ -25,10 +25,10 @@ 1460 1460 1460 1460 </DataArray> <DataArray type="Float32" Name="mobW" NumberOfComponents="1" format="ascii"> - 22.3989 178.317 219.989 704.943 + 22.587 247.769 312.188 933.954 </DataArray> <DataArray type="Float32" Name="mobN" NumberOfComponents="1" format="ascii"> - 991.922 349.985 282.437 15.943 + 989.77 245.533 177.857 2.08447 </DataArray> <DataArray type="Float32" Name="porosity" NumberOfComponents="1" format="ascii"> 0.1 0.1 0.3 0.3