diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index d17346bf8..d1e190074 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -293,8 +293,9 @@ outputFipresvLog(std::map& miscSummaryData, miscSummaryData, regionData); - if (!substep) - outputFipresvLogImpl(inplace); + if (!substep && !forceDisableFipresvOutput_) { + logOutput_.fipResv(inplace); + } return inplace; } @@ -1043,83 +1044,6 @@ doAllocBuffers(unsigned bufferSize, } } -template -void EclGenericOutputBlackoilModule:: -fipUnitConvert_(std::unordered_map& fip) const -{ - const UnitSystem& units = eclState_.getUnits(); - using M = UnitSystem::measure; - const auto unit_map = std::unordered_map { - {Inplace::Phase::WATER, M::liquid_surface_volume}, - {Inplace::Phase::OIL, M::liquid_surface_volume}, - {Inplace::Phase::OilInLiquidPhase, M::liquid_surface_volume}, - {Inplace::Phase::OilInGasPhase, M::liquid_surface_volume}, - {Inplace::Phase::GAS, M::gas_surface_volume}, - {Inplace::Phase::GasInLiquidPhase, M::gas_surface_volume}, - {Inplace::Phase::GasInGasPhase, M::gas_surface_volume}, - {Inplace::Phase::PoreVolume, M::volume}, - {Inplace::Phase::DynamicPoreVolume, M::volume}, - {Inplace::Phase::WaterResVolume, M::volume}, - {Inplace::Phase::OilResVolume, M::volume}, - {Inplace::Phase::GasResVolume, M::volume}, - {Inplace::Phase::SALT, M::mass}, - {Inplace::Phase::CO2InWaterPhase, M::moles}, - {Inplace::Phase::CO2InGasPhaseInMob,M::moles}, - {Inplace::Phase::CO2InGasPhaseMob, M::moles}, - {Inplace::Phase::WaterInWaterPhase, M::liquid_surface_volume}, - {Inplace::Phase::WaterInGasPhase, M::liquid_surface_volume}, - }; - - for (auto& [phase, value] : fip) { - auto unitPos = unit_map.find(phase); - if (unitPos != unit_map.end()) { - value = units.from_si(unitPos->second, value); - } - } -} - -template -void EclGenericOutputBlackoilModule:: -pressureUnitConvert_(Scalar& pav) const -{ - pav = this->eclState_.getUnits() - .from_si(UnitSystem::measure::pressure, pav); -} - -template -void EclGenericOutputBlackoilModule:: -outputResvFluidInPlace_(std::unordered_map cipr, const int reg) const -{ - if (forceDisableFipresvOutput_) - return; - - // don't output FIPNUM report if the region has no porv. - if (cipr[Inplace::Phase::PoreVolume] == 0) - return; - const UnitSystem& units = eclState_.getUnits(); - std::ostringstream ss; - - if (reg == 0) { - ss << " ===================================\n"; - if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { - ss << " : RESERVOIR VOLUMES M3 :\n"; - } - if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { - ss << " : RESERVOIR VOLUMES RB :\n"; - } - ss << ":---------:---------------:---------------:---------------:---------------:---------------:\n" - << ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n" - << ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n" - << ": : : OIL : WATER : GAS : HYDRO-CARBON :\n" - << ":---------:---------------:---------------:---------------:---------------:---------------\n"; - } - else { - ss << std::right << std::fixed << std::setprecision(0) << ":" << std::setw (9) << reg << ":" << std::setw(15) << cipr[Inplace::Phase::DynamicPoreVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::OilResVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::WaterResVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":" << std::setw(15) << cipr[Inplace::Phase::OilResVolume] + cipr[Inplace::Phase::GasResVolume] << ":\n" - << ":---------:---------------:---------------:---------------:---------------:---------------:\n"; - } - OpmLog::note(ss.str()); -} - template bool EclGenericOutputBlackoilModule:: isOutputCreationDirective_(const std::string& keyword) @@ -1203,34 +1127,6 @@ outputErrorLog(const Parallel::Communication& comm) const ijkString); } -template -void EclGenericOutputBlackoilModule:: -outputFipresvLogImpl(const Inplace& inplace) const -{ - { - std::unordered_map current_values; - - for (const auto& phase : Inplace::phases()) { - current_values[phase] = inplace.get(phase); - } - fipUnitConvert_(current_values); - outputResvFluidInPlace_(current_values); - } - - for (size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { - std::unordered_map current_values; - - for (const auto& phase : Inplace::phases()) { - current_values[phase] = inplace.get("FIPNUM", phase, reg); - } - current_values[Inplace::Phase::DynamicPoreVolume] = - inplace.get("FIPNUM", Inplace::Phase::DynamicPoreVolume, reg); - - fipUnitConvert_(current_values); - outputResvFluidInPlace_(current_values, reg); - } -} - template int EclGenericOutputBlackoilModule:: regionMax(const std::vector& region, diff --git a/ebos/eclgenericoutputblackoilmodule.hh b/ebos/eclgenericoutputblackoilmodule.hh index 4b0e793b1..fbdd9343c 100644 --- a/ebos/eclgenericoutputblackoilmodule.hh +++ b/ebos/eclgenericoutputblackoilmodule.hh @@ -304,15 +304,6 @@ protected: unsigned numTracers, unsigned numOutputNnc); - void fipUnitConvert_(std::unordered_map& fip) const; - - void pressureUnitConvert_(Scalar& pav) const; - - void outputResvFluidInPlace_(std::unordered_map cipr, - const int reg = 0) const; - - void outputFipresvLogImpl(const Inplace& inplace) const; - void makeRegionSum(Inplace& inplace, const std::string& region_name, const Parallel::Communication& comm) const; diff --git a/opm/simulators/flow/LogOutputHelper.cpp b/opm/simulators/flow/LogOutputHelper.cpp index 8b5bd0eda..670554552 100644 --- a/opm/simulators/flow/LogOutputHelper.cpp +++ b/opm/simulators/flow/LogOutputHelper.cpp @@ -246,6 +246,34 @@ fip(const Inplace& inplace, } } +template +void LogOutputHelper:: +fipResv(const Inplace& inplace) const +{ + { + std::unordered_map current_values; + + for (const auto& phase : Inplace::phases()) { + current_values[phase] = inplace.get(phase); + } + this->fipUnitConvert_(current_values); + this->outputResvFluidInPlace_(current_values, 0); + } + + for (size_t reg = 1; reg <= inplace.max_region("FIPNUM"); ++reg) { + std::unordered_map current_values; + + for (const auto& phase : Inplace::phases()) { + current_values[phase] = inplace.get("FIPNUM", phase, reg); + } + current_values[Inplace::Phase::DynamicPoreVolume] = + inplace.get("FIPNUM", Inplace::Phase::DynamicPoreVolume, reg); + + this->fipUnitConvert_(current_values); + this->outputResvFluidInPlace_(current_values, reg); + } +} + template void LogOutputHelper:: injection(const std::size_t reportStepNum, @@ -726,6 +754,45 @@ outputRegionFluidInPlace_(std::unordered_map oip, OpmLog::note(ss.str()); } +template +void LogOutputHelper:: +outputResvFluidInPlace_(std::unordered_map cipr, + const int reg) const +{ + // don't output FIPNUM report if the region has no porv. + if (cipr[Inplace::Phase::PoreVolume] == 0) { + return; + } + + const UnitSystem& units = eclState_.getUnits(); + std::ostringstream ss; + if (reg == 0) { + ss << " ===================================\n"; + if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_METRIC) { + ss << " : RESERVOIR VOLUMES M3 :\n"; + } else if (units.getType() == UnitSystem::UnitType::UNIT_TYPE_FIELD) { + ss << " : RESERVOIR VOLUMES RB :\n"; + } + ss << ":---------:---------------:---------------:---------------:---------------:---------------:\n" + << ": REGION : TOTAL PORE : PORE VOLUME : PORE VOLUME : PORE VOLUME : PORE VOLUME :\n" + << ": : VOLUME : CONTAINING : CONTAINING : CONTAINING : CONTAINING :\n" + << ": : : OIL : WATER : GAS : HYDRO-CARBON :\n" + << ":---------:---------------:---------------:---------------:---------------:---------------\n"; + } + else { + ss << std::right << std::fixed << std::setprecision(0) << ":" + << std::setw (9) << reg << ":" + << std::setw(15) << cipr[Inplace::Phase::DynamicPoreVolume] << ":" + << std::setw(15) << cipr[Inplace::Phase::OilResVolume] << ":" + << std::setw(15) << cipr[Inplace::Phase::WaterResVolume] << ":" + << std::setw(15) << cipr[Inplace::Phase::GasResVolume] << ":" + << std::setw(15) << cipr[Inplace::Phase::OilResVolume] + + cipr[Inplace::Phase::GasResVolume] << ":\n" + << ":---------:---------------:---------------:---------------:---------------:---------------:\n"; + } + OpmLog::note(ss.str()); +} + template void LogOutputHelper:: fipUnitConvert_(std::unordered_map& fip) const diff --git a/opm/simulators/flow/LogOutputHelper.hpp b/opm/simulators/flow/LogOutputHelper.hpp index 4cc9f7553..01f567cf0 100644 --- a/opm/simulators/flow/LogOutputHelper.hpp +++ b/opm/simulators/flow/LogOutputHelper.hpp @@ -51,6 +51,9 @@ public: void fip(const Inplace& inplace, const Inplace& initialInplace) const; + //! \brief Write fluid-in-place reservoir reports to output. + void fipResv(const Inplace& inplace) const; + //! \brief Write injection report to output. void injection(const std::size_t reportStepNum, std::function isDefunct) const; @@ -68,6 +71,9 @@ private: const Scalar pav, const int reg) const; + void outputResvFluidInPlace_(std::unordered_map cipr, + const int reg) const; + void outputInjectionReport_(const std::vector& wellInj, const std::vector& wellInjNames) const;