Support RPTSCHED WELLS=N

This commit is contained in:
Vegard Kippe 2024-09-23 14:03:53 +02:00
parent 5137f51848
commit 6ba9dc086c
4 changed files with 34 additions and 19 deletions

View File

@ -31,6 +31,7 @@
#include <dune/grid/common/partitionset.hh>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/Schedule/RPTConfig.hpp>
#include <opm/input/eclipse/Units/UnitSystem.hpp>
@ -375,6 +376,28 @@ public:
}
}
void writeReports(const SimulatorTimer& timer) {
const int reportStepNum = simulator_.episodeIndex() + 1;
auto rstep = timer.reportStepNum();
if ((rstep > 0) && (this->collectOnIORank_.isIORank())){
const auto& rpt = this->schedule_[rstep-1].rpt_config.get();
if (rpt.contains("WELLS") && rpt.at("WELLS") > 0) {
outputModule_->outputTimeStamp("WELLS", timer.simulationTimeElapsed(), rstep, timer.currentDateTime());
outputModule_->outputProdLog(reportStepNum);
outputModule_->outputInjLog(reportStepNum);
outputModule_->outputCumLog(reportStepNum);
}
outputModule_->outputFipAndResvLog(inplace_, rstep, timer.simulationTimeElapsed(),
timer.currentDateTime(), false, simulator_.gridView().comm());
OpmLog::note(""); // Blank line after all reports.
}
}
void writeOutput(data::Solution&& localCellData, const SimulatorTimer& timer, bool isSubStep)
{
OPM_TIMEBLOCK(writeOutput);
@ -399,24 +422,7 @@ public:
// data::Solution localCellData = {};
if (! isSubStep || Parameters::Get<Parameters::EnableWriteAllSolutions>()) {
auto rstep = timer.reportStepNum();
if ((rstep > 0) && (this->collectOnIORank_.isIORank())){
outputModule_->outputFipAndResvLog(inplace_, rstep, timer.simulationTimeElapsed(),
timer.currentDateTime(), false, simulator_.gridView().comm());
outputModule_->outputTimeStamp("WELLS", timer.simulationTimeElapsed(), rstep, timer.currentDateTime());
outputModule_->outputProdLog(reportStepNum);
outputModule_->outputInjLog(reportStepNum);
outputModule_->outputCumLog(reportStepNum);
OpmLog::note(""); // Blank line after all reports.
}
if (localCellData.empty()) {
this->outputModule_->assignToSolution(localCellData);
}

View File

@ -466,6 +466,13 @@ public:
FlowProblemType::endEpisode();
}
void writeReports(const SimulatorTimer& timer) {
if (enableEclOutput_){
eclWriter_->writeReports(timer);
}
}
/*!
* \brief Write the requested quantities of the current solution into the output
* files.

View File

@ -351,8 +351,8 @@ outputFipAndResvLog(const Inplace& inplace,
// For report step 0 we use the RPTSOL config, else derive from RPTSCHED
std::unique_ptr<FIPConfig> fipSched;
if (reportStepNum != 0) {
const auto& rpt = this->schedule_[reportStepNum].rpt_config.get();
if (reportStepNum > 0) {
const auto& rpt = this->schedule_[reportStepNum-1].rpt_config.get();
fipSched = std::make_unique<FIPConfig>(rpt);
}
const FIPConfig& fipc = reportStepNum == 0 ? this->eclState_.getEclipseConfig().fip()

View File

@ -200,9 +200,11 @@ public:
simulator_.model().invalidateAndUpdateIntensiveQuantities(/*timeIdx=*/0);
// Main simulation loop.
while (!timer.done()) {
simulator_.problem().writeReports(timer);
bool continue_looping = runStep(timer);
if (!continue_looping) break;
}
simulator_.problem().writeReports(timer);
return finalize();
}