mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: don't store schedule keywords unless required in simulators
in the python simulator we cannot make this decision up front since the schedule can be modified from python code so we have to do the safe thing
This commit is contained in:
parent
fc578bad7f
commit
2353ba56a6
@ -149,7 +149,7 @@ void FlowGenericVanguard::readDeck(const std::string& filename)
|
|||||||
modelParams_.actionState_,
|
modelParams_.actionState_,
|
||||||
modelParams_.wtestState_,
|
modelParams_.wtestState_,
|
||||||
modelParams_.eclSummaryConfig_,
|
modelParams_.eclSummaryConfig_,
|
||||||
nullptr, "normal", "normal", "100", false, false, {});
|
nullptr, "normal", "normal", "100", false, false, false, {});
|
||||||
modelParams_.setupTime_ = setupTimer.stop();
|
modelParams_.setupTime_ = setupTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +202,7 @@ void Main::readDeck(const std::string& deckFilename,
|
|||||||
const std::string& parsingStrictness,
|
const std::string& parsingStrictness,
|
||||||
const std::string& actionParsingStrictness,
|
const std::string& actionParsingStrictness,
|
||||||
const std::string& inputSkipMode,
|
const std::string& inputSkipMode,
|
||||||
|
const bool keepKeywords,
|
||||||
const std::size_t numThreads,
|
const std::size_t numThreads,
|
||||||
const int output_param,
|
const int output_param,
|
||||||
const std::string& parameters,
|
const std::string& parameters,
|
||||||
@ -238,6 +239,7 @@ void Main::readDeck(const std::string& deckFilename,
|
|||||||
inputSkipMode,
|
inputSkipMode,
|
||||||
init_from_restart_file,
|
init_from_restart_file,
|
||||||
outputCout_,
|
outputCout_,
|
||||||
|
keepKeywords,
|
||||||
outputInterval);
|
outputInterval);
|
||||||
|
|
||||||
verifyValidCellGeometry(FlowGenericVanguard::comm(), *this->eclipseState_);
|
verifyValidCellGeometry(FlowGenericVanguard::comm(), *this->eclipseState_);
|
||||||
|
@ -272,12 +272,13 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
/// \brief Initialize
|
/// \brief Initialize
|
||||||
/// \param exitCode The exitCode of the program.
|
/// \param exitCode The exitCode of the program.
|
||||||
|
/// \param keepKeywords Keep Schedule keywords even if there are no actions
|
||||||
///
|
///
|
||||||
/// \return Whether to actually run the simulator. I.e. true if
|
/// \return Whether to actually run the simulator. I.e. true if
|
||||||
/// parsing of command line was successful and no --help,
|
/// parsing of command line was successful and no --help,
|
||||||
/// --print-properties, or --print-parameters have been found.
|
/// --print-properties, or --print-parameters have been found.
|
||||||
template <class TypeTagEarlyBird>
|
template <class TypeTagEarlyBird>
|
||||||
bool initialize_(int& exitCode)
|
bool initialize_(int& exitCode, bool keepKeywords = false)
|
||||||
{
|
{
|
||||||
Dune::Timer externalSetupTimer;
|
Dune::Timer externalSetupTimer;
|
||||||
externalSetupTimer.start();
|
externalSetupTimer.start();
|
||||||
@ -404,6 +405,7 @@ protected:
|
|||||||
Parameters::Get<Parameters::ParsingStrictness>(),
|
Parameters::Get<Parameters::ParsingStrictness>(),
|
||||||
Parameters::Get<Parameters::ActionParsingStrictness>(),
|
Parameters::Get<Parameters::ActionParsingStrictness>(),
|
||||||
Parameters::Get<Parameters::InputSkipMode>(),
|
Parameters::Get<Parameters::InputSkipMode>(),
|
||||||
|
keepKeywords,
|
||||||
getNumThreads(),
|
getNumThreads(),
|
||||||
Parameters::Get<Parameters::EclOutputInterval>(),
|
Parameters::Get<Parameters::EclOutputInterval>(),
|
||||||
cmdline_params,
|
cmdline_params,
|
||||||
@ -683,6 +685,7 @@ private:
|
|||||||
const std::string& parsingStrictness,
|
const std::string& parsingStrictness,
|
||||||
const std::string& actionParsingStrictness,
|
const std::string& actionParsingStrictness,
|
||||||
const std::string& inputSkipMode,
|
const std::string& inputSkipMode,
|
||||||
|
const bool keepKeywords,
|
||||||
const std::size_t numThreads,
|
const std::size_t numThreads,
|
||||||
const int output_param,
|
const int output_param,
|
||||||
const std::string& parameters,
|
const std::string& parameters,
|
||||||
|
@ -73,12 +73,10 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <unordered_map>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -105,6 +103,7 @@ namespace {
|
|||||||
const bool initFromRestart,
|
const bool initFromRestart,
|
||||||
const std::optional<int>& outputInterval,
|
const std::optional<int>& outputInterval,
|
||||||
const bool lowActionParsingStrictness,
|
const bool lowActionParsingStrictness,
|
||||||
|
const bool keepKeywords,
|
||||||
Opm::EclipseState& eclipseState,
|
Opm::EclipseState& eclipseState,
|
||||||
std::shared_ptr<Opm::Python> python,
|
std::shared_ptr<Opm::Python> python,
|
||||||
std::shared_ptr<Opm::Schedule>& schedule,
|
std::shared_ptr<Opm::Schedule>& schedule,
|
||||||
@ -152,7 +151,8 @@ namespace {
|
|||||||
if (schedule == nullptr) {
|
if (schedule == nullptr) {
|
||||||
schedule = std::make_shared<Opm::Schedule>
|
schedule = std::make_shared<Opm::Schedule>
|
||||||
(deck, eclipseState, parseContext, errorGuard,
|
(deck, eclipseState, parseContext, errorGuard,
|
||||||
std::move(python), lowActionParsingStrictness, outputInterval, init_state);
|
std::move(python), lowActionParsingStrictness,
|
||||||
|
keepKeywords, outputInterval, init_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read network pressures from restart
|
// Read network pressures from restart
|
||||||
@ -174,6 +174,7 @@ namespace {
|
|||||||
const Opm::EclipseState& eclipseState,
|
const Opm::EclipseState& eclipseState,
|
||||||
const Opm::ParseContext& parseContext,
|
const Opm::ParseContext& parseContext,
|
||||||
const bool lowActionParsingStrictness,
|
const bool lowActionParsingStrictness,
|
||||||
|
const bool keepKeywords,
|
||||||
std::shared_ptr<Opm::Python> python,
|
std::shared_ptr<Opm::Python> python,
|
||||||
std::shared_ptr<Opm::Schedule>& schedule,
|
std::shared_ptr<Opm::Schedule>& schedule,
|
||||||
std::unique_ptr<Opm::UDQState>& udqState,
|
std::unique_ptr<Opm::UDQState>& udqState,
|
||||||
@ -184,7 +185,7 @@ namespace {
|
|||||||
if (schedule == nullptr) {
|
if (schedule == nullptr) {
|
||||||
schedule = std::make_shared<Opm::Schedule>
|
schedule = std::make_shared<Opm::Schedule>
|
||||||
(deck, eclipseState, parseContext,
|
(deck, eclipseState, parseContext,
|
||||||
errorGuard, std::move(python), lowActionParsingStrictness);
|
errorGuard, std::move(python), lowActionParsingStrictness, keepKeywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
udqState = std::make_unique<Opm::UDQState>
|
udqState = std::make_unique<Opm::UDQState>
|
||||||
@ -246,6 +247,7 @@ namespace {
|
|||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
const bool treatCriticalAsNonCritical,
|
const bool treatCriticalAsNonCritical,
|
||||||
const bool lowActionParsingStrictness,
|
const bool lowActionParsingStrictness,
|
||||||
|
const bool keepKeywords,
|
||||||
const std::optional<int>& outputInterval,
|
const std::optional<int>& outputInterval,
|
||||||
Opm::ErrorGuard& errorGuard)
|
Opm::ErrorGuard& errorGuard)
|
||||||
{
|
{
|
||||||
@ -270,14 +272,15 @@ namespace {
|
|||||||
if (eclipseState->getInitConfig().restartRequested()) {
|
if (eclipseState->getInitConfig().restartRequested()) {
|
||||||
loadObjectsFromRestart(deck, parser, *parseContext,
|
loadObjectsFromRestart(deck, parser, *parseContext,
|
||||||
initFromRestart, outputInterval,
|
initFromRestart, outputInterval,
|
||||||
lowActionParsingStrictness,
|
lowActionParsingStrictness, keepKeywords,
|
||||||
*eclipseState, std::move(python),
|
*eclipseState, std::move(python),
|
||||||
schedule, udqState, actionState, wtestState,
|
schedule, udqState, actionState, wtestState,
|
||||||
errorGuard);
|
errorGuard);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
createNonRestartDynamicObjects(deck, *eclipseState, *parseContext,
|
createNonRestartDynamicObjects(deck, *eclipseState, *parseContext,
|
||||||
lowActionParsingStrictness, std::move(python),
|
lowActionParsingStrictness, keepKeywords,
|
||||||
|
std::move(python),
|
||||||
schedule, udqState, actionState, wtestState,
|
schedule, udqState, actionState, wtestState,
|
||||||
errorGuard);
|
errorGuard);
|
||||||
}
|
}
|
||||||
@ -535,6 +538,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
const std::string& inputSkipMode,
|
const std::string& inputSkipMode,
|
||||||
const bool initFromRestart,
|
const bool initFromRestart,
|
||||||
const bool checkDeck,
|
const bool checkDeck,
|
||||||
|
const bool keepKeywords,
|
||||||
const std::optional<int>& outputInterval)
|
const std::optional<int>& outputInterval)
|
||||||
{
|
{
|
||||||
auto errorGuard = std::make_unique<ErrorGuard>();
|
auto errorGuard = std::make_unique<ErrorGuard>();
|
||||||
@ -569,7 +573,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
|||||||
eclipseState, schedule, udqState, actionState, wtestState,
|
eclipseState, schedule, udqState, actionState, wtestState,
|
||||||
summaryConfig, std::move(python), initFromRestart,
|
summaryConfig, std::move(python), initFromRestart,
|
||||||
checkDeck, treatCriticalAsNonCritical, lowActionParsingStrictness,
|
checkDeck, treatCriticalAsNonCritical, lowActionParsingStrictness,
|
||||||
outputInterval, *errorGuard);
|
keepKeywords, outputInterval, *errorGuard);
|
||||||
|
|
||||||
// Update schedule so that re-parsing after actions use same strictness
|
// Update schedule so that re-parsing after actions use same strictness
|
||||||
assert(schedule);
|
assert(schedule);
|
||||||
|
@ -98,6 +98,7 @@ void readDeck(Parallel::Communication comm,
|
|||||||
const std::string& inputSkipMode,
|
const std::string& inputSkipMode,
|
||||||
bool initFromRestart,
|
bool initFromRestart,
|
||||||
bool checkDeck,
|
bool checkDeck,
|
||||||
|
bool keepKeywords,
|
||||||
const std::optional<int>& outputInterval);
|
const std::optional<int>& outputInterval);
|
||||||
|
|
||||||
void verifyValidCellGeometry(Parallel::Communication comm,
|
void verifyValidCellGeometry(Parallel::Communication comm,
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
|
std::unique_ptr<FlowMainType> initFlowBlackoil(int& exitCode)
|
||||||
{
|
{
|
||||||
exitCode = EXIT_SUCCESS;
|
exitCode = EXIT_SUCCESS;
|
||||||
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode)) {
|
if (initialize_<Properties::TTag::FlowEarlyBird>(exitCode, true)) {
|
||||||
// TODO: check that this deck really represents a blackoil
|
// TODO: check that this deck really represents a blackoil
|
||||||
// case. E.g. check that number of phases == 3
|
// case. E.g. check that number of phases == 3
|
||||||
this->setupVanguard();
|
this->setupVanguard();
|
||||||
|
Loading…
Reference in New Issue
Block a user