mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[bugfix] use DUNE compatible way of computing cell center depth.
This commit is contained in:
parent
8784c81a4e
commit
26e5abf699
@ -805,10 +805,25 @@ private:
|
|||||||
static bool enableEclOutput_()
|
static bool enableEclOutput_()
|
||||||
{ return EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput); }
|
{ return EWOMS_GET_PARAM(TypeTag, bool, EnableEclOutput); }
|
||||||
|
|
||||||
|
Scalar cellCenterDepth( const Element& element ) const
|
||||||
|
{
|
||||||
|
typedef typename Element :: Geometry Geometry;
|
||||||
|
static constexpr int zCoord = Geometry ::dimension - 1;
|
||||||
|
Scalar zz = 0.0;
|
||||||
|
|
||||||
|
const Geometry geometry = element.geometry();
|
||||||
|
|
||||||
|
const int corners = geometry.corners();
|
||||||
|
for (int i=0; i<corners; ++i)
|
||||||
|
{
|
||||||
|
zz += geometry.corner( i )[ zCoord ];
|
||||||
|
}
|
||||||
|
return zz/Scalar(corners);
|
||||||
|
}
|
||||||
|
|
||||||
void updateElementDepths_()
|
void updateElementDepths_()
|
||||||
{
|
{
|
||||||
const auto& gridManager = this->simulator().gridManager();
|
const auto& gridManager = this->simulator().gridManager();
|
||||||
const auto& grid = gridManager.grid();
|
|
||||||
const auto& gridView = gridManager.gridView();
|
const auto& gridView = gridManager.gridView();
|
||||||
const auto& elemMapper = this->elementMapper();;
|
const auto& elemMapper = this->elementMapper();;
|
||||||
|
|
||||||
@ -818,13 +833,14 @@ private:
|
|||||||
auto elemIt = gridView.template begin</*codim=*/0>();
|
auto elemIt = gridView.template begin</*codim=*/0>();
|
||||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||||
for (; elemIt != elemEndIt; ++elemIt) {
|
for (; elemIt != elemEndIt; ++elemIt) {
|
||||||
|
const Element& element = *elemIt;
|
||||||
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
|
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2,4)
|
||||||
unsigned elemIdx = elemMapper.index(*elemIt);
|
const unsigned int elemIdx = elemMapper.index(element);
|
||||||
#else
|
#else
|
||||||
unsigned elemIdx = elemMapper.map(*elemIt);
|
const unsigned int elemIdx = elemMapper.map(element);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
elementCenterDepth_[elemIdx] = grid.cellCenterDepth(elemIdx);
|
elementCenterDepth_[elemIdx] = cellCenterDepth( element );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user