Merge pull request #3105 from joakim-hove/output-interval

Pass ouput interval overeride to Schedule constructor
This commit is contained in:
Joakim Hove 2021-03-09 07:25:50 +01:00 committed by GitHub
commit 46ae5fa577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 11 deletions

View File

@ -444,21 +444,20 @@ public:
parseContext_ = createParseContext();
}
std::optional<int> outputInterval;
int output_param = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
if (output_param >= 0)
outputInterval = output_param;
readDeck(myRank, fileName, deck_, eclState_, eclSchedule_,
eclSummaryConfig_, std::move(errorGuard), python,
std::move(parseContext_), /* initFromRestart = */ false,
/* checkDeck = */ enableExperiments);
/* checkDeck = */ enableExperiments, outputInterval);
this->summaryState_ = std::make_unique<Opm::SummaryState>( Opm::TimeService::from_time_t(this->eclSchedule_->getStartTime() ));
this->udqState_ = std::make_unique<Opm::UDQState>( this->eclSchedule_->getUDQConfig(0).params().undefinedValue() );
this->actionState_ = std::make_unique<Opm::Action::State>() ;
// Possibly override IOConfig setting for how often RESTART files should get
// written to disk (every N report step)
int outputInterval = EWOMS_GET_PARAM(TypeTag, int, EclOutputInterval);
if (outputInterval >= 0)
schedule().rst_override_interval(outputInterval);
// Initialize parallelWells with all local wells
const auto& schedule_wells = schedule().getWellsatEnd();
parallelWells_.reserve(schedule_wells.size());

View File

@ -455,9 +455,14 @@ namespace Opm
OpmLog::info("Reading deck file '" + deckFilename + "'");
}
std::optional<int> outputInterval;
int output_param = EWOMS_GET_PARAM(PreTypeTag, int, EclOutputInterval);
if (output_param >= 0)
outputInterval = output_param;
readDeck(mpiRank, deckFilename, deck_, eclipseState_, schedule_,
summaryConfig_, nullptr, python, std::move(parseContext),
init_from_restart_file, outputCout_);
init_from_restart_file, outputCout_, outputInterval);
setupTime_ = externalSetupTimer.elapsed();
outputFiles_ = (outputMode != FileOutputMode::OUTPUT_NONE);

View File

@ -170,7 +170,7 @@ void setupMessageLimiter(const Opm::MessageLimits msgLimits, const std::string&
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& deck, std::unique_ptr<Opm::EclipseState>& eclipseState,
std::unique_ptr<Opm::Schedule>& schedule, std::unique_ptr<Opm::SummaryConfig>& summaryConfig,
std::unique_ptr<ErrorGuard> errorGuard, std::shared_ptr<Opm::Python>& python, std::unique_ptr<ParseContext> parseContext,
bool initFromRestart, bool checkDeck)
bool initFromRestart, bool checkDeck, const std::optional<int>& outputInterval)
{
if (!errorGuard)
{
@ -216,7 +216,7 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
Opm::EclIO::ERst rst_file(rst_filename);
const auto& rst_state = Opm::RestartIO::RstState::load(rst_file, report_step);
if (!schedule)
schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python, &rst_state);
schedule = std::make_unique<Opm::Schedule>(*deck, *eclipseState, *parseContext, *errorGuard, python, outputInterval, &rst_state);
}
else {
if (!schedule)

View File

@ -34,6 +34,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp>
#include <memory>
#include <optional>
#include <string>
namespace Opm
@ -56,7 +57,7 @@ FileOutputMode setupLogging(int mpi_rank_, const std::string& deck_filename, con
void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& deck, std::unique_ptr<Opm::EclipseState>& eclipseState,
std::unique_ptr<Opm::Schedule>& schedule, std::unique_ptr<Opm::SummaryConfig>& summaryConfig,
std::unique_ptr<ErrorGuard> errorGuard, std::shared_ptr<Opm::Python>& python, std::unique_ptr<ParseContext> parseContext,
bool initFromRestart, bool checkDeck);
bool initFromRestart, bool checkDeck, const std::optional<int>& outputInterval);
} // end namespace Opm
#endif // OPM_READDECK_HEADER_INCLUDED