mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1758 Refactor IJKCellIndex
This commit is contained in:
@@ -353,10 +353,8 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
|
||||
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
|
||||
|
||||
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
|
||||
size_t i, j, k;
|
||||
mainGrid->ijkFromCellIndex(externalCell.m_globalCellIdx, &i, &j, &k);
|
||||
|
||||
RigCompletionData compDat(wellPathName, {i,j,k});
|
||||
RigCompletionData compDat(wellPathName, IJKCellIndex(externalCell.m_globalCellIdx, caseToApply));
|
||||
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor());
|
||||
compDat.addMetadata(fracture->name(), QString::number(trans));
|
||||
fractureCompletions.push_back(compDat);
|
||||
|
||||
@@ -87,17 +87,14 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
|
||||
|
||||
std::vector<RigCompletionData> completionData;
|
||||
|
||||
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
|
||||
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
|
||||
for (const auto& cellAndWellBoreParts : wellBorePartsInCells)
|
||||
{
|
||||
size_t cellIndex = cellAndWellBoreParts.first;
|
||||
size_t globalCellIndex = cellAndWellBoreParts.first;
|
||||
const std::vector<WellBorePartForTransCalc>& wellBoreParts = cellAndWellBoreParts.second;
|
||||
size_t i, j, k;
|
||||
grid->ijkFromCellIndex(cellIndex, &i, &j, &k);
|
||||
|
||||
bool cellIsActive = activeCellInfo->isActive(cellIndex);
|
||||
bool cellIsActive = activeCellInfo->isActive(globalCellIndex);
|
||||
if (!cellIsActive) continue;
|
||||
|
||||
// Find main bore and number of laterals
|
||||
@@ -113,14 +110,14 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
|
||||
else
|
||||
{
|
||||
mainBoreDirection = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
|
||||
cellIndex,
|
||||
globalCellIndex,
|
||||
wellBorePart.lengthsInCell);
|
||||
}
|
||||
}
|
||||
|
||||
for (WellBorePartForTransCalc wellBorePart : wellBoreParts)
|
||||
{
|
||||
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
|
||||
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(globalCellIndex, settings.caseToApply));
|
||||
|
||||
double transmissibility = 0.0;
|
||||
if (wellBorePart.isMainBore)
|
||||
@@ -131,7 +128,7 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
|
||||
wellBorePart.lengthsInCell,
|
||||
wellBorePart.skinFactor,
|
||||
wellBorePart.wellRadius,
|
||||
cellIndex,
|
||||
globalCellIndex,
|
||||
settings.useLateralNTG);
|
||||
|
||||
}
|
||||
@@ -143,7 +140,7 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
|
||||
wellBorePart.lengthsInCell,
|
||||
wellBorePart.skinFactor,
|
||||
wellBorePart.wellRadius,
|
||||
cellIndex,
|
||||
globalCellIndex,
|
||||
settings.useLateralNTG,
|
||||
numberOfLaterals,
|
||||
mainBoreDirection);
|
||||
@@ -151,7 +148,7 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
|
||||
}
|
||||
|
||||
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
|
||||
cellIndex,
|
||||
globalCellIndex,
|
||||
wellBorePart.lengthsInCell);
|
||||
|
||||
completion.setTransAndWPImultBackgroundDataFromFishbone(transmissibility,
|
||||
|
||||
@@ -482,8 +482,6 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp
|
||||
CVF_ASSERT(!completions.empty());
|
||||
QString wellName = completions[0].wellName();
|
||||
IJKCellIndex cellIndexIJK = completions[0].cellIndex();
|
||||
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
|
||||
size_t cellIndex = grid->cellIndexFromIJK(cellIndexIJK.i, cellIndexIJK.j, cellIndexIJK.k);
|
||||
RigCompletionData::CompletionType completionType = completions[0].completionType();
|
||||
|
||||
//completion type, skin factor, well bore diameter and cell direction are taken from (first) main bore,
|
||||
@@ -515,7 +513,7 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp
|
||||
|
||||
if (completion.completionType() != completions[0].completionType())
|
||||
{
|
||||
QString errorMessage = QString("Cannot combine completions of different types in same cell [%1, %2, %3]").arg(cellIndexIJK.i + 1).arg(cellIndexIJK.j + 1).arg(cellIndexIJK.k + 1);
|
||||
QString errorMessage = QString("Cannot combine completions of different types in same cell %1").arg(cellIndexIJK.oneBasedLocalCellIndexString());
|
||||
RiaLogging::error(errorMessage);
|
||||
resultCompletion.addMetadata("ERROR", errorMessage);
|
||||
return resultCompletion; //Returning empty completion, should not be exported
|
||||
@@ -523,7 +521,7 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp
|
||||
|
||||
if (completion.wellName() != completions[0].wellName())
|
||||
{
|
||||
QString errorMessage = QString("Cannot combine completions from different wells in same cell [%1, %2, %3]").arg(cellIndexIJK.i + 1).arg(cellIndexIJK.j + 1).arg(cellIndexIJK.k + 1);
|
||||
QString errorMessage = QString("Cannot combine completions of different types in same cell %1").arg(cellIndexIJK.oneBasedLocalCellIndexString());
|
||||
RiaLogging::error(errorMessage);
|
||||
resultCompletion.addMetadata("ERROR", errorMessage);
|
||||
return resultCompletion; //Returning empty completion, should not be exported
|
||||
@@ -531,7 +529,7 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp
|
||||
|
||||
if (completion.transmissibility() == HUGE_VAL)
|
||||
{
|
||||
QString errorMessage = QString("Transmissibility calculation has failed for cell [%1, %2, %3]").arg(cellIndexIJK.i + 1).arg(cellIndexIJK.j + 1).arg(cellIndexIJK.k + 1);
|
||||
QString errorMessage = QString("Transmissibility calculation has failed for cell %1").arg(cellIndexIJK.oneBasedLocalCellIndexString());
|
||||
RiaLogging::error(errorMessage);
|
||||
resultCompletion.addMetadata("ERROR", errorMessage);
|
||||
return resultCompletion; //Returning empty completion, should not be exported
|
||||
@@ -556,7 +554,7 @@ RigCompletionData RicWellPathExportCompletionDataFeature::combineEclipseCellComp
|
||||
double transmissibilityEclipseCalculation = RicWellPathExportCompletionDataFeature::calculateTransmissibilityAsEclipseDoes(settings.caseToApply(),
|
||||
skinfactor,
|
||||
wellBoreDiameter / 2,
|
||||
cellIndex,
|
||||
cellIndexIJK.globalCellIndex(),
|
||||
cellDirection);
|
||||
|
||||
double wpimult = totalTrans / transmissibilityEclipseCalculation;
|
||||
@@ -692,7 +690,7 @@ void RicWellPathExportCompletionDataFeature::generateCompdatTable(RifEclipseData
|
||||
formatter.comment(QString("%1 : %2").arg(metadata.name).arg(metadata.comment));
|
||||
}
|
||||
formatter.add(data.wellName());
|
||||
formatter.addZeroBasedCellIndex(data.cellIndex().i).addZeroBasedCellIndex(data.cellIndex().j).addZeroBasedCellIndex(data.cellIndex().k).addZeroBasedCellIndex(data.cellIndex().k);
|
||||
formatter.addZeroBasedCellIndex(data.cellIndex().localCellIndexI()).addZeroBasedCellIndex(data.cellIndex().localCellIndexJ()).addZeroBasedCellIndex(data.cellIndex().localCellIndexK()).addZeroBasedCellIndex(data.cellIndex().localCellIndexK());
|
||||
switch (data.connectionState())
|
||||
{
|
||||
case OPEN:
|
||||
@@ -765,7 +763,7 @@ void RicWellPathExportCompletionDataFeature::generateWpimultTable(RifEclipseData
|
||||
|
||||
formatter.add(completion.wellName());
|
||||
formatter.add(completion.wpimult());
|
||||
formatter.addZeroBasedCellIndex(completion.cellIndex().i).addZeroBasedCellIndex(completion.cellIndex().j).addZeroBasedCellIndex(completion.cellIndex().k);
|
||||
formatter.addZeroBasedCellIndex(completion.cellIndex().localCellIndexI()).addZeroBasedCellIndex(completion.cellIndex().localCellIndexJ()).addZeroBasedCellIndex(completion.cellIndex().localCellIndexK());
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
@@ -782,7 +780,6 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
|
||||
std::vector<RigCompletionData> completionData;
|
||||
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
|
||||
|
||||
|
||||
if (wellPath->perforationIntervalCollection()->isChecked())
|
||||
{
|
||||
for (const RimPerforationInterval* interval : wellPath->perforationIntervalCollection()->perforations())
|
||||
@@ -800,9 +797,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeature::generateP
|
||||
bool cellIsActive = activeCellInfo->isActive(cell.globCellIndex);
|
||||
if (!cellIsActive) continue;
|
||||
|
||||
size_t i, j, k;
|
||||
settings.caseToApply->eclipseCaseData()->mainGrid()->ijkFromCellIndex(cell.globCellIndex, &i, &j, &k);
|
||||
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
|
||||
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(cell.globCellIndex, settings.caseToApply));
|
||||
CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.intersectionLengthsInCellCS);
|
||||
|
||||
double transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
|
||||
|
||||
Reference in New Issue
Block a user