#1506 Add debug output of total transmissibility info to COMPDAT file

This commit is contained in:
Jacob Støren
2017-05-27 17:51:34 +02:00
parent e4abc737cd
commit 6cdf13a2bc
3 changed files with 114 additions and 20 deletions

View File

@@ -201,12 +201,24 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
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;
@@ -356,26 +368,13 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
}
}
out << "\n" << "\n" << "\n----------- All Transimissibilities " << fracture->name() << " -------------------- \n\n";
out << QString::fromStdString(transCondenser.neighborTransDebugOutput(mainGrid, fracTemplateStimPlan));
out << "\n" << "\n" << "\n----------- Condensed Results -------------------- \n\n";
out << QString::fromStdString(transCondenser.condensedTransDebugOutput(mainGrid, fracTemplateStimPlan));
out << "\n" ;
}
// Todo:
// For all transmissibilities
// summarize all fractures contributions pr cell,
// Print COMPDAT entry
const RigMainGrid* mainGrid = caseToApply->eclipseCaseData()->mainGrid();
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return;
}
QTextStream out(&file);
out << "\n";
out << "-- Exported from ResInsight" << "\n";
out << "\n";
out << qSetFieldWidth(7) << "COMPDAT" << "\n" << right << qSetFieldWidth(8);
for ( const auto& eclCellIdxFractureTransPair : eclCellIdxToTransPrFractureMap )
@@ -398,7 +397,7 @@ void RifFractureExportTools::exportWellPathFracturesToEclipseDataInputFile(const
fractureNames += fracTransPair.first->name() + "(" + QString::number(fracTransPair.second) + ")"+ " ";
}
if ( totalCellToWellTrans > 0 )
if ( true)// totalCellToWellTrans > 0 )
{
size_t i, j, k;
mainGrid->ijkFromCellIndex(eclCellIdxFractureTransPair.first, &i, &j, &k);

View File

@@ -21,6 +21,7 @@
#include <Eigen/Core>
#include <Eigen/LU>
#include <iomanip>
//--------------------------------------------------------------------------------------------------
///
@@ -155,7 +156,7 @@ void RigTransmissibilityCondenser::calculateCondensedTransmissibilitiesIfNeeded(
for (int exColIdx = exEqIdx +1; exColIdx < externalEquationCount; ++exColIdx)
{
double T = condensedSystem(exEqIdx, exColIdx);
if (T != 0.0)
//if (T != 0.0)
{
CellAddress cell1 = eqIdxToCellAddressMapping[exEqIdx + internalEquationCount];
CellAddress cell2 = eqIdxToCellAddressMapping[exColIdx + internalEquationCount];
@@ -172,3 +173,91 @@ void RigTransmissibilityCondenser::calculateCondensedTransmissibilitiesIfNeeded(
#include "RimStimPlanFractureTemplate.h"
#include "RigMainGrid.h"
#include "RigStimPlanFracTemplateCell.h"
void printCellAddress(std::stringstream& str,
const RigMainGrid* mainGrid,
const RimStimPlanFractureTemplate* fractureGrid,
RigTransmissibilityCondenser::CellAddress cellAddr)
{
using CellAddress = RigTransmissibilityCondenser::CellAddress;
str << (cellAddr.m_isExternal ? "E " : "I ");
switch (cellAddr.m_cellIndexSpace) {
case CellAddress::ECLIPSE:
{
str << "ECL ";
size_t i, j, k;
mainGrid->ijkFromCellIndex(cellAddr.m_globalCellIdx, &i, &j, &k);
str << std::setw(5) << i+1 << std::setw(5) << j+1 << std::setw(5) << k+1;
}
break;
case CellAddress::STIMPLAN:
{
str << "STP ";
const RigStimPlanFracTemplateCell& stpCell = fractureGrid->stimPlanCellFromIndex(cellAddr.m_globalCellIdx);
str << std::setw(5) << stpCell.getI()+1 << std::setw(5) << stpCell.getJ()+1 << std::setw(5) << " ";
}
break;
case CellAddress::WELL:
{
str << "WEL ";
str << std::setw(5) << cellAddr.m_globalCellIdx << std::setw(5) << " " << std::setw(5) << " ";
}
break;
}
str << " ";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RigTransmissibilityCondenser::neighborTransDebugOutput(const RigMainGrid* mainGrid, const RimStimPlanFractureTemplate* fractureGrid)
{
std::stringstream debugText;
for ( const auto& adrEqIdxPair : m_neighborTransmissibilities )
{
for (const auto& adrTransPair :adrEqIdxPair.second)
{
debugText << "-- ";
printCellAddress(debugText, mainGrid, fractureGrid, adrEqIdxPair.first);
printCellAddress(debugText, mainGrid, fractureGrid, adrTransPair.first);
debugText << " Trans: " << std::setprecision(10) << std::fixed << adrTransPair.second;
debugText << std::endl;
}
}
return debugText.str();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RigTransmissibilityCondenser::condensedTransDebugOutput(const RigMainGrid* mainGrid, const RimStimPlanFractureTemplate* fractureGrid)
{
std::stringstream debugText;
for ( const auto& adrEqIdxPair : m_condensedTransmissibilities )
{
for (const auto& adrTransPair :adrEqIdxPair.second)
{
debugText << "-- ";
printCellAddress(debugText, mainGrid, fractureGrid, adrEqIdxPair.first);
printCellAddress(debugText, mainGrid, fractureGrid, adrTransPair.first);
debugText << " Trans: " << std::setprecision(10) << std::fixed << adrTransPair.second;
debugText << std::endl;
}
}
return debugText.str();
}

View File

@@ -24,6 +24,9 @@
#include <vector>
#include <set>
class RigMainGrid;
class RimStimPlanFractureTemplate;
class RigTransmissibilityCondenser
{
public:
@@ -71,6 +74,9 @@ public:
double condensedTransmissibility( CellAddress externalCell1, CellAddress externalCell2);
std::string neighborTransDebugOutput(const RigMainGrid* mainGrid, const RimStimPlanFractureTemplate* fractureGrid);
std::string condensedTransDebugOutput(const RigMainGrid* mainGrid, const RimStimPlanFractureTemplate* fractureGrid);
private:
void calculateCondensedTransmissibilitiesIfNeeded();