mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1493 Remove old export fracture on selected wellpaths feature
This commit is contained in:
@@ -172,242 +172,6 @@ bool RifFractureExportTools::exportFracturesToEclipseDataInputFile(const QString
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
// Loop over fractures in well path (all)
|
||||
// Loop over stimplancells
|
||||
// if cell Is Contributing cond > 0
|
||||
// Calculate Matrix To Fracture Trans
|
||||
// Add to condenser
|
||||
// Loop over stimplanecells (i, j)
|
||||
// if cell Is Contributing cond > 0
|
||||
// Calculate trans to neighbor (+i, +j )
|
||||
// Add to condenser
|
||||
// Find well cells (Perforated Well Path, Radius, Positioned Fracture)
|
||||
// For each well cell
|
||||
// Find path intersection
|
||||
// Use LinT + 1/2 radialT on each end if endpoints are inside cell
|
||||
// Add to condenser
|
||||
// Add eclipse cell transmissibilities to a map <eclipsecell index, map<fractureptr, transmissibility> >
|
||||
// For all transmissibilities
|
||||
// summarize all fractures contributions pr cell,
|
||||
// Print COMPDAT entry
|
||||
//
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const QString& fileName,
|
||||
const RimWellPath* wellPath,
|
||||
const RimEclipseCase* caseToApply)
|
||||
{
|
||||
std::vector<RimFracture*> fracturesAlongWellPath;
|
||||
wellPath->descendantsIncludingThisOfType(fracturesAlongWellPath);
|
||||
|
||||
double cDarcyInCorrectUnit = caseToApply->eclipseCaseData()->darchysValue();
|
||||
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
|
||||
|
||||
// To handle several fractures in the same eclipse cell we need to keep track of the transmissibility
|
||||
// to the well from each fracture intersecting the cell and sum these transmissibilities at the end.
|
||||
// std::map <eclipseCellIndex ,map< fracture, trans> >
|
||||
std::map <size_t, std::map<RimFracture*, double> > eclCellIdxToTransPrFractureMap;
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
out << "\n";
|
||||
out << "-- Exported from ResInsight" << "\n";
|
||||
out << "\n";
|
||||
|
||||
for (RimFracture* fracture : fracturesAlongWellPath)
|
||||
{
|
||||
using CellIdxSpace = RigTransmissibilityCondenser::CellAddress;
|
||||
|
||||
RimFractureTemplate* fracTemplate = fracture->attachedFractureDefinition();
|
||||
const RigFractureGrid* fractureGrid = fracTemplate->fractureGrid();
|
||||
|
||||
RigTransmissibilityCondenser transCondenser;
|
||||
|
||||
//////
|
||||
// Calculate Matrix To Fracture Trans
|
||||
|
||||
std::vector<RigFractureCell> fractureCells = fractureGrid->fractureCells();
|
||||
|
||||
for (const RigFractureCell fractureCell : fractureCells)
|
||||
{
|
||||
if (fractureCell.getConductivtyValue() < 1e-7) continue;
|
||||
|
||||
RigEclipseToStimPlanCellTransmissibilityCalculator eclToFractureTransCalc(caseToApply,
|
||||
fracture->transformMatrix(),
|
||||
fracture->attachedFractureDefinition()->skinFactor,
|
||||
cDarcyInCorrectUnit,
|
||||
fractureCell);
|
||||
|
||||
const std::vector<size_t>& fractureCellContributingEclipseCells = eclToFractureTransCalc.globalIndeciesToContributingEclipseCells();
|
||||
const std::vector<double>& fractureCellContributingEclipseCellTransmissibilities = eclToFractureTransCalc.contributingEclipseCellTransmissibilities();
|
||||
|
||||
size_t stimPlanCellIndex = fractureGrid->getGlobalIndexFromIJ(fractureCell.getI(), fractureCell.getJ());
|
||||
|
||||
for (size_t i = 0; i < fractureCellContributingEclipseCells.size(); i++)
|
||||
{
|
||||
transCondenser.addNeighborTransmissibility({ true, CellIdxSpace::ECLIPSE, fractureCellContributingEclipseCells[i] },
|
||||
{ false, CellIdxSpace::STIMPLAN, stimPlanCellIndex },
|
||||
fractureCellContributingEclipseCellTransmissibilities[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//////
|
||||
// Calculate Transmissibility in the fracture: From one StimPlan Cell to the other
|
||||
|
||||
for (size_t i = 0; i < fractureGrid->iCellCount(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < fractureGrid->jCellCount(); j++)
|
||||
{
|
||||
size_t fractureCellIndex = fractureGrid->getGlobalIndexFromIJ(i, j);
|
||||
const RigFractureCell fractureCell = fractureGrid->cellFromIndex(fractureCellIndex);
|
||||
|
||||
if (fractureCell.getConductivtyValue() < 1e-7) continue;
|
||||
|
||||
if (i < fractureGrid->iCellCount()-1)
|
||||
{
|
||||
size_t fractureCellNeighbourXIndex = fractureGrid->getGlobalIndexFromIJ(i + 1, j);
|
||||
const RigFractureCell fractureCellNeighbourX = fractureGrid->cellFromIndex(fractureCellNeighbourXIndex);
|
||||
|
||||
double horizontalTransToXneigbour =
|
||||
RigFractureTransmissibilityEquations::centerToCenterFractureCellTrans(fractureCell.getConductivtyValue(),
|
||||
fractureCell.cellSizeX(),
|
||||
fractureCell.cellSizeZ(),
|
||||
fractureCellNeighbourX.getConductivtyValue(),
|
||||
fractureCellNeighbourX.cellSizeX(),
|
||||
fractureCellNeighbourX.cellSizeZ(),
|
||||
cDarcyInCorrectUnit);
|
||||
|
||||
transCondenser.addNeighborTransmissibility({ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellIndex },
|
||||
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellNeighbourXIndex },
|
||||
horizontalTransToXneigbour);
|
||||
|
||||
}
|
||||
|
||||
if (j < fractureGrid->jCellCount()-1)
|
||||
{
|
||||
size_t fractureCellNeighbourZIndex = fractureGrid->getGlobalIndexFromIJ(i, j + 1);
|
||||
const RigFractureCell fractureCellNeighbourZ = fractureGrid->cellFromIndex(fractureCellNeighbourZIndex);
|
||||
|
||||
double verticalTransToZneigbour =
|
||||
RigFractureTransmissibilityEquations::centerToCenterFractureCellTrans(fractureCell.getConductivtyValue(),
|
||||
fractureCell.cellSizeZ(),
|
||||
fractureCell.cellSizeX(),
|
||||
fractureCellNeighbourZ.getConductivtyValue(),
|
||||
fractureCellNeighbourZ.cellSizeZ(),
|
||||
fractureCellNeighbourZ.cellSizeX(),
|
||||
cDarcyInCorrectUnit);
|
||||
|
||||
transCondenser.addNeighborTransmissibility({ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellIndex },
|
||||
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fractureCellNeighbourZIndex },
|
||||
verticalTransToZneigbour);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
// Calculate transmissibility into the well
|
||||
|
||||
RigWellPathStimplanIntersector wellFractureIntersector(wellPath->wellPathGeometry(), fracture);
|
||||
const std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection >& fractureWellCells = wellFractureIntersector.intersections();
|
||||
|
||||
for (const auto& fracCellIdxIsectDataPair : fractureWellCells)
|
||||
{
|
||||
size_t fracWellCellIdx = fracCellIdxIsectDataPair.first;
|
||||
RigWellPathStimplanIntersector::WellCellIntersection intersection = fracCellIdxIsectDataPair.second;
|
||||
|
||||
const RigFractureCell fractureWellCell = fractureGrid->cellFromIndex(fracWellCellIdx);
|
||||
|
||||
double radialTrans = 0.0;
|
||||
if (intersection.endpointCount)
|
||||
{
|
||||
radialTrans = RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(fractureWellCell.getConductivtyValue(),
|
||||
fractureWellCell.cellSizeX(),
|
||||
fractureWellCell.cellSizeZ(),
|
||||
fracture->wellRadius(),
|
||||
fracTemplate->skinFactor(),
|
||||
cDarcyInCorrectUnit);
|
||||
}
|
||||
|
||||
double linearTrans = 0.0;
|
||||
if (intersection.hlength > 0.0 || intersection.vlength > 0.0 )
|
||||
{
|
||||
linearTrans = RigFractureTransmissibilityEquations::fractureCellToWellLinearTrans(fractureWellCell.getConductivtyValue(),
|
||||
fractureWellCell.cellSizeX(),
|
||||
fractureWellCell.cellSizeZ(),
|
||||
intersection.vlength,
|
||||
intersection.hlength ,
|
||||
fracture->perforationEfficiency,
|
||||
fracTemplate->skinFactor(),
|
||||
cDarcyInCorrectUnit);
|
||||
}
|
||||
|
||||
double totalWellTrans = 0.5 * intersection.endpointCount * radialTrans + linearTrans;
|
||||
|
||||
transCondenser.addNeighborTransmissibility( { true, RigTransmissibilityCondenser::CellAddress::WELL, 1},
|
||||
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, fracWellCellIdx },
|
||||
totalWellTrans);
|
||||
}
|
||||
|
||||
/////
|
||||
// Insert total transmissibility from eclipse-cell to well for this fracture into the map
|
||||
|
||||
std::set<RigTransmissibilityCondenser::CellAddress> externalCells = transCondenser.externalCells();
|
||||
for (RigTransmissibilityCondenser::CellAddress externalCell : externalCells)
|
||||
{
|
||||
if (externalCell.m_cellIndexSpace == RigTransmissibilityCondenser::CellAddress::ECLIPSE)
|
||||
{
|
||||
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
|
||||
|
||||
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
|
||||
}
|
||||
}
|
||||
out << "\n" << "\n" << "\n----------- All Transimissibilities " << fracture->name() << " -------------------- \n\n";
|
||||
out << QString::fromStdString(transCondenser.neighborTransDebugOutput(mainGrid, fractureGrid));
|
||||
out << "\n" << "\n" << "\n----------- Condensed Results -------------------- \n\n";
|
||||
out << QString::fromStdString(transCondenser.condensedTransDebugOutput(mainGrid, fractureGrid));
|
||||
out << "\n" ;
|
||||
}
|
||||
|
||||
out << qSetFieldWidth(7) << "COMPDAT" << "\n" << right << qSetFieldWidth(8);
|
||||
|
||||
for ( const auto& eclCellIdxFractureTransPair : eclCellIdxToTransPrFractureMap )
|
||||
{
|
||||
const auto& fracTransMap = eclCellIdxFractureTransPair.second;
|
||||
|
||||
double skinFactor = cvf::UNDEFINED_DOUBLE;
|
||||
double totalCellToWellTrans = 0.0;
|
||||
QString fractureNames;
|
||||
for ( const auto& fracTransPair: fracTransMap )
|
||||
{
|
||||
totalCellToWellTrans += fracTransPair.second;
|
||||
|
||||
// Selecting the last existing skin factor TODO: What should we do ? Use highest/lowest ... ?
|
||||
if ( fracTransPair.first->attachedFractureDefinition() )
|
||||
{
|
||||
skinFactor = fracTransPair.first->attachedFractureDefinition()->skinFactor();
|
||||
}
|
||||
|
||||
fractureNames += fracTransPair.first->name() + "(" + QString::number(fracTransPair.second) + ")"+ " ";
|
||||
}
|
||||
|
||||
if ( true)// totalCellToWellTrans > 0 )
|
||||
{
|
||||
size_t i, j, k;
|
||||
mainGrid->ijkFromCellIndex(eclCellIdxFractureTransPair.first, &i, &j, &k);
|
||||
printCOMPDATvalues(out, totalCellToWellTrans, i, j, k, fractureNames, skinFactor, wellPath->name());
|
||||
}
|
||||
}
|
||||
|
||||
out << "/ \n";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -53,11 +53,6 @@ public:
|
||||
const std::vector<RimFracture*>& fractures,
|
||||
RimEclipseCase* caseToApply);
|
||||
|
||||
static void exportWellPathFracturesToEclipseDataInputFile(const QString& fileName,
|
||||
const RimWellPath* wellPath,
|
||||
const RimEclipseCase* caseToApply);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
static void printCOMPDATvalues(QTextStream & out,
|
||||
|
||||
Reference in New Issue
Block a user