mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add more support for directional relperms
Adds support for directional relperms for the tpfa linearizer.
This commit is contained in:
parent
fe7b415350
commit
7eeca28018
@ -38,6 +38,8 @@
|
|||||||
#include "blackoildiffusionmodule.hh"
|
#include "blackoildiffusionmodule.hh"
|
||||||
#include "blackoilmicpmodules.hh"
|
#include "blackoilmicpmodules.hh"
|
||||||
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
#include <opm/material/fluidstates/BlackOilFluidState.hpp>
|
||||||
|
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
/*!
|
/*!
|
||||||
@ -198,7 +200,8 @@ public:
|
|||||||
const IntensiveQuantities& intQuantsIn,
|
const IntensiveQuantities& intQuantsIn,
|
||||||
const IntensiveQuantities& intQuantsEx,
|
const IntensiveQuantities& intQuantsEx,
|
||||||
const Scalar trans,
|
const Scalar trans,
|
||||||
const Scalar faceArea)
|
const Scalar faceArea,
|
||||||
|
const FaceDir::DirEnum facedir)
|
||||||
{
|
{
|
||||||
flux = 0.0;
|
flux = 0.0;
|
||||||
Scalar Vin = problem.model().dofTotalVolume(globalIndexIn);
|
Scalar Vin = problem.model().dofTotalVolume(globalIndexIn);
|
||||||
@ -233,7 +236,8 @@ public:
|
|||||||
distZ * g,
|
distZ * g,
|
||||||
thpres,
|
thpres,
|
||||||
trans,
|
trans,
|
||||||
faceArea);
|
faceArea,
|
||||||
|
facedir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function demonstrates compatibility with the ElementContext-based interface.
|
// This function demonstrates compatibility with the ElementContext-based interface.
|
||||||
@ -264,6 +268,11 @@ public:
|
|||||||
const auto& globalIndexEx = stencil.globalSpaceIndex(exteriorDofIdx);
|
const auto& globalIndexEx = 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();
|
||||||
|
const auto& materialLawManager = problem.materialLawManager();
|
||||||
|
FaceDir::DirEnum facedir = FaceDir::DirEnum::Unknown; // Use an arbitrary
|
||||||
|
if (materialLawManager->hasDirectionalRelperms()) {
|
||||||
|
facedir = scvf.dirId();
|
||||||
|
}
|
||||||
Scalar thpres = problem.thresholdPressure(globalIndexIn, globalIndexEx);
|
Scalar thpres = problem.thresholdPressure(globalIndexIn, globalIndexEx);
|
||||||
|
|
||||||
// estimate the gravity correction: for performance reasons we use a simplified
|
// estimate the gravity correction: for performance reasons we use a simplified
|
||||||
@ -295,7 +304,8 @@ public:
|
|||||||
distZ * g,
|
distZ * g,
|
||||||
thpres,
|
thpres,
|
||||||
trans,
|
trans,
|
||||||
faceArea);
|
faceArea,
|
||||||
|
facedir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calculateFluxes_(RateVector& flux,
|
static void calculateFluxes_(RateVector& flux,
|
||||||
@ -308,7 +318,8 @@ public:
|
|||||||
const Scalar& distZg,
|
const Scalar& distZg,
|
||||||
const Scalar& thpres,
|
const Scalar& thpres,
|
||||||
const Scalar& trans,
|
const Scalar& trans,
|
||||||
const Scalar& faceArea)
|
const Scalar& faceArea,
|
||||||
|
const FaceDir::DirEnum facedir)
|
||||||
{
|
{
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx))
|
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||||
@ -346,9 +357,10 @@ public:
|
|||||||
darcyFlux = 0.0; // NB maybe we could drop calculations
|
darcyFlux = 0.0; // NB maybe we could drop calculations
|
||||||
} else {
|
} else {
|
||||||
if (globalUpIndex == globalIndexIn)
|
if (globalUpIndex == globalIndexIn)
|
||||||
darcyFlux = pressureDifference * up.mobility(phaseIdx) * transMult * (-trans / faceArea);
|
darcyFlux = pressureDifference * up.mobility(phaseIdx, facedir) * transMult * (-trans / faceArea);
|
||||||
else
|
else
|
||||||
darcyFlux = pressureDifference * (Toolbox::value(up.mobility(phaseIdx)) * Toolbox::value(transMult) * (-trans / faceArea));
|
darcyFlux = pressureDifference *
|
||||||
|
(Toolbox::value(up.mobility(phaseIdx, facedir)) * Toolbox::value(transMult) * (-trans / faceArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pvtRegionIdx = up.pvtRegionIndex();
|
unsigned pvtRegionIdx = up.pvtRegionIndex();
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <opm/material/common/Exceptions.hpp>
|
#include <opm/material/common/Exceptions.hpp>
|
||||||
#include <opm/grid/utility/SparseTable.hpp>
|
#include <opm/grid/utility/SparseTable.hpp>
|
||||||
|
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||||
|
|
||||||
#include <dune/common/version.hh>
|
#include <dune/common/version.hh>
|
||||||
#include <dune/common/fvector.hh>
|
#include <dune/common/fvector.hh>
|
||||||
@ -314,7 +315,8 @@ private:
|
|||||||
unsigned numCells = model.numTotalDof();
|
unsigned numCells = model.numTotalDof();
|
||||||
neighborInfo_.reserve(numCells, 6 * numCells);
|
neighborInfo_.reserve(numCells, 6 * numCells);
|
||||||
std::vector<NeighborInfo> loc_nbinfo;
|
std::vector<NeighborInfo> loc_nbinfo;
|
||||||
|
const auto& materialLawManager = problem_().materialLawManager();
|
||||||
|
using FaceDirection = FaceDir::DirEnum;
|
||||||
ElementIterator elemIt = gridView_().template begin<0>();
|
ElementIterator elemIt = gridView_().template begin<0>();
|
||||||
const ElementIterator elemEndIt = gridView_().template end<0>();
|
const ElementIterator elemEndIt = gridView_().template end<0>();
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
for (; elemIt != elemEndIt; ++elemIt) {
|
||||||
@ -330,8 +332,14 @@ private:
|
|||||||
sparsityPattern[myIdx].insert(neighborIdx);
|
sparsityPattern[myIdx].insert(neighborIdx);
|
||||||
if (dofIdx > 0) {
|
if (dofIdx > 0) {
|
||||||
const double trans = problem_().transmissibility(myIdx, neighborIdx);
|
const double trans = problem_().transmissibility(myIdx, neighborIdx);
|
||||||
const double area = stencil.interiorFace(dofIdx - 1).area();
|
const auto scvfIdx = dofIdx - 1;
|
||||||
loc_nbinfo[dofIdx - 1] = NeighborInfo{neighborIdx, trans, area};
|
const auto& scvf = stencil.interiorFace(scvfIdx);
|
||||||
|
const double area = scvf.area();
|
||||||
|
FaceDirection dirId = FaceDirection::Unknown;
|
||||||
|
if (materialLawManager->hasDirectionalRelperms()) {
|
||||||
|
dirId = scvf.dirId();
|
||||||
|
}
|
||||||
|
loc_nbinfo[dofIdx - 1] = NeighborInfo{neighborIdx, trans, area, dirId};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
neighborInfo_.appendRow(loc_nbinfo.begin(), loc_nbinfo.end());
|
neighborInfo_.appendRow(loc_nbinfo.begin(), loc_nbinfo.end());
|
||||||
@ -410,7 +418,8 @@ private:
|
|||||||
}
|
}
|
||||||
const IntensiveQuantities& intQuantsEx = *intQuantsExP;
|
const IntensiveQuantities& intQuantsEx = *intQuantsExP;
|
||||||
LocalResidual::computeFlux(
|
LocalResidual::computeFlux(
|
||||||
adres, problem_(), globI, globJ, intQuantsIn, intQuantsEx, nbInfo.trans, nbInfo.faceArea);
|
adres, problem_(), globI, globJ, intQuantsIn, intQuantsEx,
|
||||||
|
nbInfo.trans, nbInfo.faceArea, nbInfo.faceDirection);
|
||||||
adres *= nbInfo.faceArea;
|
adres *= nbInfo.faceArea;
|
||||||
setResAndJacobi(res, bMat, adres);
|
setResAndJacobi(res, bMat, adres);
|
||||||
residual_[globI] += res;
|
residual_[globI] += res;
|
||||||
@ -467,6 +476,7 @@ private:
|
|||||||
unsigned int neighbor;
|
unsigned int neighbor;
|
||||||
double trans;
|
double trans;
|
||||||
double faceArea;
|
double faceArea;
|
||||||
|
FaceDir::DirEnum faceDirection;
|
||||||
};
|
};
|
||||||
SparseTable<NeighborInfo> neighborInfo_;
|
SparseTable<NeighborInfo> neighborInfo_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user