mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-24 10:10:18 -06:00
Merge pull request #4757 from aritorto/lookupdata-generalgrid
Refactor lookup of cartesian index and element data
This commit is contained in:
commit
eafed43dad
@ -29,17 +29,23 @@
|
|||||||
#define EWOMS_ECL_GENERIC_THRESHOLD_PRESSURE_HH
|
#define EWOMS_ECL_GENERIC_THRESHOLD_PRESSURE_HH
|
||||||
|
|
||||||
#include <opm/grid/common/CartesianIndexMapper.hpp>
|
#include <opm/grid/common/CartesianIndexMapper.hpp>
|
||||||
|
#include <opm/grid/LookUpData.hh>
|
||||||
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
|
|
||||||
class EclipseState;
|
class EclipseState;
|
||||||
|
template<typename Grid, typename GridView> class LookUpData;
|
||||||
|
template<typename Grid, typename GridView> class LookUpCartesianData;
|
||||||
|
|
||||||
template<class Grid, class GridView, class ElementMapper, class Scalar>
|
template<class Grid, class GridView, class ElementMapper, class Scalar>
|
||||||
class EclGenericThresholdPressure {
|
class EclGenericThresholdPressure {
|
||||||
public:
|
public:
|
||||||
using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
|
using CartesianIndexMapper = Dune::CartesianIndexMapper<Grid>;
|
||||||
|
using LookUpData = Opm::LookUpData<Grid,GridView>;
|
||||||
|
using LookUpCartesianData = Opm::LookUpCartesianData<Grid,GridView>;
|
||||||
|
|
||||||
EclGenericThresholdPressure(const CartesianIndexMapper& cartMapper,
|
EclGenericThresholdPressure(const CartesianIndexMapper& cartMapper,
|
||||||
const GridView& gridView,
|
const GridView& gridView,
|
||||||
@ -93,6 +99,8 @@ protected:
|
|||||||
const CartesianIndexMapper& cartMapper_;
|
const CartesianIndexMapper& cartMapper_;
|
||||||
const GridView& gridView_;
|
const GridView& gridView_;
|
||||||
const ElementMapper& elementMapper_;
|
const ElementMapper& elementMapper_;
|
||||||
|
const LookUpData lookUpData_;
|
||||||
|
const LookUpCartesianData lookUpCartesianData_;
|
||||||
const EclipseState& eclState_;
|
const EclipseState& eclState_;
|
||||||
std::vector<Scalar> thpresDefault_;
|
std::vector<Scalar> thpresDefault_;
|
||||||
std::vector<Scalar> thpres_;
|
std::vector<Scalar> thpres_;
|
||||||
|
@ -55,6 +55,8 @@ EclGenericThresholdPressure(const CartesianIndexMapper& cartMapper,
|
|||||||
: cartMapper_(cartMapper)
|
: cartMapper_(cartMapper)
|
||||||
, gridView_(gridView)
|
, gridView_(gridView)
|
||||||
, elementMapper_(elementMapper)
|
, elementMapper_(elementMapper)
|
||||||
|
, lookUpData_(gridView)
|
||||||
|
, lookUpCartesianData_(gridView, cartMapper_)
|
||||||
, eclState_(eclState)
|
, eclState_(eclState)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -68,14 +70,10 @@ thresholdPressure(int elem1Idx, int elem2Idx) const
|
|||||||
|
|
||||||
// threshold pressure accross faults
|
// threshold pressure accross faults
|
||||||
if (!thpresftValues_.empty()) {
|
if (!thpresftValues_.empty()) {
|
||||||
int cartElem1Idx = cartMapper_.cartesianIndex(elem1Idx);
|
|
||||||
int cartElem2Idx = cartMapper_.cartesianIndex(elem2Idx);
|
|
||||||
|
|
||||||
assert(0 <= cartElem1Idx && static_cast<int>(cartElemFaultIdx_.size()) > cartElem1Idx);
|
int fault1Idx = lookUpCartesianData_(elem1Idx, cartElemFaultIdx_);
|
||||||
assert(0 <= cartElem2Idx && static_cast<int>(cartElemFaultIdx_.size()) > cartElem2Idx);
|
int fault2Idx = lookUpCartesianData_(elem2Idx, cartElemFaultIdx_);
|
||||||
|
|
||||||
int fault1Idx = cartElemFaultIdx_[cartElem1Idx];
|
|
||||||
int fault2Idx = cartElemFaultIdx_[cartElem2Idx];
|
|
||||||
if (fault1Idx != -1 && fault1Idx == fault2Idx)
|
if (fault1Idx != -1 && fault1Idx == fault2Idx)
|
||||||
// inside a fault there's no threshold pressure, even accross EQUIL
|
// inside a fault there's no threshold pressure, even accross EQUIL
|
||||||
// regions.
|
// regions.
|
||||||
@ -173,11 +171,9 @@ applyExplicitThresholdPressures_()
|
|||||||
const auto& inside = intersection.inside();
|
const auto& inside = intersection.inside();
|
||||||
const auto& outside = intersection.outside();
|
const auto& outside = intersection.outside();
|
||||||
|
|
||||||
unsigned insideElemIdx = elementMapper_.index(inside);
|
auto equilRegionInside = lookUpData_(inside, elemEquilRegion_);
|
||||||
unsigned outsideElemIdx = elementMapper_.index(outside);
|
auto equilRegionOutside = lookUpData_(outside, elemEquilRegion_);
|
||||||
|
|
||||||
auto equilRegionInside = elemEquilRegion_[insideElemIdx];
|
|
||||||
auto equilRegionOutside = elemEquilRegion_[outsideElemIdx];
|
|
||||||
if (thpres.hasRegionBarrier(equilRegionInside + 1, equilRegionOutside + 1)) {
|
if (thpres.hasRegionBarrier(equilRegionInside + 1, equilRegionOutside + 1)) {
|
||||||
Scalar pth = 0.0;
|
Scalar pth = 0.0;
|
||||||
if (thpres.hasThresholdPressure(equilRegionInside + 1, equilRegionOutside + 1)) {
|
if (thpres.hasThresholdPressure(equilRegionInside + 1, equilRegionOutside + 1)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user