diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index 486b3b84c..9e97aa5cf 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -1335,10 +1335,7 @@ accumulateRegionSums(const Parallel::Communication& comm) } // The first time the outputFipLog function is run we store the inplace values in - // the initialInplace_ member. This has at least two problems: - // - // o We really want the *initial* value - now we get the value after - // the first timestep. + // the initialInplace_ member. This has a problem: // // o For restarted runs this is obviously wrong. // diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 2252215f5..776f85769 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -754,8 +754,6 @@ public: if (enableEclOutput_){ eclWriter_->writeOutput(std::move(localCellData), isSubStep); } - - } void finalizeOutput() { @@ -1346,6 +1344,10 @@ public: if (enableAquifers_) aquiferModel_.initialSolutionApplied(); + + if (this->simulator().episodeIndex() == 0) { + eclWriter_->writeInitialFIPReport(); + } } /*! diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index 0a4b04d58..4991c95bd 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -319,6 +319,43 @@ 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 numElements = gridView.size(/*codim=*/0); + + this->eclOutputModule_-> + allocBuffers(numElements, 0, false, false, /*isRestart*/ false); + +#ifdef _OPENMP +#pragma omp parallel for +#endif + for (int dofIdx = 0; dofIdx < numElements; ++dofIdx) { + const auto& intQuants = *simulator_.model().cachedIntensiveQuantities(dofIdx, /*timeIdx=*/0); + const auto totVolume = simulator_.model().dofTotalVolume(dofIdx); + + this->eclOutputModule_->updateFluidInPlace(dofIdx, intQuants, totVolume); + } + + std::map miscSummaryData; + std::map> regionData; + Inplace inplace; + { + OPM_TIMEBLOCK(outputFipLogAndFipresvLog); + inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, 0, + false, simulator_.gridView().comm()); + eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, 0, + false, simulator_.gridView().comm()); + } + } + void writeOutput(data::Solution&& localCellData, bool isSubStep) { OPM_TIMEBLOCK(writeOutput);