diff --git a/.gitignore b/.gitignore
index 5fe7b14c..a3a8f8a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*~
.\#*
*.o
+*.mod
*.lo
*.la
.libs
@@ -34,6 +35,7 @@ tutorials/tutorial[1-4]
# Ignoring executables
*_test
+examples/compute_tof
examples/scaneclipsedeck
examples/spu_2p
examples/reorder-qfs
@@ -42,8 +44,10 @@ examples/sim_2p_incomp_reorder
examples/sim_2p_comp_reorder
examples/sim_wateroil
examples/wells_example
+tests/test_agmg
tests/test_cfs_tpfa
tests/test_jacsys
+tests/test_read_grid
tests/test_readvector
tests/test_sf2p
tests/bo_fluid_p_and_z_deps
@@ -53,4 +57,5 @@ tests/test_column_extract
tests/test_lapack
tests/test_read_vag
tests/test_readpolymer
+tests/test_wells
tests/test_writeVtkData
diff --git a/Makefile.am b/Makefile.am
index 61d08142..787af5f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,9 +11,10 @@ lib_LTLIBRARIES = lib/libopmcore.la
# ----------------------------------------------------------------------
# Build-time flags needed to build libopmcore.la
-AM_CPPFLAGS = \
+AM_CPPFLAGS = \
$(ERT_CPPFLAGS) \
-$(OPM_BOOST_CPPFLAGS)
+$(OPM_BOOST_CPPFLAGS) \
+${SUPERLU_CPPFLAGS}
# ----------------------------------------------------------------------
# Link-time flags needed both to successfully link the library and to
@@ -23,6 +24,7 @@ lib_libopmcore_la_LDFLAGS = \
-R $(OPM_BOOST_LIBDIR) \
$(OPM_BOOST_LDFLAGS) \
$(ERT_LDFLAGS)
+${SUPERLU_LDFLAGS}
lib_libopmcore_la_LIBADD = \
$(BOOST_FILESYSTEM_LIB) \
@@ -30,7 +32,7 @@ $(BOOST_SYSTEM_LIB) \
$(BOOST_DATE_TIME_LIB) \
$(BOOST_UNIT_TEST_FRAMEWORK_LIB) \
$(ERT_LIBS) \
-$(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS)
+$(LAPACK_LIBS) ${SUPERLU_LIBS} $(BLAS_LIBS) $(LIBS)
# ----------------------------------------------------------------------
# Library constituents. SOURCES followed by HEADERS.
@@ -59,80 +61,82 @@ opm/core/fluid/SaturationPropsFromDeck.cpp \
opm/core/fluid/SatFuncGwseg.cpp \
opm/core/fluid/SatFuncStone2.cpp \
opm/core/fluid/SatFuncSimple.cpp \
-opm/core/fluid/blackoil/BlackoilPvtProperties.cpp \
-opm/core/fluid/blackoil/SinglePvtDead.cpp \
-opm/core/fluid/blackoil/SinglePvtDeadSpline.cpp \
-opm/core/fluid/blackoil/SinglePvtInterface.cpp \
-opm/core/fluid/blackoil/SinglePvtLiveGas.cpp \
-opm/core/fluid/blackoil/SinglePvtLiveOil.cpp \
-opm/core/grid.c \
-opm/core/grid/cart_grid.c \
-opm/core/grid/cornerpoint_grid.c \
-opm/core/grid/cpgpreprocess/facetopology.c \
-opm/core/grid/cpgpreprocess/geometry.c \
-opm/core/grid/cpgpreprocess/preprocess.c \
-opm/core/grid/cpgpreprocess/uniquepoints.c \
-opm/core/linalg/LinearSolverFactory.cpp \
-opm/core/linalg/LinearSolverInterface.cpp \
-opm/core/linalg/sparse_sys.c \
-opm/core/newwells.c \
-opm/core/pressure/CompressibleTpfa.cpp \
-opm/core/pressure/FlowBCManager.cpp \
-opm/core/pressure/IncompTpfa.cpp \
-opm/core/pressure/cfsh.c \
-opm/core/pressure/flow_bc.c \
-opm/core/pressure/fsh.c \
-opm/core/pressure/fsh_common_impl.c \
-opm/core/pressure/ifsh.c \
-opm/core/pressure/mimetic/hybsys.c \
-opm/core/pressure/mimetic/hybsys_global.c \
-opm/core/pressure/mimetic/mimetic.c \
-opm/core/pressure/msmfem/coarse_conn.c \
-opm/core/pressure/msmfem/coarse_sys.c \
-opm/core/pressure/msmfem/dfs.c \
-opm/core/pressure/msmfem/hash_set.c \
-opm/core/pressure/msmfem/ifsh_ms.c \
-opm/core/pressure/msmfem/partition.c \
-opm/core/pressure/tpfa/cfs_tpfa.c \
-opm/core/pressure/tpfa/cfs_tpfa_residual.c \
-opm/core/pressure/tpfa/compr_bc.c \
-opm/core/pressure/tpfa/compr_quant.c \
-opm/core/pressure/tpfa/compr_quant_general.c \
-opm/core/pressure/tpfa/compr_source.c \
-opm/core/pressure/tpfa/ifs_tpfa.c \
-opm/core/pressure/tpfa/trans_tpfa.c \
-opm/core/pressure/well.c \
-opm/core/simulator/SimulatorCompressibleTwophase.cpp \
-opm/core/simulator/SimulatorIncompTwophase.cpp \
-opm/core/simulator/SimulatorReport.cpp \
-opm/core/simulator/SimulatorTimer.cpp \
-opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp \
-opm/core/transport/reorder/TransportModelInterface.cpp \
-opm/core/transport/reorder/TransportModelTwophase.cpp \
-opm/core/transport/reorder/nlsolvers.c \
-opm/core/transport/reorder/reordersequence.cpp \
-opm/core/transport/reorder/tarjan.c \
-opm/core/transport/spu_explicit.c \
-opm/core/transport/spu_implicit.c \
-opm/core/transport/transport_source.c \
-opm/core/utility/MonotCubicInterpolator.cpp \
-opm/core/utility/StopWatch.cpp \
-opm/core/utility/miscUtilities.cpp \
-opm/core/utility/miscUtilitiesBlackoil.cpp \
-opm/core/utility/parameters/Parameter.cpp \
-opm/core/utility/parameters/ParameterGroup.cpp \
-opm/core/utility/parameters/ParameterTools.cpp \
-opm/core/utility/parameters/ParameterXML.cpp \
-opm/core/utility/parameters/tinyxml/tinystr.cpp \
-opm/core/utility/parameters/tinyxml/tinyxml.cpp \
-opm/core/utility/parameters/tinyxml/tinyxmlerror.cpp \
-opm/core/utility/parameters/tinyxml/tinyxmlparser.cpp \
-opm/core/utility/writeVtkData.cpp \
-opm/core/vag_format/vag.cpp \
-opm/core/wells/InjectionSpecification.cpp \
-opm/core/wells/ProductionSpecification.cpp \
-opm/core/wells/WellCollection.cpp \
-opm/core/wells/WellsGroup.cpp \
+opm/core/fluid/blackoil/BlackoilPvtProperties.cpp \
+opm/core/fluid/blackoil/SinglePvtDead.cpp \
+opm/core/fluid/blackoil/SinglePvtDeadSpline.cpp \
+opm/core/fluid/blackoil/SinglePvtInterface.cpp \
+opm/core/fluid/blackoil/SinglePvtLiveGas.cpp \
+opm/core/fluid/blackoil/SinglePvtLiveOil.cpp \
+opm/core/grid.c \
+opm/core/grid/cart_grid.c \
+opm/core/grid/cornerpoint_grid.c \
+opm/core/grid/cpgpreprocess/facetopology.c \
+opm/core/grid/cpgpreprocess/geometry.c \
+opm/core/grid/cpgpreprocess/preprocess.c \
+opm/core/grid/cpgpreprocess/uniquepoints.c \
+opm/core/linalg/LinearSolverFactory.cpp \
+opm/core/linalg/LinearSolverInterface.cpp \
+opm/core/linalg/sparse_sys.c \
+opm/core/newwells.c \
+opm/core/pressure/CompressibleTpfa.cpp \
+opm/core/pressure/FlowBCManager.cpp \
+opm/core/pressure/IncompTpfa.cpp \
+opm/core/pressure/cfsh.c \
+opm/core/pressure/flow_bc.c \
+opm/core/pressure/fsh.c \
+opm/core/pressure/fsh_common_impl.c \
+opm/core/pressure/ifsh.c \
+opm/core/pressure/mimetic/hybsys.c \
+opm/core/pressure/mimetic/hybsys_global.c \
+opm/core/pressure/mimetic/mimetic.c \
+opm/core/pressure/msmfem/coarse_conn.c \
+opm/core/pressure/msmfem/coarse_sys.c \
+opm/core/pressure/msmfem/dfs.c \
+opm/core/pressure/msmfem/hash_set.c \
+opm/core/pressure/msmfem/ifsh_ms.c \
+opm/core/pressure/msmfem/partition.c \
+opm/core/pressure/tpfa/cfs_tpfa.c \
+opm/core/pressure/tpfa/cfs_tpfa_residual.c \
+opm/core/pressure/tpfa/compr_bc.c \
+opm/core/pressure/tpfa/compr_quant.c \
+opm/core/pressure/tpfa/compr_quant_general.c \
+opm/core/pressure/tpfa/compr_source.c \
+opm/core/pressure/tpfa/ifs_tpfa.c \
+opm/core/pressure/tpfa/trans_tpfa.c \
+opm/core/pressure/well.c \
+opm/core/simulator/SimulatorCompressibleTwophase.cpp \
+opm/core/simulator/SimulatorIncompTwophase.cpp \
+opm/core/simulator/SimulatorReport.cpp \
+opm/core/simulator/SimulatorTimer.cpp \
+opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp \
+opm/core/transport/reorder/TransportModelInterface.cpp \
+opm/core/transport/reorder/TransportModelTracerTof.cpp \
+opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp \
+opm/core/transport/reorder/TransportModelTwophase.cpp \
+opm/core/transport/reorder/nlsolvers.c \
+opm/core/transport/reorder/reordersequence.cpp \
+opm/core/transport/reorder/tarjan.c \
+opm/core/transport/spu_explicit.c \
+opm/core/transport/spu_implicit.c \
+opm/core/transport/transport_source.c \
+opm/core/utility/MonotCubicInterpolator.cpp \
+opm/core/utility/StopWatch.cpp \
+opm/core/utility/miscUtilities.cpp \
+opm/core/utility/miscUtilitiesBlackoil.cpp \
+opm/core/utility/parameters/Parameter.cpp \
+opm/core/utility/parameters/ParameterGroup.cpp \
+opm/core/utility/parameters/ParameterTools.cpp \
+opm/core/utility/parameters/ParameterXML.cpp \
+opm/core/utility/parameters/tinyxml/tinystr.cpp \
+opm/core/utility/parameters/tinyxml/tinyxml.cpp \
+opm/core/utility/parameters/tinyxml/tinyxmlerror.cpp \
+opm/core/utility/parameters/tinyxml/tinyxmlparser.cpp \
+opm/core/utility/writeVtkData.cpp \
+opm/core/vag_format/vag.cpp \
+opm/core/wells/InjectionSpecification.cpp \
+opm/core/wells/ProductionSpecification.cpp \
+opm/core/wells/WellCollection.cpp \
+opm/core/wells/WellsGroup.cpp \
opm/core/wells/WellsManager.cpp
nobase_include_HEADERS = \
@@ -158,137 +162,140 @@ opm/core/fluid/RockFromDeck.hpp \
opm/core/fluid/SatFuncGwseg.hpp \
opm/core/fluid/SatFuncStone2.hpp \
opm/core/fluid/SatFuncSimple.hpp \
-opm/core/fluid/SaturationPropsBasic.hpp \
-opm/core/fluid/SaturationPropsFromDeck.hpp \
-opm/core/fluid/SaturationPropsFromDeck_impl.hpp \
-opm/core/fluid/SaturationPropsInterface.hpp \
-opm/core/fluid/SimpleFluid2p.hpp \
-opm/core/fluid/blackoil/BlackoilPhases.hpp \
-opm/core/fluid/blackoil/BlackoilPvtProperties.hpp \
-opm/core/fluid/blackoil/SinglePvtConstCompr.hpp \
-opm/core/fluid/blackoil/SinglePvtDead.hpp \
-opm/core/fluid/blackoil/SinglePvtDeadSpline.hpp \
-opm/core/fluid/blackoil/SinglePvtInterface.hpp \
-opm/core/fluid/blackoil/SinglePvtLiveGas.hpp \
-opm/core/fluid/blackoil/SinglePvtLiveOil.hpp \
-opm/core/fluid/blackoil/phaseUsageFromDeck.hpp \
-opm/core/grid.h \
-opm/core/grid/cart_grid.h \
-opm/core/grid/cornerpoint_grid.h \
-opm/core/grid/cpgpreprocess/facetopology.h \
-opm/core/grid/cpgpreprocess/geometry.h \
-opm/core/grid/cpgpreprocess/grdecl.h \
-opm/core/grid/cpgpreprocess/preprocess.h \
-opm/core/grid/cpgpreprocess/uniquepoints.h \
-opm/core/linalg/LinearSolverFactory.hpp \
-opm/core/linalg/LinearSolverInterface.hpp \
-opm/core/linalg/blas_lapack.h \
-opm/core/linalg/sparse_sys.h \
-opm/core/newwells.h \
-opm/core/pressure/CompressibleTpfa.hpp \
-opm/core/pressure/FlowBCManager.hpp \
-opm/core/pressure/HybridPressureSolver.hpp \
-opm/core/pressure/IncompTpfa.hpp \
-opm/core/pressure/TPFACompressiblePressureSolver.hpp \
-opm/core/pressure/TPFAPressureSolver.hpp \
-opm/core/pressure/flow_bc.h \
-opm/core/pressure/fsh.h \
-opm/core/pressure/fsh_common_impl.h \
-opm/core/pressure/mimetic/hybsys.h \
-opm/core/pressure/mimetic/hybsys_global.h \
-opm/core/pressure/mimetic/mimetic.h \
-opm/core/pressure/msmfem/coarse_conn.h \
-opm/core/pressure/msmfem/coarse_sys.h \
-opm/core/pressure/msmfem/dfs.h \
-opm/core/pressure/msmfem/hash_set.h \
-opm/core/pressure/msmfem/ifsh_ms.h \
-opm/core/pressure/msmfem/partition.h \
-opm/core/pressure/tpfa/cfs_tpfa.h \
-opm/core/pressure/tpfa/cfs_tpfa_residual.h \
-opm/core/pressure/tpfa/compr_bc.h \
-opm/core/pressure/tpfa/compr_quant.h \
-opm/core/pressure/tpfa/compr_quant_general.h \
-opm/core/pressure/tpfa/compr_source.h \
-opm/core/pressure/tpfa/ifs_tpfa.h \
-opm/core/pressure/tpfa/trans_tpfa.h \
-opm/core/simulator/BlackoilState.hpp \
-opm/core/simulator/SimulatorCompressibleTwophase.hpp \
-opm/core/simulator/SimulatorReport.hpp \
-opm/core/simulator/SimulatorIncompTwophase.hpp \
-opm/core/simulator/SimulatorTimer.hpp \
-opm/core/simulator/TwophaseState.hpp \
-opm/core/simulator/WellState.hpp \
-opm/core/transport/CSRMatrixBlockAssembler.hpp \
-opm/core/transport/CSRMatrixUmfpackSolver.hpp \
-opm/core/transport/GravityColumnSolver.hpp \
-opm/core/transport/GravityColumnSolver_impl.hpp \
-opm/core/transport/ImplicitAssembly.hpp \
-opm/core/transport/ImplicitTransport.hpp \
-opm/core/transport/JacobianSystem.hpp \
-opm/core/transport/NormSupport.hpp \
-opm/core/transport/SimpleFluid2pWrapper.hpp \
-opm/core/transport/SinglePointUpwindTwoPhase.hpp \
-opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp \
-opm/core/transport/reorder/TransportModelInterface.hpp \
-opm/core/transport/reorder/TransportModelTwophase.hpp \
-opm/core/transport/reorder/nlsolvers.h \
-opm/core/transport/reorder/reordersequence.h \
-opm/core/transport/reorder/tarjan.h \
-opm/core/transport/spu_explicit.h \
-opm/core/transport/spu_implicit.h \
-opm/core/transport/transport_source.h \
-opm/core/utility/Average.hpp \
-opm/core/utility/ColumnExtract.hpp \
-opm/core/utility/DataMap.hpp \
-opm/core/utility/ErrorMacros.hpp \
-opm/core/utility/Factory.hpp \
-opm/core/utility/MonotCubicInterpolator.hpp \
-opm/core/utility/NonuniformTableLinear.hpp \
-opm/core/utility/RootFinders.hpp \
-opm/core/utility/SparseTable.hpp \
-opm/core/utility/SparseVector.hpp \
-opm/core/utility/StopWatch.hpp \
-opm/core/utility/UniformTableLinear.hpp \
-opm/core/utility/Units.hpp \
-opm/core/utility/buildUniformMonotoneTable.hpp \
-opm/core/utility/initState.hpp \
-opm/core/utility/initState_impl.hpp \
-opm/core/utility/linInt.hpp \
-opm/core/utility/linearInterpolation.hpp \
-opm/core/utility/miscUtilities.hpp \
-opm/core/utility/miscUtilitiesBlackoil.hpp \
-opm/core/utility/parameters/Parameter.hpp \
-opm/core/utility/parameters/ParameterGroup.hpp \
-opm/core/utility/parameters/ParameterGroup_impl.hpp \
-opm/core/utility/parameters/ParameterMapItem.hpp \
-opm/core/utility/parameters/ParameterRequirement.hpp \
-opm/core/utility/parameters/ParameterStrings.hpp \
-opm/core/utility/parameters/ParameterTools.hpp \
-opm/core/utility/parameters/ParameterXML.hpp \
-opm/core/utility/parameters/tinyxml/tinystr.h \
-opm/core/utility/parameters/tinyxml/tinyxml.h \
-opm/core/utility/writeVtkData.hpp \
-opm/core/vag_format/vag.hpp \
-opm/core/well.h \
-opm/core/wells/InjectionSpecification.hpp \
-opm/core/wells/ProductionSpecification.hpp \
-opm/core/wells/WellCollection.hpp \
-opm/core/wells/WellsGroup.hpp \
+opm/core/fluid/SaturationPropsBasic.hpp \
+opm/core/fluid/SaturationPropsFromDeck.hpp \
+opm/core/fluid/SaturationPropsFromDeck_impl.hpp \
+opm/core/fluid/SaturationPropsInterface.hpp \
+opm/core/fluid/SimpleFluid2p.hpp \
+opm/core/fluid/blackoil/BlackoilPhases.hpp \
+opm/core/fluid/blackoil/BlackoilPvtProperties.hpp \
+opm/core/fluid/blackoil/SinglePvtConstCompr.hpp \
+opm/core/fluid/blackoil/SinglePvtDead.hpp \
+opm/core/fluid/blackoil/SinglePvtDeadSpline.hpp \
+opm/core/fluid/blackoil/SinglePvtInterface.hpp \
+opm/core/fluid/blackoil/SinglePvtLiveGas.hpp \
+opm/core/fluid/blackoil/SinglePvtLiveOil.hpp \
+opm/core/fluid/blackoil/phaseUsageFromDeck.hpp \
+opm/core/grid.h \
+opm/core/grid/cart_grid.h \
+opm/core/grid/cornerpoint_grid.h \
+opm/core/grid/cpgpreprocess/facetopology.h \
+opm/core/grid/cpgpreprocess/geometry.h \
+opm/core/grid/cpgpreprocess/grdecl.h \
+opm/core/grid/cpgpreprocess/preprocess.h \
+opm/core/grid/cpgpreprocess/uniquepoints.h \
+opm/core/linalg/LinearSolverFactory.hpp \
+opm/core/linalg/LinearSolverInterface.hpp \
+opm/core/linalg/blas_lapack.h \
+opm/core/linalg/sparse_sys.h \
+opm/core/newwells.h \
+opm/core/pressure/CompressibleTpfa.hpp \
+opm/core/pressure/FlowBCManager.hpp \
+opm/core/pressure/HybridPressureSolver.hpp \
+opm/core/pressure/IncompTpfa.hpp \
+opm/core/pressure/TPFACompressiblePressureSolver.hpp \
+opm/core/pressure/TPFAPressureSolver.hpp \
+opm/core/pressure/flow_bc.h \
+opm/core/pressure/fsh.h \
+opm/core/pressure/fsh_common_impl.h \
+opm/core/pressure/mimetic/hybsys.h \
+opm/core/pressure/mimetic/hybsys_global.h \
+opm/core/pressure/mimetic/mimetic.h \
+opm/core/pressure/msmfem/coarse_conn.h \
+opm/core/pressure/msmfem/coarse_sys.h \
+opm/core/pressure/msmfem/dfs.h \
+opm/core/pressure/msmfem/hash_set.h \
+opm/core/pressure/msmfem/ifsh_ms.h \
+opm/core/pressure/msmfem/partition.h \
+opm/core/pressure/tpfa/cfs_tpfa.h \
+opm/core/pressure/tpfa/cfs_tpfa_residual.h \
+opm/core/pressure/tpfa/compr_bc.h \
+opm/core/pressure/tpfa/compr_quant.h \
+opm/core/pressure/tpfa/compr_quant_general.h \
+opm/core/pressure/tpfa/compr_source.h \
+opm/core/pressure/tpfa/ifs_tpfa.h \
+opm/core/pressure/tpfa/trans_tpfa.h \
+opm/core/simulator/BlackoilState.hpp \
+opm/core/simulator/SimulatorCompressibleTwophase.hpp \
+opm/core/simulator/SimulatorReport.hpp \
+opm/core/simulator/SimulatorIncompTwophase.hpp \
+opm/core/simulator/SimulatorTimer.hpp \
+opm/core/simulator/TwophaseState.hpp \
+opm/core/simulator/WellState.hpp \
+opm/core/transport/CSRMatrixBlockAssembler.hpp \
+opm/core/transport/CSRMatrixUmfpackSolver.hpp \
+opm/core/transport/GravityColumnSolver.hpp \
+opm/core/transport/GravityColumnSolver_impl.hpp \
+opm/core/transport/ImplicitAssembly.hpp \
+opm/core/transport/ImplicitTransport.hpp \
+opm/core/transport/JacobianSystem.hpp \
+opm/core/transport/NormSupport.hpp \
+opm/core/transport/SimpleFluid2pWrapper.hpp \
+opm/core/transport/SinglePointUpwindTwoPhase.hpp \
+opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp \
+opm/core/transport/reorder/TransportModelInterface.hpp \
+opm/core/transport/reorder/TransportModelTracerTof.hpp \
+opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp \
+opm/core/transport/reorder/TransportModelTwophase.hpp \
+opm/core/transport/reorder/nlsolvers.h \
+opm/core/transport/reorder/reordersequence.h \
+opm/core/transport/reorder/tarjan.h \
+opm/core/transport/spu_explicit.h \
+opm/core/transport/spu_implicit.h \
+opm/core/transport/transport_source.h \
+opm/core/utility/Average.hpp \
+opm/core/utility/ColumnExtract.hpp \
+opm/core/utility/DataMap.hpp \
+opm/core/utility/ErrorMacros.hpp \
+opm/core/utility/Factory.hpp \
+opm/core/utility/MonotCubicInterpolator.hpp \
+opm/core/utility/NonuniformTableLinear.hpp \
+opm/core/utility/RootFinders.hpp \
+opm/core/utility/SparseTable.hpp \
+opm/core/utility/SparseVector.hpp \
+opm/core/utility/StopWatch.hpp \
+opm/core/utility/UniformTableLinear.hpp \
+opm/core/utility/Units.hpp \
+opm/core/utility/buildUniformMonotoneTable.hpp \
+opm/core/utility/initState.hpp \
+opm/core/utility/initState_impl.hpp \
+opm/core/utility/linInt.hpp \
+opm/core/utility/linearInterpolation.hpp \
+opm/core/utility/miscUtilities.hpp \
+opm/core/utility/miscUtilitiesBlackoil.hpp \
+opm/core/utility/parameters/Parameter.hpp \
+opm/core/utility/parameters/ParameterGroup.hpp \
+opm/core/utility/parameters/ParameterGroup_impl.hpp \
+opm/core/utility/parameters/ParameterMapItem.hpp \
+opm/core/utility/parameters/ParameterRequirement.hpp \
+opm/core/utility/parameters/ParameterStrings.hpp \
+opm/core/utility/parameters/ParameterTools.hpp \
+opm/core/utility/parameters/ParameterXML.hpp \
+opm/core/utility/parameters/tinyxml/tinystr.h \
+opm/core/utility/parameters/tinyxml/tinyxml.h \
+opm/core/utility/writeVtkData.hpp \
+opm/core/vag_format/vag.hpp \
+opm/core/well.h \
+opm/core/wells/InjectionSpecification.hpp \
+opm/core/wells/ProductionSpecification.hpp \
+opm/core/wells/WellCollection.hpp \
+opm/core/wells/WellsGroup.hpp \
opm/core/wells/WellsManager.hpp
# ----------------------------------------------------------------------
# Optional library constituents.
if UMFPACK
-lib_libopmcore_la_SOURCES += \
-opm/core/linalg/call_umfpack.c \
+lib_libopmcore_la_SOURCES += \
+opm/core/linalg/call_umfpack.c \
opm/core/linalg/LinearSolverUmfpack.cpp
-nobase_include_HEADERS += \
-opm/core/linalg/call_umfpack.h \
+nobase_include_HEADERS += \
+opm/core/linalg/call_umfpack.h \
opm/core/linalg/LinearSolverUmfpack.hpp
endif
+
if HAVE_ERT
lib_libopmcore_la_SOURCES += \
opm/core/utility/writeECLData.cpp
@@ -299,26 +306,26 @@ endif
if DUNE_ISTL
-lib_libopmcore_la_SOURCES += \
+lib_libopmcore_la_SOURCES += \
opm/core/linalg/LinearSolverIstl.cpp
-nobase_include_HEADERS += \
+nobase_include_HEADERS += \
opm/core/linalg/LinearSolverIstl.hpp
endif
if BUILD_AGMG
-nodist_lib_libopmcore_la_SOURCES += \
-$(AGMG_SRCDIR)/dagmg.f90 \
+nodist_lib_libopmcore_la_SOURCES += \
+$(AGMG_SRCDIR)/dagmg.f90 \
$(AGMG_SRCDIR)/dagmg_mumps.f90
-lib_libopmcore_la_SOURCES += \
+lib_libopmcore_la_SOURCES += \
opm/core/linalg/LinearSolverAGMG.cpp
-nobase_include_HEADERS += \
+nobase_include_HEADERS += \
opm/core/linalg/LinearSolverAGMG.hpp
-lib_libopmcore_la_LDFLAGS += \
+lib_libopmcore_la_LDFLAGS += \
$(FCLIBS)
endif
diff --git a/README b/README
index f0314100..f2dfddcc 100644
--- a/README
+++ b/README
@@ -56,10 +56,10 @@ sudo add-apt-repository -y ppa:opm/ppa
sudo apt-get update
# parts of DUNE needed
-sudo apt-get install libdune-common-dev libdune-istl-dev
+sudo apt-get install libdune-common-dev libdune-istl-dev libdune-grid-dev
# libraries necessary for OPM
-sudo apt-get install -y libxml0-dev
+sudo apt-get install -y libxml2-dev
DEPENDENCIES FOR SUSE BASED DISTRIBUTIONS
@@ -88,10 +88,25 @@ If you want to contribute, fork OPM/opm-core on github.
BUILDING
--------
+There are two ways to build the opm-core library:
+
+1. As a stand-alone library.
cd opm-core
autoreconf -i
./configure
make
+If you want to install the library:
+ make install
+or (if installing to /usr/local or similar)
+ sudo make install
+
+2. As a dune module.
+ - Put the opm-core directory in the same directory
+ as the other dune modules to be built (e.g. dune-commmon,
+ dune-grid).
+ - Run dunecontrol as normal. For more information on
+ the dune build system, see
+ http://www.dune-project.org/doc/installation-notes.html
DOCUMENTATION
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 35fe4e75..145fbbdd 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -3,19 +3,34 @@ ERT_INCLUDE_PATH = $(ERT_ROOT)/include
AM_CPPFLAGS = \
-I$(top_srcdir) \
-$(OPM_BOOST_CPPFLAGS) \
--I$(ERT_INCLUDE_PATH)
+-I$(ERT_INCLUDE_PATH) \
+$(OPM_BOOST_CPPFLAGS)
# All targets link to the library
LDADD = \
$(top_builddir)/lib/libopmcore.la
+# Convenience definition for targets that use Boost.Filesystem directly.
+# While libopmcore depends on (and references) Boost.Filesystem (through
+# the $(BOOST_FILESYSTEM_LIB) macro) this indirect dependency is not
+# sufficient to satisfy the requirements of targets that use the indirect
+# libraries directly.
+#
+# Additional details at
+# https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
+#
+LINK_BOOST_FILESYSTEM = \
+$(OPM_BOOST_LDFLAGS) \
+$(BOOST_FILESYSTEM_LIB) \
+$(BOOST_SYSTEM_LIB)
+
# ----------------------------------------------------------------------
# Declare products (i.e., the example programs).
#
# Please keep the list sorted.
noinst_PROGRAMS = \
+compute_tof \
refine_wells \
scaneclipsedeck \
sim_2p_comp_reorder \
@@ -30,10 +45,19 @@ wells_example
#
# Please maintain sort order from "noinst_PROGRAMS".
+compute_tof_SOURCES = compute_tof.cpp
+compute_tof_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
refine_wells_SOURCES = refine_wells.cpp
+
sim_2p_comp_reorder_SOURCES = sim_2p_comp_reorder.cpp
+sim_2p_comp_reorder_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
+
sim_2p_incomp_reorder_SOURCES = sim_2p_incomp_reorder.cpp
+sim_2p_incomp_reorder_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
+
sim_wateroil_SOURCES = sim_wateroil.cpp
+sim_wateroil_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
+
wells_example_SOURCES = wells_example.cpp
# ----------------------------------------------------------------------
@@ -45,5 +69,6 @@ noinst_PROGRAMS += spu_2p
spu_2p_SOURCES = spu_2p.cpp
spu_2p_LDADD = \
$(LDADD) \
+$(LINK_BOOST_FILESYSTEM) \
$(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS)
endif
diff --git a/examples/compute_tof.cpp b/examples/compute_tof.cpp
new file mode 100644
index 00000000..046dae38
--- /dev/null
+++ b/examples/compute_tof.cpp
@@ -0,0 +1,254 @@
+/*
+ Copyright 2012 SINTEF ICT, Applied Mathematics.
+
+ This file is part of the Open Porous Media project (OPM).
+
+ OPM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OPM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OPM. If not, see .
+*/
+
+
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif // HAVE_CONFIG_H
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+
+namespace
+{
+ void warnIfUnusedParams(const Opm::parameter::ParameterGroup& param)
+ {
+ if (param.anyUnused()) {
+ std::cout << "-------------------- Unused parameters: --------------------\n";
+ param.displayUsage();
+ std::cout << "----------------------------------------------------------------" << std::endl;
+ }
+ }
+} // anon namespace
+
+
+
+// ----------------- Main program -----------------
+int
+main(int argc, char** argv)
+{
+ using namespace Opm;
+
+ std::cout << "\n================ Test program for incompressible tof computations ===============\n\n";
+ parameter::ParameterGroup param(argc, argv, false);
+ std::cout << "--------------- Reading parameters ---------------" << std::endl;
+
+ // If we have a "deck_filename", grid and props will be read from that.
+ bool use_deck = param.has("deck_filename");
+ boost::scoped_ptr deck;
+ boost::scoped_ptr grid;
+ boost::scoped_ptr props;
+ boost::scoped_ptr wells;
+ TwophaseState state;
+ // bool check_well_controls = false;
+ // int max_well_control_iterations = 0;
+ double gravity[3] = { 0.0 };
+ if (use_deck) {
+ std::string deck_filename = param.get("deck_filename");
+ deck.reset(new EclipseGridParser(deck_filename));
+ // Grid init
+ grid.reset(new GridManager(*deck));
+ // Rock and fluid init
+ props.reset(new IncompPropertiesFromDeck(*deck, *grid->c_grid()));
+ // Wells init.
+ wells.reset(new Opm::WellsManager(*deck, *grid->c_grid(), props->permeability()));
+ // Gravity.
+ gravity[2] = deck->hasField("NOGRAV") ? 0.0 : unit::gravity;
+ // Init state variables (saturation and pressure).
+ if (param.has("init_saturation")) {
+ initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
+ } else {
+ initStateFromDeck(*grid->c_grid(), *props, *deck, gravity[2], state);
+ }
+ } else {
+ // Grid init.
+ const int nx = param.getDefault("nx", 100);
+ const int ny = param.getDefault("ny", 100);
+ const int nz = param.getDefault("nz", 1);
+ const double dx = param.getDefault("dx", 1.0);
+ const double dy = param.getDefault("dy", 1.0);
+ const double dz = param.getDefault("dz", 1.0);
+ grid.reset(new GridManager(nx, ny, nz, dx, dy, dz));
+ // Rock and fluid init.
+ props.reset(new IncompPropertiesBasic(param, grid->c_grid()->dimensions, grid->c_grid()->number_of_cells));
+ // Wells init.
+ wells.reset(new Opm::WellsManager());
+ // Gravity.
+ gravity[2] = param.getDefault("gravity", 0.0);
+ // Init state variables (saturation and pressure).
+ initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
+ }
+
+ // Warn if gravity but no density difference.
+ bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
+ if (use_gravity) {
+ if (props->density()[0] == props->density()[1]) {
+ std::cout << "**** Warning: nonzero gravity, but zero density difference." << std::endl;
+ }
+ }
+ const double *grav = use_gravity ? &gravity[0] : 0;
+
+ // Initialising src
+ std::vector porevol;
+ computePorevolume(*grid->c_grid(), props->porosity(), porevol);
+ int num_cells = grid->c_grid()->number_of_cells;
+ std::vector src(num_cells, 0.0);
+ if (use_deck) {
+ // Do nothing, wells will be the driving force, not source terms.
+ } else {
+ const double tot_porevol_init = std::accumulate(porevol.begin(), porevol.end(), 0.0);
+ const double default_injection = use_gravity ? 0.0 : 0.1;
+ const double flow_per_sec = param.getDefault("injected_porevolumes_per_day", default_injection)
+ *tot_porevol_init/unit::day;
+ src[0] = flow_per_sec;
+ src[num_cells - 1] = -flow_per_sec;
+ }
+
+ // Boundary conditions.
+ FlowBCManager bcs;
+ if (param.getDefault("use_pside", false)) {
+ int pside = param.get("pside");
+ double pside_pressure = param.get("pside_pressure");
+ bcs.pressureSide(*grid->c_grid(), FlowBCManager::Side(pside), pside_pressure);
+ }
+
+ // Linear solver.
+ LinearSolverFactory linsolver(param);
+
+ // Pressure solver.
+ Opm::IncompTpfa psolver(*grid->c_grid(), *props, 0, linsolver,
+ 0.0, 0.0, 0,
+ grav, wells->c_wells(), src, bcs.c_bcs());
+
+ // Choice of tof solver.
+ bool use_dg = param.getDefault("use_dg", false);
+ int dg_degree = -1;
+ if (use_dg) {
+ dg_degree = param.getDefault("dg_degree", 0);
+ }
+
+ // Write parameters used for later reference.
+ bool output = param.getDefault("output", true);
+ std::ofstream epoch_os;
+ std::string output_dir;
+ if (output) {
+ output_dir =
+ param.getDefault("output_dir", std::string("output"));
+ boost::filesystem::path fpath(output_dir);
+ try {
+ create_directories(fpath);
+ }
+ catch (...) {
+ THROW("Creating directories failed: " << fpath);
+ }
+ std::string filename = output_dir + "/epoch_timing.param";
+ epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
+ // open file to clean it. The file is appended to in SimulatorTwophase
+ filename = output_dir + "/step_timing.param";
+ std::fstream step_os(filename.c_str(), std::fstream::trunc | std::fstream::out);
+ step_os.close();
+ param.writeParam(output_dir + "/simulation.param");
+ }
+
+ // Init wells.
+ Opm::WellState well_state;
+ well_state.init(wells->c_wells(), state);
+
+ // Main solvers.
+ Opm::time::StopWatch pressure_timer;
+ double ptime = 0.0;
+ Opm::time::StopWatch transport_timer;
+ double ttime = 0.0;
+ Opm::time::StopWatch total_timer;
+ total_timer.start();
+ std::cout << "\n\n================ Starting main solvers ===============" << std::endl;
+
+ // Solve pressure.
+ pressure_timer.start();
+ psolver.solve(1.0, state, well_state);
+ pressure_timer.stop();
+ double pt = pressure_timer.secsSinceStart();
+ std::cout << "Pressure solver took: " << pt << " seconds." << std::endl;
+ ptime += pt;
+
+ // Process transport sources (to include bdy terms and well flows).
+ std::vector transport_src;
+ Opm::computeTransportSource(*grid->c_grid(), src, state.faceflux(), 1.0,
+ wells->c_wells(), well_state.perfRates(), transport_src);
+
+ // Solve time-of-flight.
+ std::vector tof;
+ if (use_dg) {
+ Opm::TransportModelTracerTofDiscGal tofsolver(*grid->c_grid());
+ transport_timer.start();
+ tofsolver.solveTof(&state.faceflux()[0], &porevol[0], &transport_src[0], dg_degree, tof);
+ transport_timer.stop();
+ } else {
+ Opm::TransportModelTracerTof tofsolver(*grid->c_grid());
+ transport_timer.start();
+ tofsolver.solveTof(&state.faceflux()[0], &porevol[0], &transport_src[0], tof);
+ transport_timer.stop();
+ }
+ double tt = transport_timer.secsSinceStart();
+ std::cout << "Transport solver took: " << tt << " seconds." << std::endl;
+ ttime += tt;
+ total_timer.stop();
+
+ // Output.
+ if (output) {
+ std::string tof_filename = output_dir + "/tof.txt";
+ std::ofstream tof_stream(tof_filename.c_str());
+ std::copy(tof.begin(), tof.end(), std::ostream_iterator(tof_stream, "\n"));
+ }
+
+ std::cout << "\n\n================ End of simulation ===============\n"
+ << "Total time taken: " << total_timer.secsSinceStart()
+ << "\n Pressure time: " << ptime
+ << "\n Transport time: " << ttime << std::endl;
+}
diff --git a/m4/opm_core.m4 b/m4/opm_core.m4
index efb75c13..40e1b7c5 100644
--- a/m4/opm_core.m4
+++ b/m4/opm_core.m4
@@ -17,8 +17,8 @@ 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.
diff --git a/m4/opm_superlu.m4 b/m4/opm_superlu.m4
new file mode 100644
index 00000000..ed42bd41
--- /dev/null
+++ b/m4/opm_superlu.m4
@@ -0,0 +1,334 @@
+## -*- 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([_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([_slu_search_versions],
+ [
+ my_slu_header=slu_ddefs.h
+ _slu_lib_path($1, $my_slu_header)
+ if test "$my_slu_found" != "yes"; then
+ my_slu_header="dsp_defs.h"
+ _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([_slu_search_default],
+ [
+ with_superlu=/usr
+ _slu_search_versions($with_superlu)
+
+ if test "$my_slu_found" = "no"; then
+ with_superlu=/usr/local
+ _slu_search_versions($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])
+
+ #
+ # 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
+ with_superlu=`eval cd $withval > /dev/null 2>&1 && pwd`
+ if test x"$withval" = xyes; then
+ # Search in default locations
+ _slu_search_default
+ else
+ # Search for the headers in the specified location
+ _slu_search_versions(["$with_superlu"])
+ fi
+ fi
+ ], [dnl
+ # Search in default locations
+ _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"$with_superlu" != x"no" ; then
+ # defaultpath
+ SUPERLU_LIB_PATH="$with_superlu/$my_lib_path"
+ SUPERLU_INCLUDE_PATH="$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 # $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"
+])
diff --git a/opm/core/eclipse/EclipseGridParserHelpers.hpp b/opm/core/eclipse/EclipseGridParserHelpers.hpp
index 6ab5fb78..7bc0e003 100644
--- a/opm/core/eclipse/EclipseGridParserHelpers.hpp
+++ b/opm/core/eclipse/EclipseGridParserHelpers.hpp
@@ -398,10 +398,18 @@ namespace
yv.push_back(table[k][i]);
}
}
- // Interpolate
- for (int i=0; i double_data(10, -1.0E20);
- const int num_to_read = 10;
+ const int num_to_read = 4;
int num_read = readDefaultedVectorData(is, double_data, num_to_read);
gconinje_line.surface_flow_max_rate_ = double_data[0];
gconinje_line.resv_flow_max_rate_ = double_data[1];
diff --git a/opm/core/fluid/IncompPropertiesInterface.hpp b/opm/core/fluid/IncompPropertiesInterface.hpp
index 4f8bfb51..d3aaaa7b 100644
--- a/opm/core/fluid/IncompPropertiesInterface.hpp
+++ b/opm/core/fluid/IncompPropertiesInterface.hpp
@@ -62,7 +62,7 @@ namespace Opm
/// \return Array of P viscosity values.
virtual const double* viscosity() const = 0;
- /// Densities of fluid phases at surface conditions.
+ /// Densities of fluid phases at reservoir conditions.
/// \return Array of P density values.
virtual const double* density() const = 0;
diff --git a/opm/core/grid/cpgpreprocess/preprocess.c b/opm/core/grid/cpgpreprocess/preprocess.c
index 84e9e8fe..dc274160 100644
--- a/opm/core/grid/cpgpreprocess/preprocess.c
+++ b/opm/core/grid/cpgpreprocess/preprocess.c
@@ -590,6 +590,9 @@ get_zcorn_sign(int nx, int ny, int nz, const int *actnum,
c1 = i/2 + nx*(j/2 + ny*(k/2));
c2 = i/2 + nx*(j/2 + ny*((k+1)/2));
+ assert (c1 < (nx * ny * nz));
+ assert (c2 < (nx * ny * nz));
+
if (((actnum == NULL) ||
(actnum[c1] && actnum[c2]))
&& (z2 < z1)) {
diff --git a/opm/core/newwells.c b/opm/core/newwells.c
index 68037201..c28e8566 100644
--- a/opm/core/newwells.c
+++ b/opm/core/newwells.c
@@ -468,6 +468,8 @@ add_well(enum WellType type ,
struct WellMgmt *m;
+ assert (W != NULL);
+
nw = W->number_of_wells;
nperf_tot = W->well_connpos[nw];
@@ -532,6 +534,7 @@ append_well_controls(enum WellControlType type,
struct WellControlMgmt *m;
assert (W != NULL);
+ assert ((0 <= well_index) && (well_index < W->number_of_wells));
ctrl = W->ctrls[well_index];
np = W->number_of_phases;
@@ -567,8 +570,13 @@ void
set_current_control(int well_index, int current_control, struct Wells *W)
/* ---------------------------------------------------------------------- */
{
+ assert (W != NULL);
+ assert ((0 <= well_index) && (well_index < W->number_of_wells));
+
assert (W->ctrls[well_index] != NULL);
+ assert (current_control < W->ctrls[well_index]->num);
+
W->ctrls[well_index]->current = current_control;
}
@@ -578,7 +586,85 @@ void
clear_well_controls(int well_index, struct Wells *W)
/* ---------------------------------------------------------------------- */
{
+ assert (W != NULL);
+ assert ((0 <= well_index) && (well_index < W->number_of_wells));
+
if (W->ctrls[well_index] != NULL) {
W->ctrls[well_index]->num = 0;
}
}
+
+
+/* ---------------------------------------------------------------------- */
+struct Wells *
+clone_wells(const struct Wells *W)
+/* ---------------------------------------------------------------------- */
+{
+ int c, np, nperf, ok, pos, w;
+ double target;
+ const int *cells;
+ const double *WI, *comp_frac, *distr;
+ enum WellControlType type;
+ const struct WellControls *ctrls;
+
+ struct Wells *ret;
+
+ if (W == NULL) {
+ ret = NULL;
+ }
+ else {
+ np = W->number_of_phases;
+ ret = create_wells(W->number_of_phases, W->number_of_wells,
+ W->well_connpos[ W->number_of_wells ]);
+
+ if (ret != NULL) {
+ pos = W->well_connpos[ 0 ];
+ ok = 1;
+
+ for (w = 0; ok && (w < W->number_of_wells); w++) {
+ nperf = W->well_connpos[w + 1] - pos;
+ cells = W->well_cells + pos;
+
+ WI = W->WI != NULL ? W->WI + pos : NULL;
+ comp_frac = W->comp_frac != NULL ? W->comp_frac + w*np : NULL;
+
+ ok = add_well(W->type[ w ], W->depth_ref[ w ], nperf,
+ comp_frac, cells, WI, W->name[ w ], ret);
+
+ /* Capacity should be sufficient from create_wells() */
+ assert (ok);
+
+ ctrls = W->ctrls[ w ];
+
+ if (ok) {
+ ok = well_controls_reserve(ctrls->num, np, ret->ctrls[ w ]);
+
+ for (c = 0; ok && (c < ctrls->num); c++) {
+ type = ctrls->type [ c ];
+ target = ctrls->target[ c ];
+ distr = & ctrls->distr [ c * np ];
+
+ ok = append_well_controls(type, target, distr, w, ret);
+
+ /* Capacity *should* be sufficient from
+ * well_controls_reserve() */
+ assert (ok);
+ }
+ }
+
+ if (ok) {
+ set_current_control(w, ctrls->current, ret);
+ }
+
+ pos = W->well_connpos[w + 1];
+ }
+
+ if (! ok) {
+ destroy_wells(ret);
+ ret = NULL;
+ }
+ }
+ }
+
+ return ret;
+}
diff --git a/opm/core/newwells.h b/opm/core/newwells.h
index f16675b6..20cfce61 100644
--- a/opm/core/newwells.h
+++ b/opm/core/newwells.h
@@ -235,6 +235,19 @@ void
destroy_wells(struct Wells *W);
+/**
+ * Create a deep-copy (i.e., clone) of an existing Wells object, including its
+ * controls.
+ *
+ * @param[in] W Existing Wells object.
+ * @return Complete clone of the input object. Dispose of resources using
+ * function destroy_wells() when no longer needed. Returns @c NULL in case of
+ * allocation failure.
+ */
+struct Wells *
+clone_wells(const struct Wells *W);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/opm/core/simulator/SimulatorCompressibleTwophase.cpp b/opm/core/simulator/SimulatorCompressibleTwophase.cpp
index 6fb475e9..e921db87 100644
--- a/opm/core/simulator/SimulatorCompressibleTwophase.cpp
+++ b/opm/core/simulator/SimulatorCompressibleTwophase.cpp
@@ -407,8 +407,8 @@ namespace Opm
// Optionally, check if well controls are satisfied.
if (check_well_controls_) {
Opm::computePhaseFlowRatesPerWell(*wells_,
- fractional_flows,
well_state.perfRates(),
+ fractional_flows,
well_resflows_phase);
std::cout << "Checking well conditions." << std::endl;
// For testing we set surface := reservoir
diff --git a/opm/core/simulator/SimulatorIncompTwophase.cpp b/opm/core/simulator/SimulatorIncompTwophase.cpp
index 60f63806..911c64ce 100644
--- a/opm/core/simulator/SimulatorIncompTwophase.cpp
+++ b/opm/core/simulator/SimulatorIncompTwophase.cpp
@@ -485,8 +485,8 @@ namespace Opm
// Optionally, check if well controls are satisfied.
if (check_well_controls_) {
Opm::computePhaseFlowRatesPerWell(*wells_,
- fractional_flows,
well_state.perfRates(),
+ fractional_flows,
well_resflows_phase);
std::cout << "Checking well conditions." << std::endl;
// For testing we set surface := reservoir
diff --git a/opm/core/transport/reorder/TransportModelInterface.cpp b/opm/core/transport/reorder/TransportModelInterface.cpp
index f8e138a3..8a90ae34 100644
--- a/opm/core/transport/reorder/TransportModelInterface.cpp
+++ b/opm/core/transport/reorder/TransportModelInterface.cpp
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
@@ -31,7 +32,11 @@ void Opm::TransportModelInterface::reorderAndTransport(const UnstructuredGrid& g
std::vector sequence(grid.number_of_cells);
std::vector components(grid.number_of_cells + 1);
int ncomponents;
+ time::StopWatch clock;
+ clock.start();
compute_sequence(&grid, darcyflux, &sequence[0], &components[0], &ncomponents);
+ clock.stop();
+ std::cout << "Topological sort took: " << clock.secsSinceStart() << " seconds." << std::endl;
// Invoke appropriate solve method for each interdependent component.
for (int comp = 0; comp < ncomponents; ++comp) {
diff --git a/opm/core/transport/reorder/TransportModelTracerTof.cpp b/opm/core/transport/reorder/TransportModelTracerTof.cpp
new file mode 100644
index 00000000..8d93f248
--- /dev/null
+++ b/opm/core/transport/reorder/TransportModelTracerTof.cpp
@@ -0,0 +1,122 @@
+/*
+ Copyright 2012 SINTEF ICT, Applied Mathematics.
+
+ This file is part of the Open Porous Media project (OPM).
+
+ OPM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OPM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OPM. If not, see .
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace Opm
+{
+
+
+ /// Construct solver.
+ /// \param[in] grid A 2d or 3d grid.
+ TransportModelTracerTof::TransportModelTracerTof(const UnstructuredGrid& grid)
+ : grid_(grid)
+ {
+ }
+
+
+
+
+ /// Solve for time-of-flight.
+ /// \param[in] darcyflux Array of signed face fluxes.
+ /// \param[in] porevolume Array of pore volumes.
+ /// \param[in] source Source term. Sign convention is:
+ /// (+) inflow flux,
+ /// (-) outflow flux.
+ /// \param[out] tof Array of time-of-flight values.
+ void TransportModelTracerTof::solveTof(const double* darcyflux,
+ const double* porevolume,
+ const double* source,
+ std::vector& tof)
+ {
+ darcyflux_ = darcyflux;
+ porevolume_ = porevolume;
+ source_ = source;
+#ifndef NDEBUG
+ // Sanity check for sources.
+ const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
+ if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
+ THROW("Sources do not sum to zero: " << cum_src);
+ }
+#endif
+ tof.resize(grid_.number_of_cells);
+ std::fill(tof.begin(), tof.end(), 0.0);
+ tof_ = &tof[0];
+ reorderAndTransport(grid_, darcyflux);
+ }
+
+
+
+
+ void TransportModelTracerTof::solveSingleCell(const int cell)
+ {
+ // Compute flux terms.
+ // Sources have zero tof, and therefore do not contribute
+ // to upwind_term. Sinks on the other hand, must be added
+ // to the downwind_flux (note sign change resulting from
+ // different sign conventions: pos. source is injection,
+ // pos. flux is outflow).
+ double upwind_term = 0.0;
+ double downwind_flux = std::max(-source_[cell], 0.0);
+ for (int i = grid_.cell_facepos[cell]; i < grid_.cell_facepos[cell+1]; ++i) {
+ int f = grid_.cell_faces[i];
+ double flux;
+ int other;
+ // Compute cell flux
+ if (cell == grid_.face_cells[2*f]) {
+ flux = darcyflux_[f];
+ other = grid_.face_cells[2*f+1];
+ } else {
+ flux =-darcyflux_[f];
+ other = grid_.face_cells[2*f];
+ }
+ // Add flux to upwind_term or downwind_flux, if interior.
+ if (other != -1) {
+ if (flux < 0.0) {
+ upwind_term += flux*tof_[other];
+ } else {
+ downwind_flux += flux;
+ }
+ }
+ }
+
+ // Compute tof.
+ tof_[cell] = (porevolume_[cell] - upwind_term)/downwind_flux;
+ }
+
+
+
+
+ void TransportModelTracerTof::solveMultiCell(const int num_cells, const int* cells)
+ {
+ std::cout << "Pretending to solve multi-cell dependent equation with " << num_cells << " cells." << std::endl;
+ for (int i = 0; i < num_cells; ++i) {
+ solveSingleCell(cells[i]);
+ }
+ }
+
+
+
+
+} // namespace Opm
diff --git a/opm/core/transport/reorder/TransportModelTracerTof.hpp b/opm/core/transport/reorder/TransportModelTracerTof.hpp
new file mode 100644
index 00000000..270ac328
--- /dev/null
+++ b/opm/core/transport/reorder/TransportModelTracerTof.hpp
@@ -0,0 +1,74 @@
+/*
+ Copyright 2012 SINTEF ICT, Applied Mathematics.
+
+ This file is part of the Open Porous Media project (OPM).
+
+ OPM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OPM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OPM. If not, see .
+*/
+
+#ifndef OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED
+#define OPM_TRANSPORTMODELTRACERTOF_HEADER_INCLUDED
+
+#include
+#include
+#include