diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 04b86894b..111f39a49 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -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 diff --git a/examples/flow.cpp b/examples/flow.cpp index e5885177f..cc22c2017 100644 --- a/examples/flow.cpp +++ b/examples/flow.cpp @@ -18,68 +18,28 @@ 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 -// Define making clear that the simulator supports AMG -#define FLOW_SUPPORT_AMG 1 - -#include -#include - -#include -#include -#include - -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); - - - NEW_TYPE_TAG(EclFlowGasOilProblem, INHERITS_FROM(EclFlowProblem)); - //! The indices required by the model - SET_TYPE_PROP(EclFlowGasOilProblem, Indices, - Ewoms::BlackOilTwoPhaseIndices); - - /////////////////////////////////// - // 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 +#else +#include +#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=, 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=, 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 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 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 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 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 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 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; } diff --git a/examples/flow_ebos.cpp b/examples/flow_ebos.cpp index 00d8eddb1..e6491a653 100644 --- a/examples/flow_ebos.cpp +++ b/examples/flow_ebos.cpp @@ -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 . */ - - -#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 // ----------------- Main program ----------------- int main(int argc, char** argv) { - Opm::FlowMainEbos mainfunc; - return mainfunc.execute(argc, argv); + return Opm::flowEbosBlackoilMain(argc, argv); } diff --git a/examples/flow_ebos_2p.cpp b/examples/flow_ebos_2p.cpp index 5e802331e..6159f0ef4 100644 --- a/examples/flow_ebos_2p.cpp +++ b/examples/flow_ebos_2p.cpp @@ -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 . */ - - -#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); -}} +#include // ----------------- Main program ----------------- int main(int argc, char** argv) { - Opm::FlowMainEbos mainfunc; - return mainfunc.execute(argc, argv); + return Opm::flowEbosOilWaterMain(argc, argv); } diff --git a/examples/flow_ebos_polymer.cpp b/examples/flow_ebos_polymer.cpp index d09a0d759..9a4c18938 100644 --- a/examples/flow_ebos_polymer.cpp +++ b/examples/flow_ebos_polymer.cpp @@ -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 . */ - - -#if HAVE_CONFIG_H #include "config.h" -#endif // HAVE_CONFIG_H -#include -#include -#include -#include -#include - -namespace Ewoms { -namespace Properties { -NEW_TYPE_TAG(EclFlowPolymerProblem, INHERITS_FROM(EclFlowProblem)); -SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true); -}} +#include // ----------------- Main program ----------------- int main(int argc, char** argv) { - Opm::FlowMainEbos mainfunc; - return mainfunc.execute(argc, argv); + return Opm::flowEbosPolymerMain(argc, argv); } diff --git a/examples/flow_ebos_solvent.cpp b/examples/flow_ebos_solvent.cpp index 443c400f8..67a3683f0 100644 --- a/examples/flow_ebos_solvent.cpp +++ b/examples/flow_ebos_solvent.cpp @@ -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 . */ - - -#if HAVE_CONFIG_H #include "config.h" -#endif // HAVE_CONFIG_H -#include -#include -#include -#include -#include - -namespace Ewoms { -namespace Properties { -NEW_TYPE_TAG(EclFlowSolventProblem, INHERITS_FROM(EclFlowProblem)); -SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true); -}} +#include // ----------------- Main program ----------------- int main(int argc, char** argv) { - Opm::FlowMainEbos mainfunc; - return mainfunc.execute(argc, argv); + return Opm::flowEbosSolventMain(argc, argv); } diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index ac8d94630..a30770def 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -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 { diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp index 4334d988e..5804336d8 100755 --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include @@ -55,7 +54,11 @@ #include #include -#include +#if HAVE_DUNE_FEM +#include +#else +#include +#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 deck = std::shared_ptr(), - std::shared_ptr eclipseState = std::shared_ptr() ) + 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& dck, std::shared_ptr& 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 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 ElementMapper; ElementMapper globalElemMapper(globalGridView); const auto* globalTrans = &(ebosSimulator_->gridManager().globalTransmissibility()); diff --git a/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp b/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp index 63de3f2e5..f5ca046ce 100644 --- a/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp +++ b/opm/autodiff/SimulatorFullyImplicitBlackoilEbos.hpp @@ -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]]); diff --git a/opm/simulators/flow_ebos_blackoil.cpp b/opm/simulators/flow_ebos_blackoil.cpp new file mode 100644 index 000000000..690057ece --- /dev/null +++ b/opm/simulators/flow_ebos_blackoil.cpp @@ -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 . +*/ +#include "config.h" + +// Define making clear that the simulator supports AMG +#define FLOW_SUPPORT_AMG 1 + +#include + +#include +#include +#include +#include + +#if HAVE_DUNE_FEM +#include +#else +#include +#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 mainfunc; + return mainfunc.execute(argc, argv); +} + +} diff --git a/opm/simulators/flow_ebos_blackoil.hpp b/opm/simulators/flow_ebos_blackoil.hpp new file mode 100644 index 000000000..f9175e82a --- /dev/null +++ b/opm/simulators/flow_ebos_blackoil.hpp @@ -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 . +*/ +#ifndef FLOW_EBOS_BLACKOIL_HPP +#define FLOW_EBOS_BLACKOIL_HPP + +#include +#include + +namespace Opm { +void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState); +int flowEbosBlackoilMain(int argc, char** argv); +} + +#endif // FLOW_EBOS_BLACKOIL_HPP diff --git a/opm/simulators/flow_ebos_gasoil.cpp b/opm/simulators/flow_ebos_gasoil.cpp new file mode 100644 index 000000000..e33e7861b --- /dev/null +++ b/opm/simulators/flow_ebos_gasoil.cpp @@ -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 . +*/ +#include "config.h" + +// Define making clear that the simulator supports AMG +#define FLOW_SUPPORT_AMG 1 + +#include + +#include +#include + +#include +#include +#include + +#if HAVE_DUNE_FEM +#include +#else +#include +#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); +}} + +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 mainfunc; + return mainfunc.execute(argc, argv); +} + +} diff --git a/opm/simulators/flow_ebos_gasoil.hpp b/opm/simulators/flow_ebos_gasoil.hpp new file mode 100644 index 000000000..53916b902 --- /dev/null +++ b/opm/simulators/flow_ebos_gasoil.hpp @@ -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 . +*/ +#ifndef FLOW_EBOS_GASOIL_HPP +#define FLOW_EBOS_GASOIL_HPP + +#include +#include + +namespace Opm { +void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState); +int flowEbosGasOilMain(int argc, char** argv); +} + +#endif // FLOW_EBOS_GASOIL_HPP diff --git a/opm/simulators/flow_ebos_oilwater.cpp b/opm/simulators/flow_ebos_oilwater.cpp new file mode 100644 index 000000000..6b93eb271 --- /dev/null +++ b/opm/simulators/flow_ebos_oilwater.cpp @@ -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 . +*/ +#include "config.h" + +// Define making clear that the simulator supports AMG +#define FLOW_SUPPORT_AMG 1 + +#include + +#include +#include + +#include +#include +#include + +#if HAVE_DUNE_FEM +#include +#else +#include +#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); +}} + +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 mainfunc; + return mainfunc.execute(argc, argv); +} + +} diff --git a/opm/simulators/flow_ebos_oilwater.hpp b/opm/simulators/flow_ebos_oilwater.hpp new file mode 100644 index 000000000..c1eb0ff18 --- /dev/null +++ b/opm/simulators/flow_ebos_oilwater.hpp @@ -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 . +*/ +#ifndef FLOW_EBOS_OILWATER_HPP +#define FLOW_EBOS_OILWATER_HPP + +#include +#include + +namespace Opm { +void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState); +int flowEbosOilWaterMain(int argc, char** argv); +} + +#endif // FLOW_EBOS_OILWATER_HPP diff --git a/opm/simulators/flow_ebos_polymer.cpp b/opm/simulators/flow_ebos_polymer.cpp new file mode 100644 index 000000000..917485794 --- /dev/null +++ b/opm/simulators/flow_ebos_polymer.cpp @@ -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 . +*/ +#include "config.h" + +#include + +#include +#include +#include +#include + +#if HAVE_DUNE_FEM +#include +#else +#include +#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 mainfunc; + return mainfunc.execute(argc, argv); +} + +} diff --git a/opm/simulators/flow_ebos_polymer.hpp b/opm/simulators/flow_ebos_polymer.hpp new file mode 100644 index 000000000..7eb81939d --- /dev/null +++ b/opm/simulators/flow_ebos_polymer.hpp @@ -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 . +*/ +#ifndef FLOW_EBOS_POLYMER_HPP +#define FLOW_EBOS_POLYMER_HPP + +#include +#include + +namespace Opm { +void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState); +int flowEbosPolymerMain(int argc, char** argv); +} + +#endif // FLOW_EBOS_POLYMER_HPP diff --git a/opm/simulators/flow_ebos_solvent.cpp b/opm/simulators/flow_ebos_solvent.cpp new file mode 100644 index 000000000..3498c5df4 --- /dev/null +++ b/opm/simulators/flow_ebos_solvent.cpp @@ -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 . +*/ +#include "config.h" + +#include + +#include +#include +#include +#include + +#if HAVE_DUNE_FEM +#include +#else +#include +#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 mainfunc; + return mainfunc.execute(argc, argv); +} + +} diff --git a/opm/simulators/flow_ebos_solvent.hpp b/opm/simulators/flow_ebos_solvent.hpp new file mode 100644 index 000000000..69831c254 --- /dev/null +++ b/opm/simulators/flow_ebos_solvent.hpp @@ -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 . +*/ +#ifndef FLOW_EBOS_SOLVENT_HPP +#define FLOW_EBOS_SOLVENT_HPP + +#include +#include + +namespace Opm { +void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState); +int flowEbosSolventMain(int argc, char** argv); +} + +#endif // FLOW_EBOS_SOLVENT_HPP diff --git a/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp b/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp index 63b8ed28c..4e1e1bfc1 100644 --- a/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp +++ b/opm/simulators/timestepping/AdaptiveTimeStepping_impl.hpp @@ -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"