mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Transmissibility::applyAllZMultipliers: simplify by passing FaceInfo structs
This commit is contained in:
parent
637bd7a1c4
commit
2dda16bc71
@ -175,10 +175,8 @@ protected:
|
|||||||
///
|
///
|
||||||
/// \param pinchTop Whether PINCH(5) is TOP, otherwise ALL is assumed.
|
/// \param pinchTop Whether PINCH(5) is TOP, otherwise ALL is assumed.
|
||||||
void applyAllZMultipliers_(Scalar& trans,
|
void applyAllZMultipliers_(Scalar& trans,
|
||||||
unsigned insideFaceIdx,
|
const FaceInfo& inside,
|
||||||
unsigned outsideFaceIdx,
|
const FaceInfo& outside,
|
||||||
unsigned insideCartElemIdx,
|
|
||||||
unsigned outsideCartElemIdx,
|
|
||||||
const TransMult& transMult,
|
const TransMult& transMult,
|
||||||
const std::array<int, dimWorld>& cartDims);
|
const std::array<int, dimWorld>& cartDims);
|
||||||
|
|
||||||
|
@ -414,9 +414,7 @@ update(bool global, const TransUpdateQuantities update_quantities,
|
|||||||
// PINCH(4) == TOPBOT is assumed here as we set useSmallestMultipliers
|
// PINCH(4) == TOPBOT is assumed here as we set useSmallestMultipliers
|
||||||
// to false if PINCH(4) == ALL holds
|
// to false if PINCH(4) == ALL holds
|
||||||
// In contrast to the name this will also apply
|
// In contrast to the name this will also apply
|
||||||
applyAllZMultipliers_(trans, inside.faceIdx,
|
applyAllZMultipliers_(trans, inside, outside, transMult, cartDims);
|
||||||
outside.faceIdx, inside.cartElemIdx,
|
|
||||||
outside.cartElemIdx, transMult, cartDims);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
applyMultipliers_(trans, inside.faceIdx, inside.cartElemIdx, transMult);
|
applyMultipliers_(trans, inside.faceIdx, inside.cartElemIdx, transMult);
|
||||||
@ -686,34 +684,32 @@ removeNonCartesianTransmissibilities_(bool removeAll)
|
|||||||
template<class Grid, class GridView, class ElementMapper, class CartesianIndexMapper, class Scalar>
|
template<class Grid, class GridView, class ElementMapper, class CartesianIndexMapper, class Scalar>
|
||||||
void Transmissibility<Grid,GridView,ElementMapper,CartesianIndexMapper, Scalar>::
|
void Transmissibility<Grid,GridView,ElementMapper,CartesianIndexMapper, Scalar>::
|
||||||
applyAllZMultipliers_(Scalar& trans,
|
applyAllZMultipliers_(Scalar& trans,
|
||||||
unsigned insideFaceIdx,
|
const FaceInfo& inside,
|
||||||
unsigned outsideFaceIdx,
|
const FaceInfo& outside,
|
||||||
unsigned insideCartElemIdx,
|
|
||||||
unsigned outsideCartElemIdx,
|
|
||||||
const TransMult& transMult,
|
const TransMult& transMult,
|
||||||
const std::array<int, dimWorld>& cartDims)
|
const std::array<int, dimWorld>& cartDims)
|
||||||
{
|
{
|
||||||
if (grid_.maxLevel() > 0) {
|
if (grid_.maxLevel() > 0) {
|
||||||
OPM_THROW(std::invalid_argument, "MULTZ not support with LGRS, yet.");
|
OPM_THROW(std::invalid_argument, "MULTZ not support with LGRS, yet.");
|
||||||
}
|
}
|
||||||
if (insideFaceIdx > 3) { // top or or bottom
|
if (inside.faceIdx > 3) { // top or or bottom
|
||||||
assert(insideFaceIdx==5); // as insideCartElemIdx < outsideCartElemIdx holds for the Z column
|
assert(inside.faceIdx == 5); // as insideCartElemIdx < outsideCartElemIdx holds for the Z column
|
||||||
// For CpGrid with LGRs, insideCartElemIdx == outsideCartElemIdx when cells on the leaf have the same parent cell on level zero.
|
// For CpGrid with LGRs, insideCartElemIdx == outsideCartElemIdx when cells on the leaf have the same parent cell on level zero.
|
||||||
assert(outsideCartElemIdx >= insideCartElemIdx);
|
assert(outside.cartElemIdx >= inside.cartElemIdx);
|
||||||
unsigned lastCartElemIdx;
|
unsigned lastCartElemIdx;
|
||||||
if (outsideCartElemIdx == insideCartElemIdx) {
|
if (outside.cartElemIdx == inside.cartElemIdx) {
|
||||||
lastCartElemIdx = outsideCartElemIdx;
|
lastCartElemIdx = outside.cartElemIdx;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lastCartElemIdx = outsideCartElemIdx - cartDims[0]*cartDims[1];
|
lastCartElemIdx = outside.cartElemIdx - cartDims[0]*cartDims[1];
|
||||||
}
|
}
|
||||||
// Last multiplier using (Z+)*(Z-)
|
// Last multiplier using (Z+)*(Z-)
|
||||||
Scalar mult = transMult.getMultiplier(lastCartElemIdx , FaceDir::ZPlus) *
|
Scalar mult = transMult.getMultiplier(lastCartElemIdx , FaceDir::ZPlus) *
|
||||||
transMult.getMultiplier(outsideCartElemIdx , FaceDir::ZMinus);
|
transMult.getMultiplier(outside.cartElemIdx , FaceDir::ZMinus);
|
||||||
|
|
||||||
// pick the smallest multiplier using (Z+)*(Z-) while looking down
|
// pick the smallest multiplier using (Z+)*(Z-) while looking down
|
||||||
// the pillar until reaching the other end of the connection
|
// the pillar until reaching the other end of the connection
|
||||||
for (auto cartElemIdx = insideCartElemIdx; cartElemIdx < lastCartElemIdx;) {
|
for (auto cartElemIdx = inside.cartElemIdx; cartElemIdx < lastCartElemIdx;) {
|
||||||
auto multiplier = transMult.getMultiplier(cartElemIdx, FaceDir::ZPlus);
|
auto multiplier = transMult.getMultiplier(cartElemIdx, FaceDir::ZPlus);
|
||||||
cartElemIdx += cartDims[0]*cartDims[1];
|
cartElemIdx += cartDims[0]*cartDims[1];
|
||||||
multiplier *= transMult.getMultiplier(cartElemIdx, FaceDir::ZMinus);
|
multiplier *= transMult.getMultiplier(cartElemIdx, FaceDir::ZMinus);
|
||||||
@ -723,8 +719,8 @@ applyAllZMultipliers_(Scalar& trans,
|
|||||||
trans *= mult;
|
trans *= mult;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
applyMultipliers_(trans, insideFaceIdx, insideCartElemIdx, transMult);
|
applyMultipliers_(trans, inside.faceIdx, inside.cartElemIdx, transMult);
|
||||||
applyMultipliers_(trans, outsideFaceIdx, outsideCartElemIdx, transMult);
|
applyMultipliers_(trans, outside.faceIdx, outside.cartElemIdx, transMult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user