Merge pull request #4048 from hakonhagland/krnum

Add support for directional relative permeabilities
This commit is contained in:
Tor Harald Sandve 2022-09-26 09:10:48 +02:00 committed by GitHub
commit 1849c95c2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 5 deletions

View File

@ -36,9 +36,12 @@
#include <opm/models/utils/signum.hh> #include <opm/models/utils/signum.hh>
#include <opm/material/common/Valgrind.hpp> #include <opm/material/common/Valgrind.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <dune/common/fvector.hh> #include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh> #include <dune/common/fmatrix.hh>
#include <fmt/format.h>
namespace Opm { namespace Opm {
@ -227,7 +230,6 @@ public:
unsigned I = stencil.globalSpaceIndex(interiorDofIdx); unsigned I = stencil.globalSpaceIndex(interiorDofIdx);
unsigned J = stencil.globalSpaceIndex(exteriorDofIdx); unsigned J = stencil.globalSpaceIndex(exteriorDofIdx);
Scalar trans = problem.transmissibility(elemCtx, interiorDofIdx, exteriorDofIdx); Scalar trans = problem.transmissibility(elemCtx, interiorDofIdx, exteriorDofIdx);
Scalar faceArea = scvf.area(); Scalar faceArea = scvf.area();
Scalar thpres = problem.thresholdPressure(I, J); Scalar thpres = problem.thresholdPressure(I, J);
@ -265,7 +267,7 @@ public:
intQuantsEx, intQuantsEx,
phaseIdx,//input phaseIdx,//input
interiorDofIdx,//input interiorDofIdx,//input
exteriorDofIdx,//intput exteriorDofIdx,//input
Vin, Vin,
Vex, Vex,
I, I,
@ -283,12 +285,18 @@ public:
// or averaged? all fluids should see the same compaction?! // or averaged? all fluids should see the same compaction?!
const Evaluation& transMult = up.rockCompTransMultiplier(); const Evaluation& transMult = up.rockCompTransMultiplier();
const auto& materialLawManager = problem.materialLawManager();
FaceDir::DirEnum facedir = FaceDir::DirEnum::Unknown;
if (materialLawManager->hasDirectionalRelperms()) {
facedir = scvf.faceDirFromDirId(); // direction (X, Y, or Z) of the face
}
if (upwindIsInterior) if (upwindIsInterior)
volumeFlux[phaseIdx] = volumeFlux[phaseIdx] =
pressureDifferences[phaseIdx]*up.mobility(phaseIdx)*transMult*(-trans/faceArea); pressureDifferences[phaseIdx]*up.mobility(phaseIdx, facedir)*transMult*(-trans/faceArea);
else else
volumeFlux[phaseIdx] = volumeFlux[phaseIdx] =
pressureDifferences[phaseIdx]*(Toolbox::value(up.mobility(phaseIdx))*Toolbox::value(transMult)*(-trans/faceArea)); pressureDifferences[phaseIdx]*
(Toolbox::value(up.mobility(phaseIdx, facedir))*Toolbox::value(transMult)*(-trans/faceArea));
} }
} }

View File

@ -322,6 +322,15 @@ updatePlmixnum_()
updateNum("PLMIXNUM", plmixnum_); updateNum("PLMIXNUM", plmixnum_);
} }
template<class GridView, class FluidSystem, class Scalar>
void EclGenericProblem<GridView,FluidSystem,Scalar>::
updateKrnum_()
{
updateNum("KRNUMX", krnumx_);
updateNum("KRNUMY", krnumy_);
updateNum("KRNUMZ", krnumz_);
}
template<class GridView, class FluidSystem, class Scalar> template<class GridView, class FluidSystem, class Scalar>
bool EclGenericProblem<GridView,FluidSystem,Scalar>:: bool EclGenericProblem<GridView,FluidSystem,Scalar>::
vapparsActive(int episodeIdx) const vapparsActive(int episodeIdx) const

View File

@ -306,6 +306,7 @@ protected:
void updateSatnum_(); void updateSatnum_();
void updateMiscnum_(); void updateMiscnum_();
void updatePlmixnum_(); void updatePlmixnum_();
void updateKrnum_();
const EclipseState& eclState_; const EclipseState& eclState_;
const Schedule& schedule_; const Schedule& schedule_;
@ -318,6 +319,9 @@ protected:
std::vector<unsigned short> satnum_; std::vector<unsigned short> satnum_;
std::vector<unsigned short> miscnum_; std::vector<unsigned short> miscnum_;
std::vector<unsigned short> plmixnum_; std::vector<unsigned short> plmixnum_;
std::vector<unsigned short> krnumx_;
std::vector<unsigned short> krnumy_;
std::vector<unsigned short> krnumz_;
std::vector<RockParams> rockParams_; std::vector<RockParams> rockParams_;
std::vector<unsigned short> rockTableIdx_; std::vector<unsigned short> rockTableIdx_;

View File

@ -1505,6 +1505,12 @@ public:
std::shared_ptr<const EclMaterialLawManager> materialLawManager() const std::shared_ptr<const EclMaterialLawManager> materialLawManager() const
{ return materialLawManager_; } { return materialLawManager_; }
// TODO: See discussion in multiphasebaseproblem.hh for the reason why we need this method
const EclMaterialLawManager* materialLawManagerPtr() const
{
return materialLawManager_.get();
}
/*! /*!
* \copydoc materialLawManager() * \copydoc materialLawManager()
*/ */
@ -2223,6 +2229,8 @@ private:
// the PLMIX region numbers (polymer model) // the PLMIX region numbers (polymer model)
this->updatePlmixnum_(); this->updatePlmixnum_();
// directional relative permeabilities
this->updateKrnum_();
//////////////////////////////// ////////////////////////////////
// porosity // porosity
updateReferencePorosity_(); updateReferencePorosity_();
@ -2849,6 +2857,8 @@ private:
case FaceDir::ZPlus: case FaceDir::ZPlus:
data = &massratebcZ_; data = &massratebcZ_;
break; break;
case FaceDir::Unknown:
throw std::runtime_error("Unexpected unknown face direction");
} }
const Evaluation rate = bcface.rate; const Evaluation rate = bcface.rate;
@ -2883,6 +2893,8 @@ private:
case FaceDir::ZPlus: case FaceDir::ZPlus:
data = &freebcZ_; data = &freebcZ_;
break; break;
case FaceDir::Unknown:
throw std::runtime_error("Unexpected unknown face direction");
} }
for (int i = bcface.i1; i <= bcface.i2; ++i) { for (int i = bcface.i1; i <= bcface.i2; ++i) {

View File

@ -196,7 +196,6 @@ partiallySupported()
{ {
"SATOPTS", "SATOPTS",
{ {
{1,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(DIRECT): directional relative permeability assignment option not supported - value ignored"}}, // options
{2,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(IRREVERS): reversible directional relative permeability option not supported value ignored"}}, // IRREVERS {2,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(IRREVERS): reversible directional relative permeability option not supported value ignored"}}, // IRREVERS
{3,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(HYSTER): hysteresis directional relative permeability option not supported - value ignored"}}, // HYSTER {3,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(HYSTER): hysteresis directional relative permeability option not supported - value ignored"}}, // HYSTER
{4,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(SURFTENS): capillary pressure surface tension pressure dependency option not supported value ignored"}}, // SURFTENS {4,{false, allow_values<std::string> {"HYSTER"}, "SATOPTS(SURFTENS): capillary pressure surface tension pressure dependency option not supported value ignored"}}, // SURFTENS