From d8a7875f9b6c9a2637691ad93cb9da2fac4c6755 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 5 Dec 2024 11:57:50 +0100 Subject: [PATCH] fixed: always calculate initial FIP this can be used by various Schedule keywords even if FIP is not in RPTSOL --- opm/simulators/flow/EclWriter.hpp | 25 ++++++++----------- .../flow/GenericOutputBlackoilModule.cpp | 8 ++++++ .../flow/GenericOutputBlackoilModule.hpp | 3 +++ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/opm/simulators/flow/EclWriter.hpp b/opm/simulators/flow/EclWriter.hpp index 6a75ebb33..2f59da851 100644 --- a/opm/simulators/flow/EclWriter.hpp +++ b/opm/simulators/flow/EclWriter.hpp @@ -350,12 +350,6 @@ public: //! \brief Writes the initial FIP report as configured in RPTSOL. void writeInitialFIPReport() { - const auto& fip = simulator_.vanguard().eclState().getEclipseConfig().fip(); - if (!fip.output(FIPConfig::OutputField::FIELD) && - !fip.output(FIPConfig::OutputField::RESV)) { - return; - } - const auto& gridView = simulator_.vanguard().gridView(); const int num_interior = detail:: countLocalInteriorCellsGridView(gridView); @@ -373,17 +367,20 @@ public: this->outputModule_->updateFluidInPlace(dofIdx, intQuants, totVolume); } - std::map miscSummaryData; - std::map> regionData; - Inplace inplace; + // We always calculate the initial fip values as it may be used by various + // keywords in the Schedule, e.g. FIP=2 in RPTSCHED but no FIP in RPTSOL + const Inplace inplace = outputModule_->calc_initial_inplace(simulator_.gridView().comm()); + + // check if RPTSOL entry has FIP output + const auto& fip = simulator_.vanguard().eclState().getEclipseConfig().fip(); + if (fip.output(FIPConfig::OutputField::FIELD) || + fip.output(FIPConfig::OutputField::RESV)) { OPM_TIMEBLOCK(outputFipLogAndFipresvLog); - - boost::posix_time::ptime start_time = boost::posix_time::from_time_t(simulator_.vanguard().schedule().getStartTime()); + boost::posix_time::ptime start_time = + boost::posix_time::from_time_t(simulator_.vanguard().schedule().getStartTime()); - inplace = outputModule_->calc_inplace(miscSummaryData, regionData, simulator_.gridView().comm()); - - if (this->collectOnIORank_.isIORank()){ + if (this->collectOnIORank_.isIORank()) { inplace_ = inplace; outputModule_->outputFipAndResvLog(inplace_, 0, 0.0, start_time, diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.cpp b/opm/simulators/flow/GenericOutputBlackoilModule.cpp index 6d8834cad..0a345e8ae 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.cpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.cpp @@ -325,6 +325,14 @@ outputInjLog(std::size_t reportStepNum) this->logOutput_.injection(reportStepNum); } +template +Inplace GenericOutputBlackoilModule:: +calc_initial_inplace(const Parallel::Communication& comm) +{ + // calling accumulateRegionSums() updates InitialInplace_ as a side effect + return this->accumulateRegionSums(comm); +} + template Inplace GenericOutputBlackoilModule:: calc_inplace(std::map& miscSummaryData, diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.hpp b/opm/simulators/flow/GenericOutputBlackoilModule.hpp index 7a23b5bc4..b8f3afdcc 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.hpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.hpp @@ -95,6 +95,9 @@ public: // write injection report to output void outputInjLog(std::size_t reportStepNum); + // calculate Initial Fluid In Place + Inplace calc_initial_inplace(const Parallel::Communication& comm); + // calculate Fluid In Place Inplace calc_inplace(std::map& miscSummaryData, std::map>& regionData,