Merge pull request #1704 from joakim-hove/create-all-objects

Create all objects
This commit is contained in:
Atgeirr Flø Rasmussen
2019-01-14 10:50:47 +01:00
committed by GitHub
15 changed files with 86 additions and 40 deletions
+44 -25
View File
@@ -44,6 +44,9 @@
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp> #include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp> #include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp> #include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#if HAVE_DUNE_FEM #if HAVE_DUNE_FEM
#include <dune/fem/misc/mpimanager.hh> #include <dune/fem/misc/mpimanager.hh>
@@ -171,26 +174,42 @@ int main(int argc, char** argv)
std::cout << "Reading deck file '" << deckFilename << "'\n"; std::cout << "Reading deck file '" << deckFilename << "'\n";
std::cout.flush(); std::cout.flush();
} }
Opm::Parser parser; std::shared_ptr<Opm::Deck> deck;
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair; std::shared_ptr<Opm::EclipseState> eclipseState;
typedef std::vector<ParseModePair> ParseModePairs; std::shared_ptr<Opm::Schedule> schedule;
ParseModePairs tmp; std::shared_ptr<Opm::SummaryConfig> summaryConfig;
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE)); {
tmp.push_back(ParseModePair(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN)); Opm::Parser parser;
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN)); Opm::ParseContext parseContext;
tmp.push_back(ParseModePair(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN)); Opm::ErrorGuard errorGuard;
Opm::ParseContext parseContext(tmp);
Opm::ErrorGuard errorGuard;
std::shared_ptr<Opm::Deck> deck = std::make_shared< Opm::Deck >( parser.parseFile(deckFilename , parseContext, errorGuard) ); if (EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing))
if ( outputCout ) { parseContext.update( Opm::InputError::DELAYED_EXIT1);
Opm::checkDeck(*deck, parser); else {
Opm::MissingFeatures::checkKeywords(*deck); parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE);
parseContext.update(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN);
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN);
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN);
}
deck.reset( new Opm::Deck( parser.parseFile(deckFilename , parseContext, errorGuard)));
if ( outputCout ) {
Opm::checkDeck(*deck, parser);
Opm::MissingFeatures::checkKeywords(*deck);
}
eclipseState.reset( new Opm::EclipseState(*deck, parseContext, errorGuard ));
schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard));
summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), parseContext, errorGuard));
if (errorGuard) {
errorGuard.dump();
errorGuard.clear();
throw std::runtime_error("Unrecoverable errors were encountered while loading input.");
}
} }
Opm::Runspec runspec( *deck ); const auto& phases = Opm::Runspec(*deck).phases();
const auto& phases = runspec.phases();
std::shared_ptr<Opm::EclipseState> eclipseState = std::make_shared< Opm::EclipseState > ( *deck, parseContext, errorGuard );
// run the actual simulator // run the actual simulator
// //
@@ -202,13 +221,13 @@ int main(int argc, char** argv)
// oil-gas // oil-gas
if (phases.active( Opm::Phase::GAS )) if (phases.active( Opm::Phase::GAS ))
{ {
Opm::flowEbosGasOilSetDeck(*deck, *eclipseState); Opm::flowEbosGasOilSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosGasOilMain(argc, argv); return Opm::flowEbosGasOilMain(argc, argv);
} }
// oil-water // oil-water
else if ( phases.active( Opm::Phase::WATER ) ) else if ( phases.active( Opm::Phase::WATER ) )
{ {
Opm::flowEbosOilWaterSetDeck(*deck, *eclipseState); Opm::flowEbosOilWaterSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosOilWaterMain(argc, argv); return Opm::flowEbosOilWaterMain(argc, argv);
} }
else { else {
@@ -236,26 +255,26 @@ int main(int argc, char** argv)
} }
if ( phases.size() == 3 ) { // oil water polymer case if ( phases.size() == 3 ) { // oil water polymer case
Opm::flowEbosOilWaterPolymerSetDeck(*deck, *eclipseState); Opm::flowEbosOilWaterPolymerSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosOilWaterPolymerMain(argc, argv); return Opm::flowEbosOilWaterPolymerMain(argc, argv);
} else { } else {
Opm::flowEbosPolymerSetDeck(*deck, *eclipseState); Opm::flowEbosPolymerSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosPolymerMain(argc, argv); return Opm::flowEbosPolymerMain(argc, argv);
} }
} }
// Solvent case // Solvent case
else if ( phases.active( Opm::Phase::SOLVENT ) ) { else if ( phases.active( Opm::Phase::SOLVENT ) ) {
Opm::flowEbosSolventSetDeck(*deck, *eclipseState); Opm::flowEbosSolventSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosSolventMain(argc, argv); return Opm::flowEbosSolventMain(argc, argv);
} }
// Energy case // Energy case
else if (eclipseState->getSimulationConfig().isThermal()) { else if (eclipseState->getSimulationConfig().isThermal()) {
Opm::flowEbosEnergySetDeck(*deck, *eclipseState); Opm::flowEbosEnergySetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosEnergyMain(argc, argv); return Opm::flowEbosEnergyMain(argc, argv);
} }
// Blackoil case // Blackoil case
else if( phases.size() == 3 ) { else if( phases.size() == 3 ) {
Opm::flowEbosBlackoilSetDeck(*deck, *eclipseState); Opm::flowEbosBlackoilSetDeck(*deck, *eclipseState, *schedule, *summaryConfig);
return Opm::flowEbosBlackoilMain(argc, argv); return Opm::flowEbosBlackoilMain(argc, argv);
} }
else else
+3 -1
View File
@@ -34,12 +34,14 @@
namespace Opm { namespace Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState) void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowProblem) TypeTag; typedef TTAG(EclFlowProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
+3 -2
View File
@@ -19,10 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState); void flowEbosBlackoilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosBlackoilMain(int argc, char** argv); int flowEbosBlackoilMain(int argc, char** argv);
} }
+3 -1
View File
@@ -36,12 +36,14 @@ SET_BOOL_PROP(EclFlowEnergyProblem, EnableEnergy, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosEnergySetDeck(Deck &deck, EclipseState& eclState) void flowEbosEnergySetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowEnergyProblem) TypeTag; typedef TTAG(EclFlowEnergyProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
+3 -1
View File
@@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosEnergySetDeck(Deck &deck, EclipseState& eclState); void flowEbosEnergySetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosEnergyMain(int argc, char** argv); int flowEbosEnergyMain(int argc, char** argv);
} }
+3 -1
View File
@@ -58,12 +58,14 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState) void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowGasOilProblem) TypeTag; typedef TTAG(EclFlowGasOilProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
+3 -1
View File
@@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState); void flowEbosGasOilSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosGasOilMain(int argc, char** argv); int flowEbosGasOilMain(int argc, char** argv);
} }
+3 -1
View File
@@ -58,12 +58,14 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState) void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowOilWaterProblem) TypeTag; typedef TTAG(EclFlowOilWaterProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
+3 -1
View File
@@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState); void flowEbosOilWaterSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosOilWaterMain(int argc, char** argv); int flowEbosOilWaterMain(int argc, char** argv);
} }
+3 -1
View File
@@ -59,12 +59,14 @@ public:
}} }}
namespace Opm { namespace Opm {
void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState) void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowOilWaterPolymerProblem) TypeTag; typedef TTAG(EclFlowOilWaterPolymerProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
+3 -1
View File
@@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState); void flowEbosOilWaterPolymerSetDeck(Deck& deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosOilWaterPolymerMain(int argc, char** argv); int flowEbosOilWaterPolymerMain(int argc, char** argv);
} }
+3 -1
View File
@@ -36,12 +36,14 @@ SET_BOOL_PROP(EclFlowPolymerProblem, EnablePolymer, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState) void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowPolymerProblem) TypeTag; typedef TTAG(EclFlowPolymerProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
// ----------------- Main program ----------------- // ----------------- Main program -----------------
+3 -1
View File
@@ -19,9 +19,11 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState); void flowEbosPolymerSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosPolymerMain(int argc, char** argv); int flowEbosPolymerMain(int argc, char** argv);
} }
+3 -1
View File
@@ -36,12 +36,14 @@ SET_BOOL_PROP(EclFlowSolventProblem, EnableSolvent, true);
}} }}
namespace Opm { namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState) void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig)
{ {
typedef TTAG(EclFlowSolventProblem) TypeTag; typedef TTAG(EclFlowSolventProblem) TypeTag;
typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard; typedef GET_PROP_TYPE(TypeTag, Vanguard) Vanguard;
Vanguard::setExternalDeck(&deck, &eclState); Vanguard::setExternalDeck(&deck, &eclState);
Vanguard::setExternalSchedule(&schedule);
Vanguard::setExternalSummaryConfig(&summaryConfig);
} }
+3 -1
View File
@@ -19,10 +19,12 @@
#include <opm/parser/eclipse/Deck/Deck.hpp> #include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.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 { namespace Opm {
void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState); void flowEbosSolventSetDeck(Deck &deck, EclipseState& eclState, Schedule& schedule, SummaryConfig& summaryConfig);
int flowEbosSolventMain(int argc, char** argv); int flowEbosSolventMain(int argc, char** argv);
} }