From 8440ac3bd1ddf033bf25df42e5849051fb02a18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Fri, 3 Jan 2020 20:07:08 +0100 Subject: [PATCH] Don't Output RFT Files Unless Specifically Requested This commit ensures that we do not create RFT output files unless the simulation model specifically requests such output (e.g., through keywords WRFT or WRFTPLT). Notably, the OutputStream::RFT constructor will also create the file so we must take care not to form an object of this type unless actually needed. --- src/opm/output/eclipse/EclipseIO.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/opm/output/eclipse/EclipseIO.cpp b/src/opm/output/eclipse/EclipseIO.cpp index 6fadcf95d..8e9182566 100644 --- a/src/opm/output/eclipse/EclipseIO.cpp +++ b/src/opm/output/eclipse/EclipseIO.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include +#include #include #include #include // unique_ptr @@ -99,6 +101,7 @@ class EclipseIO::Impl { Impl( const EclipseState&, EclipseGrid, const Schedule&, const SummaryConfig& ); void writeINITFile( const data::Solution& simProps, std::map > int_data, const NNC& nnc) const; void writeEGRIDFile( const NNC& nnc ); + bool wantRFTOutput( const int report_step, const bool isSubstep ) const; const EclipseState& es; EclipseGrid grid; @@ -150,6 +153,14 @@ void EclipseIO::Impl::writeEGRIDFile( const NNC& nnc ) { this->grid.save( egridFile, formatted, nnc, this->es.getDeckUnitSystem()); } +bool EclipseIO::Impl::wantRFTOutput( const int report_step, + const bool isSubstep ) const +{ + return !isSubstep + && (static_cast(report_step) + >= this->schedule.rftConfig().firstRFTOutput()); +} + /* int_data: Writes key(string) and integers vector to INIT file as eclipse keywords - Key: Max 8 chars. @@ -219,8 +230,8 @@ void EclipseIO::writeTimeStep(const SummaryState& st, es, grid, schedule, st, write_double); } - // RFT file is not written for substeps - if (! isSubstep) { + // RFT file written only if requested and never for substeps. + if (this->impl->wantRFTOutput(report_step, isSubstep)) { // Open existing RFT file if report step is after first RFT event. const auto openExisting = EclIO::OutputStream::RFT::OpenExisting { static_cast(report_step)