Merge pull request #5626 from vkip/rptsched_wells

Support RPTSCHED WELLS=N
This commit is contained in:
Bård Skaflestad 2024-09-25 09:27:58 +02:00 committed by GitHub
commit 02555ac504
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 40 additions and 26 deletions

View File

@ -142,7 +142,7 @@ public:
{
// \Note: the SimulatorTimer does not carry any useful information, so PRT file (if it gets output) will contain wrong
// timing information.
ParentType::writeOutput(SimulatorTimer{}, verbose);
ParentType::writeOutput(verbose);
}
}

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,7 +376,28 @@ public:
}
}
void writeOutput(data::Solution&& localCellData, const SimulatorTimer& timer, bool isSubStep)
void writeReports(const SimulatorTimer& timer) {
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(rstep-1);
outputModule_->outputInjLog(rstep-1);
outputModule_->outputCumLog(rstep-1);
}
outputModule_->outputFipAndResvLog(inplace_, rstep, timer.simulationTimeElapsed(),
timer.currentDateTime(), false, simulator_.gridView().comm());
OpmLog::note(""); // Blank line after all reports.
}
}
void writeOutput(data::Solution&& localCellData, bool isSubStep)
{
OPM_TIMEBLOCK(writeOutput);
@ -399,24 +421,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,11 +466,18 @@ 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.
*/
void writeOutput(const SimulatorTimer& timer, bool verbose = true)
void writeOutput(bool verbose = true)
{
FlowProblemType::writeOutput(verbose);
@ -485,7 +492,7 @@ public:
}
#endif
if (enableEclOutput_){
eclWriter_->writeOutput(std::move(localCellData), timer, isSubStep);
eclWriter_->writeOutput(std::move(localCellData), isSubStep);
}
}

View File

@ -355,8 +355,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();
}
@ -281,7 +283,7 @@ public:
simulator_.setEpisodeLength(0.0);
simulator_.setTimeStepSize(0.0);
wellModel_().beginReportStep(timer.currentStepNum());
simulator_.problem().writeOutput(timer);
simulator_.problem().writeOutput();
report_.success.output_write_time += perfTimer.stop();
}
@ -368,7 +370,7 @@ public:
perfTimer.start();
const double nextstep = adaptiveTimeStepping_ ? adaptiveTimeStepping_->suggestedNextStep() : -1.0;
simulator_.problem().setNextTimeStepSize(nextstep);
simulator_.problem().writeOutput(timer);
simulator_.problem().writeOutput();
report_.success.output_write_time += perfTimer.stop();
solver_->model().endReportStep();

View File

@ -349,7 +349,7 @@ void registerAdaptiveParameters();
time::StopWatch perfTimer;
perfTimer.start();
problem.writeOutput(simulatorTimer);
problem.writeOutput();
report.success.output_write_time += perfTimer.secsSinceStart();
}