Merge pull request #1416 from GitPaean/support_oil_water_polymer

trying to add the functionality to handle oil/water polymer
This commit is contained in:
Atgeirr Flø Rasmussen
2018-02-28 12:30:37 +01:00
committed by GitHub
6 changed files with 139 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow_ebos_oilwater.cpp
opm/simulators/flow_ebos_polymer.cpp
opm/simulators/flow_ebos_solvent.cpp
opm/simulators/flow_ebos_oilwater_polymer.cpp
opm/autodiff/Compat.cpp
opm/autodiff/ExtractParallelGridInformationToISTL.cpp
@@ -444,6 +445,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow_ebos_oilwater.hpp
opm/simulators/flow_ebos_polymer.hpp
opm/simulators/flow_ebos_solvent.hpp
opm/simulators/flow_ebos_oilwater_polymer.hpp
opm/simulators/ensureDirectoryExists.hpp
opm/simulators/ParallelFileMerger.hpp
opm/simulators/SimulatorCompressibleTwophase.hpp

View File

@@ -225,6 +225,12 @@ add_test_compareECLFiles(CASENAME msw_3d_hfa
REL_TOL ${rel_tol}
TEST_ARGS use_multisegment_well=true)
add_test_compareECLFiles(CASENAME polymer_oilwater
FILENAME 2D_OILWATER_POLYMER
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol})
add_test_compareECLFiles(CASENAME polymer_simple2D
FILENAME 2D_THREEPHASE_POLY_HETER
SIMULATOR flow

View File

@@ -25,6 +25,7 @@
#include <opm/simulators/flow_ebos_oilwater.hpp>
#include <opm/simulators/flow_ebos_solvent.hpp>
#include <opm/simulators/flow_ebos_polymer.hpp>
#include <opm/simulators/flow_ebos_oilwater_polymer.hpp>
#include <opm/autodiff/MissingFeatures.hpp>
#include <opm/common/utility/parameters/ParameterGroup.hpp>
@@ -166,8 +167,21 @@ int main(int argc, char** argv)
}
// Polymer case
else if ( phases.active( Opm::Phase::POLYMER ) ) {
Opm::flowEbosPolymerSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosPolymerMain(argc, argv);
if ( !phases.active( Opm::Phase::WATER) ) {
if (outputCout)
std::cerr << "No valid configuration is found for polymer simulation, valid options include "
<< "oilwater + polymer and blackoil + polymer" << std::endl;
return EXIT_FAILURE;
}
if ( phases.size() == 3 ) { // oil water polymer case
Opm::flowEbosOilWaterPolymerSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosOilWaterPolymerMain(argc, argv);
} else {
Opm::flowEbosPolymerSetDeck(*deck, *eclipseState, *schedule, *summary_config);
return Opm::flowEbosPolymerMain(argc, argv);
}
}
// Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) {

View File

@@ -0,0 +1,74 @@
/*
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/>.
*/
#include "config.h"
// Define making clear that the simulator supports AMG
#define FLOW_SUPPORT_AMG 1
#include <opm/simulators/flow_ebos_oilwater_polymer.hpp>
#include <opm/material/common/ResetLocale.hpp>
#include <ewoms/models/blackoil/blackoiltwophaseindices.hh>
#include <opm/grid/CpGrid.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/autodiff/FlowMainEbos.hpp>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
namespace Ewoms {
namespace Properties {
NEW_TYPE_TAG(EclFlowOilWaterPolymerProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowOilWaterPolymerProblem, EnablePolymer, true);
//! The indices required by the model
SET_TYPE_PROP(EclFlowOilWaterPolymerProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent) ? 1 : 0,
GET_PROP_VALUE(TypeTag, EnablePolymer) ? 1 : 0,
/*PVOffset =*/ 0, /*disabledCompIdx=*/ 2>);
}}
namespace Opm {
void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{
typedef TTAG(EclFlowOilWaterPolymerProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState, &schedule, &summaryConfig);
}
// ----------------- Main program -----------------
int flowEbosOilWaterPolymerMain(int argc, char** argv)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
Opm::resetLocale();
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
#else
Dune::MPIHelper::instance(argc, argv);
#endif
Opm::FlowMainEbos<TTAG(EclFlowOilWaterPolymerProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@@ -0,0 +1,31 @@
/*
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/>.
*/
#ifndef FLOW_EBOS_OILWATER_POLYMER_HPP
#define FLOW_EBOS_OILWATER_POLYMER_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
namespace Opm {
void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summary_config);
int flowEbosOilWaterPolymerMain(int argc, char** argv);
}
#endif // FLOW_EBOS_OILWATER_POLYMER_HPP

View File

@@ -20,7 +20,7 @@ copyToReferenceDir () {
}
tests=${@:2}
test -z "$tests" && tests="spe11 spe12 spe12p spe1oilgas spe1nowells spe3 spe5 spe9 norne_init msw_2d_h msw_3d_hfa polymer2d spe9group"
test -z "$tests" && tests="spe11 spe12 spe12p spe1oilgas spe1nowells spe3 spe5 spe9 norne_init msw_2d_h msw_3d_hfa polymer2d spe9group polymer_oilwater"
if grep -q -i "norne " <<< $ghprbCommentBody
then
if test -d $WORKSPACE/deps/opm-data/norne/flow
@@ -107,6 +107,15 @@ for test_name in ${tests}; do
EGRID INIT SMSPEC UNRST UNSMRY
fi
if grep -q "polymer_oilwater" <<< $test_name
then
copyToReferenceDir \
$configuration/build-opm-simulators/tests/results/flow+polymer_oilwater/ \
$OPM_DATA_ROOT/polymer_oilwater/opm-simulation-reference/flow \
2D_OILWATER_POLYMER \
EGRID INIT SMSPEC UNRST UNSMRY
fi
if grep -q "polymer2d" <<< $test_name
then
copyToReferenceDir \