Skip to content
Snippets Groups Projects
Commit a5f8e795 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[cornerpoint] update CpGridCreator to Opm 2018.04

It is not possible to ask for the employed Opm version in a
convenient way. Therefore, support for older versions has to be
dropped.

Adapt an include. Get rid of the `TypeTag` template parameter.
Perform `loadBlance` only in a parallel run. Otherwise, the
boundary segment indices are lost. Add a small workaround for the
`static Deck` to prevent segfaults.
Provide a patch for opm-grid, delete patches for older versions.
Update `patches/README`.
parent 1886f7c5
No related branches found
No related tags found
1 merge request!1011Feature/support cpgrid
...@@ -25,32 +25,23 @@ ...@@ -25,32 +25,23 @@
#define DUMUX_CPGRID_CREATOR_HH #define DUMUX_CPGRID_CREATOR_HH
#if HAVE_OPM_GRID #if HAVE_OPM_GRID
#include <dune/grid/CpGrid.hpp> #include <opm/grid/CpGrid.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp> #include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp> #include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <dumux/common/properties.hh>
#include <dumux/common/parameters.hh> #include <dumux/common/parameters.hh>
namespace Dumux namespace Dumux
{ {
namespace Properties
{
NEW_PROP_TAG(Scalar);
NEW_PROP_TAG(Grid);
}
/*! /*!
* \ingroup InputOutput * \ingroup InputOutput
* \brief A grid creator that reads Petrel files and generates a CpGrid. * \brief A grid creator that reads Petrel files and generates a CpGrid.
*/ */
template <class TypeTag>
class CpGridCreator class CpGridCreator
{ {
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Grid = Dune::CpGrid;
using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
using GridPointer = std::shared_ptr<Grid>; using GridPointer = std::shared_ptr<Grid>;
using Deck = Opm::Deck; using Deck = Opm::Deck;
...@@ -62,8 +53,9 @@ public: ...@@ -62,8 +53,9 @@ public:
{ {
auto fileName = getParam<std::string>("Grid.File"); auto fileName = getParam<std::string>("Grid.File");
deck() = Opm::Parser().parseFile(fileName); static auto deckLocal = Opm::Parser().parseFile(fileName);
Opm::EclipseGrid ecl_grid(deck()); Opm::EclipseGrid ecl_grid(deckLocal);
deck() = deckLocal;
gridPtr() = std::make_shared<Grid>(*(new Grid())); gridPtr() = std::make_shared<Grid>(*(new Grid()));
gridPtr()->processEclipseFormat(ecl_grid, false, false); gridPtr()->processEclipseFormat(ecl_grid, false, false);
...@@ -102,7 +94,8 @@ public: ...@@ -102,7 +94,8 @@ public:
*/ */
static void loadBalance() static void loadBalance()
{ {
gridPtr()->loadBalance(); if (gridPtr()->comm().size() > 1)
gridPtr()->loadBalance();
} }
}; };
} }
......
...@@ -5,14 +5,9 @@ ...@@ -5,14 +5,9 @@
patch -p1 <../dumux/patches/istl-2.4.1.patch patch -p1 <../dumux/patches/istl-2.4.1.patch
- If opm-grid has to be used for, e.g., employing the CpGridCreator, - If opm-grid has to be used for, e.g., employing the CpGridCreator,
and Opm is compiled from source, it might be necessary to patch opm-parser and opm-common: and Opm is compiled from source, it is necessary to patch opm-grid:
patch -p1 <../dumux/patches/opm-parser-2017.10.patch patch -p1 <../dumux/patches/opm-grid-2018.04.patch
patch -p1 <../dumux/patches/opm-common-2017.10.patch In addition, it might be necessary to set manually a CMake variable in the
In addition, it might be necessary to set manually some CMake variables in the
CMAKE_FLAGS section of the .opts-file: CMAKE_FLAGS section of the .opts-file:
-DOPM_COMMON_ROOT=/path/to/opm-common/ \
-Dopm-grid_PREFIX=/path/to/opm-grid \
-Dopm-common_PREFIX=/path/to/opm-common \
-Dopm-parser_PREFIX=/path/to/opm-parser \
-DHAVE_OPM_GRID=1 \ -DHAVE_OPM_GRID=1 \
Currently, Dumux is supposed to be compatible with the Opm 2017.04 and 2017.10 releases. Currently, Dumux is supposed to be compatible with the Opm 2018.04 release.
diff --git a/cmake/Modules/Findopm-parser.cmake b/cmake/Modules/Findopm-parser.cmake
index a0b0b08..eb142dd 100644
--- a/cmake/Modules/Findopm-parser.cmake
+++ b/cmake/Modules/Findopm-parser.cmake
@@ -38,8 +38,8 @@ string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PR
# 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 "")
+ set (_opm_parser_source "${OPM_PARSER_ROOT}")
+ set (_opm_parser_build "${OPM_PARSER_ROOT}/${BUILD_DIR_SUFFIX}")
else ()
set (_no_default_path "")
set (_opm_parser_source
diff --git a/cmake/Modules/Findopm-parser.cmake b/cmake/Modules/Findopm-parser.cmake
index 42b5ae9..2977ee9 100644
--- a/cmake/Modules/Findopm-parser.cmake
+++ b/cmake/Modules/Findopm-parser.cmake
@@ -31,8 +31,8 @@ string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PR
# 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 "")
+ set (_opm_parser_source "${OPM_PARSER_ROOT}")
+ set (_opm_parser_build "${OPM_PARSER_ROOT}/${BUILD_DIR_SUFFIX}")
else ()
set (_no_default_path "")
set (_opm_parser_source
diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake
index fbbdaf05..34cdc425 100644
--- a/CMakeLists_files.cmake
+++ b/CMakeLists_files.cmake
@@ -36,7 +36,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/core/flowdiagnostics/TofReorder.cpp
opm/core/linalg/LinearSolverFactory.cpp
opm/core/linalg/LinearSolverInterface.cpp
- opm/core/linalg/LinearSolverIstl.cpp
+# opm/core/linalg/LinearSolverIstl.cpp
opm/core/linalg/LinearSolverPetsc.cpp
opm/core/linalg/LinearSolverUmfpack.cpp
opm/core/linalg/call_umfpack.c
@@ -133,12 +133,12 @@ list (APPEND TEST_SOURCE_FILES
tests/test_nonuniformtablelinear.cpp
tests/test_parallelistlinformation.cpp
tests/test_sparsevector.cpp
- tests/test_velocityinterpolation.cpp
+ tests/test_velocityinterpolation.cpp
tests/test_uniformtablelinear.cpp
tests/test_wells.cpp
tests/test_wachspresscoord.cpp
- tests/test_linearsolver.cpp
- tests/test_parallel_linearsolver.cpp
+# tests/test_linearsolver.cpp
+# tests/test_parallel_linearsolver.cpp
tests/test_param.cpp
tests/test_satfunc.cpp
tests/test_shadow.cpp
@@ -153,7 +153,7 @@ list (APPEND TEST_SOURCE_FILES
tests/test_anisotropiceikonal.cpp
tests/test_stoppedwells.cpp
tests/test_relpermdiagnostics.cpp
- tests/test_norne_pvt.cpp
+ tests/test_norne_pvt.cpp
)
# originally generated with the command:
@@ -194,8 +194,8 @@ list (APPEND TEST_DATA_FILES
list (APPEND EXAMPLE_SOURCE_FILES
examples/compute_eikonal_from_files.cpp
examples/compute_initial_state.cpp
- examples/compute_tof.cpp
- examples/compute_tof_from_files.cpp
+# examples/compute_tof.cpp
+# examples/compute_tof_from_files.cpp
examples/diagnose_relperm.cpp
tutorials/tutorial1.cpp
tutorials/tutorial2.cpp
diff --git a/dune/grid/cpgrid/Entity.hpp b/dune/grid/cpgrid/Entity.hpp
index eadcb33..0efcedd 100644
--- a/dune/grid/cpgrid/Entity.hpp
+++ b/dune/grid/cpgrid/Entity.hpp
@@ -148,7 +148,7 @@ namespace Dune
}
/// Returns the geometry of the entity (does not depend on its orientation).
- const Geometry& geometry() const;
+ Geometry geometry() const;
/// We do not support refinement, so level() is always 0.
int level() const
@@ -182,7 +182,7 @@ namespace Dune
/// The count of subentities of codimension cc
unsigned int subEntities ( const unsigned int cc ) const
{
- static_assert(codim == 0, "");
+// static_assert(codim == 0, "");
if (cc == 0) {
return 1;
} else if (cc == 3) {
@@ -412,7 +412,7 @@ namespace Dune {
namespace cpgrid {
template <int codim>
-const typename Entity<codim>::Geometry& Entity<codim>::geometry() const
+typename Entity<codim>::Geometry Entity<codim>::geometry() const
{
return pgrid_->geomVector<codim>()[*this];
}
diff --git a/dune/grid/cpgrid/Geometry.hpp b/dune/grid/cpgrid/Geometry.hpp
index 86d82a5..10c7e14 100644
--- a/dune/grid/cpgrid/Geometry.hpp
+++ b/dune/grid/cpgrid/Geometry.hpp
@@ -41,8 +41,13 @@
#include <dune/common/version.hh>
#include <dune/geometry/referenceelements.hh>
+
+#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 5 )
+#include <dune/geometry/type.hh>
+#else
#include <dune/geometry/genericgeometry/geometrytraits.hh>
#include <dune/geometry/genericgeometry/matrixhelper.hh>
+#endif
#include <opm/common/utility/platform_dependent/reenable_warnings.h>
@@ -99,6 +104,12 @@ namespace Dune
/// Type of the inverse of the transposed Jacobian matrix
typedef FieldMatrix< ctype, coorddimension, mydimension > JacobianInverseTransposed;
+#if DUNE_VERSION_NEWER(DUNE_GRID,2,5)
+ typedef Dune::Impl::FieldMatrixHelper< double > MatrixHelperType;
+#else
+ typedef Dune::GenericGeometry::MatrixHelper< Dune::GenericGeometry::DuneCoordTraits<double> > MatrixHelperType;
+#endif
+
/// @brief Construct from centroid, volume (1- and 0-moments) and
/// corners.
/// @param pos the centroid of the entity
@@ -189,12 +200,11 @@ namespace Dune
LocalCoordinate x = refElement.position(0,0);
LocalCoordinate dx;
do {
- using namespace GenericGeometry;
// DF^n dx^n = F^n, x^{n+1} -= dx^n
JacobianTransposed JT = jacobianTransposed(x);
GlobalCoordinate z = global(x);
z -= y;
- MatrixHelper<DuneCoordTraits<double> >::template xTRightInvA<3, 3>(JT, z, dx );
+ MatrixHelperType::template xTRightInvA<3, 3>(JT, z, dx );
x -= dx;
} while (dx.two_norm2() > epsilon*epsilon);
return x;
@@ -206,9 +216,8 @@ namespace Dune
/// and {u_j} are the reference coordinates.
double integrationElement(const LocalCoordinate& local_coord) const
{
- FieldMatrix<ctype, coorddimension, mydimension> Jt = jacobianTransposed(local_coord);
- using namespace GenericGeometry;
- return MatrixHelper<DuneCoordTraits<double> >::template sqrtDetAAT<3, 3>(Jt);
+ JacobianTransposed Jt = jacobianTransposed(local_coord);
+ return MatrixHelperType::template sqrtDetAAT<3, 3>(Jt);
}
/// Using the cube type for all entities now (cells and vertices),
diff --git a/dune/grid/cpgrid/Intersection.hpp b/dune/grid/cpgrid/Intersection.hpp
index f7152ef..cf01473 100644
--- a/dune/grid/cpgrid/Intersection.hpp
+++ b/dune/grid/cpgrid/Intersection.hpp
@@ -188,7 +188,7 @@ namespace Dune
/// @brief
/// @todo Doc me!
/// @return
- const Geometry& geometry() const
+ Geometry geometry() const
{
return global_geom_;
}
diff --git a/dune/grid/polyhedralgrid/geometry.hh b/dune/grid/polyhedralgrid/geometry.hh
index 64a15fc..9c3c0b4 100644
--- a/dune/grid/polyhedralgrid/geometry.hh
+++ b/dune/grid/polyhedralgrid/geometry.hh
@@ -42,6 +42,12 @@ namespace Dune
typedef typename Grid::Traits::ExtraData ExtraData;
typedef typename Grid::Traits::template Codim<codimension>::EntitySeed EntitySeed;
+#if DUNE_VERSION_NEWER(DUNE_GRID,2,5)
+ typedef Dune::Impl::FieldMatrixHelper< double > MatrixHelperType;
+#else
+ typedef Dune::GenericGeometry::MatrixHelper< Dune::GenericGeometry::DuneCoordTraits<double> > MatrixHelperType;
+#endif
+
explicit PolyhedralGridBasicGeometry ( ExtraData data )
: data_( data ),
seed_( )
@@ -136,12 +142,11 @@ namespace Dune
LocalCoordinate x = refElement.position(0,0);
LocalCoordinate dx;
do {
- using namespace GenericGeometry;
// DF^n dx^n = F^n, x^{n+1} -= dx^n
JacobianTransposed JT = jacobianTransposed(x);
GlobalCoordinate z = global(x);
z -= y;
- MatrixHelper<DuneCoordTraits<double> >::template xTRightInvA<mydimension,coorddimension>(JT, z, dx );
+ MatrixHelperType::template xTRightInvA<mydimension,coorddimension>(JT, z, dx );
x -= dx;
} while (dx.two_norm2() > epsilon*epsilon);
return x;
diff --git a/opm-grid-prereqs.cmake b/opm-grid-prereqs.cmake
index 2ad0d86..032ac19 100644
--- a/opm-grid-prereqs.cmake
+++ b/opm-grid-prereqs.cmake
@@ -34,4 +34,5 @@ set (opm-grid_DEPS
"ecl REQUIRED"
)
+include(OpmPackage)
find_package_deps(opm-grid)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a53c6634..2a6b5147 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,24 +99,8 @@ SET( CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG -ggdb3 ${CMAKE_C_FLAGS} ${CMAKE_
SET( CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -mtune=native ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
-if (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
- set (Boost_NO_SYSTEM_PATHS TRUE)
-endif (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
-
-# if we are building shared libraries ourselves, then don't include Boost in them
-if (BUILD_SHARED_LIBS)
- set(Boost_USE_STATIC_LIBS OFF)
-elseif (DEFINED BUILD_SHARED_LIBS)
- set(Boost_USE_STATIC_LIBS ON)
-endif ()
-set(Boost_USE_MULTITHREADED ON)
-set(Boost_USE_STATIC_RUNTIME OFF)
-
-
-add_definitions(-DOPM_PARSER_DECK_API=1)
-# Requires BOOST filesystem version 3, thus 1.44 is necessary.
-add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
-find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex REQUIRED)
+# get the prerequisite Boost libraries
+find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
@@ -177,9 +161,9 @@ 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()
set(opm-parser_TARGET opmparser)
opm_cmake_config(opm-parser)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d81c5dc2..964c19de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -91,14 +91,7 @@ else ()
add_subdirectory(external/cjson)
endif()
-# if building shared libraries, then don't include Boost in them
-if (BUILD_SHARED_LIBS)
- set(Boost_USE_STATIC_LIBS OFF)
- set(Boost_USE_STATIC_RUNTIME OFF)
-else ()
-# if using dynamic boost, the header file must generate a main() function
- set(Boost_USE_STATIC_LIBS ON)
-endif ()
+add_definitions(-DBOOST_TEST_DYN_LINK)
find_package(Boost 1.44.0
COMPONENTS filesystem
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment