Merge pull request #1287 from andlaus/improve_polymorphic_flow

Improve polymorphic flow
This commit is contained in:
Atgeirr Flø Rasmussen 2017-10-11 15:44:54 +02:00 committed by GitHub
commit 67401d7d63
20 changed files with 595 additions and 197 deletions

View File

@ -62,6 +62,11 @@ list (APPEND MAIN_SOURCE_FILES
opm/polymer/TransportSolverTwophaseCompressiblePolymer.cpp
opm/polymer/TransportSolverTwophasePolymer.cpp
opm/polymer/fullyimplicit/PolymerPropsAd.cpp
opm/simulators/flow_ebos_blackoil.cpp
opm/simulators/flow_ebos_gasoil.cpp
opm/simulators/flow_ebos_oilwater.cpp
opm/simulators/flow_ebos_polymer.cpp
opm/simulators/flow_ebos_solvent.cpp
opm/simulators/ensureDirectoryExists.cpp
opm/simulators/SimulatorCompressibleTwophase.cpp
opm/simulators/SimulatorIncompTwophase.cpp
@ -273,6 +278,11 @@ list (APPEND PUBLIC_HEADER_FILES
opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer.hpp
opm/polymer/fullyimplicit/SimulatorFullyImplicitBlackoilPolymer_impl.hpp
opm/polymer/fullyimplicit/WellStateFullyImplicitBlackoilPolymer.hpp
opm/simulators/flow_ebos_blackoil.hpp
opm/simulators/flow_ebos_gasoil.hpp
opm/simulators/flow_ebos_oilwater.hpp
opm/simulators/flow_ebos_polymer.hpp
opm/simulators/flow_ebos_solvent.hpp
opm/simulators/ensureDirectoryExists.hpp
opm/simulators/ParallelFileMerger.hpp
opm/simulators/SimulatorCompressibleTwophase.hpp

View File

@ -18,68 +18,28 @@
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
#include <memory>
#include <opm/simulators/flow_ebos_blackoil.hpp>
#include <opm/simulators/flow_ebos_gasoil.hpp>
#include <opm/simulators/flow_ebos_oilwater.hpp>
#include <opm/simulators/flow_ebos_solvent.hpp>
#include <opm/simulators/flow_ebos_polymer.hpp>
#include <opm/autodiff/MissingFeatures.hpp>
#include <opm/core/utility/parameters/ParameterGroup.hpp>
#include <opm/common/ResetLocale.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
// 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 <opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/autodiff/FlowMainEbos.hpp>
namespace Ewoms {
namespace Properties {
///////////////////////////////////
// Twophase case
///////////////////////////////////
NEW_TYPE_TAG(EclFlowOilWaterProblem, INHERITS_FROM(EclFlowProblem));
//! The indices required by the model
SET_TYPE_PROP(EclFlowOilWaterProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent)?1:0, GET_PROP_VALUE(TypeTag, EnablePolymer)?1:0, /*PVOffset=*/0, /*disabledCompIdx=*/2>);
NEW_TYPE_TAG(EclFlowGasOilProblem, INHERITS_FROM(EclFlowProblem));
//! The indices required by the model
SET_TYPE_PROP(EclFlowGasOilProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent)?1:0, GET_PROP_VALUE(TypeTag, EnablePolymer)?1:0, /*PVOffset=*/0, /*disabledCompIdx=*/1>);
///////////////////////////////////
// Polymer case
///////////////////////////////////
NEW_TYPE_TAG(EclFlowPolymerProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
///////////////////////////////////
// Solvent case
///////////////////////////////////
NEW_TYPE_TAG(EclFlowSolventProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}} // end namespaces
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
namespace detail
{
@ -116,18 +76,31 @@ namespace detail
int main(int argc, char** argv)
{
// MPI setup.
// Must ensure an instance of the helper is created to initialise MPI.
// For a build without MPI the Dune::FakeMPIHelper is used, so rank will
// be 0 and size 1.
const Dune::MPIHelper& mpi_helper = Dune::MPIHelper::instance(argc, argv);
const bool outputCout = mpi_helper.rank() == 0;
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
int mpiRank = Dune::Fem::MPIManager::rank();
#else
// the design of the plain dune MPIHelper class is quite flawed: there is no way to
// get the instance without having the argc and argv parameters available and it is
// not possible to determine the MPI rank and size without an instance. (IOW: the
// rank() and size() methods are supposed to be static.)
const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
int mpiRank = mpiHelper.rank();
#endif
const bool outputCout = (mpiRank == 0);
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
Opm::resetLocale();
Opm::ParameterGroup param(argc, argv, false, outputCout);
// See if a deck was specified on the command line.
if (!param.unhandledArguments().empty()) {
if (param.unhandledArguments().size() != 1) {
std::cerr << "You can only specify a single input deck on the command line.\n";
if (outputCout)
std::cerr << "You can only specify a single input deck on the command line.\n";
return EXIT_FAILURE;
} else {
const auto casename = detail::simulationCaseName( param.unhandledArguments()[ 0 ] );
@ -137,11 +110,12 @@ int main(int argc, char** argv)
// We must have an input deck. Grid and props will be read from that.
if (!param.has("deck_filename")) {
std::cerr << "This program must be run with an input deck.\n"
"Specify the deck filename either\n"
" a) as a command line argument by itself\n"
" b) as a command line parameter with the syntax deck_filename=<path to your deck>, or\n"
" c) as a parameter in a parameter file (.param or .xml) passed to the program.\n";
if (outputCout)
std::cerr << "This program must be run with an input deck.\n"
"Specify the deck filename either\n"
" a) as a command line argument by itself\n"
" b) as a command line parameter with the syntax deck_filename=<path to your deck>, or\n"
" c) as a parameter in a parameter file (.param or .xml) passed to the program.\n";
return EXIT_FAILURE;
}
@ -160,8 +134,8 @@ int main(int argc, char** argv)
Opm::ParseContext parseContext(tmp);
std::shared_ptr<Opm::Deck> deck = std::make_shared< Opm::Deck >( parser.parseFile(deckFilename , parseContext) );
Opm::checkDeck(*deck, parser);
if ( outputCout ) {
Opm::checkDeck(*deck, parser);
Opm::MissingFeatures::checkKeywords(*deck);
}
@ -171,52 +145,54 @@ int main(int argc, char** argv)
Opm::Runspec runspec( *deck );
const auto& phases = runspec.phases();
// Twophase case
// Twophase cases
if( phases.size() == 2 ) {
// oil-gas
if (phases.active( Opm::Phase::GAS ))
{
Opm::FlowMainEbos<TTAG(EclFlowGasOilProblem)> mainfunc;
return mainfunc.execute(argc, argv, deck, eclipseState );
Opm::flowEbosGasOilSetDeck(*deck, *eclipseState);
return Opm::flowEbosGasOilMain(argc, argv);
}
// oil-water
else if ( phases.active( Opm::Phase::WATER ) )
{
Opm::FlowMainEbos<TTAG(EclFlowOilWaterProblem)> mainfunc;
return mainfunc.execute(argc, argv, deck, eclipseState );
Opm::flowEbosOilWaterSetDeck(*deck, *eclipseState);
return Opm::flowEbosOilWaterMain(argc, argv);
}
else {
std::cerr << "No suitable configuration found, valid are Twophase (oilwater and oilgas), polymer, solvent, or blackoil" << std::endl;
if (outputCout)
std::cerr << "No suitable configuration found, valid are Twophase (oilwater and oilgas), polymer, solvent, or blackoil" << std::endl;
return EXIT_FAILURE;
}
}
// Polymer case
else if ( phases.active( Opm::Phase::POLYMER ) ) {
Opm::FlowMainEbos<TTAG(EclFlowPolymerProblem)> mainfunc;
return mainfunc.execute(argc, argv, deck, eclipseState );
Opm::flowEbosPolymerSetDeck(*deck, *eclipseState);
return Opm::flowEbosPolymerMain(argc, argv);
}
// Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) {
Opm::FlowMainEbos<TTAG(EclFlowSolventProblem)> mainfunc;
return mainfunc.execute(argc, argv, deck, eclipseState );
Opm::flowEbosSolventSetDeck(*deck, *eclipseState);
return Opm::flowEbosSolventMain(argc, argv);
}
// Blackoil case
else if( phases.size() == 3 ) {
Opm::FlowMainEbos<TTAG(EclFlowProblem)> mainfunc;
return mainfunc.execute(argc, argv, deck, eclipseState );
Opm::flowEbosBlackoilSetDeck(*deck, *eclipseState);
return Opm::flowEbosBlackoilMain(argc, argv);
}
else
{
std::cerr << "No suitable configuration found, valid are Twophase, polymer, solvent, or blackoil" << std::endl;
if (outputCout)
std::cerr << "No suitable configuration found, valid are Twophase, polymer, solvent, or blackoil" << std::endl;
return EXIT_FAILURE;
}
}
catch (const std::invalid_argument& e)
{
std::cerr << "Failed to create valid EclipseState object." << std::endl;
std::cerr << "Exception caught: " << e.what() << std::endl;
if (outputCout) {
std::cerr << "Failed to create valid EclipseState object." << std::endl;
std::cerr << "Exception caught: " << e.what() << std::endl;
}
throw;
}

View File

@ -1,8 +1,4 @@
/*
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2015 IRIS AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
@ -18,25 +14,12 @@
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 <opm/autodiff/DuneMatrix.hpp>
#include <dune/grid/CpGrid.hpp>
#include <opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp>
#include <opm/autodiff/FlowMainEbos.hpp>
#include <opm/simulators/flow_ebos_blackoil.hpp>
// ----------------- Main program -----------------
int main(int argc, char** argv)
{
Opm::FlowMainEbos<TTAG(EclFlowProblem)> mainfunc;
return mainfunc.execute(argc, argv);
return Opm::flowEbosBlackoilMain(argc, argv);
}

View File

@ -1,6 +1,4 @@
/*
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
@ -16,34 +14,12 @@
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, /*disabledCompIdx=*/2>);
}}
#include <opm/simulators/flow_ebos_oilwater.hpp>
// ----------------- Main program -----------------
int main(int argc, char** argv)
{
Opm::FlowMainEbos<TTAG(EclFlowTwoPhaseProblem)> mainfunc;
return mainfunc.execute(argc, argv);
return Opm::flowEbosOilWaterMain(argc, argv);
}

View File

@ -1,6 +1,4 @@
/*
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
@ -16,27 +14,12 @@
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
#include <opm/material/densead/Evaluation.hpp>
#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(EclFlowPolymerProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
}}
#include <opm/simulators/flow_ebos_polymer.hpp>
// ----------------- Main program -----------------
int main(int argc, char** argv)
{
Opm::FlowMainEbos<TTAG(EclFlowPolymerProblem)> mainfunc;
return mainfunc.execute(argc, argv);
return Opm::flowEbosPolymerMain(argc, argv);
}

View File

@ -1,6 +1,4 @@
/*
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
@ -16,27 +14,12 @@
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
#include <opm/material/densead/Evaluation.hpp>
#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(EclFlowSolventProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}}
#include <opm/simulators/flow_ebos_solvent.hpp>
// ----------------- Main program -----------------
int main(int argc, char** argv)
{
Opm::FlowMainEbos<TTAG(EclFlowSolventProblem)> mainfunc;
return mainfunc.execute(argc, argv);
return Opm::flowEbosSolventMain(argc, argv);
}

View File

@ -91,6 +91,10 @@ SET_BOOL_PROP(EclFlowProblem, UseVolumetricResidual, false);
// SWATINIT is done by the flow part of flow_ebos. this can be removed once the legacy
// code for fluid and satfunc handling gets fully retired.
SET_BOOL_PROP(EclFlowProblem, EnableSwatinit, false);
// Silence the deprecation warnings about the SimulatorParameter mechanism. This needs to
// be removed once the SimulatorParameter mechanism bites the dust!
SET_TYPE_PROP(EclFlowProblem, SimulatorParameter, Ewoms::EmptySimulationParameters);
}}
namespace Opm {

View File

@ -45,7 +45,6 @@
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/EclipsePRTLog.hpp>
#include <opm/common/OpmLog/LogUtil.hpp>
#include <opm/common/ResetLocale.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
@ -55,7 +54,11 @@
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <ewoms/version.hh>
#if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh>
#else
#include <dune/common/parallel/mpihelper.hh>
#endif
namespace Opm
{
@ -75,9 +78,8 @@ namespace Opm
public:
typedef typename GET_PROP(TypeTag, MaterialLaw)::EclMaterialLawManager MaterialLawManager;
typedef typename GET_PROP_TYPE(TypeTag, Simulator) EbosSimulator;
typedef typename GET_PROP_TYPE(TypeTag, SimulatorParameter) EbosSimulatorParameter;
typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper;
typedef typename GET_PROP_TYPE(TypeTag, Grid) Grid;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
@ -91,23 +93,17 @@ namespace Opm
/// simulator classes, based on user command-line input. The
/// content of this function used to be in the main() function of
/// flow.cpp.
int execute(int argc, char** argv,
std::shared_ptr<Opm::Deck> deck = std::shared_ptr<Opm::Deck>(),
std::shared_ptr<Opm::EclipseState> eclipseState = std::shared_ptr<Opm::EclipseState>() )
int execute(int argc, char** argv)
{
try {
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
resetLocale();
setupParallelism(argc, argv);
setupParallelism();
printStartupMessage();
const bool ok = setupParameters(argc, argv);
if (!ok) {
return EXIT_FAILURE;
}
setupEbosSimulator( deck, eclipseState );
setupEbosSimulator();
setupOutput();
setupLogging();
printPRTHeader();
@ -147,15 +143,18 @@ namespace Opm
}
protected:
void setupParallelism(int argc, char** argv)
void setupParallelism()
{
// MPI setup.
// Must ensure an instance of the helper is created to initialise MPI.
// For a build without MPI the Dune::FakeMPIHelper is used, so rank will
// be 0 and size 1.
const Dune::MPIHelper& mpi_helper = Dune::MPIHelper::instance(argc, argv);
mpi_rank_ = mpi_helper.rank();
const int mpi_size = mpi_helper.size();
// determine the rank of the current process and the number of processes
// involved in the simulation. MPI must have already been initialized here.
#if HAVE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank_);
int mpi_size;
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
#else
mpi_rank_ = 0;
const int mpi_size = 1;
#endif
output_cout_ = ( mpi_rank_ == 0 );
must_distribute_ = ( mpi_size > 1 );
@ -409,7 +408,7 @@ namespace Opm
detail::ParallelFileMerger(output_path, deck_filename.stem().string()));
}
void setupEbosSimulator( std::shared_ptr<Opm::Deck>& dck, std::shared_ptr<Opm::EclipseState>& eclipseState)
void setupEbosSimulator()
{
std::string progName("flow_ebos");
std::string deckFile("--ecl-deck-file-name=");
@ -417,10 +416,9 @@ namespace Opm
char* ptr[2];
ptr[ 0 ] = const_cast< char * > (progName.c_str());
ptr[ 1 ] = const_cast< char * > (deckFile.c_str());
EbosSimulatorParameter simParam( dck, eclipseState );
EbosSimulator::registerParameters();
Ewoms::setupParameters_< TypeTag > ( 2, ptr );
ebosSimulator_.reset(new EbosSimulator(simParam, /*verbose=*/false));
ebosSimulator_.reset(new EbosSimulator(/*verbose=*/false));
ebosSimulator_->model().applyInitialSolution();
// Create a grid with a global view.
@ -808,6 +806,8 @@ namespace Opm
const Grid& globalGrid = this->globalGrid();
const auto& globalGridView = globalGrid.leafGridView();
typedef typename Grid::LeafGridView GridView;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
ElementMapper globalElemMapper(globalGridView);
const auto& cartesianCellIdx = globalGrid.globalCell();
@ -881,6 +881,8 @@ namespace Opm
const Grid& globalGrid = this->globalGrid();
const auto& globalGridView = globalGrid.leafGridView();
typedef typename Grid::LeafGridView GridView;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, Dune::MCMGElementLayout> ElementMapper;
ElementMapper globalElemMapper(globalGridView);
const auto* globalTrans = &(ebosSimulator_->gridManager().globalTransmissibility());

