mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
reusing ResidualNBInfo class in blackoillocalresidualtpfa
to ResidualNBInfo class in tpfalinearizer.
This commit is contained in:
parent
406ebf7cff
commit
2813195e15
@ -107,7 +107,7 @@ class BlackOilLocalResidualTPFA : public GetPropType<TypeTag, Properties::DiscLo
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct LocalNBInfo
|
struct ResidualNBInfo
|
||||||
{
|
{
|
||||||
double trans;
|
double trans;
|
||||||
double faceArea;
|
double faceArea;
|
||||||
@ -216,21 +216,17 @@ public:
|
|||||||
* one main difference: The darcy flux is calculated here, not
|
* one main difference: The darcy flux is calculated here, not
|
||||||
* read from the extensive quantities of the element context.
|
* read from the extensive quantities of the element context.
|
||||||
*/
|
*/
|
||||||
template<class NaboInfo>
|
|
||||||
static void computeFlux(RateVector& flux,
|
static void computeFlux(RateVector& flux,
|
||||||
RateVector& darcy,
|
RateVector& darcy,
|
||||||
const unsigned globalIndexIn,
|
const unsigned globalIndexIn,
|
||||||
const unsigned globalIndexEx,
|
const unsigned globalIndexEx,
|
||||||
const IntensiveQuantities& intQuantsIn,
|
const IntensiveQuantities& intQuantsIn,
|
||||||
const IntensiveQuantities& intQuantsEx,
|
const IntensiveQuantities& intQuantsEx,
|
||||||
const NaboInfo& nbInfo)
|
const ResidualNBInfo& nbInfo)
|
||||||
{
|
{
|
||||||
OPM_TIMEBLOCK_LOCAL(computeFlux);
|
OPM_TIMEBLOCK_LOCAL(computeFlux);
|
||||||
flux = 0.0;
|
flux = 0.0;
|
||||||
darcy = 0.0;
|
darcy = 0.0;
|
||||||
const LocalNBInfo local_nbinfo {nbInfo.trans, nbInfo.faceArea, nbInfo.thpres,
|
|
||||||
nbInfo.dZg, nbInfo.faceDirection, nbInfo.Vin,
|
|
||||||
nbInfo.Vex, nbInfo.inAlpha, nbInfo.outAlpha};
|
|
||||||
|
|
||||||
calculateFluxes_(flux,
|
calculateFluxes_(flux,
|
||||||
darcy,
|
darcy,
|
||||||
@ -238,7 +234,7 @@ public:
|
|||||||
intQuantsEx,
|
intQuantsEx,
|
||||||
globalIndexIn,
|
globalIndexIn,
|
||||||
globalIndexEx,
|
globalIndexEx,
|
||||||
local_nbinfo);
|
nbInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function demonstrates compatibility with the ElementContext-based interface.
|
// This function demonstrates compatibility with the ElementContext-based interface.
|
||||||
@ -290,16 +286,16 @@ public:
|
|||||||
// solution would be to take the Z coordinate of the element centroids, but since
|
// solution would be to take the Z coordinate of the element centroids, but since
|
||||||
// ECL seems to like to be inconsistent on that front, it needs to be done like
|
// ECL seems to like to be inconsistent on that front, it needs to be done like
|
||||||
// here...
|
// here...
|
||||||
Scalar zIn = problem.dofCenterDepth(elemCtx, interiorDofIdx, timeIdx);
|
const Scalar zIn = problem.dofCenterDepth(elemCtx, interiorDofIdx, timeIdx);
|
||||||
Scalar zEx = problem.dofCenterDepth(elemCtx, exteriorDofIdx, timeIdx);
|
const Scalar zEx = problem.dofCenterDepth(elemCtx, exteriorDofIdx, timeIdx);
|
||||||
// the distances from the DOF's depths. (i.e., the additional depth of the
|
// the distances from the DOF's depths. (i.e., the additional depth of the
|
||||||
// exterior DOF)
|
// exterior DOF)
|
||||||
Scalar distZ = zIn - zEx;
|
const Scalar distZ = zIn - zEx;
|
||||||
// for thermal harmonic mean of half trans
|
// for thermal harmonic mean of half trans
|
||||||
const Scalar inAlpha = problem.thermalHalfTransmissibility(globalIndexIn, globalIndexEx);
|
const Scalar inAlpha = problem.thermalHalfTransmissibility(globalIndexIn, globalIndexEx);
|
||||||
const Scalar outAlpha = problem.thermalHalfTransmissibility(globalIndexEx, globalIndexIn);
|
const Scalar outAlpha = problem.thermalHalfTransmissibility(globalIndexEx, globalIndexIn);
|
||||||
|
|
||||||
const LocalNBInfo localNBInfo {trans, faceArea, thpres, distZ * g, facedir, Vin, Vex, inAlpha, outAlpha};
|
const ResidualNBInfo res_nbinfo {trans, faceArea, thpres, distZ * g, facedir, Vin, Vex, inAlpha, outAlpha};
|
||||||
|
|
||||||
calculateFluxes_(flux,
|
calculateFluxes_(flux,
|
||||||
darcy,
|
darcy,
|
||||||
@ -307,7 +303,7 @@ public:
|
|||||||
intQuantsEx,
|
intQuantsEx,
|
||||||
globalIndexIn,
|
globalIndexIn,
|
||||||
globalIndexEx,
|
globalIndexEx,
|
||||||
localNBInfo);
|
res_nbinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void calculateFluxes_(RateVector& flux,
|
static void calculateFluxes_(RateVector& flux,
|
||||||
@ -316,18 +312,18 @@ public:
|
|||||||
const IntensiveQuantities& intQuantsEx,
|
const IntensiveQuantities& intQuantsEx,
|
||||||
const unsigned& globalIndexIn,
|
const unsigned& globalIndexIn,
|
||||||
const unsigned& globalIndexEx,
|
const unsigned& globalIndexEx,
|
||||||
const LocalNBInfo& localNBInfo)
|
const ResidualNBInfo& nbInfo)
|
||||||
{
|
{
|
||||||
OPM_TIMEBLOCK_LOCAL(calculateFluxes);
|
OPM_TIMEBLOCK_LOCAL(calculateFluxes);
|
||||||
const Scalar Vin = localNBInfo.Vin;
|
const Scalar Vin = nbInfo.Vin;
|
||||||
const Scalar Vex = localNBInfo.Vex;
|
const Scalar Vex = nbInfo.Vex;
|
||||||
const Scalar distZg = localNBInfo.dZg;
|
const Scalar distZg = nbInfo.dZg;
|
||||||
const Scalar thpres = localNBInfo.thpres;
|
const Scalar thpres = nbInfo.thpres;
|
||||||
const Scalar trans = localNBInfo.trans;
|
const Scalar trans = nbInfo.trans;
|
||||||
const Scalar faceArea = localNBInfo.faceArea;
|
const Scalar faceArea = nbInfo.faceArea;
|
||||||
const FaceDir::DirEnum facedir = localNBInfo.faceDirection;
|
const FaceDir::DirEnum facedir = nbInfo.faceDirection;
|
||||||
const Scalar inAlpha = localNBInfo.inAlpha;
|
const Scalar inAlpha = nbInfo.inAlpha;
|
||||||
const Scalar outAlpha = localNBInfo.outAlpha;
|
const Scalar outAlpha = nbInfo.outAlpha;
|
||||||
|
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||||
if (!FluidSystem::phaseIsActive(phaseIdx))
|
if (!FluidSystem::phaseIsActive(phaseIdx))
|
||||||
|
@ -456,7 +456,7 @@ private:
|
|||||||
if (materialLawManager->hasDirectionalRelperms()) {
|
if (materialLawManager->hasDirectionalRelperms()) {
|
||||||
dirId = scvf.faceDirFromDirId();
|
dirId = scvf.faceDirFromDirId();
|
||||||
}
|
}
|
||||||
loc_nbinfo[dofIdx - 1] = NeighborInfo{neighborIdx, trans, area, thpres, dZg, dirId, Vin, Vex, inAlpha, outAlpha, nullptr};
|
loc_nbinfo[dofIdx - 1] = NeighborInfo{neighborIdx, {trans, area, thpres, dZg, dirId, Vin, Vex, inAlpha, outAlpha}, nullptr};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
neighborInfo_.appendRow(loc_nbinfo.begin(), loc_nbinfo.end());
|
neighborInfo_.appendRow(loc_nbinfo.begin(), loc_nbinfo.end());
|
||||||
@ -651,8 +651,8 @@ private:
|
|||||||
adres = 0.0;
|
adres = 0.0;
|
||||||
darcyFlux = 0.0;
|
darcyFlux = 0.0;
|
||||||
const IntensiveQuantities& intQuantsEx = model_().intensiveQuantities(globJ, /*timeIdx*/ 0);
|
const IntensiveQuantities& intQuantsEx = model_().intensiveQuantities(globJ, /*timeIdx*/ 0);
|
||||||
LocalResidual::computeFlux(adres,darcyFlux, globI, globJ, intQuantsIn, intQuantsEx, nbInfo);
|
LocalResidual::computeFlux(adres,darcyFlux, globI, globJ, intQuantsIn, intQuantsEx, nbInfo.res_nbinfo);
|
||||||
adres *= nbInfo.faceArea;
|
adres *= nbInfo.res_nbinfo.faceArea;
|
||||||
if (enableFlows) {
|
if (enableFlows) {
|
||||||
for (unsigned phaseIdx = 0; phaseIdx < numEq; ++ phaseIdx) {
|
for (unsigned phaseIdx = 0; phaseIdx < numEq; ++ phaseIdx) {
|
||||||
flowsInfo_[globI][loc].flow[phaseIdx] = adres[phaseIdx].value();
|
flowsInfo_[globI][loc].flow[phaseIdx] = adres[phaseIdx].value();
|
||||||
@ -783,7 +783,7 @@ private:
|
|||||||
auto nbInfos = neighborInfo_[globI]; // nbInfos will be a SparseTable<...>::mutable_iterator_range.
|
auto nbInfos = neighborInfo_[globI]; // nbInfos will be a SparseTable<...>::mutable_iterator_range.
|
||||||
for (auto& nbInfo : nbInfos) {
|
for (auto& nbInfo : nbInfos) {
|
||||||
unsigned globJ = nbInfo.neighbor;
|
unsigned globJ = nbInfo.neighbor;
|
||||||
nbInfo.trans = problem_().transmissibility(globI, globJ);
|
nbInfo.res_nbinfo.trans = problem_().transmissibility(globI, globJ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -799,18 +799,11 @@ private:
|
|||||||
|
|
||||||
LinearizationType linearizationType_;
|
LinearizationType linearizationType_;
|
||||||
|
|
||||||
|
using ResidualNBInfo = typename LocalResidual::ResidualNBInfo;
|
||||||
struct NeighborInfo
|
struct NeighborInfo
|
||||||
{
|
{
|
||||||
unsigned int neighbor;
|
unsigned int neighbor;
|
||||||
double trans;
|
ResidualNBInfo res_nbinfo;
|
||||||
double faceArea;
|
|
||||||
double thpres;
|
|
||||||
double dZg;
|
|
||||||
FaceDir::DirEnum faceDirection;
|
|
||||||
double Vin;
|
|
||||||
double Vex;
|
|
||||||
double inAlpha;
|
|
||||||
double outAlpha;
|
|
||||||
MatrixBlock* matBlockAddress;
|
MatrixBlock* matBlockAddress;
|
||||||
};
|
};
|
||||||
SparseTable<NeighborInfo> neighborInfo_;
|
SparseTable<NeighborInfo> neighborInfo_;
|
||||||
|
Loading…
Reference in New Issue
Block a user