Merge pull request #3677 from vkip/numaqcell_depth

Ensure numerical aquifer cells get the correct depth
This commit is contained in:
Bård Skaflestad
2023-09-15 13:04:33 +02:00
committed by GitHub
2 changed files with 14 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
#include <stdexcept>
#include <unordered_set>
#include <vector>
#include <map>
namespace Opm {
@@ -255,12 +256,15 @@ namespace Opm {
std::vector<int> m_global_to_active;
// Numerical aquifer cells, needs to be active
std::unordered_set<size_t> m_aquifer_cells;
// Keep track of aquifer cell depths
std::map<size_t, double> m_aquifer_cell_depths;
// Radial grids need this for volume calculations.
std::optional<std::vector<double>> m_thetav;
std::optional<std::vector<double>> m_rv;
void updateNumericalAquiferCells(const Deck&);
double computeCellGeometricDepth(size_t globalIndex) const;
void initGridFromEGridFile(Opm::EclIO::EclFile& egridfile, std::string fileName);
void resetACTNUM( const int* actnum);

View File

@@ -1678,6 +1678,12 @@ std::vector<double> EclipseGrid::createDVector(const std::array<int,3>& dims, st
double EclipseGrid::getCellDepth(size_t globalIndex) const {
assertGlobalIndex( globalIndex );
auto it = this->m_aquifer_cell_depths.find(globalIndex);
return it != this->m_aquifer_cell_depths.end() ? it->second : computeCellGeometricDepth(globalIndex);
}
double EclipseGrid::computeCellGeometricDepth(size_t globalIndex) const {
std::array<double,8> X;
std::array<double,8> Y;
std::array<double,8> Z;
@@ -1891,6 +1897,10 @@ std::vector<double> EclipseGrid::createDVector(const std::array<int,3>& dims, st
const size_t k = record.getItem<AQUNUM::K>().get<int>(0) - 1;
const size_t global_index = this->getGlobalIndex(i, j, k);
this->m_aquifer_cells.insert(global_index);
const double depth = record.getItem<AQUNUM::DEPTH>().defaultApplied(0) ?
this->computeCellGeometricDepth(global_index) : record.getItem<AQUNUM::DEPTH>().getSIDouble(0);
this->m_aquifer_cell_depths.insert_or_assign(global_index, depth);
}
}
}