diff --git a/ebos/eclgenericproblem.hh b/ebos/eclgenericproblem.hh index f4105b9c4..e83af70c7 100644 --- a/ebos/eclgenericproblem.hh +++ b/ebos/eclgenericproblem.hh @@ -377,6 +377,15 @@ protected: using LookUpData = Opm::LookUpData; const LookUpData lookUpData_; + // \brief Function to assign the origin cell index on level zero, for a cell on the leaf grid view. + // + // For CpGrid with local grid refinement, the field property of a cell on the leaf + // is inherited from its parent or equivalent (when has no parent) cell on level zero. + std::function lookupIdxOnLevelZeroAssigner_() + { + return [this](unsigned elemIdx) { return lookUpData_.template getFieldPropIdx(elemIdx);}; + } + private: template void updateNum(const std::string& name, std::vector& numbers, std::size_t num_regions); diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index f740ca44c..4de6bb3c2 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -2018,7 +2018,8 @@ protected: materialLawManager_ = std::make_shared(); materialLawManager_->initFromState(eclState); materialLawManager_->initParamsForElements(eclState, this->model().numGridDof(), - this-> template fieldPropIntTypeOnLeafAssigner_()); + this-> template fieldPropIntTypeOnLeafAssigner_(), + this-> lookupIdxOnLevelZeroAssigner_()); //////////////////////////////// }