diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake
index 8eb2d685e..bb119f3ad 100644
--- a/CMakeLists_files.cmake
+++ b/CMakeLists_files.cmake
@@ -113,6 +113,7 @@ list (APPEND EXAMPLE_SOURCE_FILES
examples/flow_reorder.cpp
examples/flow_sequential.cpp
examples/flow_ebos.cpp
+ examples/flow_ebos_2p.cpp
examples/flow_ebos_solvent.cpp
examples/flow_ebos_polymer.cpp
examples/flow_multisegment.cpp
diff --git a/compareECLFiles.cmake b/compareECLFiles.cmake
index 8cbaf49d9..2cbcf8059 100644
--- a/compareECLFiles.cmake
+++ b/compareECLFiles.cmake
@@ -105,6 +105,7 @@ set(rel_tol 1e-5)
add_test_compareECLFiles(spe1 SPE1CASE2 flow_ebos ${abs_tol} ${rel_tol} compareECLFiles "")
add_test_compareECLFiles(spe1_2p SPE1CASE2_2P flow_ebos ${abs_tol} ${rel_tol} compareECLFiles "" spe1)
+add_test_compareECLFiles(spe1_2p SPE1CASE2_2P flow_ebos_2p ${abs_tol} ${rel_tol} compareECLFiles "" spe1)
add_test_compareECLFiles(spe1 SPE1CASE2 flow_legacy ${abs_tol} ${rel_tol} compareECLFiles "")
add_test_compareECLFiles(spe1_2p SPE1CASE2_2P flow_legacy ${abs_tol} ${rel_tol} compareECLFiles "" spe1)
add_test_compareECLFiles(spe1 SPE1CASE1 flow_sequential ${abs_tol} ${rel_tol} compareECLFiles "")
diff --git a/examples/flow_ebos_2p.cpp b/examples/flow_ebos_2p.cpp
new file mode 100644
index 000000000..0ef174ca0
--- /dev/null
+++ b/examples/flow_ebos_2p.cpp
@@ -0,0 +1,49 @@
+/*
+ Copyright 2017 IRIS AS
+
+ 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
+
+// Define making clear that the simulator supports AMG
+#define FLOW_SUPPORT_AMG 1
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+namespace Ewoms {
+namespace Properties {
+NEW_TYPE_TAG(EclFlowTwoPhaseProblem, INHERITS_FROM(EclFlowProblem));
+//! The indices required by the model
+SET_TYPE_PROP(EclFlowTwoPhaseProblem, Indices,
+ Ewoms::BlackOilTwoPhaseIndices);
+}}
+
+// ----------------- Main program -----------------
+int main(int argc, char** argv)
+{
+ Opm::FlowMainEbos mainfunc;
+ return mainfunc.execute(argc, argv);
+}
diff --git a/opm/autodiff/StandardWellsDense.hpp b/opm/autodiff/StandardWellsDense.hpp
index e2125ec51..16cee601c 100644
--- a/opm/autodiff/StandardWellsDense.hpp
+++ b/opm/autodiff/StandardWellsDense.hpp
@@ -86,21 +86,22 @@ enum WellVariablePositions {
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
+ typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
- typedef double Scalar;
static const int numEq = BlackoilIndices::numEq;
- static const int numWellEq = GET_PROP_VALUE(TypeTag, EnablePolymer)? 3:numEq; // //numEq; //number of wellEq is only for 3 for polymer
+ static const int numWellEq = GET_PROP_VALUE(TypeTag, EnablePolymer)? numEq-1 : numEq; // //numEq; //number of wellEq is only numEq for polymer
static const int contiSolventEqIdx = BlackoilIndices::contiSolventEqIdx;
static const int contiPolymerEqIdx = BlackoilIndices::contiPolymerEqIdx;
static const int solventSaturationIdx = BlackoilIndices::solventSaturationIdx;
static const int polymerConcentrationIdx = BlackoilIndices::polymerConcentrationIdx;
+
typedef Dune::FieldVector VectorBlockType;
typedef Dune::FieldMatrix MatrixBlockType;
typedef Dune::BCRSMatrix Mat;
typedef Dune::BlockVector BVector;
- typedef DenseAd::Evaluation EvalWell;
- typedef DenseAd::Evaluation Eval;
+ typedef DenseAd::Evaluation EvalWell;
+ typedef DenseAd::Evaluation Eval;
typedef Ewoms::BlackOilPolymerModule PolymerModule;
// For the conversion between the surface volume rate and resrevoir voidage rate
diff --git a/opm/autodiff/StandardWellsDense_impl.hpp b/opm/autodiff/StandardWellsDense_impl.hpp
index 52ec4b835..c9ba026a3 100644
--- a/opm/autodiff/StandardWellsDense_impl.hpp
+++ b/opm/autodiff/StandardWellsDense_impl.hpp
@@ -239,7 +239,7 @@ namespace Opm {
}
// add trivial equation for 2p cases (Only support water + oil)
- if (numComp == 2) {
+ if (numComp < numEq ) {
assert(!active_[ Gas ]);
invDuneD_[w][w][Gas][Gas] = 1.0;
}