mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-07-31 02:17:56 -05:00
flow: refactor the specializations
The motivation for this PR is that currently the build fails on my Ubuntu 17.10 laptop with two processes because that machine "only" has 8 GB of RAM (granted, the optimization options may have been a bit too excessive). under the new scheme, each specialization of the simulator is put into a separate compile unit which is part of libopmsimulators. this has the advantages that the specialized simulators and the main binary automatically stay consistent, the compilation is faster (2m25s vs 4m16s on my machine) because all compile units can be built in parallel and that compilation takes up less RAM because there is no need to instantiate all specializations in a single compile unit. on the minus side, all specializations must now always be compiled, the approach means slightly more work for the maintainers and the flow_* startup code gets even more complicated.
This commit is contained in:
+21
-64
@@ -18,69 +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 <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
|
||||
{
|
||||
@@ -191,14 +150,14 @@ int main(int argc, char** argv)
|
||||
// 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 {
|
||||
if (outputCout)
|
||||
@@ -208,20 +167,18 @@ int main(int argc, char** argv)
|
||||
}
|
||||
// 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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user