mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ECL grid manager: make the cartesianCellId() method take an integer and return one
the fact that this is implemented via a std::vector<int> is an implementation detail which should not be visible to the outside of this class.
This commit is contained in:
parent
a720a322c3
commit
019c272a11
@ -526,12 +526,12 @@ public:
|
|||||||
if (!deck->hasKeyword("PVTNUM"))
|
if (!deck->hasKeyword("PVTNUM"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const auto &cartesianCellId = this->simulator().gridManager().cartesianCellId();
|
const auto& gridManager = this->simulator().gridManager();
|
||||||
|
|
||||||
// this is quite specific to the ECFV discretization. But so is everything in an
|
// this is quite specific to the ECFV discretization. But so is everything in an
|
||||||
// ECL deck, i.e., we don't need to care here...
|
// ECL deck, i.e., we don't need to care here...
|
||||||
int compressedDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
int compressedDofIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
||||||
int cartesianDofIdx = cartesianCellId[compressedDofIdx];
|
int cartesianDofIdx = gridManager.cartesianCellId(compressedDofIdx);
|
||||||
|
|
||||||
return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1;
|
return deck->getKeyword("PVTNUM")->getIntData()[cartesianDofIdx] - 1;
|
||||||
}
|
}
|
||||||
@ -662,9 +662,9 @@ private:
|
|||||||
|
|
||||||
void readMaterialParameters_()
|
void readMaterialParameters_()
|
||||||
{
|
{
|
||||||
auto deck = this->simulator().gridManager().deck();
|
const auto &gridManager = this->simulator().gridManager();
|
||||||
auto eclState = this->simulator().gridManager().eclState();
|
auto deck = gridManager.deck();
|
||||||
const auto &cartesianCellId = this->simulator().gridManager().cartesianCellId();
|
auto eclState = gridManager.eclState();
|
||||||
|
|
||||||
size_t numDof = this->model().numGridDof();
|
size_t numDof = this->model().numGridDof();
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ private:
|
|||||||
permzData = eclState->getDoubleGridProperty("PERMZ")->getData();
|
permzData = eclState->getDoubleGridProperty("PERMZ")->getData();
|
||||||
|
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
||||||
int cartesianElemIdx = cartesianCellId[dofIdx];
|
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
|
||||||
intrinsicPermeability_[dofIdx] = 0.0;
|
intrinsicPermeability_[dofIdx] = 0.0;
|
||||||
intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx];
|
intrinsicPermeability_[dofIdx][0][0] = permxData[cartesianElemIdx];
|
||||||
intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx];
|
intrinsicPermeability_[dofIdx][1][1] = permyData[cartesianElemIdx];
|
||||||
@ -712,7 +712,7 @@ private:
|
|||||||
eclState->getDoubleGridProperty("PORO")->getData();
|
eclState->getDoubleGridProperty("PORO")->getData();
|
||||||
|
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
||||||
int cartesianElemIdx = cartesianCellId[dofIdx];
|
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
|
||||||
porosity_[dofIdx] = poroData[cartesianElemIdx];
|
porosity_[dofIdx] = poroData[cartesianElemIdx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,10 +726,8 @@ private:
|
|||||||
const std::vector<double> &ntgData =
|
const std::vector<double> &ntgData =
|
||||||
eclState->getDoubleGridProperty("NTG")->getData();
|
eclState->getDoubleGridProperty("NTG")->getData();
|
||||||
|
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx)
|
||||||
int cartesianElemIdx = cartesianCellId[dofIdx];
|
porosity_[dofIdx] *= ntgData[gridManager.cartesianCellId(dofIdx)];
|
||||||
porosity_[dofIdx] *= ntgData[cartesianElemIdx];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply the MULTPV keyword to the porosity
|
// apply the MULTPV keyword to the porosity
|
||||||
@ -737,10 +735,8 @@ private:
|
|||||||
const std::vector<double> &multpvData =
|
const std::vector<double> &multpvData =
|
||||||
eclState->getDoubleGridProperty("MULTPV")->getData();
|
eclState->getDoubleGridProperty("MULTPV")->getData();
|
||||||
|
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx)
|
||||||
int cartesianElemIdx = cartesianCellId[dofIdx];
|
porosity_[dofIdx] *= multpvData[gridManager.cartesianCellId(dofIdx)];
|
||||||
porosity_[dofIdx] *= multpvData[cartesianElemIdx];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@ -802,7 +798,7 @@ private:
|
|||||||
|
|
||||||
materialParamTableIdx_.resize(numDof);
|
materialParamTableIdx_.resize(numDof);
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx) {
|
||||||
int cartesianElemIdx = cartesianCellId[dofIdx];
|
int cartesianElemIdx = gridManager.cartesianCellId(dofIdx);
|
||||||
|
|
||||||
// make sure that all values are in the correct range
|
// make sure that all values are in the correct range
|
||||||
assert(1 <= satnumData[dofIdx]);
|
assert(1 <= satnumData[dofIdx]);
|
||||||
@ -849,7 +845,6 @@ private:
|
|||||||
{
|
{
|
||||||
const auto deck = this->simulator().gridManager().deck();
|
const auto deck = this->simulator().gridManager().deck();
|
||||||
const auto &gridManager = this->simulator().gridManager();
|
const auto &gridManager = this->simulator().gridManager();
|
||||||
const auto &cartesianCellId = gridManager.cartesianCellId();
|
|
||||||
|
|
||||||
if (!deck->hasKeyword("SWAT") ||
|
if (!deck->hasKeyword("SWAT") ||
|
||||||
!deck->hasKeyword("SGAS"))
|
!deck->hasKeyword("SGAS"))
|
||||||
@ -903,7 +898,7 @@ private:
|
|||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
|
for (size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
|
||||||
auto &dofFluidState = initialFluidStates_[dofIdx];
|
auto &dofFluidState = initialFluidStates_[dofIdx];
|
||||||
|
|
||||||
size_t cartesianDofIdx = cartesianCellId[dofIdx];
|
size_t cartesianDofIdx = gridManager.cartesianCellId(dofIdx);
|
||||||
assert(0 <= cartesianDofIdx);
|
assert(0 <= cartesianDofIdx);
|
||||||
assert(cartesianDofIdx <= numCartesianCells);
|
assert(cartesianDofIdx <= numCartesianCells);
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ protected:
|
|||||||
void updateWellTopology_(int reportStepIdx, const WellCompletionsMap& wellCompletions)
|
void updateWellTopology_(int reportStepIdx, const WellCompletionsMap& wellCompletions)
|
||||||
{
|
{
|
||||||
auto& model = simulator_.model();
|
auto& model = simulator_.model();
|
||||||
const auto& cartesianCellId = simulator_.gridManager().cartesianCellId();
|
const auto& gridManager = simulator_.gridManager();
|
||||||
|
|
||||||
// first, remove all wells from the reservoir
|
// first, remove all wells from the reservoir
|
||||||
model.clearAuxiliaryModules();
|
model.clearAuxiliaryModules();
|
||||||
@ -557,7 +557,7 @@ protected:
|
|||||||
elemCtx.updateStencil(elem);
|
elemCtx.updateStencil(elem);
|
||||||
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
||||||
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||||
int cartesianDofIdx = cartesianCellId[globalDofIdx];
|
int cartesianDofIdx = gridManager.cartesianCellId(globalDofIdx);
|
||||||
|
|
||||||
if (wellCompletions.count(cartesianDofIdx) == 0)
|
if (wellCompletions.count(cartesianDofIdx) == 0)
|
||||||
// the current DOF is not contained in any well, so we must skip
|
// the current DOF is not contained in any well, so we must skip
|
||||||
@ -635,8 +635,8 @@ protected:
|
|||||||
|
|
||||||
// associate the well completions with grid cells and register them in the
|
// associate the well completions with grid cells and register them in the
|
||||||
// Peaceman well object
|
// Peaceman well object
|
||||||
const GridView gridView = simulator_.gridManager().gridView();
|
const auto& gridManager = simulator_.gridManager();
|
||||||
const auto& cartesianCellId = simulator_.gridManager().cartesianCellId();
|
const GridView gridView = gridManager.gridView();
|
||||||
|
|
||||||
ElementContext elemCtx(simulator_);
|
ElementContext elemCtx(simulator_);
|
||||||
auto elemIt = gridView.template begin</*codim=*/0>();
|
auto elemIt = gridView.template begin</*codim=*/0>();
|
||||||
@ -650,7 +650,7 @@ protected:
|
|||||||
elemCtx.updateStencil(elem);
|
elemCtx.updateStencil(elem);
|
||||||
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
for (int dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++ dofIdx) {
|
||||||
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
int globalDofIdx = elemCtx.globalSpaceIndex(dofIdx, /*timeIdx=*/0);
|
||||||
int cartesianDofIdx = cartesianCellId[globalDofIdx];
|
int cartesianDofIdx = gridManager.cartesianCellId(globalDofIdx);
|
||||||
|
|
||||||
if (wellCompletions.count(cartesianDofIdx) == 0)
|
if (wellCompletions.count(cartesianDofIdx) == 0)
|
||||||
// the current DOF is not contained in any well, so we must skip
|
// the current DOF is not contained in any well, so we must skip
|
||||||
|
Loading…
Reference in New Issue
Block a user