mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only consider perforation in the interior of the local grid.
This is needed for distributed wells to save most of the code
from checking whether a perforation is in the interior.
We add new methods compressedIndexForInterior that return -1
for non-interior cells and use that for the wells. This restores
the old behaviour before 1cfe3e0aad
This commit is contained in:
parent
23e0b06387
commit
fa9e93529b
@ -296,6 +296,8 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Return compressed index from cartesian index
|
* \brief Return compressed index from cartesian index
|
||||||
*
|
*
|
||||||
|
* \return compressed index of cell is in interior, -1 otherwise
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
int compressedIndex(int cartesianCellIdx) const
|
int compressedIndex(int cartesianCellIdx) const
|
||||||
{
|
{
|
||||||
@ -306,6 +308,25 @@ public:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return compressed index from cartesian index only in interior
|
||||||
|
*
|
||||||
|
* \return compressed index of cell is in interior, -1 otherwise
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int compressedIndexForInterior(int cartesianCellIdx) const
|
||||||
|
{
|
||||||
|
auto index_pair = cartesianToCompressed_.find(cartesianCellIdx);
|
||||||
|
if (index_pair == cartesianToCompressed_.end() ||
|
||||||
|
!is_interior_[index_pair->second])
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return index_pair->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief Extract Cartesian index triplet (i,j,k) of an active cell.
|
* \brief Extract Cartesian index triplet (i,j,k) of an active cell.
|
||||||
*
|
*
|
||||||
@ -424,9 +445,22 @@ protected:
|
|||||||
void updateCartesianToCompressedMapping_()
|
void updateCartesianToCompressedMapping_()
|
||||||
{
|
{
|
||||||
size_t num_cells = asImp_().grid().leafGridView().size(0);
|
size_t num_cells = asImp_().grid().leafGridView().size(0);
|
||||||
for (unsigned i = 0; i < num_cells; ++i) {
|
is_interior_.resize(num_cells);
|
||||||
unsigned cartesianCellIdx = cartesianIndex(i);
|
|
||||||
cartesianToCompressed_[cartesianCellIdx] = i;
|
ElementMapper elemMapper(this->gridView(), Dune::mcmgElementLayout());
|
||||||
|
for (const auto& element : elements(this->gridView()))
|
||||||
|
{
|
||||||
|
const auto elemIdx = elemMapper.index(element);
|
||||||
|
unsigned cartesianCellIdx = cartesianIndex(elemIdx);
|
||||||
|
cartesianToCompressed_[cartesianCellIdx] = elemIdx;
|
||||||
|
if (element.partitionType() == Dune::InteriorEntity)
|
||||||
|
{
|
||||||
|
is_interior_[elemIdx] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is_interior_[elemIdx] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,6 +549,10 @@ protected:
|
|||||||
/*! \brief Cell thickness
|
/*! \brief Cell thickness
|
||||||
*/
|
*/
|
||||||
std::vector<Scalar> cellThickness_;
|
std::vector<Scalar> cellThickness_;
|
||||||
|
|
||||||
|
/*! \brief Whether a cells is in the interior.
|
||||||
|
*/
|
||||||
|
std::vector<int> is_interior_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -419,8 +419,8 @@ namespace Opm {
|
|||||||
|
|
||||||
void assignWellTracerRates(data::Wells& wsrpt) const;
|
void assignWellTracerRates(data::Wells& wsrpt) const;
|
||||||
|
|
||||||
int compressedIndex(int cartesian_cell_idx) const override {
|
int compressedIndexForInterior(int cartesian_cell_idx) const override {
|
||||||
return ebosSimulator_.vanguard().compressedIndex(cartesian_cell_idx);
|
return ebosSimulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -349,7 +349,7 @@ initializeWellPerfData()
|
|||||||
parallelWellInfo.beginReset();
|
parallelWellInfo.beginReset();
|
||||||
|
|
||||||
for (const auto& completion : well.getConnections()) {
|
for (const auto& completion : well.getConnections()) {
|
||||||
const int active_index = compressedIndex(completion.global_index());
|
const int active_index = compressedIndexForInterior(completion.global_index());
|
||||||
if (completion.state() == Connection::State::OPEN) {
|
if (completion.state() == Connection::State::OPEN) {
|
||||||
if (active_index >= 0) {
|
if (active_index >= 0) {
|
||||||
if (firstOpenCompletion)
|
if (firstOpenCompletion)
|
||||||
|
@ -374,7 +374,8 @@ protected:
|
|||||||
void runWellPIScaling(const int timeStepIdx,
|
void runWellPIScaling(const int timeStepIdx,
|
||||||
DeferredLogger& local_deferredLogger);
|
DeferredLogger& local_deferredLogger);
|
||||||
|
|
||||||
virtual int compressedIndex(int cartesian_cell_idx) const = 0;
|
/// \brief get compressed index for interior cells (-1, otherwise
|
||||||
|
virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0;
|
||||||
|
|
||||||
|
|
||||||
Schedule& schedule_;
|
Schedule& schedule_;
|
||||||
|
@ -125,7 +125,7 @@ namespace Opm {
|
|||||||
for ( size_t c=0; c < connectionSet.size(); c++ )
|
for ( size_t c=0; c < connectionSet.size(); c++ )
|
||||||
{
|
{
|
||||||
const auto& connection = connectionSet.get(c);
|
const auto& connection = connectionSet.get(c);
|
||||||
int compressed_idx = compressedIndex(connection.global_index());
|
int compressed_idx = compressedIndexForInterior(connection.global_index());
|
||||||
|
|
||||||
if ( compressed_idx >= 0 ) { // Ignore connections in inactive/remote cells.
|
if ( compressed_idx >= 0 ) { // Ignore connections in inactive/remote cells.
|
||||||
wellCells.push_back(compressed_idx);
|
wellCells.push_back(compressed_idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user