diff --git a/CMakeLists.txt b/CMakeLists.txt index e2308289..2a771819 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,11 @@ set (${project}_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") list (APPEND CMAKE_MODULE_PATH ${${project}_MODULE_DIR}) # include special +if (CMAKE_VERSION VERSION_LESS "2.8.3") + message (STATUS "Enabling compatibility modules for CMake 2.8.3") + list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.3") +endif (CMAKE_VERSION VERSION_LESS "2.8.3") + if (CMAKE_VERSION VERSION_LESS "2.8.5") message (STATUS "Enabling compatibility modules for CMake 2.8.5") list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.5") @@ -294,3 +299,6 @@ configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE) ### clean in-source builds ### include (OpmDistClean) opm_dist_clean (${project}) + +### emulate the with-xxx feature of autotools; +include (OpmKnown) diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 7405a869..69d5a22d 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -147,6 +147,7 @@ list (APPEND TEST_SOURCE_FILES tests/test_column_extract.cpp tests/test_geom2d.cpp tests/test_param.cpp + tests/test_blackoilfluid.cpp ) # originally generated with the command: @@ -154,6 +155,7 @@ list (APPEND TEST_SOURCE_FILES list (APPEND TEST_DATA_FILES tests/extratestdata.xml tests/testdata.xml + tests/testFluid.DATA ) # originally generated with the command: diff --git a/README b/README index 01c4c257..bb5c5bd8 100644 --- a/README +++ b/README @@ -63,6 +63,9 @@ sudo apt-get install libdune-common-dev libdune-istl-dev libdune-grid-dev # libraries necessary for OPM sudo apt-get install -y libtinyxml-dev +# optional: Ensemble based Reservoir Tool Eclipse utilities module +sudo apt-get install ert.ecl + Note: You should compile the OPM modules using the same toolchain that was used to build DUNE. Otherwise, you can get strange ABI errors. @@ -70,16 +73,26 @@ Note: You should compile the OPM modules using the same toolchain that DEPENDENCIES FOR SUSE BASED DISTRIBUTIONS ----------------------------------------- -# libraries -sudo zypper in libblas3 liblapack3 libboost libtinyxml-devel libumfpack +# repository containing prerequisites +sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.3/science.repo -# tools -sudo zypper in gcc cmake git doxygen +# math libraries +sudo zypper in blas-devel lapack-devel suitesparse-devel superlu-devel + +# utility libraries +sudo zypper in boost-devel tinyxml-devel + +# tools necessary for building +sudo zypper in gcc gcc-c++ gcc-fortran cmake git doxygen # DUNE libraries -sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.2/science.repo -sudo zypper in dune-common dune-istl +sudo zypper in dune-common-devel dune-istl-devel +# optional: Ensemble-based Reservoir Tools Eclipse utility module +git sudo zypper ar http://www.opm-project.org/packages/current/opensuse/12/opm.repo +sudo zypper in zlib-devel ert.ecl-devel + +(to remove the repository, run `sudo zypper removerepo "Open Porous Media Initiative"`) DEPENDENCIES FOR RHEL BASED DISTRIBUTIONS ----------------------------------------- diff --git a/cmake/Modules/FindCXX11Features.cmake b/cmake/Modules/FindCXX11Features.cmake index 001a386a..85f2f341 100644 --- a/cmake/Modules/FindCXX11Features.cmake +++ b/cmake/Modules/FindCXX11Features.cmake @@ -12,7 +12,8 @@ # HAVE_CONSTEXPR True if constexpr attribute is available # HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant # HAVE_STATIC_ASSERT True if static_assert is available -# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt +# HAVE_AUTO True if the compiler supports the auto keyword +# HAVE_VARIADIC_TEMPLATES True if variadic templates are supported # HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported # HAVE_RVALUE_REFERENCES True if rvalue references are supported # HAVE_TUPLE True if std::tuple is available @@ -189,6 +190,16 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_STATIC_ASSERT ) +# auto keyword +CHECK_CXX_SOURCE_COMPILES(" + int main(void) + { + auto foo = 1.23; + return 0; + } +" HAVE_AUTO +) + # variadic template support CHECK_CXX_SOURCE_COMPILES(" #include diff --git a/cmake/Modules/OpmKnown.cmake b/cmake/Modules/OpmKnown.cmake new file mode 100644 index 00000000..cc3403cf --- /dev/null +++ b/cmake/Modules/OpmKnown.cmake @@ -0,0 +1,47 @@ +# -*- 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: + +# emulate the with-xxx feature of autotools to not give warnings +# if we specify the directories of packages that are known to the +# family but not necessarily used + +# pick package names from these; opm-xxx, dune-xxx +set (KNOWN_FAMILIES + opm + dune + ) + +# variables to test; xxx_DIR, xxx_ROOT +set (KNOWN_VARS + DIR + ROOT + ) + +set (KNOWN_opm_PKGS + autodiff + core + material + parser + polymer + porsol + upscaling + verteq + ) + +set (KNOWN_dune_PKGS + common + cornerpoint + geometry + grid + istl + localfunctions + ) + +foreach (family IN ITEMS ${KNOWN_FAMILIES}) + foreach (package IN ITEMS ${KNOWN_${family}_PKGS}) + foreach (var IN ITEMS ${KNOWN_VARS}) + # just "use" the variable, so we don't get warnings + set (_dummy ${${family}-${package}_${var}}) + endforeach (var) + endforeach (package) +endforeach (family) diff --git a/cmake/Modules/UseOptimization.cmake b/cmake/Modules/UseOptimization.cmake index 4cb99f3d..f4e67150 100644 --- a/cmake/Modules/UseOptimization.cmake +++ b/cmake/Modules/UseOptimization.cmake @@ -16,7 +16,8 @@ if (CMAKE_COMPILER_IS_GNUCXX) set (_opt_flags "") # link-time (a.k.a. global) optimizations - option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" ON) + # disabled due to widespread bugs in the linker plugin + option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" OFF) if (WHOLE_PROG_OPTIM) check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS) if (HAVE_LINK_OPTS) diff --git a/cmake/Modules/compat-2.8.3/CMakeParseArguments.cmake b/cmake/Modules/compat-2.8.3/CMakeParseArguments.cmake new file mode 100644 index 00000000..7ce4c49a --- /dev/null +++ b/cmake/Modules/compat-2.8.3/CMakeParseArguments.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS( args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in , and +# a variable composed of the given +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# _UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else(insideValues) + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif(insideValues) + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach(currentArg) + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach(arg_name) + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/configure b/configure index 37b7f11a..87218223 100755 --- a/configure +++ b/configure @@ -19,7 +19,7 @@ Optional Features: of the options shared and static may be built. --enable-debug build a non-optimized version of the library [default=no] - --disable-lto do not use whole program optimization [default=yes] + --enable-lto use whole program optimization [default=no] --disable-pch do not use precompiled headers (if buggy compiler) --disable-silent-rules print every compilation statement as executed --enable-system-debug put .debug files in global GDB debug dir @@ -104,7 +104,7 @@ use_mpi= silent_rules= #debug_loc=" -DSYSTEM_DEBUG=OFF" debug_loc= -#use_lto=" -DWHOLE_PROG_OPTIM=ON" +#use_lto=" -DWHOLE_PROG_OPTIM=OFF" use_lto= # default is to warn for unknown options, but this can be disabled @@ -299,6 +299,10 @@ for OPT in "$@"; do pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON" shared="" ;; + lto) + use_lto=" -DWHOLE_PROG_OPTIM=ON" + shared="" + ;; # this flag is just for compatibility with the deprecation # flag in DUNE, so we can build without warnings fieldvector-size-is-method) diff --git a/debian/rules b/debian/rules index 317db881..d6fcf5f4 100755 --- a/debian/rules +++ b/debian/rules @@ -19,7 +19,7 @@ override_dh_auto_build: dh_auto_build --buildsystem=cmake override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1 -DWHOLE_PROG_OPTIM=ON override_dh_auto_install: dh_auto_install -- install-html diff --git a/m4/agmg.m4 b/m4/agmg.m4 deleted file mode 100644 index 0a16e9b3..00000000 --- a/m4/agmg.m4 +++ /dev/null @@ -1,30 +0,0 @@ -AC_DEFUN([OPM_AGMG],dnl -[AC_ARG_WITH([agmg],dnl - [AS_HELP_STRING([--with-agmg=SRCDIR],dnl - [Include DOUBLE PRECISION version Notay's of AGMG Algebraic - Multigrid solver from specified source location SRCDIR. Note: this - option requires a complete, working Fortran 90 environment.])], - [],dnl - [with_agmg=no])[]dnl - - AS_IF([test x"$with_agmg" != x"no" -a -d "$with_agmg"],dnl - [AS_IF([test -f "$with_agmg/dagmg.f90"],dnl - [AC_SUBST([AGMG_SRCDIR], [$with_agmg])[]dnl - AC_DEFINE([HAVE_AGMG], [1],dnl - [Define to 1 if Notay's AGMG solver is included.])[]dnl - build_agmg="yes"],dnl - [AC_DEFINE([HAVE_AGMG], [0],dnl - [Define to 0 if Notay's AGMG solver is unavailable.])[]dnl - build_agmg="no"])],dnl - [AC_DEFINE([HAVE_AGMG], [0],dnl - [Define to 0 if Notay's AGMG solver is unwanted.])[]dnl - build_agmg="no"])[]dnl - - AS_IF([test x"$build_agmg" = x"yes"],dnl - [AC_PROG_FC_C_O[]dnl - AC_FC_WRAPPERS[]dnl - AC_FC_LIBRARY_LDFLAGS[]dnl - ], [:])[]dnl - - AM_CONDITIONAL([BUILD_AGMG], [test x"$build_agmg" = x"yes"]) -])[]dnl diff --git a/m4/ax_blas.m4 b/m4/ax_blas.m4 deleted file mode 100644 index 7e6fd549..00000000 --- a/m4/ax_blas.m4 +++ /dev/null @@ -1,209 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_blas.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the BLAS linear-algebra -# interface (see http://www.netlib.org/blas/). On success, it sets the -# BLAS_LIBS output variable to hold the requisite library linkages. -# -# To link with BLAS, you should link with: -# -# $BLAS_LIBS $LIBS $FLIBS -# -# in that order. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# Many libraries are searched for, from ATLAS to CXML to ESSL. The user -# may also use --with-blas= in order to use some specific BLAS -# library . In order to link successfully, however, be aware that you -# will probably need to use the same Fortran compiler (which can be set -# via the F77 env. var.) as was used to compile the BLAS library. -# -# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is -# not found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_BLAS. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# -# This program 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. -# -# This program 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 this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 11 - -AU_ALIAS([ACX_BLAS], [AX_BLAS]) -AC_DEFUN([AX_BLAS], [ -AC_PREREQ(2.50) -AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) -ax_blas_ok=no - -AC_ARG_WITH(blas, - [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) -case $with_blas in - yes | "") ;; - no) ax_blas_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;; - *) BLAS_LIBS="-l$with_blas" ;; -esac - -# Get fortran linker names of BLAS functions to check for. -AC_F77_FUNC(sgemm) -AC_F77_FUNC(dgemm) - -ax_blas_save_LIBS="$LIBS" -LIBS="$LIBS $FLIBS" - -# First, check BLAS_LIBS environment variable -if test $ax_blas_ok = no; then -if test "x$BLAS_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) - AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes], [BLAS_LIBS=""]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi -fi - -# don't probe if explicitly defined; by bailing out here if the -# argument is set, we guard against typo, incompatible libs. etc. -# being inadvertedly overrided by another (random) implementation -if test "x$with_blas" == x; then - -# BLAS linked to by default? (happens on some supercomputers) -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS" - AC_MSG_CHECKING([if $sgemm is being linked in already]) - AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(atlas, ATL_xerbla, - [AC_CHECK_LIB(f77blas, $sgemm, - [AC_CHECK_LIB(cblas, cblas_dgemm, - [ax_blas_ok=yes - BLAS_LIBS="-lcblas -lf77blas -latlas"], - [], [-lf77blas -latlas])], - [], [-latlas])]) -fi - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(dgemm, $dgemm, - [AC_CHECK_LIB(sgemm, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], - [], [-lblas])], - [], [-lblas])]) -fi - -# BLAS in Intel MKL library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl"]) -fi - -# BLAS in Apple vecLib library? -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" - AC_MSG_CHECKING([for $sgemm in -framework vecLib]) - AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in Alpha CXML library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"]) -fi - -# BLAS in Alpha DXML library? (now called CXML, see above) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"]) -fi - -# BLAS in Sun Performance library? -if test $ax_blas_ok = no; then - if test "x$GCC" != xyes; then # only works with Sun CC - AC_CHECK_LIB(sunmath, acosp, - [AC_CHECK_LIB(sunperf, $sgemm, - [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" - ax_blas_ok=yes],[],[-lsunmath])]) - fi -fi - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"]) -fi - -# BLAS in SGIMATH library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(complib.sgimath, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) -fi - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(essl, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], - [], [-lblas $FLIBS])]) -fi - -# Generic BLAS library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) -fi - -# end of guard against automatic overriding explicit definitions -fi - -AC_SUBST(BLAS_LIBS) - -LIBS="$ax_blas_save_LIBS" - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_blas_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) - : -else - ax_blas_ok=no - $2 -fi -])dnl AX_BLAS diff --git a/m4/ax_boost_date_time.m4 b/m4/ax_boost_date_time.m4 deleted file mode 100644 index 4e9d57ba..00000000 --- a/m4/ax_boost_date_time.m4 +++ /dev/null @@ -1,114 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_date_time.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_DATE_TIME -# -# DESCRIPTION -# -# Test for Date_Time library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_DATE_TIME_LIB) -# -# And sets: -# -# HAVE_BOOST_DATE_TIME -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2008 Michael Tindal -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 19 - -AC_DEFUN([AX_BOOST_DATE_TIME], -[ - AC_ARG_WITH([boost-date-time], - AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@], - [use the Date_Time library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_date_time_lib="" - else - want_boost="yes" - ax_boost_user_date_time_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Date_Time library is available, - ax_cv_boost_date_time, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using namespace boost::gregorian; date d(2002,Jan,10); - return 0; - ]])], - ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_date_time" = "xyes"; then - AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available]) - BOOSTLIBDIR=`echo $OPM_BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - ax_lib="-lboost_date_time" - - if test "x$ax_boost_user_date_time_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.so* $BOOSTLIBDIR/libboost_date_time*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break], - [link_date_time="no"]) - done - if test "x$link_date_time" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_date_time*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break], - [link_date_time="no"]) - done - fi - else - for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do - AC_CHECK_LIB($ax_lib, main, - [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break], - [link_date_time="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_date_time" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4 deleted file mode 100644 index 2bb74e5a..00000000 --- a/m4/ax_boost_filesystem.m4 +++ /dev/null @@ -1,119 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_FILESYSTEM -# -# DESCRIPTION -# -# Test for Filesystem library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_FILESYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_FILESYSTEM -# -# LICENSE -# -# Copyright (c) 2009 Thomas Porschberg -# Copyright (c) 2009 Michael Tindal -# Copyright (c) 2009 Roman Rybalko -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 21 - -AC_DEFUN([AX_BOOST_FILESYSTEM], -[ - AC_ARG_WITH([boost-filesystem], - AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], - [use the Filesystem library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_filesystem_lib="" - else - want_boost="yes" - ax_boost_user_filesystem_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - LIBS_SAVED=$LIBS - LIBS="$LIBS $BOOST_SYSTEM_LIB" - export LIBS - - AC_CACHE_CHECK(whether the Boost::Filesystem library is available, - ax_cv_boost_filesystem, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using namespace boost::filesystem; - path my_path( "foo/bar/data.txt" ); - return 0;]])], - ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_filesystem" = "xyes"; then - AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) - BOOSTLIBDIR=`echo $OPM_BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - ax_lib="-lboost_filesystem" - if test "x$ax_boost_user_filesystem_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - if test "x$link_program_options" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - fi - else - for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_filesystem" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - LIBS="$LIBS_SAVED" - fi -]) diff --git a/m4/ax_boost_system.m4 b/m4/ax_boost_system.m4 deleted file mode 100644 index 2d47ad45..00000000 --- a/m4/ax_boost_system.m4 +++ /dev/null @@ -1,121 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_SYSTEM -# -# DESCRIPTION -# -# Test for System library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_SYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_SYSTEM -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2008 Michael Tindal -# Copyright (c) 2008 Daniel Casimiro -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 14 - -AC_DEFUN([AX_BOOST_SYSTEM], -[ - AC_ARG_WITH([boost-system], - AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], - [use the System library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-system=boost_system-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_system_lib="" - else - want_boost="yes" - ax_boost_user_system_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::System library is available, - ax_cv_boost_system, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::system::system_category]])], - ax_cv_boost_system=yes, ax_cv_boost_system=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_system" = "xyes"; then - AC_SUBST(OPM_BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) - BOOSTLIBDIR=`echo $OPM_BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - ax_lib="-lboost_system" - - LDFLAGS_SAVE=$LDFLAGS - if test "x$ax_boost_user_system_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - if test "x$link_system" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_system" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/m4/ax_boost_unit_test_framework.m4 b/m4/ax_boost_unit_test_framework.m4 deleted file mode 100644 index 424b3162..00000000 --- a/m4/ax_boost_unit_test_framework.m4 +++ /dev/null @@ -1,143 +0,0 @@ -# ================================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html -# ================================================================================ -# -# SYNOPSIS -# -# AX_BOOST_UNIT_TEST_FRAMEWORK -# -# DESCRIPTION -# -# Test for Unit_Test_Framework library from the Boost C++ libraries. The -# macro requires a preceding call to AX_BOOST_BASE. Further documentation -# is available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) -# -# And sets: -# -# HAVE_BOOST_UNIT_TEST_FRAMEWORK -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 17 - -AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], -[ - AC_ARG_WITH([boost-unit-test-framework], - AS_HELP_STRING([--with-boost-unit-test-framework@<:@=special-lib@:>@], - [use the Unit_Test_Framework library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-unit-test-framework=boost_unit_test_framework-gcc ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_unit_test_framework_lib="" - else - want_boost="yes" - ax_boost_user_unit_test_framework_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Unit_Test_Framework library is available, - ax_cv_boost_unit_test_framework, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using boost::unit_test::test_suite; - test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); return 0;]])], - ax_cv_boost_unit_test_framework=yes, ax_cv_boost_unit_test_framework=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then - AC_DEFINE(HAVE_BOOST_UNIT_TEST_FRAMEWORK,,[define if the Boost::Unit_Test_Framework library is available]) - BOOSTLIBDIR=`echo $OPM_BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - ax_lib="-lboost_unit_test_framework" - - if test "x$ax_boost_user_unit_test_framework_lib" = "x"; then - saved_ldflags="${LDFLAGS}" - for monitor_library in `ls $BOOSTLIBDIR/libboost_unit_test_framework*.so* $BOOSTLIBDIR/libboost_unit_test_framework*.a* 2>/dev/null` ; do - if test -r $monitor_library ; then - libextension=`echo $monitor_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a*$;\1;'` - ax_lib=${libextension} - link_unit_test_framework="yes" - else - link_unit_test_framework="no" - fi - - if test "x$link_unit_test_framework" = "xyes"; then - BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" - AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) - break - fi - done - if test "x$link_unit_test_framework" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_unit_test_framework*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_unit_test_framework.*\)\.dll.*$;\1;' -e 's;^\(boost_unit_test_framework.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"; AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) link_unit_test_framework="yes"; break], - [link_unit_test_framework="no"]) - done - fi - else - link_unit_test_framework="no" - saved_ldflags="${LDFLAGS}" - for ax_lib in boost_unit_test_framework-$ax_boost_user_unit_test_framework_lib $ax_boost_user_unit_test_framework_lib ; do - #if test "x$link_unit_test_framework" = "xyes"; then - # break; - #fi - #for unittest_library in `ls $BOOSTLIBDIR/lib${ax_lib}.so* $BOOSTLIBDIR/lib${ax_lib}.a* 2>/dev/null` ; do - #if test -r $unittest_library ; then - # libextension=`echo $unittest_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a*$;\1;'` - # ax_lib=${libextension} - # link_unit_test_framework="yes" - # else - # link_unit_test_framework="no" - # fi -# - # if test "x$link_unit_test_framework" = "xyes"; then - # BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" - # AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) - # break - # fi - - # done - - AC_CHECK_LIB($ax_lib, [exit], - [BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"; AC_SUBST([BOOST_UNIT_TEST_FRAMEWORK_LIB]) link_unit_test_framework="yes"; break], - [link_unit_test_framework="no"]) - done - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_unit_test_framework" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/m4/ax_dune_common.m4 b/m4/ax_dune_common.m4 deleted file mode 100644 index c8087420..00000000 --- a/m4/ax_dune_common.m4 +++ /dev/null @@ -1,36 +0,0 @@ -AC_DEFUN([OPM_DUNE_COMMON_PROGRAM_TEXT], -[AC_LANG_PROGRAM( - [[#include - #include - ]],dnl - [[Dune::FieldVector v; - Dune::FieldMatrix m; - m[0][0] = 1.0; - v[0] = 1.0; - Dune::FieldVector w = m*v; - ]])[]dnl -]) - - -AC_DEFUN([AX_DUNE_COMMON], -[AC_CACHE_CHECK(dnl -[for installed dune-common headers],dnl -[ax_cv_dune_common_available],dnl - [AC_LANG_PUSH([C++])[]dnl - - AC_LINK_IFELSE([OPM_DUNE_COMMON_PROGRAM_TEXT],dnl - [ax_cv_dune_common_available=yes],dnl - [ax_cv_dune_common_available=no]) - - AC_LANG_POP([C++])[]dnl - ])[]dnl - - AS_IF([test "x$ax_cv_dune_common_available" = "xyes"],dnl - [AC_DEFINE([HAVE_DUNE_COMMON], [1],dnl - [Define to 1 if `dune-common' is available])[]dnl - LIBS="-ldunecommon $LIBS" - ])[]dnl - - AM_CONDITIONAL([DUNE_COMMON], - [test "x$ax_cv_dune_common_available" = "xyes"]) -]) diff --git a/m4/ax_dune_istl.m4 b/m4/ax_dune_istl.m4 deleted file mode 100644 index 40fa9072..00000000 --- a/m4/ax_dune_istl.m4 +++ /dev/null @@ -1,41 +0,0 @@ -AC_DEFUN([OPM_DUNE_ISTL_PROGRAM_TEXT], -[AC_LANG_PROGRAM( - [[#include - #include - #include - ]],dnl - [[typedef Dune::BCRSMatrix > Matrix; - Matrix matrix( 3, 3, Matrix::random ); - for (int i = 0; i < 3; ++i) matrix.setrowsize(i, 2); - matrix.endrowsizes(); - ]])[]dnl -]) - - -AC_DEFUN([AX_DUNE_ISTL], -[AC_REQUIRE([AX_DUNE_COMMON]) - - AC_CACHE_CHECK(dnl -[for installed dune-istl headers],dnl -[ax_cv_dune_istl_available],dnl - [AC_LANG_PUSH([C++])[]dnl - - AC_LINK_IFELSE([OPM_DUNE_ISTL_PROGRAM_TEXT],dnl - [ax_cv_dune_istl_available=yes],dnl - [ax_cv_dune_istl_available=no]) - - AC_LANG_POP([C++])[]dnl - ])[]dnl - - AS_IF([test "x$ax_cv_dune_istl_available" = "xyes" -a \ - "x$ax_cv_dune_common_available" = "xyes"],dnl - [AC_DEFINE([HAVE_DUNE_ISTL], [1],dnl - [Define to 1 if `dune-istl' is available]) - ],dnl - [AC_DEFINE([HAVE_DUNE_ISTL], [0],dnl - [Define to 0 if `dune-istl' is unavailable.])])[]dnl - - AM_CONDITIONAL([DUNE_ISTL], - [test "x$ax_cv_dune_istl_available" = "xyes" -a \ - "x$ax_cv_dune_common_available" = "xyes"]) -]) diff --git a/m4/ax_lapack.m4 b/m4/ax_lapack.m4 deleted file mode 100644 index b642c38c..00000000 --- a/m4/ax_lapack.m4 +++ /dev/null @@ -1,139 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_lapack.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the LAPACK linear-algebra -# interface (see http://www.netlib.org/lapack/). On success, it sets the -# LAPACK_LIBS output variable to hold the requisite library linkages. -# -# To link with LAPACK, you should link with: -# -# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS -# -# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, -# called automatically. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# The user may also use --with-lapack= in order to use some specific -# LAPACK library . In order to link successfully, however, be aware -# that you will probably need to use the same Fortran compiler (which can -# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS -# libraries. -# -# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_LAPACK. -# -# LICENSE -# -# Copyright (c) 2009 Steven G. Johnson -# -# This program 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. -# -# This program 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 this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) -AC_DEFUN([AX_LAPACK], [ -AC_REQUIRE([AX_BLAS]) -ax_lapack_ok=no - -AC_ARG_WITH(lapack, - [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) -case $with_lapack in - yes | "") ;; - no) ax_lapack_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;; - *) LAPACK_LIBS="-l$with_lapack" ;; -esac - -# Get fortran linker name of LAPACK function to check for. -AC_F77_FUNC(cheev) - -# We cannot use LAPACK if BLAS is not found -if test "x$ax_blas_ok" != xyes; then - ax_lapack_ok=noblas - LAPACK_LIBS="" -fi - -# First, check LAPACK_LIBS environment variable -if test "x$LAPACK_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" - AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) - AC_TRY_LINK_FUNC($cheev, [ax_lapack_ok=yes], [LAPACK_LIBS=""]) - AC_MSG_RESULT($ax_lapack_ok) - LIBS="$save_LIBS" - if test $ax_lapack_ok = no; then - LAPACK_LIBS="" - fi -fi - -# don't probe if explicitly defined; by bailing out here if the -# argument is set, we guard against typo, incompatible libs. etc. -# being inadvertedly overrided by another (random) implementation -if test "x$with_lapack" = x; then - -# LAPACK linked to by default? (is sometimes included in BLAS lib) -if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" - AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) - LIBS="$save_LIBS" -fi - -# Generic LAPACK library? -for lapack in lapack lapack_rs6k; do - if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_CHECK_LIB($lapack, $cheev, - [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) - LIBS="$save_LIBS" - fi -done - -# end of guard against automatic overriding explicit definitions -fi - -AC_SUBST(LAPACK_LIBS) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_lapack_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) - : -else - ax_lapack_ok=no - $2 -fi -])dnl AX_LAPACK diff --git a/m4/cxx0x_compiler.m4 b/m4/cxx0x_compiler.m4 deleted file mode 100644 index 47a7e90c..00000000 --- a/m4/cxx0x_compiler.m4 +++ /dev/null @@ -1,66 +0,0 @@ -# whether compiler accepts -std=c++11 or -std=c++0x -# can be disabled by --disable-gxx0xcheck - -AC_DEFUN([GXX0X],[ - save_CXX="$CXX" - - # put this check first, so we get disable C++11 if C++0x is - AC_ARG_ENABLE(gxx0xcheck, - AC_HELP_STRING([--disable-gxx0xcheck], - [try flag -std=c++0x to enable C++0x features [[default=yes]]]), - [gxx0xcheck=$enableval], - [gxx0xcheck=yes]) - AC_ARG_ENABLE(gxx11check, - AC_HELP_STRING([--disable-gxx11check], - [try flag -std=c++11 to enable C++11 features [[default=yes]]]), - [gxx11check=$enableval], - [gxx11check=yes]) - - # try flag -std=c++11 - AC_CACHE_CHECK([whether $CXX accepts -std=c++11], dune_cv_gplusplus_accepts_cplusplus11, [ - AC_REQUIRE([AC_PROG_CXX]) - if test "x$GXX" = xyes && test "x$gxx11check" = xyes && test "x$gxx0xcheck" = xyes ; then - AC_LANG_PUSH([C++]) - CXX="$CXX -std=c++11" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ - #include - #include - ],)], - [dune_cv_gplusplus_accepts_cplusplus11=yes], - [dune_cv_gplusplus_accepts_cplusplus11=no]) - AC_LANG_POP([C++]) - else - dune_cv_gplusplus_accepts_cplusplus11=disabled - fi - ]) - if test "x$dune_cv_gplusplus_accepts_cplusplus11" = "xyes" ; then - CXX="$save_CXX -std=c++11" - CXXCPP="$CXXCPP -std=c++11" - else - CXX="$save_CXX" - - # try flag -std=c++0x instead - AC_CACHE_CHECK([whether $CXX accepts -std=c++0x], dune_cv_gplusplus_accepts_cplusplus0x, [ - AC_REQUIRE([AC_PROG_CXX]) - if test "x$GXX" = xyes && test "x$gxx0xcheck" = xyes; then - AC_LANG_PUSH([C++]) - CXX="$CXX -std=c++0x" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ - #include - #include - ],)], - [dune_cv_gplusplus_accepts_cplusplus0x=yes], - [dune_cv_gplusplus_accepts_cplusplus0x=no]) - AC_LANG_POP([C++]) - else - dune_cv_gplusplus_accepts_cplusplus0x=disabled - fi - ]) - if test "x$dune_cv_gplusplus_accepts_cplusplus0x" = "xyes" ; then - CXX="$save_CXX -std=c++0x" - CXXCPP="$CXXCPP -std=c++0x" - else - CXX="$save_CXX" - fi - fi -]) diff --git a/m4/cxx0x_nullptr.m4 b/m4/cxx0x_nullptr.m4 deleted file mode 100644 index 18d44451..00000000 --- a/m4/cxx0x_nullptr.m4 +++ /dev/null @@ -1,17 +0,0 @@ -AC_DEFUN([NULLPTR_CHECK],[ - AC_CACHE_CHECK([whether nullptr is supported], dune_cv_nullptr_support, [ - AC_REQUIRE([AC_PROG_CXX]) - AC_REQUIRE([GXX0X]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ - char* ch = nullptr; - if(ch!=nullptr) { ; } - ])], - [dune_cv_nullptr_support=yes], - [dune_cv_nullptr_support=no]) - AC_LANG_POP - ]) - if test "x$dune_cv_nullptr_support" = xyes; then - AC_DEFINE(HAVE_NULLPTR, 1, [Define to 1 if nullptr is supported]) - fi -]) diff --git a/m4/cxx0x_static_assert.m4 b/m4/cxx0x_static_assert.m4 deleted file mode 100644 index b68d155b..00000000 --- a/m4/cxx0x_static_assert.m4 +++ /dev/null @@ -1,14 +0,0 @@ -AC_DEFUN([STATIC_ASSERT_CHECK],[ - AC_CACHE_CHECK([whether static_assert is supported], dune_cv_static_assert_support, [ - AC_REQUIRE([AC_PROG_CXX]) - AC_REQUIRE([GXX0X]) - AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[static_assert(true,"MSG")])], - [dune_cv_static_assert_support=yes], - [dune_cv_static_assert_support=no]) - AC_LANG_POP - ]) - if test "x$dune_cv_static_assert_support" = xyes; then - AC_DEFINE(HAVE_STATIC_ASSERT, 1, [Define to 1 if static_assert is supported]) - fi -]) diff --git a/m4/ert.m4 b/m4/ert.m4 deleted file mode 100644 index a28d4b67..00000000 --- a/m4/ert.m4 +++ /dev/null @@ -1,67 +0,0 @@ -AC_DEFUN([_ERT_SOURCE_TEXT], -[ -AC_LANG_PROGRAM( -[[ -#include -#include -]],dnl -[[ -int sz; -sz = ecl_util_get_sizeof_ctype(ECL_INT_TYPE); -]])[]dnl -])[]dnl - -# ---------------------------------------------------------------------- - -AC_DEFUN([ERT], -[ -AC_ARG_WITH([ert], - [AS_HELP_STRING([--with-ert=], [Use ERT libraries])], - [], [with_ert=no]) - -use_ert=no - -AS_IF([test x"${with_ert}" != x"no"], -[ - _ert_LDFLAGS_SAVE="${LDFLAGS}" - _ert_LIBS_SAVE="${LIBS}" - _ert_CPPFLAGS_SAVE="${CPPFLAGS}" - _ert_CFLAGS_SAVE="${CFLAGS}" - - ERT_CPPFLAGS= - ERT_LDFLAGS= - ERT_LIBS="-lecl -lert_geometry -lert_util -lpthread -lz -lgomp" - AS_IF([test x"${with_ert}" != x"yes"], - [ERT_LDFLAGS="-L${with_ert}/lib" - ERT_CPPFLAGS="-I${with_ert}/include"], [:])[]dnl - - CFLAGS="-std=gnu99" - CPPFLAGS="${ERT_CPPFLAGS} ${CPPFLAGS}" - LDFLAGS="${ERT_LDFLAGS} ${LDFLAGS}" - LIBS="${ERT_LIBS} ${LIBS}" - - AC_LINK_IFELSE([_ERT_SOURCE_TEXT], - [use_ert=yes], [use_ert=no]) - - LIBS="${_ert_LIBS_SAVE}" - CPPFLAGS="${_ert_CPPFLAGS_SAVE}" - LDFLAGS="${_ert_LDFLAGS_SAVE}" - CFLAGS="${_ert_CFLAGS_SAVE}" - - AS_IF([test x"${use_ert}" = x"yes"], - [AC_SUBST([ERT_CPPFLAGS]) - AC_SUBST([ERT_LDFLAGS]) - AC_SUBST([ERT_LIBS]) - AC_DEFINE([HAVE_ERT], [1], - [Are the ERT libraries available for reading and writing ECLIPSE files.])],dnl - [:])[]dnl -], [:])[]dnl - -AM_CONDITIONAL([HAVE_ERT], [test x"${use_ert}" != x"no"]) - -# AC_MSG_ERROR( -# [**** ERT_CPPFLAGS = ${ERT_CPPFLAGS} **** -# **** ERT_LDFLAGS = ${ERT_LDFLAGS} **** -# **** ERT_LIBS = ${ERT_LIBS} **** -# ]) -]) diff --git a/m4/opm.m4 b/m4/opm.m4 new file mode 100644 index 00000000..caad8bc1 --- /dev/null +++ b/m4/opm.m4 @@ -0,0 +1,50 @@ +dnl -*- autoconf -*- + +dnl OPM_PKG_CONFIG_MODULE (name, version, description) +dnl +dnl Common routine to include configuration module for an OPM project +AC_DEFUN([OPM_CHECK_PKG_MODULE],[ + dnl local variables representing parameters + m4_pushdef([_opm_name], [$1]) + m4_pushdef([_opm_version], [$2]) + m4_pushdef([_opm_description], [$3]) + + dnl macro-friendly version of the name; uppercase and with dashes + dnl replaced with underscores + m4_pushdef([_opm_module], [m4_translit(_opm_name,[-],[_])]) + m4_pushdef([_OPM_MODULE], [m4_toupper(_opm_module)]) + + dnl if we are given the location as a parameter, look there first + AC_ARG_WITH(_opm_name, + AS_HELP_STRING([--with-_opm_name=PATH],[_opm_description directory])) + + AS_IF([test -n "$with_[]_opm_module"],[ + export PKG_CONFIG_PATH=$with_[]_opm_module:$PKG_CONFIG_PATH + ]) + + dnl let pkg-config do the heavy lifting of finding the .pc file + PKG_CHECK_MODULES(_OPM_MODULE,[_opm_name = _opm_version],[ + AC_DEFINE(HAVE_[]_OPM_MODULE,[1],[_opm_description available]) + ]) + + dnl TODO: here we could call PKG_CONFIG --variable if we need more + + dnl make flag available for Makefiles too + AM_CONDITIONAL(HAVE_[]_OPM_MODULE, test x$HAVE_[]_OPM_MODULE = x1) + + dnl add our libraries to the global list of compiler and linker options + DUNE_CPPFLAGS="$DUNE_CPPFLAGS $_OPM_MODULE[]_CFLAGS" + DUNE_LIBS="$DUNE_LIBS $_OPM_MODULE[]_LIBS" + + # add this module to summary (if we are used with dunecontrol) + ifdef([DUNE_MODULE_ADD_SUMMARY_ENTRY],[ + DUNE_MODULE_ADD_SUMMARY_ENTRY(_opm_name) + ]) + + dnl cleanup + m4_popdef([_OPM_MODULE]) + m4_popdef([_opm_module]) + m4_popdef([_opm_description]) + m4_popdef([_opm_version]) + m4_popdef([_opm_name]) +]) diff --git a/m4/opm_boost_base.m4 b/m4/opm_boost_base.m4 deleted file mode 100644 index 4f4ea066..00000000 --- a/m4/opm_boost_base.m4 +++ /dev/null @@ -1,266 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html -# =========================================================================== -# -# SYNOPSIS -# -# OPM_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# Test for the Boost C++ libraries of a particular version (or newer) -# -# If no path to the installed boost library is given the macro searchs -# under /usr, /usr/local, /opt and /opt/local and evaluates the -# $BOOST_ROOT environment variable. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(OPM_BOOST_CPPFLAGS) / AC_SUBST(OPM_BOOST_LDFLAGS) -# -# And sets: -# -# OPM_HAVE_BOOST -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2009 Peter Adolphs -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 20 - -AC_DEFUN([OPM_BOOST_BASE], -[ -AC_ARG_WITH([boost], - [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], - [use Boost library from a standard location (ARG=yes), - from the specified location (ARG=), - or disable it (ARG=no) - @<:@ARG=yes@:>@ ])], - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ac_boost_path="" - else - want_boost="yes" - ac_boost_path="$withval" - fi - ], - [want_boost="yes"]) - - -AC_ARG_WITH([boost-libdir], - AS_HELP_STRING([--with-boost-libdir=LIB_DIR], - [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), - [ - if test -d "$withval" - then - ac_boost_lib_path="$withval" - else - AC_MSG_ERROR(--with-boost-libdir expected directory name) - fi - ], - [ac_boost_lib_path=""] -) - -if test "x$want_boost" = "xyes"; then - boost_lib_version_req=ifelse([$1], ,1.20.0,$1) - boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` - boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` - boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` - boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` - if test "x$boost_lib_version_req_sub_minor" = "x" ; then - boost_lib_version_req_sub_minor="0" - fi - WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` - AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) - succeeded=no - - dnl On 64-bit systems check for system libraries in both lib64 and lib. - dnl The former is specified by FHS, but e.g. Debian does not adhere to - dnl this (as it rises problems for generic multi-arch support). - dnl The last entry in the list is chosen by default when no libraries - dnl are found, e.g. when only header-only libraries are installed! - libsubdirs="lib" - ax_arch=`uname -m` - if test $ax_arch = x86_64 -o $ax_arch = ppc64 -o $ax_arch = s390x -o $ax_arch = sparc64; then - libsubdirs="lib64 lib lib64" - fi - - dnl first we check the system location for boost libraries - dnl this location ist chosen if boost libraries are installed with the --layout=system option - dnl or if you install boost with RPM - if test "$ac_boost_path" != ""; then - OPM_BOOST_CPPFLAGS="-I$ac_boost_path/include" - for ac_boost_path_tmp in $libsubdirs; do - if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then - OPM_BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" - OPM_BOOST_LIBDIR="${ac_boost_path}/${ac_boost_path_tmp}" - break - fi - done - elif test "$cross_compiling" != yes; then - for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then - for libsubdir in $libsubdirs ; do - if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - OPM_BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" - OPM_BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" - OPM_BOOST_LIBDIR="${ac_boost_path_tmp}/${libsubdir}" - break; - fi - done - fi - - dnl overwrite ld flags if we have required special directory with - dnl --with-boost-libdir parameter - if test "$ac_boost_lib_path" != ""; then - OPM_BOOST_LDFLAGS="-L$ac_boost_lib_path" - OPM_BOOST_LIBDIR="${ac_boost_lib_path}" - fi - - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - AC_REQUIRE([AC_PROG_CXX]) - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - - - - dnl if we found no boost with system layout we search for boost libraries - dnl built and installed without the --layout=system option or for a staged(not installed) version - if test "x$succeeded" != "xyes"; then - _version=0 - if test "$ac_boost_path" != ""; then - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - fi - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - OPM_BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" - done - fi - else - if test "$cross_compiling" != yes; then - for ac_boost_path in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - best_path=$ac_boost_path - fi - done - fi - done - - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - OPM_BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" - if test "$ac_boost_lib_path" = ""; then - for libsubdir in $libsubdirs ; do - if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - OPM_BOOST_LDFLAGS="-L$best_path/$libsubdir" - OPM_BOOST_LIBDIR="$best_path/$libsubdir" - fi - fi - - if test "x$BOOST_ROOT" != "x"; then - for libsubdir in $libsubdirs ; do - if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then - version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` - stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` - stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` - V_CHECK=`expr $stage_version_shorten \>\= $_version` - if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then - AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) - OPM_BOOST_CPPFLAGS="-I$BOOST_ROOT" - OPM_BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" - OPM_BOOST_LIBDIR="$BOOST_ROOT/stage/$libsubdir" - fi - fi - fi - fi - - CPPFLAGS="$CPPFLAGS $OPM_BOOST_CPPFLAGS" - export CPPFLAGS - LDFLAGS="$LDFLAGS $OPM_BOOST_LDFLAGS" - export LDFLAGS - - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - fi - - if test "$succeeded" != "yes" ; then - if test "$_version" = "0" ; then - AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) - else - AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) - fi - # execute ACTION-IF-NOT-FOUND (if present): - ifelse([$3], , :, [$3]) - AC_DEFINE([OPM_HAVE_BOOST], [0],dnl - [Define to `0' if the Boost library is not available]) - else - AC_SUBST([OPM_BOOST_CPPFLAGS]) - AC_SUBST([OPM_BOOST_LDFLAGS]) - AC_SUBST([OPM_BOOST_LIBDIR]) - AC_DEFINE([OPM_HAVE_BOOST], [1], [define if the Boost library is available]) - # execute ACTION-IF-FOUND (if present): - ifelse([$2], , :, [$2]) - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" -fi - -]) diff --git a/m4/opm_core.m4 b/m4/opm_core.m4 index a5b24a0c..7f82cf5f 100644 --- a/m4/opm_core.m4 +++ b/m4/opm_core.m4 @@ -1,71 +1,12 @@ dnl -*- autoconf -*- - # Macros needed to find OPM-core and dependent libraries. They are called by -# the macros in ${top_src_dir}/dependencies.m4, which is generated by -# "dunecontrol autogen" -AC_DEFUN([OPM_CORE_CHECKS], -[ -# Language features -GXX0X -STATIC_ASSERT_CHECK -NULLPTR_CHECK - -# Checks for libraries. - -# Bring in numerics support (standard library component) -AC_SEARCH_LIBS([sqrt], [m]) - -OPM_LAPACK - -OPM_BOOST_BASE([1.37]) -AX_BOOST_SYSTEM -AX_BOOST_DATE_TIME -AX_BOOST_FILESYSTEM -AX_BOOST_UNIT_TEST_FRAMEWORK -AX_DUNE_ISTL -OPM_PATH_SUPERLU -OPM_AGMG - -# Checks for header files. -AC_CHECK_HEADERS([float.h limits.h stddef.h stdlib.h string.h]) - -AC_CHECK_HEADERS([suitesparse/umfpack.h], - [umfpack_header=yes], - [umfpack_header=no]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_TYPE_SIZE_T -AC_CHECK_TYPES([ptrdiff_t]) - -# Checks for library functions. -AC_CHECK_FUNCS([floor memset memmove strchr strtol sqrt pow]) -AC_FUNC_STRTOD - -# Search for UMFPACK direct sparse solver. -AC_SEARCH_LIBS([amd_free], [amd]) -AC_SEARCH_LIBS([camd_free], [camd]) -AC_SEARCH_LIBS([colamd_set_defaults], [colamd]) -AC_SEARCH_LIBS([ccolamd_set_defaults], [ccolamd]) -AC_SEARCH_LIBS([cholmod_l_start], [cholmod]) -AC_SEARCH_LIBS([umfpack_dl_solve], [umfpack],dnl - [umfpack_lib=yes], [umfpack_lib=no]) - -AM_CONDITIONAL([UMFPACK], - [test "x$umfpack_header" != "xno" -a "x$umfpack_lib" != "xno"]) - -m4_ifdef([AM_COND_IF], -[AM_COND_IF([UMFPACK], [], - [AC_MSG_NOTICE([Found no working installation of UMFPACK. - UMFPACK support is disabled.])]) -]) - -]) - -# Additional checks needed to find eWoms -# This macro should be invoked by every module which depends on dumux, but -# not by dumux itself +dnl locate opm-core library itself; this macro is called by every module +dnl that depends on opm-core. AC_DEFUN([OPM_CORE_CHECK_MODULE], [ - OPM_CORE_CHECK_MODULES([opm-core],[opm/core/grid.h],[create_grid_empty()]) + OPM_CHECK_PKG_MODULE([opm-core],[1.0],[OPM Core Library]) ]) + +dnl find all prerequisites of opm-core; nothing to do here since this +dnl is done by the CMake module and then stored in the -config file. +AC_DEFUN([OPM_CORE_CHECKS],[]) diff --git a/m4/opm_core_check_modules.m4 b/m4/opm_core_check_modules.m4 deleted file mode 100644 index 1f7cf878..00000000 --- a/m4/opm_core_check_modules.m4 +++ /dev/null @@ -1,281 +0,0 @@ -dnl -*- autoconf -*- - -# OPM_CORE_CHECK_MODULES(NAME, HEADER, SYMBOL) -# -# THIS MACRO IS JUST A COPY OF DUNE_CHECK_MODULES WITH THE REQUIREMENT -# THAT ALL HEADERS MUST RESIDE IN $MODULE_ROOT/dune REMOVED. REMOVE -# THIS MACRO AS SOON AS DUNE DOES NOT ENFORCE THIS ANYMORE. -# -# Generic check for dune modules. This macro should not be used directly, but -# in the modules m4/{module}.m4 in the {MODULE}_CHECK_MODULE macro. The -# {MODULE}_CHECK_MODULE macro knows the parameters to call this -# DUNE_CHECK_MODULES macro with, and it does not take any parameters itself, -# so it may be used with AC_REQUIRE. -# -# NAME Name of the module, lowercase with dashes (like "dune-common"). The -# value must be known when autoconf runs, so shell variables in the -# value are not permissible. -# -# HEADER Header to check for. The check will really be for , -# so the header must reside within a directory called "dune". -# -# SYMBOL Symbol to check for in the module's library. If this argument is -# empty or missing, it is assumed that the module does not provide a -# library. The value must be known when autoconf runs, so shell -# variables in the value are not permissible. This value is actually -# handed to AC_TRY_LINK unchanged as the FUNCTION-BODY argument, so it -# may contain more complex stuff than a simple symbol. -# -# The name of the library is assumed to be the same as the module name, -# with any occurance of "-" removed. The path of the library is -# obtained from pkgconfig for installed modules, or assumed to be the -# directory "lib" within the modules root for non-installed modules. -# -# In the following, {module} is {NAME} with any "-" replaced by "_" and -# {MODULE} is the uppercase version of {module}. -# -# configure options: -# --with-{NAME} -# -# configure/shell variables: -# {MODULE}_ROOT, {MODULE}_LIBDIR -# HAVE_{MODULE} (1 or 0) -# with_{module} ("yes" or "no") -# DUNE_CPPFLAGS, DUNE_LDFLAGS, DUNE_LIBS (adds the modules values here, -# substitution done by DUNE_CHECK_ALL) -# ALL_PKG_CPPFLAGS, ALL_PKG_LDFLAGS, ALL_PKG_LIBS (adds the modules values -# here, substitution done by DUNE_CHECK_ALL) -# {MODULE}_VERSION -# {MODULE}_VERSION_MAJOR -# {MODULE}_VERSION_MINOR -# {MODULE}_VERSION_REVISION -# -# configure substitutions/makefile variables: -# {MODULE}_CPPFLAGS, {MODULE}_LDFLAGS, {MODULE}_LIBS -# {MODULE}_ROOT -# {MODULE}_LIBDIR (only if modules provides a library) -# -# preprocessor defines: -# HAVE_{MODULE} (1 or undefined) -# {MODULE}_VERSION -# {MODULE}_VERSION_MAJOR -# {MODULE}_VERSION_MINOR -# {MODULE}_VERSION_REVISION -# -# automake conditionals: -# HAVE_{MODULE} -AC_DEFUN([OPM_CORE_CHECK_MODULES],[ - AC_REQUIRE([AC_PROG_CXX]) - AC_REQUIRE([AC_PROG_CXXCPP]) - AC_REQUIRE([PKG_PROG_PKG_CONFIG]) - AC_REQUIRE([DUNE_DISABLE_LIBCHECK]) - AC_REQUIRE([LT_OUTPUT]) - - # ____DUNE_CHECK_MODULES_____ ($1) - - m4_pushdef([_dune_name], [$1]) - m4_pushdef([_dune_module], [m4_translit(_dune_name, [-], [_])]) - m4_pushdef([_dune_header], [$2]) - m4_pushdef([_dune_ldpath], [lib]) - m4_pushdef([_dune_lib], [m4_translit(_dune_name, [-], [])]) - m4_pushdef([_dune_symbol], [$3]) - m4_pushdef([_DUNE_MODULE], [m4_toupper(_dune_module)]) - - # switch tests to c++ - AC_LANG_PUSH([C++]) - - # the usual option... - AC_ARG_WITH(_dune_name, - AS_HELP_STRING([--with-_dune_name=PATH],[_dune_module directory])) - - # backup of flags - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LIBS="$LIBS" - ac_save_LDFLAGS="$LDFLAGS" - CPPFLAGS="" - LIBS="" - - ## - ## Where is the module $1? - ## - - AC_MSG_CHECKING([for $1 installation or source tree]) - - # is a directory set? - AS_IF([test -z "$with_[]_dune_module"],[ - # - # search module $1 via pkg-config - # - with_[]_dune_module="global installation" - AS_IF([test -z "$PKG_CONFIG"],[ - AC_MSG_RESULT([failed]) - AC_MSG_NOTICE([could not search for module _dune_name]) - AC_MSG_ERROR([pkg-config is required for using installed modules]) - ]) - AS_IF(AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]),[ - _dune_cm_CPPFLAGS="`$PKG_CONFIG --cflags _dune_name`" 2>/dev/null - _DUNE_MODULE[]_ROOT="`$PKG_CONFIG --variable=prefix _dune_name`" 2>/dev/null - _DUNE_MODULE[]_VERSION="`$PKG_CONFIG --modversion _dune_name`" 2>/dev/null - _dune_cm_LDFLAGS="" - ifelse(_dune_symbol,, - [_DUNE_MODULE[]_LIBDIR="" - _dune_cm_LIBS=""], - [_DUNE_MODULE[]_LIBDIR=`$PKG_CONFIG --variable=libdir _dune_name 2>/dev/null` - _dune_cm_LIBS="-L$_DUNE_MODULE[]_LIBDIR -l[]_dune_lib"]) - HAVE_[]_DUNE_MODULE=1 - AC_MSG_RESULT([global installation in $_DUNE_MODULE[]_ROOT]) - ],[ - HAVE_[]_DUNE_MODULE=0 - AC_MSG_RESULT([not found]) - ]) - ],[ - # - # path for module $1 is specified via command line - # - AS_IF([test -d "$with_[]_dune_module"],[ - # expand tilde / other stuff - _DUNE_MODULE[]_ROOT=`cd $with_[]_dune_module && pwd` - - # expand search path (otherwise empty CPPFLAGS) - AS_IF([test -d "$_DUNE_MODULE[]_ROOT/include/dune"],[ - # Dune was installed into directory given by with-dunecommon - _dune_cm_CPPFLAGS="-I$_DUNE_MODULE[]_ROOT/include" - _DUNE_MODULE[]_BUILDDIR=_DUNE_MODULE[]_ROOT - _DUNE_MODULE[]_VERSION="`PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$_DUNE_MODULE[]_ROOT/lib/pkgconfig $PKG_CONFIG --modversion _dune_name`" 2>/dev/null - ],[ - _DUNE_MODULE[]_SRCDIR=$_DUNE_MODULE[]_ROOT - # extract src and build path from Makefile, if found - AS_IF([test -f $_DUNE_MODULE[]_ROOT/Makefile],[ - _DUNE_MODULE[]_SRCDIR="`sed -ne '/^abs_top_srcdir = /{s/^abs_top_srcdir = //; p;}' $_DUNE_MODULE[]_ROOT/Makefile`" - ]) - _dune_cm_CPPFLAGS="-I$_DUNE_MODULE[]_SRCDIR" - _DUNE_MODULE[]_VERSION="`grep Version $_DUNE_MODULE[]_SRCDIR/dune.module | sed -e 's/^Version: *//'`" 2>/dev/null - ]) - _dune_cm_LDFLAGS="" - ifelse(_dune_symbol,, - [_DUNE_MODULE[]_LIBDIR="" - _dune_cm_LIBS=""], - [_DUNE_MODULE[]_LIBDIR="$_DUNE_MODULE[]_ROOT/lib" - _dune_cm_LIBS="-L$_DUNE_MODULE[]_LIBDIR -l[]_dune_lib"]) - # set expanded module path - with_[]_dune_module="$_DUNE_MODULE[]_ROOT" - HAVE_[]_DUNE_MODULE=1 - AC_MSG_RESULT([found in $_DUNE_MODULE[]_ROOT]) - ],[ - HAVE_[]_DUNE_MODULE=0 - AC_MSG_RESULT([not found]) - AC_MSG_ERROR([_dune_name-directory $with_[]_dune_module does not exist]) - ]) - ]) - - CPPFLAGS="$ac_save_CPPFLAGS $DUNE_CPPFLAGS $_dune_cm_CPPFLAGS" - ## - ## check for an arbitrary header - ## - AS_IF([test "$HAVE_[]_DUNE_MODULE" != "1"],[ - AC_CHECK_HEADER([[]_dune_header], - [HAVE_[]_DUNE_MODULE=1], [HAVE_[]_DUNE_MODULE=0]) - ]) - - AS_IF([test "$HAVE_[]_DUNE_MODULE" != "1"],[ - AC_MSG_WARN([$_DUNE_MODULE[]_ROOT does not seem to contain a valid _dune_name (dune/[]_dune_header not found)]) - ]) - - ## - ## check for lib (if lib name was provided) - ## - ifelse(_dune_symbol,, - AC_MSG_NOTICE([_dune_name does not provide libs]), - - AS_IF([test "x$enable_dunelibcheck" = "xno"],[ - AC_MSG_WARN([library check for _dune_name is disabled. DANGEROUS!]) - ],[ - AS_IF([test "x$HAVE_[]_DUNE_MODULE" = "x1"],[ - - # save current LDFLAGS - ac_save_CXX="$CXX" - HAVE_[]_DUNE_MODULE=0 - - # define LTCXXLINK like it will be defined in the Makefile - CXX="./libtool --tag=CXX --mode=link $ac_save_CXX" - - # use module LDFLAGS - LDFLAGS="$ac_save_LDFLAGS $DUNE_LDFLAGS $_dune_cm_LDFLAGS" - LIBS="$_dune_cm_LIBS $DUNE_LIBS $LIBS" - - AC_MSG_CHECKING([for lib[]_dune_lib]) - - AC_TRY_LINK(dnl - [#]include<_dune_header>, - _dune_symbol, - [ - AC_MSG_RESULT([yes]) - HAVE_[]_DUNE_MODULE=1 - ],[ - AC_MSG_RESULT([no]) - HAVE_[]_DUNE_MODULE=0 - AS_IF([test -n "$_DUNE_MODULE[]_ROOT"],[ - AC_MSG_WARN([$with_[]_dune_module does not seem to contain a valid _dune_name (failed to link with lib[]_dune_lib[].la)]) - ]) - ] - ) - ]) - - # reset variables - CXX="$ac_save_CXX" - ]) - ) - - # did we succeed? - AS_IF([test "x$HAVE_[]_DUNE_MODULE" = "x1"],[ - # add the module's own flags and libs to the modules and the global - # variables - DUNE_ADD_MODULE_DEPS(m4_defn([_dune_name]), m4_defn([_dune_name]), - [$_dune_cm_CPPFLAGS], [$_dune_cm_LDFLAGS], [$_dune_cm_LIBS]) - - # set variables for our modules - AC_SUBST(_DUNE_MODULE[]_CPPFLAGS, "$_DUNE_MODULE[]_CPPFLAGS") - AC_SUBST(_DUNE_MODULE[]_LDFLAGS, "$_DUNE_MODULE[]_LDFLAGS") - AC_SUBST(_DUNE_MODULE[]_LIBS, "$_DUNE_MODULE[]_LIBS") - AC_SUBST(_DUNE_MODULE[]_ROOT, "$_DUNE_MODULE[]_ROOT") - ifelse(m4_defn([_dune_symbol]),, - [], - [AC_SUBST(_DUNE_MODULE[]_LIBDIR) - ]) - AC_DEFINE(HAVE_[]_DUNE_MODULE, 1, [Define to 1 if] _dune_name [was found]) - - DUNE_PARSE_MODULE_VERSION(_dune_name, $_DUNE_MODULE[]_VERSION) - - # set DUNE_* variables - # This should actually be unneccesary, but I'm keeping it in here for now - # for backward compatibility - DUNE_LDFLAGS="$DUNE_LDFLAGS $_DUNE_MODULE[]_LDFLAGS" - DUNE_LIBS="$_DUNE_MODULE[]_LIBS $DUNE_LIBS" - - with_[]_dune_module="yes" - ],[ - with_[]_dune_module="no" - ]) - - AM_CONDITIONAL(HAVE_[]_DUNE_MODULE, test x$HAVE_[]_DUNE_MODULE = x1) - - # reset previous flags - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$ac_save_LIBS" - - # add this module to DUNE_SUMMARY - DUNE_MODULE_ADD_SUMMARY_ENTRY(_dune_name) - - # remove local variables - m4_popdef([_dune_name]) - m4_popdef([_dune_module]) - m4_popdef([_dune_header]) - m4_popdef([_dune_ldpath]) - m4_popdef([_dune_lib]) - m4_popdef([_dune_symbol]) - m4_popdef([_DUNE_MODULE]) - - # restore previous language settings (leave C++) - AC_LANG_POP([C++]) -]) diff --git a/m4/opm_dynlink_boost_test.m4 b/m4/opm_dynlink_boost_test.m4 deleted file mode 100644 index 7005b552..00000000 --- a/m4/opm_dynlink_boost_test.m4 +++ /dev/null @@ -1,80 +0,0 @@ -# _OPM_DYNLINK_BOOST_TEST_SRC(Symbol) -# Generate source text for use in AC_LINK_IFELSE when determining -# how to link the Boost.Test library. -# -# Note: -# We use AC_LANG_SOURCE rather than AC_LANG_PROGRAM to avoid -# multiple definitions of "main()" (defined by both the UTF -# *and* the AC_LANG_PROGRAM macro). -AC_DEFUN([_OPM_DYNLINK_BOOST_TEST_SRC], -[AC_LANG_SOURCE( -[[$1 -#define BOOST_TEST_MODULE OPM_DYNLINK_TEST -#include - -int f(int x) { return 2 * x; } - -BOOST_AUTO_TEST_CASE(DynlinkConfigureTest) { - BOOST_CHECK_MESSAGE(f(2) == 4, - "Apparently, multiplication doesn't " - "work: f(2) = " << f(2)); -} -]]dnl -)[]dnl -]) - -dnl ------------------------------------------------------------------- - -# OPM_DYNLINK_BOOST_TEST -# Determine how to link (or compile+link) tests based on the UTF. -# -# If the system uses dynamic linking, then all tests need to -# -# #define BOOST_TEST_DYN_LINK -# -# Otherwise, this symbol must *not* be #define'd. -# -# Macro defines the symbol HAVE_DYNAMIC_BOOST_TEST (to 1) if the -# system uses dynamic linking of Boost.Test . -AC_DEFUN([OPM_DYNLINK_BOOST_TEST], -[ -AC_REQUIRE([OPM_BOOST_BASE]) -AC_REQUIRE([AX_BOOST_UNIT_TEST_FRAMEWORK]) - -_opm_LIBS_SAVE="${LIBS}" -_opm_CPPFLAGS_SAVE="${CPPFLAGS}" - -LIBS="${OPM_BOOST_LDFLAGS} ${BOOST_UNIT_TEST_FRAMEWORK_LIB} ${LIBS}" -CPPFLAGS="${OPM_BOOST_CPPFLAGS} ${CPPFLAGS}" - -AC_LANG_PUSH([C++]) - -AC_CACHE_CHECK([if the Boost.Test library can be linked statically],dnl -[opm_cv_boost_link_static],dnl -[AC_LINK_IFELSE([_OPM_DYNLINK_BOOST_TEST_SRC([])], - [opm_cv_boost_link_static=yes],dnl - [opm_cv_boost_link_static=no])[]dnl -])[]dnl - -AC_CACHE_CHECK([if the Boost.Test library can be linked dynamically],dnl -[opm_cv_boost_link_dynamic],dnl -[AC_LINK_IFELSE([_OPM_DYNLINK_BOOST_TEST_SRC(dnl -[#define BOOST_TEST_DYN_LINK])], - [opm_cv_boost_link_dynamic=yes],dnl - [opm_cv_boost_link_dynamic=no])[]dnl -])[]dnl - -AC_LANG_POP([C++]) - -LIBS="${_opm_LIBS_SAVE}" -CPPFLAGS="${_opm_CPPFLAGS_SAVE}" - -AS_IF([test x"${opm_cv_boost_link_static}" = x"yes" -o \ - x"${opm_cv_boost_link_dynamic}" = x"yes"], -[AS_IF([test x"${opm_cv_boost_link_dynamic}" = x"yes"], - [AC_DEFINE([HAVE_DYNAMIC_BOOST_TEST], [1], - [Define to `1' if Boost.Test should use BOOST_TEST_DYN_LINK])] - [:])[]dnl -],dnl -[AC_MSG_NOTICE([Boost.Test is not supported on this system])]) -])[]dnl diff --git a/m4/opm_lapack.m4 b/m4/opm_lapack.m4 deleted file mode 100644 index 083ecf0b..00000000 --- a/m4/opm_lapack.m4 +++ /dev/null @@ -1,7 +0,0 @@ -AC_DEFUN([OPM_LAPACK], -[AC_REQUIRE([AC_F77_WRAPPERS])dnl - AC_REQUIRE([AX_LAPACK])dnl - if test x"$ax_lapack_ok" != xyes; then - AC_MSG_ERROR([BLAS/LAPACK required, but not found.]) - fi -])[]dnl diff --git a/m4/opm_superlu.m4 b/m4/opm_superlu.m4 deleted file mode 100644 index edd887c0..00000000 --- a/m4/opm_superlu.m4 +++ /dev/null @@ -1,338 +0,0 @@ -## -*- autoconf -*- -# $Id: superlu.m4 5908 2010-02-23 16:46:05Z joe $ -# searches for SuperLU headers and libs - -# _slu_lib_path(SUPERLU_ROOT, HEADER) -# -# Try to find the subpath unter SUPERLU_ROOT containing HEADER. Try -# SUPERLU_ROOT/"include/superlu", SUPERLU_ROOT/"include", and -# SUPERLU_ROOT/"SRC", in that order. Set the subpath for the library to -# "lib". If HEADER was found in SUPERLU_ROOT/"SRC", check whether -# SUPERLU_ROOT/"lib" is a directory, and set the subpath for the library to -# the empty string "" if it isn't. -# -# Shell variables: -# my_include_path -# The subpath HEADER was found in: "include/superlu", "include", or -# "SRC". Contents is only meaningful for my_slu_found=yes. -# my_lib_path -# The subpath for the library: "lib" or "". Contents is only meaningful -# for my_slu_found=yes. -# my_slu_found -# Whether HEADER was found at all. Either "yes" or "no". -AC_DEFUN([_opm_slu_lib_path], - [ - my_include_path=include/superlu - my_lib_path=lib - my_slu_found=yes - if test ! -f "$1/$my_include_path/$2" ; then - #Try to find headers under superlu - my_include_path=include - if test ! -f "$1/$my_include_path/$2" ; then - my_include_path=SRC - if test ! -f "$1/$my_include_path/$2"; then - my_slu_found=no - else - if ! test -d "$1/$my_lib_path"; then - my_lib_path="" - fi - fi - fi - fi - ] -) - -# _slu_search_versions(SUPERLU_ROOT) -# -# Search for either "slu_ddefs.h" or "dsp_defs.h" using _slu_lib_path(). -# -# Shell variables: -# my_slu_header -# The name of the header that was found: first of "slu_ddefs.h" or -# "dsp_defs.h". Contents is only meaningful for my_slu_found=yes. -# my_include_path -# The subpath the header was found in: "include/superlu", "include", or -# "SRC". Contents is only meaningful for my_slu_found=yes. -# my_lib_path -# The subpath for the library: "lib" or "". Contents is only meaningful -# for my_slu_found=yes. -# my_slu_found -# Whether any of the headers. Either "yes" or "no". -AC_DEFUN([_opm_slu_search_versions], - [ - my_slu_header=slu_ddefs.h - _opm_slu_lib_path($1, $my_slu_header) - if test "$my_slu_found" != "yes"; then - my_slu_header="dsp_defs.h" - _opm_slu_lib_path($1, $my_slu_header) - fi - ] -) - - -# _slu_search_default() -# -# Search for SuperLU in the default locations "/usr" and "/usr/local". -# -# Shell variables: -# with_superlu -# Root of the SuperLU installation: first of "/usr" and "/usr/local". -# Contents is only meaningful for my_slu_found=yes. -# For other output variables see documentation of _slu_search_versions(). -AC_DEFUN([_opm_slu_search_default], - [ - opm_with_superlu=/usr - _opm_slu_search_versions($opm_with_superlu) - - if test "$my_slu_found" = "no"; then - opm_with_superlu=/usr/local - _opm_slu_search_versions($opm_with_superlu) - fi - ] -) - - -# OPM_PATH_SUPERLU() -# -# REQUIRES: AC_PROG_CC, AX_BLAS -# -# Shell variables: -# with_superlu -# "no", "yes (version 4.3 or newer)", "yes (version 4.2 or older, post 2005)" or "yes (pre 2005)" -# direct_SUPERLU_CPPFLAGS -# direct_SUPERLU_LIBS -# CPPFLAGS and LIBS necessary to link against SuperLU. This variable -# contains no indirect references and is suitable for use inside -# configure. Guaranteed empty if SuperLU was not found. -# SUPERLU_CPPFLAGS -# SUPERLU_LIBS -# CPPFLAGS and LIBS necessary to link against SuperLU. This variable may -# contain indirect references and is suitable for use inside makefiles. -# Guaranteed empty if SuperLU was not found. -# HAVE_SUPERLU -# "0" or "1" depending on whether SuperLU was found. -# -# Substitutions: -# SUPERLU_LIBS -# SUPERLU_CPPFLAGS -# Substitutes the values of the corresponding shell variables. -# ALL_PKG_LIBS -# ALL_PKG_CPPFLAGS -# Adds references to SuperLU's substitutions. -# -# Defines: -# HAVE_SUPERLU -# ENABLE_SUPERLU or undefined. Whether SuperLU was found. The correct -# way to check this is "#if HAVE_SUPERLU": This way SuperLU features will -# be disabled unless $(SUPERLU_CPPFLAGS) was given when compiling. -# SUPERLU_POST_2005_VERSION -# 1 or undefined. A post-2005 version of SuperLU uses the header -# "slu_ddefs.h" while earlier versions use "dsp_defs.h". -# SUPERLU_MIN_VERSION_4_3 -# 1 or undefined. SuperLU version 4.3 or newer uses the symbol -# "SLU_DOUBLE" while earlier versions use "DOUBLE". -# HAVE_MEM_USAGE_T_EXPANSIONS -# 1 or undefined. Whether "mem_usage_t.expansions" was found in -# "slu_ddefs.h" or "dsp_defs.h" as apropriate. -# -# Conditionals: -# SUPERLU -AC_DEFUN([OPM_PATH_SUPERLU],[ - AC_REQUIRE([AC_PROG_CC]) - # we need this for FLIBS - AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) - AC_REQUIRE([AX_BLAS]) - - if test x$HAVE_SUPERLU = x1 ; then - AC_MSG_WARN([SuperLU test was already performed. Skipping it here]) - else - # - # User hints ... - # - my_lib_path="" - my_include_path="" - AC_ARG_WITH([superlu], - [AC_HELP_STRING([--with-superlu],[user defined path to SuperLU library])], - [dnl - if test x"$withval" != xno ; then - # get absolute path - if test x"$withval" = xyes; then - # Search in default locations - _opm_slu_search_default - else - opm_with_superlu=`eval cd $withval > /dev/null 2>&1 && pwd` - # Search for the headers in the specified location - _opm_slu_search_versions(["$opm_with_superlu"]) - fi - fi - ], [dnl - # Search in default locations - _opm_slu_search_default - ]) - - AC_ARG_WITH([superlu-lib], - [AC_HELP_STRING([--with-superlu-lib], - [The name of the static SuperLU library to link to. By default - the static library with the name superlu.a is tried, but - only if shared linking has failed first. Giving this - options forces static linking for SuperLU.])], - [ - if test x"$withval" = xno ; then - with_superlu_lib= - fi - ]) - - AC_ARG_WITH([superlu-blaslib], - [AC_HELP_STRING([--with-superlu-blaslib], - [The name of the static blas library to link to. By default - we try to link to the systems blas library (see - --with-blas). Giving this options forces static linking - for SuperLU.])], - [ - if test "$withval" = no ; then - with_superlu_blaslib= - fi - ]) - - # store old values - ac_save_LDFLAGS="$LDFLAGS" - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LIBS="$LIBS" - - # do nothing if --without-superlu is used - if test x"$opm_with_superlu" != x"no" ; then - # defaultpath - SUPERLU_LIB_PATH="$opm_with_superlu/$my_lib_path" - SUPERLU_INCLUDE_PATH="$opm_with_superlu/$my_include_path" - - # set variables so that tests can use them - direct_SUPERLU_CPPFLAGS="-I$SUPERLU_INCLUDE_PATH -DENABLE_SUPERLU" - SUPERLU_CPPFLAGS="-I$SUPERLU_INCLUDE_PATH -DENABLE_SUPERLU" - CPPFLAGS="$CPPFLAGS $direct_SUPERLU_CPPFLAGS" - - # check for central header - AC_CHECK_HEADER([$my_slu_header], - [HAVE_SUPERLU="1"], - [ - HAVE_SUPERLU="0" - AC_MSG_WARN([$my_slu_header not found in $SUPERLU_INCLUDE_PATH with $CPPFLAGS]) - ]) - - # if header is found check for the libs - if test x$HAVE_SUPERLU = x1 ; then - HAVE_SUPERLU=0 - - # if neither --with-superlu-lib nor --with-superlu-blaslib was - # given, try to link dynamically or with properly names static libs - if test x"$with_superlu_lib$with_superlu_blaslib" = x; then - LDFLAGS="$ac_save_LDFLAGS -L$SUPERLU_LIB_PATH" - LIBS="$ac_save_LIBS" - AC_CHECK_LIB([superlu], [dgssvx], - [ - direct_SUPERLU_LIBS="-L$SUPERLU_LIB_PATH -lsuperlu $BLAS_LIBS $FLIBS" - SUPERLU_LIBS="-L$SUPERLU_LIB_PATH -lsuperlu $BLAS_LIBS $FLIBS" - HAVE_SUPERLU="1" - ], [], [$BLAS_LIBS $FLIBS]) - fi - - if test $HAVE_SUPERLU = 0 && test x"$with_superlu_lib" = x; then - # set the default - with_superlu_lib=superlu.a - fi - - if test $HAVE_SUPERLU = 0 && - test x"$with_superlu_blaslib" = x; then - # try system blas - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $BLAS_LIBS $FLIBS $ac_save_LIBS" - AC_CHECK_FUNC([dgssvx], - [ - direct_SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $BLAS_LIBS $FLIBS" - SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $BLAS_LIBS $FLIBS" - HAVE_SUPERLU="1" - ]) - fi - - # No default for with_superlu_blaslib - - if test $HAVE_SUPERLU = 0 && - test x"$with_superlu_blaslib" != x; then - # try internal blas - LDFLAGS="$ac_save_LDFLAGS" - LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib $FLIBS $ac_save_LIBS" - AC_CHECK_FUNC([dgssvx], - [ - direct_SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib $FLIBS" - SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib $FLIBS" - HAVE_SUPERLU="1" - ]) - fi - - # test whether SuperLU version is at least 4.3 - if test $HAVE_SUPERLU = "1" ; then - AC_CHECK_DECL([SLU_DOUBLE], [SUPERLU_MIN_VERSION_4_3="1"], [], [#include <$my_slu_header>]) - fi - fi - - else # $opm_with_superlu = no - HAVE_SUPERLU=0 - fi - - # Inform the user whether SuperLU was sucessfully found - AC_MSG_CHECKING([SuperLU]) - if test x$HAVE_SUPERLU = x1 ; then - if test "$my_slu_header" = "slu_ddefs.h"; then - if test x$SUPERLU_MIN_VERSION_4_3 = x1 ; then - with_superlu="yes (version 4.3 or newer)" - else - with_superlu="yes (version 4.2 or older, post 2005)" - fi - else - with_superlu="yes (pre 2005)" - fi - else - with_superlu="no" - fi - AC_MSG_RESULT([$with_superlu]) - - # check for optional member - if test $HAVE_SUPERLU = 1 ; then - if test "$my_slu_header" = "slu_ddefs.h"; then - AC_CHECK_MEMBERS([mem_usage_t.expansions],[],[],[#include "slu_ddefs.h"]) - else - AC_CHECK_MEMBERS([mem_usage_t.expansions],[],[],[#include "dsp_defs.h"]) - fi - fi - - # substitute variables - if test x$HAVE_SUPERLU = x0 ; then - SUPERLU_LIBS= - SUPERLU_CPPFLAGS= - fi - AC_SUBST([SUPERLU_LIBS]) - AC_SUBST([SUPERLU_CPPFLAGS]) - #DUNE_ADD_ALL_PKG([SUPERLU], [\$(SUPERLU_CPPFLAGS)], [], [\$(SUPERLU_LIBS)]) - - # tell automake - AM_CONDITIONAL(SUPERLU, test x$HAVE_SUPERLU = x1) - - # tell the preprocessor - if test x$HAVE_SUPERLU = x1 ; then - AC_DEFINE([HAVE_SUPERLU], [ENABLE_SUPERLU], [Define to ENABLE_SUPERLU if SUPERLU is found]) - if test "$my_slu_header" = "slu_ddefs.h"; then - AC_DEFINE([SUPERLU_POST_2005_VERSION], 1, [define to 1 if there is a header slu_ddefs.h in SuperLU]) - if test x$SUPERLU_MIN_VERSION_4_3 = x1 ; then - AC_DEFINE([SUPERLU_MIN_VERSION_4_3], 1, [define to 1 if there SLU_DOUBLE imported by header slu_ddefs.h from SuperLU]) - fi - fi - fi - - # summary - #DUNE_ADD_SUMMARY_ENTRY([SuperLU],[$with_superlu]) - - # restore variables - LDFLAGS="$ac_save_LDFLAGS" - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - fi -]) diff --git a/opm/core/io/eclipse/EclipseGridParser.cpp b/opm/core/io/eclipse/EclipseGridParser.cpp index ed4b246c..71cd090d 100644 --- a/opm/core/io/eclipse/EclipseGridParser.cpp +++ b/opm/core/io/eclipse/EclipseGridParser.cpp @@ -558,13 +558,15 @@ void EclipseGridParser::convertToSI() key == "LAMEMOD" || key == "SHEARMOD" || key == "POISSONMOD" || key == "PWAVEMOD" || key == "MULTPV" || key == "PWAVEMOD" || key == "SGAS" || key == "SWAT" || key == "SOIL" || - key == "RS" || key == "SWCR" || key == "SWL" || + key == "SWCR" || key == "SWL" || key == "SWU" || key == "SOWCR" || key == "KRW" || key == "KRWR" || key == "KRORW" || key == "KRO") { unit = 1.0; do_convert = false; // Dimensionless keywords... } else if (key == "PRESSURE") { unit = units_.pressure; + } else if (key == "RS") { + unit = units_.gasvol_s / units_.liqvol_s; } else if (key == "MAPAXES") { MESSAGE("Not applying units to MAPAXES yet!"); unit = 1.0; diff --git a/opm/core/pressure/CompressibleTpfa.cpp b/opm/core/pressure/CompressibleTpfa.cpp index 3dcb2044..43639902 100644 --- a/opm/core/pressure/CompressibleTpfa.cpp +++ b/opm/core/pressure/CompressibleTpfa.cpp @@ -429,7 +429,7 @@ namespace Opm for (int phase = 0; phase < np; ++phase) { int upwindc = -1; if (c[0] >=0 && c[1] >= 0) { - upwindc = (pot[0] < pot[1]) ? c[1] : c[0]; + upwindc = (pot[0][phase] < pot[1][phase]) ? c[1] : c[0]; } else { upwindc = (c[0] >= 0) ? c[0] : c[1]; } diff --git a/opm/core/props/pvt/SinglePvtConstCompr.hpp b/opm/core/props/pvt/SinglePvtConstCompr.hpp index dc20b4fd..7a2c6718 100644 --- a/opm/core/props/pvt/SinglePvtConstCompr.hpp +++ b/opm/core/props/pvt/SinglePvtConstCompr.hpp @@ -31,8 +31,10 @@ namespace Opm { /// Class for constant compressible phases (PVTW or PVCDO). - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. class SinglePvtConstCompr : public SinglePvtInterface @@ -83,6 +85,29 @@ namespace Opm } } + virtual void mu(const int n, + const double* p, + const double* /*r*/, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const + { + if (visc_comp_) { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + // Computing a polynomial approximation to the exponential. + double x = -visc_comp_*(p[i] - ref_press_); + double d = (1.0 + x + 0.5*x*x); + output_mu[i] = viscosity_/d; + output_dmudp[i] = (viscosity_/(d*d))*(1+x) * visc_comp_; + } + } else { + std::fill(output_mu, output_mu + n, viscosity_); + std::fill(output_dmudp, output_dmudp + n, 0.0); + } + std::fill(output_dmudr, output_dmudr + n, 0.0); + } + virtual void B(const int n, const double* p, const double* /*z*/, @@ -120,6 +145,43 @@ namespace Opm } } + virtual void b(const int n, + const double* p, + const double* /*r*/, + double* output_b, + double* output_dbdp, + double* output_dbdr) const + { + if (comp_) { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + // Computing a polynomial approximation to the exponential. + double x = comp_*(p[i] - ref_press_); + double d = (1.0 + x + 0.5*x*x); + + // b = 1/B = d/ref_B_B; + output_b[i] = d/ref_B_; + output_dbdp[i] = (1 + x) * comp_/ref_B_; + } + } else { + + std::fill(output_b, output_b + n, 1/ref_B_); + std::fill(output_dbdp, output_dbdp + n, 0.0); + } + std::fill(output_dbdr, output_dbdr + n, 0.0); + + } + + virtual void rbub(const int n, + const double* /*p*/, + double* output_rbub, + double* output_drbubdp) const + + { + std::fill(output_rbub, output_rbub + n, 0.0); + std::fill(output_drbubdp, output_drbubdp + n, 0.0); + } + virtual void R(const int n, const double* /*p*/, const double* /*z*/, diff --git a/opm/core/props/pvt/SinglePvtDead.cpp b/opm/core/props/pvt/SinglePvtDead.cpp index b226a46f..c53428b3 100644 --- a/opm/core/props/pvt/SinglePvtDead.cpp +++ b/opm/core/props/pvt/SinglePvtDead.cpp @@ -44,14 +44,14 @@ namespace Opm // Copy data const int sz = pvd_table[region_number][0].size(); std::vector press(sz); - std::vector B_inv(sz); + std::vector b(sz); std::vector visc(sz); for (int i = 0; i < sz; ++i) { press[i] = pvd_table[region_number][0][i]; - B_inv[i] = 1.0 / pvd_table[region_number][1][i]; + b[i] = 1.0 / pvd_table[region_number][1][i]; visc[i] = pvd_table[region_number][2][i]; } - one_over_B_ = NonuniformTableLinear(press, B_inv); + b_ = NonuniformTableLinear(press, b); viscosity_ = NonuniformTableLinear(press, visc); // Dumping the created tables. @@ -80,14 +80,31 @@ namespace Opm } } + void SinglePvtDead::mu(const int n, + const double* p, + const double* /*r*/, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const + { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + output_mu[i] = viscosity_(p[i]); + output_dmudp[i] = viscosity_.derivative(p[i]); + } + std::fill(output_dmudr, output_dmudr + n, 0.0); + + } + void SinglePvtDead::B(const int n, const double* p, const double* /*z*/, double* output_B) const { // #pragma omp parallel for + // B = 1/b for (int i = 0; i < n; ++i) { - output_B[i] = 1.0/one_over_B_(p[i]); + output_B[i] = 1.0/b_(p[i]); } } @@ -101,10 +118,36 @@ namespace Opm // #pragma omp parallel for for (int i = 0; i < n; ++i) { double Bg = output_B[i]; - output_dBdp[i] = -Bg*Bg*one_over_B_.derivative(p[i]); + output_dBdp[i] = -Bg*Bg*b_.derivative(p[i]); } } + void SinglePvtDead::b(const int n, + const double* p, + const double* /*r*/, + double* output_b, + double* output_dbdp, + double* output_dbdr) const + + { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + output_b[i] = b_(p[i]); + output_dbdp[i] = b_.derivative(p[i]); + + } + std::fill(output_dbdr, output_dbdr + n, 0.0); + + } + + void SinglePvtDead::rbub(const int n, + const double* /*p*/, + double* output_rbub, + double* output_drbubdp) const + { + std::fill(output_rbub, output_rbub + n, 0.0); + std::fill(output_drbubdp, output_drbubdp + n, 0.0); + } void SinglePvtDead::R(const int n, const double* /*p*/, diff --git a/opm/core/props/pvt/SinglePvtDead.hpp b/opm/core/props/pvt/SinglePvtDead.hpp index 1f829c28..4ed3f8a8 100644 --- a/opm/core/props/pvt/SinglePvtDead.hpp +++ b/opm/core/props/pvt/SinglePvtDead.hpp @@ -29,8 +29,10 @@ namespace Opm { /// Class for immiscible dead oil and dry gas. - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. class SinglePvtDead : public SinglePvtInterface @@ -46,6 +48,14 @@ namespace Opm const double* z, double* output_mu) const; + /// Viscosity and its derivatives as a function of p and r. + virtual void mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const; + /// Formation volume factor as a function of p and z. virtual void B(const int n, const double* p, @@ -59,6 +69,22 @@ namespace Opm double* output_B, double* output_dBdp) const; + /// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r. + virtual void b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const; + + + + /// Gas resolution and its derivatives at bublepoint as a function of p. + virtual void rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const; + /// Solution factor as a function of p and z. virtual void R(const int n, const double* p, @@ -73,7 +99,7 @@ namespace Opm double* output_dRdp) const; private: // PVT properties of dry gas or dead oil - NonuniformTableLinear one_over_B_; + NonuniformTableLinear b_; NonuniformTableLinear viscosity_; }; diff --git a/opm/core/props/pvt/SinglePvtDeadSpline.cpp b/opm/core/props/pvt/SinglePvtDeadSpline.cpp index 5fd7c06e..0e1c71b0 100644 --- a/opm/core/props/pvt/SinglePvtDeadSpline.cpp +++ b/opm/core/props/pvt/SinglePvtDeadSpline.cpp @@ -52,7 +52,7 @@ namespace Opm B_inv[i] = 1.0 / pvd_table[region_number][1][i]; visc[i] = pvd_table[region_number][2][i]; } - buildUniformMonotoneTable(press, B_inv, samples, one_over_B_); + buildUniformMonotoneTable(press, B_inv, samples, b_); buildUniformMonotoneTable(press, visc, samples, viscosity_); // Dumping the created tables. @@ -81,6 +81,23 @@ namespace Opm } } + void SinglePvtDeadSpline::mu(const int n, + const double* p, + const double* /*r*/, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const + { + // #pragma omp parallel for + + for (int i = 0; i < n; ++i) { + output_mu[i] = viscosity_(p[i]); + output_dmudp[i] = viscosity_.derivative(p[i]); + } + std::fill(output_dmudr, output_dmudr + n, 0.0); + + } + void SinglePvtDeadSpline::B(const int n, const double* p, const double* /*z*/, @@ -88,7 +105,7 @@ namespace Opm { // #pragma omp parallel for for (int i = 0; i < n; ++i) { - output_B[i] = 1.0/one_over_B_(p[i]); + output_B[i] = 1.0/b_(p[i]); } } @@ -102,10 +119,36 @@ namespace Opm // #pragma omp parallel for for (int i = 0; i < n; ++i) { double Bg = output_B[i]; - output_dBdp[i] = -Bg*Bg*one_over_B_.derivative(p[i]); + output_dBdp[i] = -Bg*Bg*b_.derivative(p[i]); } } + void SinglePvtDeadSpline::b(const int n, + const double* p, + const double* /*r*/, + double* output_b, + double* output_dbdp, + double* output_dbdr) const + + { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + output_b[i] = b_(p[i]); + output_dbdp[i] = b_.derivative(p[i]); + + } + std::fill(output_dbdr, output_dbdr + n, 0.0); + + } + + void SinglePvtDeadSpline::rbub(const int n, + const double* /*p*/, + double* output_rbub, + double* output_drbubdp) const + { + std::fill(output_rbub, output_rbub + n, 0.0); + std::fill(output_drbubdp, output_drbubdp + n, 0.0); + } void SinglePvtDeadSpline::R(const int n, const double* /*p*/, diff --git a/opm/core/props/pvt/SinglePvtDeadSpline.hpp b/opm/core/props/pvt/SinglePvtDeadSpline.hpp index 8f928952..f8a51b8f 100644 --- a/opm/core/props/pvt/SinglePvtDeadSpline.hpp +++ b/opm/core/props/pvt/SinglePvtDeadSpline.hpp @@ -29,8 +29,10 @@ namespace Opm { /// Class for immiscible dead oil and dry gas. - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. class SinglePvtDeadSpline : public SinglePvtInterface @@ -47,6 +49,14 @@ namespace Opm const double* z, double* output_mu) const; + /// Viscosity and its derivatives as a function of p and r. + virtual void mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const; + /// Formation volume factor as a function of p and z. virtual void B(const int n, const double* p, @@ -60,6 +70,20 @@ namespace Opm double* output_B, double* output_dBdp) const; + /// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r. + virtual void b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const; + + /// Gas resolution and its derivatives at bublepoint as a function of p. + virtual void rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const; + /// Solution factor as a function of p and z. virtual void R(const int n, const double* p, @@ -74,7 +98,7 @@ namespace Opm double* output_dRdp) const; private: // PVT properties of dry gas or dead oil - UniformTableLinear one_over_B_; + UniformTableLinear b_; UniformTableLinear viscosity_; }; diff --git a/opm/core/props/pvt/SinglePvtInterface.hpp b/opm/core/props/pvt/SinglePvtInterface.hpp index c5dd73f8..03983112 100644 --- a/opm/core/props/pvt/SinglePvtInterface.hpp +++ b/opm/core/props/pvt/SinglePvtInterface.hpp @@ -42,8 +42,10 @@ namespace Opm /// arbitrary two-phase and three-phase situations. void setPhaseConfiguration(const int num_phases, const int* phase_pos); - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. @@ -53,6 +55,14 @@ namespace Opm const double* z, double* output_mu) const = 0; + /// Viscosity as a function of p and r. + virtual void mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const = 0; + /// Formation volume factor as a function of p and z. virtual void B(const int n, const double* p, @@ -66,6 +76,21 @@ namespace Opm double* output_B, double* output_dBdp) const = 0; + /// The inverse of the volume factor b = 1 / B as a function of p and r. + virtual void b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dpdr) const = 0; + + /// Gas resolution at bublepoint as a function of pressure + virtual void rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const = 0; + + /// Solution factor as a function of p and z. virtual void R(const int n, const double* p, @@ -78,6 +103,8 @@ namespace Opm const double* z, double* output_R, double* output_dRdp) const = 0; + + protected: int num_phases_; int phase_pos_[MaxNumPhases]; diff --git a/opm/core/props/pvt/SinglePvtLiveGas.cpp b/opm/core/props/pvt/SinglePvtLiveGas.cpp index e58a51a5..85eeac0c 100644 --- a/opm/core/props/pvt/SinglePvtLiveGas.cpp +++ b/opm/core/props/pvt/SinglePvtLiveGas.cpp @@ -98,6 +98,17 @@ namespace Opm } } + /// Viscosity and its derivatives as a function of p and r. + void SinglePvtLiveGas::mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const + { + THROW("The new fluid interface not yet implemented"); + } + /// Formation volume factor as a function of p and z. void SinglePvtLiveGas::B(const int n, @@ -126,6 +137,26 @@ namespace Opm } } + /// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r. + void SinglePvtLiveGas::b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const + + { + THROW("The new fluid interface not yet implemented"); + } + + /// Gas resolution and its derivatives at bublepoint as a function of p. + void SinglePvtLiveGas::rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const + { + THROW("The new fluid interface not yet implemented"); + } /// Solution factor as a function of p and z. void SinglePvtLiveGas::R(const int n, diff --git a/opm/core/props/pvt/SinglePvtLiveGas.hpp b/opm/core/props/pvt/SinglePvtLiveGas.hpp index 7f29c3b3..6fd25bb3 100644 --- a/opm/core/props/pvt/SinglePvtLiveGas.hpp +++ b/opm/core/props/pvt/SinglePvtLiveGas.hpp @@ -26,8 +26,10 @@ namespace Opm { /// Class for miscible wet gas (with vaporized oil in vapour phase). - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. class SinglePvtLiveGas : public SinglePvtInterface @@ -44,6 +46,14 @@ namespace Opm const double* z, double* output_mu) const; + /// Viscosity and its derivatives as a function of p and r. + virtual void mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const; + /// Formation volume factor as a function of p and z. virtual void B(const int n, const double* p, @@ -57,6 +67,22 @@ namespace Opm double* output_B, double* output_dBdp) const; + /// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r. + virtual void b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const; + + + + /// Gas resolution and its derivatives at bublepoint as a function of p. + virtual void rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const; + /// Solution factor as a function of p and z. virtual void R(const int n, const double* p, diff --git a/opm/core/props/pvt/SinglePvtLiveOil.cpp b/opm/core/props/pvt/SinglePvtLiveOil.cpp index 269eb33a..eacee67a 100644 --- a/opm/core/props/pvt/SinglePvtLiveOil.cpp +++ b/opm/core/props/pvt/SinglePvtLiveOil.cpp @@ -175,6 +175,23 @@ namespace Opm } } + /// Viscosity and its derivatives as a function of p and r. + void SinglePvtLiveOil::mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const + { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + output_mu[i] = miscible_oil(p[i], r[i], 2, 0); + output_dmudp[i] = miscible_oil(p[i], r[i], 2, 1); + output_dmudr[i] = miscible_oil(p[i], r[i], 2, 2); + + } + } + /// Formation volume factor as a function of p and z. void SinglePvtLiveOil::B(const int n, @@ -203,6 +220,37 @@ namespace Opm } } + void SinglePvtLiveOil::b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const + + { + // #pragma omp parallel for + for (int i = 0; i < n; ++i) { + output_b[i] = miscible_oil(p[i], r[i], 1, 0); + output_dbdp[i] = miscible_oil(p[i], r[i], 1, 1); + output_dbdr[i] = miscible_oil(p[i], r[i], 1, 2); + + } + } + + void SinglePvtLiveOil::rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const + { + + for (int i = 0; i < n; ++i) { + output_rbub[i] = linearInterpolation(saturated_oil_table_[0], + saturated_oil_table_[3],p[i]); + output_drbubdp[i] = linearInterpolationDerivative(saturated_oil_table_[0], + saturated_oil_table_[3],p[i]); + + } + } /// Solution factor as a function of p and z. void SinglePvtLiveOil::R(const int n, @@ -347,4 +395,84 @@ namespace Opm } } + double SinglePvtLiveOil::miscible_oil(const double press, + const double r, + const int item, + const int deriv) const + { + int section; + double Rval = linearInterpolation(saturated_oil_table_[0], + saturated_oil_table_[3], + press, section); + // derivative with respect to frist component (pressure) + if (deriv == 1) { + if (Rval < r ) { // Saturated case + return linearInterpolationDerivative(saturated_oil_table_[0], + saturated_oil_table_[item], + press); + } else { // Undersaturated case + int is = tableIndex(saturated_oil_table_[3], r); + double w = (r - saturated_oil_table_[3][is]) / + (saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]); + ASSERT(undersat_oil_tables_[is][0].size() >= 2); + ASSERT(undersat_oil_tables_[is+1][0].size() >= 2); + double val1 = + linearInterpolationDerivative(undersat_oil_tables_[is][0], + undersat_oil_tables_[is][item], + press); + double val2 = + linearInterpolationDerivative(undersat_oil_tables_[is+1][0], + undersat_oil_tables_[is+1][item], + press); + double val = val1 + w*(val2 - val1); + return val; + } + // derivative with respect to second component (r) + } else if (deriv == 2) { + if (Rval < r ) { // Saturated case + return 0; + } else { // Undersaturated case + int is = tableIndex(saturated_oil_table_[3], r); + ASSERT(undersat_oil_tables_[is][0].size() >= 2); + ASSERT(undersat_oil_tables_[is+1][0].size() >= 2); + double val1 = + linearInterpolation(undersat_oil_tables_[is][0], + undersat_oil_tables_[is][item], + press); + double val2 = + linearInterpolation(undersat_oil_tables_[is+1][0], + undersat_oil_tables_[is+1][item], + press); + + double val = (val2 - val1)/(saturated_oil_table_[3][is+1]-saturated_oil_table_[3][is]); + return val; + } + + + } else { + if (Rval < r ) { // Saturated case + return linearInterpolation(saturated_oil_table_[0], + saturated_oil_table_[item], + press); + } else { // Undersaturated case + // Interpolate between table sections + int is = tableIndex(saturated_oil_table_[3], r); + double w = (r - saturated_oil_table_[3][is]) / + (saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]); + ASSERT(undersat_oil_tables_[is][0].size() >= 2); + ASSERT(undersat_oil_tables_[is+1][0].size() >= 2); + double val1 = + linearInterpolation(undersat_oil_tables_[is][0], + undersat_oil_tables_[is][item], + press); + double val2 = + linearInterpolation(undersat_oil_tables_[is+1][0], + undersat_oil_tables_[is+1][item], + press); + double val = val1 + w*(val2 - val1); + return val; + } + } + } + } // namespace Opm diff --git a/opm/core/props/pvt/SinglePvtLiveOil.hpp b/opm/core/props/pvt/SinglePvtLiveOil.hpp index 7a696dbb..a213d807 100644 --- a/opm/core/props/pvt/SinglePvtLiveOil.hpp +++ b/opm/core/props/pvt/SinglePvtLiveOil.hpp @@ -27,8 +27,10 @@ namespace Opm { /// Class for miscible live oil (with dissolved gas in liquid phase). - /// For all the virtual methods, the following apply: p and z - /// are expected to be of size n and n*num_phases, respectively. + /// The PVT properties can either be given as a function of pressure (p) and surface volume (z) + /// or pressure (p) and gas resolution factor (r). + /// For all the virtual methods, the following apply: p, r and z + /// are expected to be of size n, size n and n*num_phases, respectively. /// Output arrays shall be of size n, and must be valid before /// calling the method. class SinglePvtLiveOil : public SinglePvtInterface @@ -45,6 +47,14 @@ namespace Opm const double* z, double* output_mu) const; + /// Viscosity and its derivatives as a function of p and r. + virtual void mu(const int n, + const double* p, + const double* r, + double* output_mu, + double* output_dmudp, + double* output_dmudr) const; + /// Formation volume factor as a function of p and z. virtual void B(const int n, const double* p, @@ -58,6 +68,20 @@ namespace Opm double* output_B, double* output_dBdp) const; + /// The inverse of the formation volume factor b = 1 / B, and its derivatives as a function of p and r. + virtual void b(const int n, + const double* p, + const double* r, + double* output_b, + double* output_dbdp, + double* output_dbdr) const; + + /// Gas resolution and its derivatives at bublepoint as a function of p. + virtual void rbub(const int n, + const double* p, + double* output_rbub, + double* output_drbubdp) const; + /// Solution factor as a function of p and z. virtual void R(const int n, const double* p, @@ -83,6 +107,11 @@ namespace Opm const int item, const bool deriv = false) const; + double miscible_oil(const double press, + const double r, + const int item, + const int deriv = 0) const; + // PVT properties of live oil (with dissolved gas) std::vector > saturated_oil_table_; std::vector > > undersat_oil_tables_; diff --git a/opm/core/props/rock/RockCompressibility.cpp b/opm/core/props/rock/RockCompressibility.cpp index b290f9be..fd072798 100644 --- a/opm/core/props/rock/RockCompressibility.cpp +++ b/opm/core/props/rock/RockCompressibility.cpp @@ -42,12 +42,16 @@ namespace Opm { if (deck.hasField("ROCKTAB")) { const table_t& rt = deck.getROCKTAB().rocktab_; - int n = rt[0][0].size(); + if (rt.size() != 1) { + THROW("Can only handle a single region in ROCKTAB."); + } + const int n = rt[0][0].size(); p_.resize(n); poromult_.resize(n); for (int i = 0; i < n; ++i) { p_[i] = rt[0][0][i]; poromult_[i] = rt[0][1][i]; + transmult_[i] = rt[0][2][i]; } } else if (deck.hasField("ROCK")) { const ROCK& r = deck.getROCK(); @@ -70,11 +74,39 @@ namespace Opm const double cpnorm = rock_comp_*(pressure - pref_); return (1.0 + cpnorm + 0.5*cpnorm*cpnorm); } else { - // return Opm::linearInterpolation(p_, poromult_, pressure); return Opm::linearInterpolation(p_, poromult_, pressure); } } + double RockCompressibility::poroMultDeriv(double pressure) const + { + if (p_.empty()) { + // Approximating poro multiplier with a quadratic curve, + // we must use its derivative. + return rock_comp_ + 2 * rock_comp_ * rock_comp_ * (pressure - pref_); + } else { + return Opm::linearInterpolationDerivative(p_, poromult_, pressure); + } + } + + double RockCompressibility::transMult(double pressure) const + { + if (p_.empty()) { + return 1.0; + } else { + return Opm::linearInterpolation(p_, transmult_, pressure); + } + } + + double RockCompressibility::transMultDeriv(double pressure) const + { + if (p_.empty()) { + return 0.0; + } else { + return Opm::linearInterpolationDerivative(p_, transmult_, pressure); + } + } + double RockCompressibility::rockComp(double pressure) const { if (p_.empty()) { diff --git a/opm/core/props/rock/RockCompressibility.hpp b/opm/core/props/rock/RockCompressibility.hpp index a5c9a983..03567cae 100644 --- a/opm/core/props/rock/RockCompressibility.hpp +++ b/opm/core/props/rock/RockCompressibility.hpp @@ -47,12 +47,22 @@ namespace Opm /// Porosity multiplier. double poroMult(double pressure) const; + /// Derivative of porosity multiplier with respect to pressure. + double poroMultDeriv(double pressure) const; + + /// Transmissibility multiplier. + double transMult(double pressure) const; + + /// Derivative of transmissibility multiplier with respect to pressure. + double transMultDeriv(double pressure) const; + /// Rock compressibility = (d poro / d p)*(1 / poro). double rockComp(double pressure) const; private: std::vector p_; std::vector poromult_; + std::vector transmult_; double pref_; double rock_comp_; }; diff --git a/opm/core/props/satfunc/SatFuncGwseg.cpp b/opm/core/props/satfunc/SatFuncGwseg.cpp index 94b0131c..9f5744b6 100644 --- a/opm/core/props/satfunc/SatFuncGwseg.cpp +++ b/opm/core/props/satfunc/SatFuncGwseg.cpp @@ -136,14 +136,14 @@ namespace Opm const double sg = s[Vapour]; // xw and xg are the fractions occupied by water and gas zones. const double eps = 1e-6; - const double xw = (sw - swco) / std::max(sg + sw - swco, eps); - const double xg = 1 - xw; const double ssw = sg + sw; - const double ssg = sw - swco + sg; + const double ssg = std::max(sg + sw - swco, eps); const double krw = krw_(ssw); const double krg = krg_(ssg); const double krow = krow_(ssw); const double krog = krog_(ssg); + const double xw = (sw - swco) / ssg; + const double xg = 1 - xw; kr[Aqua] = xw*krw; kr[Vapour] = xg*krg; kr[Liquid] = xw*krow + xg*krog; @@ -341,14 +341,14 @@ namespace Opm const double sg = s[Vapour]; // xw and xg are the fractions occupied by water and gas zones. const double eps = 1e-6; - const double xw = (sw - swco) / std::max(sg + sw - swco, eps); - const double xg = 1 - xw; const double ssw = sg + sw; - const double ssg = sw - swco + sg; + const double ssg = std::max(sg + sw - swco, eps); const double krw = krw_(ssw); const double krg = krg_(ssg); const double krow = krow_(ssw); const double krog = krog_(ssg); + const double xw = (sw - swco) / ssg; + const double xg = 1 - xw; kr[Aqua] = xw*krw; kr[Vapour] = xg*krg; kr[Liquid] = xw*krow + xg*krog; diff --git a/opm/core/simulator/BlackoilState.hpp b/opm/core/simulator/BlackoilState.hpp index 153c2eed..974deffd 100644 --- a/opm/core/simulator/BlackoilState.hpp +++ b/opm/core/simulator/BlackoilState.hpp @@ -22,6 +22,7 @@ #include #include +#include #include namespace Opm @@ -47,6 +48,7 @@ namespace Opm // but use available phase information instead. sat_[num_phases*cell + 1] = 1.0; } + gor_.resize(g.number_of_cells, 0.0); } enum ExtremalSat { MinSat, MaxSat }; @@ -59,7 +61,11 @@ namespace Opm const Opm::BlackoilPropertiesInterface& props, ExtremalSat es) { + if (cells.empty()) { + return; + } const int n = cells.size(); + ASSERT(n > 0); std::vector smin(num_phases_*n); std::vector smax(num_phases_*n); props.satRange(n, &cells[0], &smin[0], &smax[0]); @@ -81,12 +87,14 @@ namespace Opm std::vector& faceflux () { return flux_ ; } std::vector& surfacevol () { return surfvol_; } std::vector& saturation () { return sat_ ; } + std::vector& gasoilratio () { return gor_ ; } const std::vector& pressure () const { return press_ ; } const std::vector& facepressure() const { return fpress_; } const std::vector& faceflux () const { return flux_ ; } const std::vector& surfacevol () const { return surfvol_; } const std::vector& saturation () const { return sat_ ; } + const std::vector& gasoilratio () const { return gor_ ; } private: int num_phases_; @@ -95,6 +103,7 @@ namespace Opm std::vector flux_ ; std::vector surfvol_; std::vector sat_ ; + std::vector gor_ ; }; } // namespace Opm diff --git a/opm/core/simulator/WellState.hpp b/opm/core/simulator/WellState.hpp index f1edc5d7..9849bd68 100644 --- a/opm/core/simulator/WellState.hpp +++ b/opm/core/simulator/WellState.hpp @@ -31,27 +31,46 @@ namespace Opm { public: /// Allocate and initialize if wells is non-null. + /// Also tries to give useful initial values to the bhp() and + /// wellRates() fields, depending on controls. The + /// perfRates() field is filled with zero, and perfPress() + /// with -1e100. template void init(const Wells* wells, const State& state) { if (wells) { const int nw = wells->number_of_wells; + const int np = wells->number_of_phases; bhp_.resize(nw); - // Initialize bhp to be target pressure - // if bhp-controlled well, otherwise set - // to pressure in first perforation cell. + wellrates_.resize(nw * np, 0.0); for (int w = 0; w < nw; ++w) { const WellControls* ctrl = wells->ctrls[w]; - + // Initialize bhp to be target pressure if + // bhp-controlled well, otherwise set to a little + // above or below (depending on if the well is an + // injector or producer) pressure in first perforation + // cell. if ((ctrl->current < 0) || // SHUT (ctrl->type[ctrl->current] != BHP)) { - const int cell = wells->well_cells[wells->well_connpos[w]]; - bhp_[w] = state.pressure()[cell]; - } - else { + const int first_cell = wells->well_cells[wells->well_connpos[w]]; + const double safety_factor = (wells->type[w] == INJECTOR) ? 1.01 : 0.99; + bhp_[w] = safety_factor*state.pressure()[first_cell]; + } else { bhp_[w] = ctrl->target[ctrl->current]; } + // Initialize well rates to match controls if type is SURFACE_RATE + if ((ctrl->current >= 0) && // open well + (ctrl->type[ctrl->current] == SURFACE_RATE)) { + const double rate_target = ctrl->target[ctrl->current]; + for (int p = 0; p < np; ++p) { + const double phase_distr = ctrl->distr[np * ctrl->current + p]; + wellrates_[np*w + p] = rate_target * phase_distr; + } + } } + // The perforation rates and perforation pressures are + // not expected to be consistent with bhp_ and wellrates_ + // after init(). perfrates_.resize(wells->well_connpos[nw], 0.0); perfpress_.resize(wells->well_connpos[nw], -1e100); } @@ -61,6 +80,10 @@ namespace Opm std::vector& bhp() { return bhp_; } const std::vector& bhp() const { return bhp_; } + /// One rate per well and phase. + std::vector& wellRates() { return wellrates_; } + const std::vector& wellRates() const { return wellrates_; } + /// One rate per well connection. std::vector& perfRates() { return perfrates_; } const std::vector& perfRates() const { return perfrates_; } @@ -71,6 +94,7 @@ namespace Opm private: std::vector bhp_; + std::vector wellrates_; std::vector perfrates_; std::vector perfpress_; }; diff --git a/opm/core/simulator/initState_impl.hpp b/opm/core/simulator/initState_impl.hpp index b6492bb9..ed9d4fd9 100644 --- a/opm/core/simulator/initState_impl.hpp +++ b/opm/core/simulator/initState_impl.hpp @@ -599,6 +599,29 @@ namespace Opm } + /// Initialize a blackoil state from input deck. + template + void initBlackoilStateFromDeck(const UnstructuredGrid& grid, + const Props& props, + const EclipseGridParser& deck, + const double gravity, + State& state) + { + initStateFromDeck(grid, props, deck, gravity, state); + initBlackoilSurfvol(grid, props, state); + if (deck.hasField("RS")) { + const std::vector& rs_deck = deck.getFloatingPointValue("RS"); + const int num_cells = grid.number_of_cells; + for (int c = 0; c < num_cells; ++c) { + int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c]; + state.gasoilratio()[c] = rs_deck[c_deck]; + } + } else { + THROW("Temporarily, we require the RS field."); + } + } + + } // namespace Opm diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 328abd49..a3254559 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -505,13 +505,33 @@ namespace Opm int control_pos[5] = { -1, -1, -1, -1, -1 }; if (ok && wci_line.surface_flow_max_rate_ >= 0.0) { control_pos[InjectionControl::RATE] = w_->ctrls[wix]->num; - const double distr[3] = { 1.0, 1.0, 1.0 }; + double distr[3] = { 0.0, 0.0, 0.0 }; + if (wci_line.injector_type_ == "WATER") { + distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; + } else if (wci_line.injector_type_ == "OIL") { + distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; + } else if (wci_line.injector_type_ == "GAS") { + distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0; + } else { + THROW("Injector type " << wci_line.injector_type_ << " not supported." + "WellsManager only supports WATER, OIL and GAS injector types."); + } ok = append_well_controls(SURFACE_RATE, wci_line.surface_flow_max_rate_, distr, wix, w_); } if (ok && wci_line.reservoir_flow_max_rate_ >= 0.0) { control_pos[InjectionControl::RESV] = w_->ctrls[wix]->num; - const double distr[3] = { 1.0, 1.0, 1.0 }; + double distr[3] = { 0.0, 0.0, 0.0 }; + if (wci_line.injector_type_ == "WATER") { + distr[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0; + } else if (wci_line.injector_type_ == "OIL") { + distr[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0; + } else if (wci_line.injector_type_ == "GAS") { + distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0; + } else { + THROW("Injector type " << wci_line.injector_type_ << " not supported." + "WellsManager only supports WATER, OIL and GAS injector types."); + } ok = append_well_controls(RESERVOIR_RATE, wci_line.reservoir_flow_max_rate_, distr, wix, w_); } diff --git a/redhat/opm-core.spec b/redhat/opm-core.spec index 90d8c4ba..4a9622ba 100644 --- a/redhat/opm-core.spec +++ b/redhat/opm-core.spec @@ -59,7 +59,7 @@ This package contains the applications for opm-core %setup -q %build -cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} +cmake28 -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_INSTALL_DOCDIR=share/doc/%{name}-%{version} -DWHOLE_PROG_OPTIM=ON make %install diff --git a/tests/testFluid.DATA b/tests/testFluid.DATA new file mode 100644 index 00000000..78c598cc --- /dev/null +++ b/tests/testFluid.DATA @@ -0,0 +1,44 @@ +OIL +WATER +GAS + +FIELD + +PVTO +-- Rs Pbub Bo Vo + .0 14.7 1.0000 1.20 / + .165 400. 1.0120 1.17 / + .335 800. 1.0255 1.14 / + .500 1200. 1.0380 1.11 / + .665 1600. 1.0510 1.08 / + .828 2000. 1.0630 1.06 / + .985 2400. 1.0750 1.03 / + 1.130 2800. 1.0870 1.00 / + 1.270 3200. 1.0985 .98 / + 1.390 3600. 1.1100 .95 / + 1.500 4000. 1.1200 .94 + 5000. 1.1189 .94 / + / + +PVDG +-- Pg Bg Vg + 14.7 178.08 .0125 + 400. 5.4777 .0130 + 800. 2.7392 .0135 + 1200. 1.8198 .0140 + 1600. 1.3648 .0145 + 2000. 1.0957 .0150 + 2400. 0.9099 .0155 + 2800. 0.7799 .0160 + 3200. 0.6871 .0165 + 3600. 0.6035 .0170 + 4000. 0.5432 .0175 / + +PVTW +--Depth Bw Comp Vw Cv + 3600. 1.0034 1.0E-6 0.96 0.0 / + + +DENSITY +-- Oil Water Gas + 44.98 63.01 0.0702 / diff --git a/tests/test_blackoilfluid.cpp b/tests/test_blackoilfluid.cpp new file mode 100644 index 00000000..ebaaa49e --- /dev/null +++ b/tests/test_blackoilfluid.cpp @@ -0,0 +1,227 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if HAVE_DYNAMIC_BOOST_TEST +#define BOOST_TEST_DYN_LINK +#endif +#define NVERBOSE // to suppress our messages when throwing +#define BOOST_TEST_MODULE BlackoilFluidTest +#define BOOST_TEST_MAIN +#include +#include +#include +#include +#include + +using namespace Opm; +using namespace std; + +BOOST_AUTO_TEST_CASE(test_blackoilfluid) +{ + + + // read eclipse deck + const string filename = "testFluid.DATA"; + cout << "Reading deck: " << filename << endl; + const EclipseGridParser deck (filename); + + // setup pvt interface + std::vector > props_; + PhaseUsage phase_usage_ = phaseUsageFromDeck(deck); + enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 }; + int samples = 0; + + + // Set the properties. + props_.resize(phase_usage_.num_phases); + // Water PVT + if (phase_usage_.phase_used[Aqua]) { + if (deck.hasField("PVTW")) { + props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(deck.getPVTW().pvtw_)); + } else { + // Eclipse 100 default. + props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise)); + } + } + // Oil PVT + if (phase_usage_.phase_used[Liquid]) { + if (deck.hasField("PVDO")) { + if (samples > 0) { + props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(deck.getPVDO().pvdo_, samples)); + } else { + props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDead(deck.getPVDO().pvdo_)); + } + } else if (deck.hasField("PVTO")) { + + props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(deck.getPVTO().pvto_)); + } else if (deck.hasField("PVCDO")) { + props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_)); + } else { + THROW("Input is missing PVDO or PVTO\n"); + } + } + // Gas PVT + if (phase_usage_.phase_used[Vapour]) { + if (deck.hasField("PVDG")) { + if (samples > 0) { + props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(deck.getPVDG().pvdg_, samples)); + } else { + props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDead(deck.getPVDG().pvdg_)); + } + } else if (deck.hasField("PVTG")) { + props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_)); + } else { + THROW("Input is missing PVDG or PVTG\n"); + } + } + + // setup a test case. We will check 6 [p,r] pairs and compare them to both the [p,z] interface and a finite difference + // approximation of the derivatives. + const int n = 6; + const int np = phase_usage_.num_phases; + + // the tolerance for acceptable difference in values + const double reltol = 1e-9; + + std::vector p(n); + std::vector r(n); + std::vector z(n * np); + + std::vector mu(n); + std::vector dmudp(n); + std::vector dmudr(n); + std::vector mu_new(n); + double dmudp_diff; + double dmudr_diff; + double dmudp_diff_u; + double dmudr_diff_u; + + + // Used for forward difference calculations + const double h_p = 100000; + const double h_r = 1; + + // saturated + p[0] = 10000000; + p[1] = p[0] + h_p; + p[2] = p[0]; + + r[0] = 200; + r[1] = 200; + r[2] = 200 + h_r; + + // undersaturated + p[3] = p[0]; + p[4] = p[1]; + p[5] = p[2]; + + r[3] = 50; + r[4] = 50; + r[5] = 50 +h_r; + + + // Corresponing z factors, used to compare with the [p,z] interface + for (int i = 0; i < n; ++i) { + z[0+i*np] = 0; z[1+i*np] = 1; + z[2+i*np] = r[i]; + + } + + // test mu + for (int phase = 1; phase < 2; ++phase) { + props_[phase]->mu(n, &p[0], &r[0], &mu_new[0], &dmudp[0], &dmudr[0]); + props_[phase]->mu(n, &p[0], &z[0], &mu[0]); + dmudp_diff = (mu_new[1]-mu_new[0])/h_p; + dmudr_diff = (mu_new[2]-mu_new[0])/h_r; + dmudp_diff_u = (mu_new[4]-mu_new[3])/h_p; + dmudr_diff_u = (mu_new[5]-mu_new[3])/h_r; + + for (int i = 0; i < n; ++i){ + BOOST_CHECK_CLOSE(mu_new[i],mu[i],reltol); + } + // saturated case + BOOST_CHECK_CLOSE(dmudp_diff,dmudp[0],reltol); + BOOST_CHECK_CLOSE(dmudr_diff,dmudr[0],reltol); + + // unsaturated case + BOOST_CHECK_CLOSE(dmudp_diff_u,dmudp[3] , reltol); + BOOST_CHECK_CLOSE(dmudr_diff_u,dmudr[3] , reltol); + + } + + // test b + std::vector b(n); + std::vector B(n); + std::vector invB(n); + std::vector dinvBdp(n); + std::vector dBdp(n); + std::vector dbdr(n); + std::vector dbdp(n); + double dbdp_diff; + double dbdr_diff; + double dbdp_diff_u; + double dbdr_diff_u; + + for (int phase = 1; phase < 2; ++phase) { + props_[phase]->b(n, &p[0], &r[0], &b[0], &dbdp[0], &dbdr[0]); + //props_[phase]->B(n, p, z, B); + props_[phase]->dBdp(n, &p[0], &z[0], &B[0], &dBdp[0]); + dbdp_diff = (b[1]-b[0])/h_p; + dbdr_diff = (b[2]-b[0])/h_r; + dbdp_diff_u = (b[4]-b[3])/h_p; + dbdr_diff_u = (b[5]-b[3])/h_r; + for (int i = 0; i < n; ++i){ + invB[i] = 1/B[i]; + dinvBdp[i] = -1/pow(B[i],2) * dBdp[i]; + } + + for (int i = 0; i < n; ++i){ + BOOST_CHECK_CLOSE(invB[i],b[i] , reltol); + BOOST_CHECK_CLOSE(dinvBdp[i],dbdp[i] , reltol); + + } + // saturated case + BOOST_CHECK_CLOSE(dbdp_diff,dbdp[0], reltol); + BOOST_CHECK_CLOSE(dbdr_diff,dbdr[0], reltol); + + // unsaturated case + BOOST_CHECK_CLOSE(dbdp_diff_u,dbdp[3], reltol); + BOOST_CHECK_CLOSE(dbdr_diff_u,dbdr[3], reltol); + } + + // test bublepoint pressure + std::vector rbub(n); + std::vector drbubdp(n); + double drbubdp_diff; + double drbubdp_diff_u; + + for (int phase = 1; phase < 2; ++phase) { + props_[phase] ->rbub(n, &p[0], &rbub[0], &drbubdp[0]); + + drbubdp_diff = (rbub[1]-rbub[0])/h_p; + drbubdp_diff_u = (rbub[4]-rbub[3])/h_p; + + // saturated case + BOOST_CHECK_CLOSE(drbubdp_diff,drbubdp[0], reltol); + + // unsaturad case + BOOST_CHECK_CLOSE(drbubdp_diff_u,drbubdp[3], reltol); + + } + + + + + +} diff --git a/tutorials/tutorial1.cpp b/tutorials/tutorial1.cpp index 9bd2a0ba..d4465a2c 100644 --- a/tutorials/tutorial1.cpp +++ b/tutorials/tutorial1.cpp @@ -1,5 +1,5 @@ +/// \cond SKIP /*! -\cond SKIP Copyright 2012 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). @@ -16,11 +16,8 @@ You should have received a copy of the GNU General Public License along with OPM. If not, see . -\endcond */ -#if HAVE_CONFIG_H -#include "config.h" -#endif // HAVE_CONFIG_H +///\endcond /// \page tutorial1 A simple cartesian grid /// This tutorial explains how to construct a simple Cartesian grid, @@ -34,6 +31,8 @@ /// \snippet tutorial1.cpp including headers /// \internal [including headers] +#include "config.h" + #include #include #include diff --git a/tutorials/tutorial2.cpp b/tutorials/tutorial2.cpp index 88016a69..964660b6 100644 --- a/tutorials/tutorial2.cpp +++ b/tutorials/tutorial2.cpp @@ -1,5 +1,5 @@ +/// \cond SKIP /*! -\cond SKIP Copyright 2012 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). @@ -16,8 +16,9 @@ You should have received a copy of the GNU General Public License along with OPM. If not, see . -\endcond */ +/// \endcond + /// \page tutorial2 Flow Solver for a single phase /// \details The flow equations consist of the mass conservation equation /// \f[\nabla\cdot {\bf u}=q\f] and the Darcy law \f[{\bf u} =- \frac{1}{\mu}K\nabla p.\f] Here, @@ -27,9 +28,7 @@ /// We solve the flow equations for a Cartesian grid and we set the source term /// \f$q\f$ be zero except at the left-lower and right-upper corner, where it is equal /// with opposite sign (inflow equal to outflow). -#if HAVE_CONFIG_H #include "config.h" -#endif // HAVE_CONFIG_H #include #include diff --git a/tutorials/tutorial3.cpp b/tutorials/tutorial3.cpp index 952ca818..a79cb067 100644 --- a/tutorials/tutorial3.cpp +++ b/tutorials/tutorial3.cpp @@ -1,5 +1,5 @@ +/// \cond SKIP /*! -\cond SKIP Copyright 2012 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). @@ -16,11 +16,9 @@ You should have received a copy of the GNU General Public License along with OPM. If not, see . -\endcond */ -#if HAVE_CONFIG_H +/// \endcond #include "config.h" -#endif // HAVE_CONFIG_H #include #include diff --git a/tutorials/tutorial4.cpp b/tutorials/tutorial4.cpp index 9267ef48..074941a2 100644 --- a/tutorials/tutorial4.cpp +++ b/tutorials/tutorial4.cpp @@ -1,5 +1,5 @@ +/// \cond SKIP /*! -\cond SKIP Copyright 2012 SINTEF ICT, Applied Mathematics. This file is part of the Open Porous Media project (OPM). @@ -16,11 +16,9 @@ You should have received a copy of the GNU General Public License along with OPM. If not, see . -\endcond */ -#if HAVE_CONFIG_H +/// \endcond #include "config.h" -#endif // HAVE_CONFIG_H #include #include