mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: make the deck an implementation detail in Opm::readDeck
This commit is contained in:
parent
f4f8c033d8
commit
c7016854d9
@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/Tables/OverburdTable.hpp>
|
#include <opm/input/eclipse/EclipseState/Tables/OverburdTable.hpp>
|
||||||
|
@ -91,7 +91,6 @@ void EclGenericVanguard::readDeck(const std::string& filename)
|
|||||||
Dune::Timer setupTimer;
|
Dune::Timer setupTimer;
|
||||||
setupTimer.start();
|
setupTimer.start();
|
||||||
|
|
||||||
std::shared_ptr<Opm::Deck> deck;
|
|
||||||
std::shared_ptr<Opm::EclipseState> eclipseState;
|
std::shared_ptr<Opm::EclipseState> eclipseState;
|
||||||
std::shared_ptr<Opm::Schedule> schedule;
|
std::shared_ptr<Opm::Schedule> schedule;
|
||||||
std::unique_ptr<Opm::UDQState> udqState;
|
std::unique_ptr<Opm::UDQState> udqState;
|
||||||
@ -107,7 +106,7 @@ void EclGenericVanguard::readDeck(const std::string& filename)
|
|||||||
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN}});
|
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN}});
|
||||||
|
|
||||||
Opm::readDeck(EclGenericVanguard::comm(),
|
Opm::readDeck(EclGenericVanguard::comm(),
|
||||||
filename, deck, eclipseState, schedule, udqState,
|
filename, eclipseState, schedule, udqState,
|
||||||
actionState, wtestState,
|
actionState, wtestState,
|
||||||
summaryConfig, nullptr, nullptr, std::move(parseContext),
|
summaryConfig, nullptr, nullptr, std::move(parseContext),
|
||||||
false, false, {});
|
false, false, {});
|
||||||
|
@ -47,12 +47,10 @@
|
|||||||
#include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
|
#include <flow/flow_ebos_oilwater_polymer_injectivity.hpp>
|
||||||
#include <flow/flow_ebos_micp.hpp>
|
#include <flow/flow_ebos_micp.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
|
||||||
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
|
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
|
||||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||||
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/checkDeck.hpp>
|
|
||||||
#include <opm/input/eclipse/Schedule/ArrayDimChecker.hpp>
|
#include <opm/input/eclipse/Schedule/ArrayDimChecker.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
#include <opm/input/eclipse/Schedule/UDQ/UDQState.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Action/State.hpp>
|
#include <opm/input/eclipse/Schedule/Action/State.hpp>
|
||||||
@ -135,16 +133,15 @@ public:
|
|||||||
|
|
||||||
// This constructor can be called from Python when Python has
|
// This constructor can be called from Python when Python has
|
||||||
// already parsed a deck
|
// already parsed a deck
|
||||||
Main(std::shared_ptr<Deck> deck,
|
Main(const std::string& filename,
|
||||||
std::shared_ptr<EclipseState> eclipseState,
|
std::shared_ptr<EclipseState> eclipseState,
|
||||||
std::shared_ptr<Schedule> schedule,
|
std::shared_ptr<Schedule> schedule,
|
||||||
std::shared_ptr<SummaryConfig> summaryConfig)
|
std::shared_ptr<SummaryConfig> summaryConfig)
|
||||||
: deck_{std::move(deck)}
|
: eclipseState_{std::move(eclipseState)}
|
||||||
, eclipseState_{std::move(eclipseState)}
|
|
||||||
, schedule_{std::move(schedule)}
|
, schedule_{std::move(schedule)}
|
||||||
, summaryConfig_{std::move(summaryConfig)}
|
, summaryConfig_{std::move(summaryConfig)}
|
||||||
{
|
{
|
||||||
setArgvArgc_(deck_->getDataFile());
|
setArgvArgc_(filename);
|
||||||
initMPI();
|
initMPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +520,8 @@ private:
|
|||||||
if (output_param >= 0)
|
if (output_param >= 0)
|
||||||
outputInterval = output_param;
|
outputInterval = output_param;
|
||||||
|
|
||||||
readDeck(EclGenericVanguard::comm(), deckFilename, deck_, eclipseState_, schedule_, udqState_, actionState_, wtestState_,
|
readDeck(EclGenericVanguard::comm(), deckFilename, eclipseState_,
|
||||||
|
schedule_, udqState_, actionState_, wtestState_,
|
||||||
summaryConfig_, nullptr, python, std::move(parseContext),
|
summaryConfig_, nullptr, python, std::move(parseContext),
|
||||||
init_from_restart_file, outputCout_, outputInterval);
|
init_from_restart_file, outputCout_, outputInterval);
|
||||||
|
|
||||||
@ -818,7 +816,6 @@ private:
|
|||||||
std::unique_ptr<WellTestState> wtestState_{};
|
std::unique_ptr<WellTestState> wtestState_{};
|
||||||
|
|
||||||
// These variables may be owned by both Python and the simulator
|
// These variables may be owned by both Python and the simulator
|
||||||
std::shared_ptr<Deck> deck_{};
|
|
||||||
std::shared_ptr<EclipseState> eclipseState_{};
|
std::shared_ptr<EclipseState> eclipseState_{};
|
||||||
std::shared_ptr<Schedule> schedule_{};
|
std::shared_ptr<Schedule> schedule_{};
|
||||||
std::shared_ptr<SummaryConfig> summaryConfig_{};
|
std::shared_ptr<SummaryConfig> summaryConfig_{};
|
||||||
|
@ -181,15 +181,14 @@ namespace {
|
|||||||
wtestState = std::make_unique<Opm::WellTestState>();
|
wtestState = std::make_unique<Opm::WellTestState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Opm::Deck>
|
Opm::Deck
|
||||||
readDeckFile(const std::string& deckFilename,
|
readDeckFile(const std::string& deckFilename,
|
||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
const Opm::Parser& parser,
|
const Opm::Parser& parser,
|
||||||
const Opm::ParseContext& parseContext,
|
const Opm::ParseContext& parseContext,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
auto deck = std::make_shared<Opm::Deck>
|
Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard));
|
||||||
(parser.parseFile(deckFilename, parseContext, errorGuard));
|
|
||||||
|
|
||||||
auto keyword_validator = Opm::KeywordValidation::KeywordValidator {
|
auto keyword_validator = Opm::KeywordValidation::KeywordValidator {
|
||||||
Opm::FlowKeywordValidation::unsupportedKeywords(),
|
Opm::FlowKeywordValidation::unsupportedKeywords(),
|
||||||
@ -199,10 +198,10 @@ namespace {
|
|||||||
Opm::KeywordValidation::specialValidation()
|
Opm::KeywordValidation::specialValidation()
|
||||||
};
|
};
|
||||||
|
|
||||||
keyword_validator.validateDeck(*deck, parseContext, errorGuard);
|
keyword_validator.validateDeck(deck, parseContext, errorGuard);
|
||||||
|
|
||||||
if (checkDeck) {
|
if (checkDeck) {
|
||||||
Opm::checkDeck(*deck, parser, parseContext, errorGuard);
|
Opm::checkDeck(deck, parser, parseContext, errorGuard);
|
||||||
}
|
}
|
||||||
|
|
||||||
return deck;
|
return deck;
|
||||||
@ -222,7 +221,6 @@ namespace {
|
|||||||
void readOnIORank(Opm::Parallel::Communication comm,
|
void readOnIORank(Opm::Parallel::Communication comm,
|
||||||
const std::string& deckFilename,
|
const std::string& deckFilename,
|
||||||
const Opm::ParseContext* parseContext,
|
const Opm::ParseContext* parseContext,
|
||||||
std::shared_ptr<Opm::Deck>& deck,
|
|
||||||
std::shared_ptr<Opm::EclipseState>& eclipseState,
|
std::shared_ptr<Opm::EclipseState>& eclipseState,
|
||||||
std::shared_ptr<Opm::Schedule>& schedule,
|
std::shared_ptr<Opm::Schedule>& schedule,
|
||||||
std::unique_ptr<Opm::UDQState>& udqState,
|
std::unique_ptr<Opm::UDQState>& udqState,
|
||||||
@ -235,33 +233,31 @@ namespace {
|
|||||||
const std::optional<int>& outputInterval,
|
const std::optional<int>& outputInterval,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
if (((deck == nullptr) || (schedule == nullptr) || (summaryConfig == nullptr)) &&
|
if (((schedule == nullptr) || (summaryConfig == nullptr)) &&
|
||||||
(parseContext == nullptr))
|
(parseContext == nullptr))
|
||||||
{
|
{
|
||||||
OPM_THROW(std::logic_error,
|
OPM_THROW(std::logic_error,
|
||||||
"We need a parse context if deck, schedule, "
|
"We need a parse context if schedule "
|
||||||
"or summaryConfig are not initialized");
|
"or summaryConfig are not initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto parser = Opm::Parser{};
|
auto parser = Opm::Parser{};
|
||||||
if (deck == nullptr) {
|
const auto deck = readDeckFile(deckFilename, checkDeck, parser,
|
||||||
deck = readDeckFile(deckFilename, checkDeck, parser,
|
*parseContext, errorGuard);
|
||||||
*parseContext, errorGuard);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eclipseState == nullptr) {
|
if (eclipseState == nullptr) {
|
||||||
eclipseState = createEclipseState(comm, *deck);
|
eclipseState = createEclipseState(comm, deck);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eclipseState->getInitConfig().restartRequested()) {
|
if (eclipseState->getInitConfig().restartRequested()) {
|
||||||
loadObjectsFromRestart(*deck, parser, *parseContext,
|
loadObjectsFromRestart(deck, parser, *parseContext,
|
||||||
initFromRestart, outputInterval,
|
initFromRestart, outputInterval,
|
||||||
*eclipseState, std::move(python),
|
*eclipseState, std::move(python),
|
||||||
schedule, udqState, actionState, wtestState,
|
schedule, udqState, actionState, wtestState,
|
||||||
errorGuard);
|
errorGuard);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
createNonRestartDynamicObjects(*deck, *eclipseState,
|
createNonRestartDynamicObjects(deck, *eclipseState,
|
||||||
*parseContext, std::move(python),
|
*parseContext, std::move(python),
|
||||||
schedule, udqState, actionState, wtestState,
|
schedule, udqState, actionState, wtestState,
|
||||||
errorGuard);
|
errorGuard);
|
||||||
@ -274,7 +270,7 @@ namespace {
|
|||||||
|
|
||||||
if (summaryConfig == nullptr) {
|
if (summaryConfig == nullptr) {
|
||||||
summaryConfig = std::make_shared<Opm::SummaryConfig>
|
summaryConfig = std::make_shared<Opm::SummaryConfig>
|
||||||
(*deck, *schedule, eclipseState->fieldProps(),
|
(deck, *schedule, eclipseState->fieldProps(),
|
||||||
eclipseState->aquifer(), *parseContext, errorGuard);
|
eclipseState->aquifer(), *parseContext, errorGuard);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +476,6 @@ Opm::setupLogging(const int mpi_rank_,
|
|||||||
|
|
||||||
void Opm::readDeck(Opm::Parallel::Communication comm,
|
void Opm::readDeck(Opm::Parallel::Communication comm,
|
||||||
const std::string& deckFilename,
|
const std::string& deckFilename,
|
||||||
std::shared_ptr<Deck>& deck,
|
|
||||||
std::shared_ptr<EclipseState>& eclipseState,
|
std::shared_ptr<EclipseState>& eclipseState,
|
||||||
std::shared_ptr<Schedule>& schedule,
|
std::shared_ptr<Schedule>& schedule,
|
||||||
std::unique_ptr<UDQState>& udqState,
|
std::unique_ptr<UDQState>& udqState,
|
||||||
@ -503,7 +498,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
|
|
||||||
if (comm.rank() == 0) { // Always true when !HAVE_MPI
|
if (comm.rank() == 0) { // Always true when !HAVE_MPI
|
||||||
try {
|
try {
|
||||||
readOnIORank(comm, deckFilename, parseContext.get(), deck,
|
readOnIORank(comm, deckFilename, parseContext.get(),
|
||||||
eclipseState, schedule, udqState, actionState, wtestState,
|
eclipseState, schedule, udqState, actionState, wtestState,
|
||||||
summaryConfig, std::move(python), initFromRestart,
|
summaryConfig, std::move(python), initFromRestart,
|
||||||
checkDeck, outputInterval, *errorGuard);
|
checkDeck, outputInterval, *errorGuard);
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
class Deck;
|
|
||||||
class EclipseState;
|
class EclipseState;
|
||||||
class ErrorGuard;
|
class ErrorGuard;
|
||||||
class ParseContext;
|
class ParseContext;
|
||||||
@ -77,7 +76,6 @@ setupLogging(int mpi_rank_,
|
|||||||
/// are created and can be used outside later.
|
/// are created and can be used outside later.
|
||||||
void readDeck(Parallel::Communication comm,
|
void readDeck(Parallel::Communication comm,
|
||||||
const std::string& deckFilename,
|
const std::string& deckFilename,
|
||||||
std::shared_ptr<Deck>& deck,
|
|
||||||
std::shared_ptr<EclipseState>& eclipseState,
|
std::shared_ptr<EclipseState>& eclipseState,
|
||||||
std::shared_ptr<Schedule>& schedule,
|
std::shared_ptr<Schedule>& schedule,
|
||||||
std::unique_ptr<UDQState>& udqState,
|
std::unique_ptr<UDQState>& udqState,
|
||||||
|
@ -147,7 +147,7 @@ int PyBlackOilSimulator::stepInit()
|
|||||||
}
|
}
|
||||||
if (this->deck_) {
|
if (this->deck_) {
|
||||||
main_ = std::make_unique<Opm::Main>(
|
main_ = std::make_unique<Opm::Main>(
|
||||||
this->deck_,
|
this->deck_->getDataFile(),
|
||||||
this->eclipse_state_,
|
this->eclipse_state_,
|
||||||
this->schedule_,
|
this->schedule_,
|
||||||
this->summary_config_
|
this->summary_config_
|
||||||
|
Loading…
Reference in New Issue
Block a user