From 323e4f1570aff752252dd0ba7eaff72aa7832dce Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Sun, 30 Oct 2016 11:22:38 +0100 Subject: [PATCH] ebos: use the PVTNUM grid property instead of the PVTNUM keyword besides enabling support for the modifier keywords, this should also be slightly faster (because no traversal of a binary is needed for every element anymore.) --- applications/ebos/eclproblem.hh | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/applications/ebos/eclproblem.hh b/applications/ebos/eclproblem.hh index 3f3992450..88b01d64d 100644 --- a/applications/ebos/eclproblem.hh +++ b/applications/ebos/eclproblem.hh @@ -689,15 +689,10 @@ public: */ unsigned pvtRegionIndex(unsigned elemIdx) const { - auto deck = this->simulator().gridManager().deck(); - - if (!deck->hasKeyword("PVTNUM")) + if (pvtnum_.empty()) return 0; - const auto& gridManager = this->simulator().gridManager(); - - unsigned cartesianDofIdx = gridManager.cartesianIndex(elemIdx); - return deck->getKeyword("PVTNUM").getIntData()[cartesianDofIdx] - 1; + return pvtnum_[elemIdx]; } /*! @@ -891,6 +886,9 @@ private: size_t numDof = this->model().numGridDof(); + // the PVT region number + updatePvtnum_(); + //////////////////////////////// // intrinsic permeability @@ -1238,6 +1236,25 @@ private: return true; } + void updatePvtnum_() + { + const auto& eclState = this->simulator().gridManager().eclState(); + const auto& eclProps = eclState->get3DProperties(); + + if (!eclProps.hasDeckIntGridProperty("PVTNUM")) + return; + + const auto& pvtnumData = eclProps.getIntGridProperty("PVTNUM").getData(); + const auto& gridManager = this->simulator().gridManager(); + + unsigned numElems = gridManager.gridView().size(/*codim=*/0); + pvtnum_.resize(numElems); + for (unsigned elemIdx = 0; elemIdx < numElems; ++elemIdx) { + unsigned cartElemIdx = gridManager.cartesianIndex(elemIdx); + pvtnum_[elemIdx] = pvtnumData[cartElemIdx] - 1; + } + } + std::vector porosity_; std::vector elementCenterDepth_; std::vector intrinsicPermeability_; @@ -1247,6 +1264,7 @@ private: EclThresholdPressure thresholdPressures_; + std::vector pvtnum_; std::vector rockTableIdx_; std::vector rockParams_;