Chase WBP Source Requirement Change

The revised depth correction algorithm requires per-cell depth
information (in SourceDataSpan::Item::Depth) for the reservoir
contributions so honour this requirement.

This is potentially a somewhat wasteful approach since the cell
centre depth is constant throughout a simulation, but it's a simple
strategy that does not require large API and synchronisation
changes, so we nevertheless stick to this as a first implementation.
We will reduce the amount of communication if this becomes a
bottleneck.
This commit is contained in:
Bård Skaflestad 2024-12-11 17:25:28 +01:00
parent 369332ef3d
commit 8f42288d71
3 changed files with 75 additions and 10 deletions

View File

@ -111,8 +111,10 @@ namespace Opm {
.cachedIntensiveQuantities(localCell, /*timeIndex = */0);
const auto& fs = intQuants->fluidState();
sourceTerms.set(Item::PoreVol, intQuants->porosity().value() *
this->simulator_.model().dofTotalVolume(localCell));
sourceTerms
.set(Item::PoreVol, intQuants->porosity().value() *
this->simulator_.model().dofTotalVolume(localCell))
.set(Item::Depth, this->depth_[localCell]);
constexpr auto io = FluidSystem::oilPhaseIdx;
constexpr auto ig = FluidSystem::gasPhaseIdx;
@ -2449,7 +2451,9 @@ namespace Opm {
sourceTerm
.set(Item::Pressure , 0.0)
.set(Item::PoreVol , 0.0)
.set(Item::MixtureDensity, 0.0);
.set(Item::MixtureDensity, 0.0)
.set(Item::Depth , 0.0)
;
};
}
@ -2471,7 +2475,9 @@ namespace Opm {
sourceTerm
.set(Item::Pressure , 0.0)
.set(Item::PoreVol , 0.0)
.set(Item::MixtureDensity, rho);
.set(Item::MixtureDensity, rho)
.set(Item::Depth , 0.0)
;
};
};
}

View File

@ -40,7 +40,17 @@ public:
/// local, on-rank, cell indices. Assumed to return a negative value
/// result if the input cell index is not owned by the current rank.
using GlobalToLocal = std::function<int(const std::size_t)>;
template<class T> using SourceDataSpan = typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<T>;
/// Fixed-width span/view of a underlying range of contiguous elements.
///
/// Interface type for populating or providing dynamic source
/// information for a specified location (typically a cell).
///
/// \tparam T Element type. Const or non-const as needed. Typically \c
/// Scalar or \code const Scalar \endcode.
template <typename T>
using SourceDataSpan = typename
PAvgDynamicSourceData<Scalar>::template SourceDataSpan<T>;
/// Collect source term contributions from local, on-rank, cell.
///

View File

@ -213,6 +213,26 @@ namespace {
});
}
double depth(const int cell)
{
return fieldValue(cell, {
// K=2
2002.5, 2002.5, 2002.5,
2002.5, 2002.5, 2002.5,
2002.5, 2002.5, 2002.5,
// K=3
2003.5, 2003.5, 2003.5,
2003.5, 2003.5, 2003.5,
2003.5, 2003.5, 2003.5,
// K=4
2004.5, 2004.5, 2004.5,
2004.5, 2004.5, 2004.5,
2004.5, 2004.5, 2004.5,
});
}
void cellSource(const int cell,
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
@ -220,7 +240,9 @@ namespace {
src .set(Item::Pressure , pressure(cell))
.set(Item::PoreVol , porevol (cell))
.set(Item::MixtureDensity, density (cell));
.set(Item::MixtureDensity, density (cell))
.set(Item::Depth , depth (cell))
;
}
std::vector<int> localConnIdx()
@ -246,7 +268,9 @@ namespace {
src .set(Item::Pressure , 1222.0)
.set(Item::PoreVol , 1.25)
.set(Item::MixtureDensity, rho[connIx]);
.set(Item::MixtureDensity, rho[connIx])
.set(Item::Depth , 0.0) // Unused
;
};
};
}
@ -353,6 +377,27 @@ namespace {
});
}
// Octave: 0.1 + round(0.1 * rand([3, 3, 6]), 2) -- bottom half
double depth(const int cell)
{
return fieldValue(cell, {
// K=5
2005.5, 2005.5, 2005.5,
2005.5, 2005.5, 2005.5,
2005.5, 2005.5, 2005.5,
// K=6
2006.5, 2006.5, 2006.5,
2006.5, 2006.5, 2006.5,
2006.5, 2006.5, 2006.5,
// K=7
2007.5, 2007.5, 2007.5,
2007.5, 2007.5, 2007.5,
2007.5, 2007.5, 2007.5,
});
}
void cellSource(const int cell,
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
@ -360,7 +405,9 @@ namespace {
src .set(Item::Pressure , pressure(cell))
.set(Item::PoreVol , porevol (cell))
.set(Item::MixtureDensity, density (cell));
.set(Item::MixtureDensity, density (cell))
.set(Item::Depth , depth (cell))
;
}
std::vector<int> localConnIdx()
@ -386,7 +433,9 @@ namespace {
src .set(Item::Pressure , 1222.0)
.set(Item::PoreVol , 1.25)
.set(Item::MixtureDensity, rho[connIx]);
.set(Item::MixtureDensity, rho[connIx])
.set(Item::Depth , 0.0) // Unused
;
};
};
}