From 21e3e4dc81cf5a6ff32fbc6b44624bd537503e0e Mon Sep 17 00:00:00 2001 From: Cintia Goncalves Machado Date: Wed, 25 Aug 2021 18:24:05 +0200 Subject: [PATCH] use Saturation to compute vol --- ebos/eclgenericoutputblackoilmodule.cc | 89 ++++++++++++++++++++++++++ ebos/eclgenericoutputblackoilmodule.hh | 12 ++++ ebos/ecloutputblackoilmodule.hh | 26 +++++++- ebos/eclwriter.hh | 1 + 4 files changed, 127 insertions(+), 1 deletion(-) diff --git a/ebos/eclgenericoutputblackoilmodule.cc b/ebos/eclgenericoutputblackoilmodule.cc index e07135d95..29af10664 100644 --- a/ebos/eclgenericoutputblackoilmodule.cc +++ b/ebos/eclgenericoutputblackoilmodule.cc @@ -54,6 +54,9 @@ std::string EclString(Opm::Inplace::Phase phase) { case Opm::Inplace::Phase::GasInLiquidPhase: return "GIPL"; case Opm::Inplace::Phase::GasInGasPhase: return "GIPG"; case Opm::Inplace::Phase::PoreVolume: return "RPV"; + case Opm::Inplace::Phase::WaterResVolume: return "WIPR"; + case Opm::Inplace::Phase::OilResVolume: return "OIPR"; + case Opm::Inplace::Phase::GasResVolume: return "GIPR"; default: throw std::logic_error("Phase not recognized"); } } @@ -497,6 +500,27 @@ outputFipLog(std::map& miscSummaryData, return inplace; } +template +Inplace EclGenericOutputBlackoilModule:: +outputFipresvLog(std::map& miscSummaryData, + std::map>& regionData, + const bool substep, + const Comm& comm) +{ + auto inplace = this->accumulateRegionSums(comm); + if (comm.rank() != 0) + return inplace; + + updateSummaryRegionValues(inplace, + miscSummaryData, + regionData); + + if (!substep) + outputFipresvLogImpl(inplace); + + return inplace; +} + template void EclGenericOutputBlackoilModule:: addRftDataToWells(data::Wells& wellDatas, size_t reportStepNum) @@ -1024,6 +1048,9 @@ fipUnitConvert_(std::unordered_map& fip) const {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}, }; for (auto& [phase, value] : fip) { @@ -1111,6 +1138,40 @@ outputRegionFluidInPlace_(std::unordered_map oip, OpmLog::note(ss.str()); } +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 void EclGenericOutputBlackoilModule:: outputProductionReport_(const ScalarBuffer& wellProd, @@ -1399,6 +1460,34 @@ outputFipLogImpl(const Inplace& inplace) const } } +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 d184f6bce..bc375e0aa 100644 --- a/ebos/eclgenericoutputblackoilmodule.hh +++ b/ebos/eclgenericoutputblackoilmodule.hh @@ -78,6 +78,13 @@ public: const bool substep, const Comm& comm); + // write Reservoir Volumes to output log + Inplace outputFipresvLog(std::map& miscSummaryData, + std::map>& regionData, + const bool substep, + const Comm& comm); + + void outputErrorLog(const Comm& comm) const; @@ -247,6 +254,8 @@ protected: void outputRegionFluidInPlace_(std::unordered_map oip, std::unordered_map cip, const Scalar& pav, const int reg = 0) const; + void outputResvFluidInPlace_(std::unordered_map cipr, + const int reg = 0) const; void outputProductionReport_(const ScalarBuffer& wellProd, const StringBuffer& wellProdNames, const bool forceDisableProdOutput); @@ -259,6 +268,8 @@ protected: void outputFipLogImpl(const Inplace& inplace) const; + void outputFipresvLogImpl(const Inplace& inplace) const; + void makeRegionSum(Inplace& inplace, const std::string& region_name, const Comm& comm) const; @@ -315,6 +326,7 @@ protected: bool enableExtbo_; bool forceDisableFipOutput_; + bool forceDisableFipresvOutput_; bool outputFipRestart_; bool computeFip_; diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 6f3408f65..309a2cd1c 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -69,6 +69,18 @@ struct ForceDisableFluidInPlaceOutput { static constexpr bool value = false; }; + +template +struct ForceDisableResvFluidInPlaceOutput { + using type = UndefinedProperty; +}; + +template +struct ForceDisableResvFluidInPlaceOutput { + static constexpr bool value = false; +}; + + } // namespace Opm::Properties namespace Opm { @@ -146,6 +158,7 @@ public: } this->forceDisableFipOutput_ = EWOMS_GET_PARAM(TypeTag, bool, ForceDisableFluidInPlaceOutput); + this->forceDisableFipresvOutput_ = EWOMS_GET_PARAM(TypeTag, bool, ForceDisableResvFluidInPlaceOutput); } /*! @@ -155,6 +168,8 @@ public: { EWOMS_REGISTER_PARAM(TypeTag, bool, ForceDisableFluidInPlaceOutput, "Do not print fluid-in-place values after each report step even if requested by the deck."); + EWOMS_REGISTER_PARAM(TypeTag, bool, ForceDisableResvFluidInPlaceOutput, + "Do not print reservoir volumes values after each report step even if requested by the deck."); } /*! @@ -652,6 +667,7 @@ private: if (this->computeFip_) { Scalar fip[FluidSystem::numPhases]; + Scalar fipr[FluidSystem::numPhases]; // at reservoir condition for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) { fip[phaseIdx] = 0.0; @@ -660,7 +676,8 @@ private: const double b = getValue(fs.invB(phaseIdx)); const double s = getValue(fs.saturation(phaseIdx)); - fip[phaseIdx] = b * s * pv; + fipr[phaseIdx] = s * pv; + fip[phaseIdx] = b * fipr[phaseIdx]; } if (FluidSystem::phaseIsActive(oilPhaseIdx) && !this->fip_[Inplace::Phase::OIL].empty()) @@ -670,6 +687,13 @@ private: if (FluidSystem::phaseIsActive(waterPhaseIdx) && !this->fip_[Inplace::Phase::WATER].empty()) this->fip_[Inplace::Phase::WATER][globalDofIdx] = fip[waterPhaseIdx]; + if (FluidSystem::phaseIsActive(oilPhaseIdx) && !this->fip_[Inplace::Phase::OilResVolume].empty()) + this->fip_[Inplace::Phase::OilResVolume][globalDofIdx] = fipr[oilPhaseIdx]; + if (FluidSystem::phaseIsActive(gasPhaseIdx) && !this->fip_[Inplace::Phase::GasResVolume].empty()) + this->fip_[Inplace::Phase::GasResVolume][globalDofIdx] = fipr[gasPhaseIdx]; + if (FluidSystem::phaseIsActive(waterPhaseIdx) && !this->fip_[Inplace::Phase::WaterResVolume].empty()) + this->fip_[Inplace::Phase::WaterResVolume][globalDofIdx] = fipr[waterPhaseIdx]; + // Store the pure oil and gas Fip if (FluidSystem::phaseIsActive(oilPhaseIdx) && !this->fip_[Inplace::Phase::OilInLiquidPhase].empty()) this->fip_[Inplace::Phase::OilInLiquidPhase][globalDofIdx] = fip[oilPhaseIdx]; diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index b5a385b16..95de4edc2 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -196,6 +196,7 @@ public: std::map miscSummaryData; std::map> regionData; auto inplace = eclOutputModule_->outputFipLog(miscSummaryData, regionData, isSubStep, simulator_.gridView().comm()); + eclOutputModule_->outputFipresvLog(miscSummaryData, regionData, isSubStep, simulator_.gridView().comm()); bool forceDisableProdOutput = false; bool forceDisableInjOutput = false;