Merge pull request #1235 from dr-robertk/PR/bo-two-phase

Added two-phase executable for numEq = 2.
This commit is contained in:
Atgeirr Flø Rasmussen 2017-06-29 14:35:07 +02:00 committed by GitHub
commit f0b60cfeed
5 changed files with 57 additions and 5 deletions

View File

@ -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

View File

@ -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 "")

49
examples/flow_ebos_2p.cpp Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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 <opm/material/densead/Evaluation.hpp>
#include <ewoms/models/blackoil/blackoiltwophaseindices.hh>
#include <opm/autodiff/DuneMatrix.hpp>
#include <dune/grid/CpGrid.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/autodiff/FlowMainEbos.hpp>
namespace Ewoms {
namespace Properties {
NEW_TYPE_TAG(EclFlowTwoPhaseProblem, INHERITS_FROM(EclFlowProblem));
//! The indices required by the model
SET_TYPE_PROP(EclFlowTwoPhaseProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent)?1:0, GET_PROP_VALUE(TypeTag, EnablePolymer)?1:0, /*PVOffset=*/0>);
}}
// ----------------- Main program -----------------
int main(int argc, char** argv)
{
Opm::FlowMainEbos<TTAG(EclFlowTwoPhaseProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}

View File

@ -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<Scalar, numEq > VectorBlockType;
typedef Dune::FieldMatrix<Scalar, numEq, numEq > MatrixBlockType;
typedef Dune::BCRSMatrix <MatrixBlockType> Mat;
typedef Dune::BlockVector<VectorBlockType> BVector;
typedef DenseAd::Evaluation<double, /*size=*/numEq + numWellEq> EvalWell;
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
typedef DenseAd::Evaluation<Scalar, /*size=*/numEq + numWellEq> EvalWell;
typedef DenseAd::Evaluation<Scalar, /*size=*/numEq> Eval;
typedef Ewoms::BlackOilPolymerModule<TypeTag> PolymerModule;
// For the conversion between the surface volume rate and resrevoir voidage rate

View File

@ -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;
}