View File

@ -461,7 +461,7 @@ public:
{ return ebosSimulator_.gridManager().grid(); }
protected:
void handleAdditionalWellInflow(SimulatorTimer& timer,
void handleAdditionalWellInflow(SimulatorTimer& /*timer*/,
WellsManager& /* wells_manager */,
WellState& /* well_state */,
const Wells* /* wells */)
@ -958,6 +958,9 @@ protected:
if ( active[Water] ) {
fluidState.setSaturation(FluidSystem::waterPhaseIdx, saturations[cellIdx*numPhases + pu.phase_pos[Water]]);
}
else {
fluidState.setSaturation(FluidSystem::waterPhaseIdx, 0.0);
}
fluidState.setSaturation(FluidSystem::oilPhaseIdx, saturations[cellIdx*numPhases + pu.phase_pos[Oil]]);
fluidState.setSaturation(FluidSystem::gasPhaseIdx, saturations[cellIdx*numPhases + pu.phase_pos[Gas]]);

View File

@ -0,0 +1,62 @@
/*
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_blackoil.hpp>
#include <opm/common/ResetLocale.hpp>
#include <dune/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 Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState)
{
typedef TTAG(EclFlowProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState);
}
// ----------------- Main program -----------------
int flowEbosBlackoilMain(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(EclFlowProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@ -0,0 +1,28 @@
/*
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_BLACKOIL_HPP
#define FLOW_EBOS_BLACKOIL_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosBlackoilMain(int argc, char** argv);
}
#endif // FLOW_EBOS_BLACKOIL_HPP

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_gasoil.hpp>
#include <opm/common/ResetLocale.hpp>
#include <ewoms/models/blackoil/blackoiltwophaseindices.hh>
#include <dune/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(EclFlowGasOilProblem, INHERITS_FROM(EclFlowProblem));
//! The indices required by the model
SET_TYPE_PROP(EclFlowGasOilProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent)?1:0,
GET_PROP_VALUE(TypeTag, EnablePolymer)?1:0,
/*PVOffset=*/0, /*disabledCompIdx=*/1>);
}}
namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState)
{
typedef TTAG(EclFlowGasOilProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState);
}
// ----------------- Main program -----------------
int flowEbosGasOilMain(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(EclFlowGasOilProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@ -0,0 +1,28 @@
/*
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_GASOIL_HPP
#define FLOW_EBOS_GASOIL_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosGasOilMain(int argc, char** argv);
}
#endif // FLOW_EBOS_GASOIL_HPP

View File

@ -0,0 +1,73 @@
/*
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.hpp>
#include <opm/common/ResetLocale.hpp>
#include <ewoms/models/blackoil/blackoiltwophaseindices.hh>
#include <dune/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(EclFlowOilWaterProblem, INHERITS_FROM(EclFlowProblem));
//! The indices required by the model
SET_TYPE_PROP(EclFlowOilWaterProblem, Indices,
Ewoms::BlackOilTwoPhaseIndices<GET_PROP_VALUE(TypeTag, EnableSolvent)?1:0,
GET_PROP_VALUE(TypeTag, EnablePolymer)?1:0,
/*PVOffset=*/0, /*disabledCompIdx=*/2>);
}}
namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState)
{
typedef TTAG(EclFlowOilWaterProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState);
}
// ----------------- Main program -----------------
int flowEbosOilWaterMain(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(EclFlowOilWaterProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@ -0,0 +1,28 @@
/*
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_HPP
#define FLOW_EBOS_OILWATER_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosOilWaterMain(int argc, char** argv);
}
#endif // FLOW_EBOS_OILWATER_HPP

View File

@ -0,0 +1,65 @@
/*
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"
#include <opm/simulators/flow_ebos_polymer.hpp>
#include <opm/common/ResetLocale.hpp>
#include <dune/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(EclFlowPolymerProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
}}
namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState)
{
typedef TTAG(EclFlowPolymerProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState);
}
// ----------------- Main program -----------------
int flowEbosPolymerMain(int argc, char** argv)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
Opm::resetLocale();
// initialize MPI, finalize is done automatically on exit
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
#else
Dune::MPIHelper::instance(argc, argv).rank();
#endif
Opm::FlowMainEbos<TTAG(EclFlowPolymerProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@ -0,0 +1,28 @@
/*
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_POLYMER_HPP
#define FLOW_EBOS_POLYMER_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosPolymerMain(int argc, char** argv);
}
#endif // FLOW_EBOS_POLYMER_HPP

View File

@ -0,0 +1,65 @@
/*
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"
#include <opm/simulators/flow_ebos_solvent.hpp>
#include <opm/common/ResetLocale.hpp>
#include <dune/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(EclFlowSolventProblem, INHERITS_FROM(EclFlowProblem));
SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}}
namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState)
{
typedef TTAG(EclFlowSolventProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, GridManager) GridManager;
GridManager::setExternalDeck(&deck, &eclState);
}
// ----------------- Main program -----------------
int flowEbosSolventMain(int argc, char** argv)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
Opm::resetLocale();
// initialize MPI, finalize is done automatically on exit
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
#else
Dune::MPIHelper::instance(argc, argv).rank();
#endif
Opm::FlowMainEbos<TTAG(EclFlowSolventProblem)> mainfunc;
return mainfunc.execute(argc, argv);
}
}

View File

@ -0,0 +1,28 @@
/*
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_SOLVENT_HPP
#define FLOW_EBOS_SOLVENT_HPP
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState);
int flowEbosSolventMain(int argc, char** argv);
}
#endif // FLOW_EBOS_SOLVENT_HPP

View File

@ -74,11 +74,10 @@ namespace Opm {
// AdaptiveTimeStepping
//---------------------
AdaptiveTimeStepping::AdaptiveTimeStepping( const Tuning& tuning,
size_t time_step,
const ParameterGroup& param,
const bool terminal_output )
inline AdaptiveTimeStepping::AdaptiveTimeStepping( const Tuning& tuning,
size_t time_step,
const ParameterGroup& param,
const bool terminal_output )
: timeStepControl_()
, restart_factor_( tuning.getTSFCNV(time_step) )
, growth_factor_(tuning.getTFDIFF(time_step) )
@ -97,8 +96,8 @@ namespace Opm {
}
AdaptiveTimeStepping::AdaptiveTimeStepping( const ParameterGroup& param,
const bool terminal_output )
inline AdaptiveTimeStepping::AdaptiveTimeStepping( const ParameterGroup& param,
const bool terminal_output )
: timeStepControl_()
, restart_factor_( param.getDefault("solver.restartfactor", double(0.33) ) )
, growth_factor_( param.getDefault("solver.growthfactor", double(2) ) )
@ -116,7 +115,7 @@ namespace Opm {
init(param);
}
void AdaptiveTimeStepping::
inline void AdaptiveTimeStepping::
init(const ParameterGroup& param)
{
// valid are "pid" and "pid+iteration"