diff --git a/opm/models/blackoil/blackoilintensivequantities.hh b/opm/models/blackoil/blackoilintensivequantities.hh index e1bb0d226..c5d8c9442 100644 --- a/opm/models/blackoil/blackoilintensivequantities.hh +++ b/opm/models/blackoil/blackoilintensivequantities.hh @@ -661,8 +661,8 @@ private: // mobility_ class attribute. the division by the phase viscosity happens later. MaterialLaw::relativePermeabilities(mobility, materialParams, fluidState); Valgrind::CheckDefined(mobility); - const auto& materialLawManager = problem.materialLawManager(); - if (materialLawManager->hasDirectionalRelperms()) { + const auto* materialLawManager = problem.materialLawManagerPtr(); + if (materialLawManager && materialLawManager->hasDirectionalRelperms()) { auto satnumIdx = materialLawManager->satnumRegionIdx(globalSpaceIdx); using Dir = FaceDir::DirEnum; constexpr int ndim = 3; diff --git a/opm/models/common/multiphasebaseproblem.hh b/opm/models/common/multiphasebaseproblem.hh index 85964a5c4..f0380b64a 100644 --- a/opm/models/common/multiphasebaseproblem.hh +++ b/opm/models/common/multiphasebaseproblem.hh @@ -40,7 +40,13 @@ #include namespace Opm { - +// TODO: This hack is used to be able compile blackoilintensitivequantities.hh (see the function updateRelperms()) when +// the problem is not an EclProblem. For example if the problem is a ReservoirBlackOilVcfvProblem, the problem will not +// have a materialLawManager pointer (as the EclProblem has). Since this class MuitPhaseBaseProblem (see below) is a parent +// class for both those problem types, we can solve this problem by forward declaring EclMaterialLawManager here +// and defining a method materialLawManagerPtr() here that returns a nullptr, but is overridden in EclProblem to +// return the real EclMaterialManager pointer. +template class EclMaterialLawManager; /*! * \ingroup Discretization * @@ -246,6 +252,13 @@ public: return dummy; } + // TODO: See the comment at the top of this file for the reason why we need this method + template + const ::Opm::EclMaterialLawManager* materialLawManagerPtr() const + { + return nullptr; + } + /*! * \brief Returns the temperature \f$\mathrm{[K]}\f$ within a control volume. *