#1320 - pre-proto - Performing artithmetric upscaling of stimPlan values.

This commit is contained in:
astridkbjorke 2017-03-20 10:38:58 +01:00
parent 85c69aa15e
commit 28a794cc40
5 changed files with 78 additions and 64 deletions

View File

@ -98,44 +98,9 @@ bool RifEclipseExportTools::writeFracturesToTextFile(const QString& fileName, c
if (caseUnit == RigEclipseCaseData::UNITS_FIELD) out << "-- Using field unit system" << "\n";
out << "\n";
for (RimFracture* fracture : fractures) //For testing upscaling...
{
fracture->computeUpscaledPropertyFromStimPlan(caseToApply);
std::vector<RigFractureData> fracDataVector = fracture->attachedRigFracture()->fractureData();
for (RigFractureData fracData : fracDataVector)
{
out << qSetFieldWidth(4);
out << "-- ";
out << qSetFieldWidth(12);
wellPath, simWell = nullptr;
fracture->firstAncestorOrThisOfType(simWell);
if (simWell) out << simWell->name + " "; // 1. Well name
fracture->firstAncestorOrThisOfType(wellPath);
if (wellPath) out << wellPath->name + " "; // 1. Well name
out << qSetFieldWidth(16);
out << fracture->name().left(15) + " ";
out << qSetFieldWidth(5);
size_t i, j, k;
mainGrid->ijkFromCellIndex(fracData.reservoirCellIndex, &i, &j, &k);
out << i + 1; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
out << j + 1; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
out << k + 1; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
out << qSetFieldWidth(10);
out << QString::number(fracData.upscaledStimPlanValue, 'f', 3);
out << "\n";
}
}
//Included for debug / prototyping only
performStimPlanUpscalingAndPrintResults(fractures, caseToApply, out, wellPath, simWell, mainGrid);
printBackgroundDataHeaderLine(out);
@ -182,6 +147,49 @@ bool RifEclipseExportTools::writeFracturesToTextFile(const QString& fileName, c
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseExportTools::performStimPlanUpscalingAndPrintResults(const std::vector<RimFracture *>& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid)
{
for (RimFracture* fracture : fractures) //For testing upscaling...
{
fracture->computeUpscaledPropertyFromStimPlan(caseToApply);
std::vector<RigFractureData> fracDataVector = fracture->attachedRigFracture()->fractureData();
for (RigFractureData fracData : fracDataVector)
{
out << qSetFieldWidth(4);
out << "-- ";
out << qSetFieldWidth(12);
wellPath, simWell = nullptr;
fracture->firstAncestorOrThisOfType(simWell);
if (simWell) out << simWell->name + " "; // 1. Well name
fracture->firstAncestorOrThisOfType(wellPath);
if (wellPath) out << wellPath->name + " "; // 1. Well name
out << qSetFieldWidth(16);
out << fracture->name().left(15) + " ";
out << qSetFieldWidth(5);
size_t i, j, k;
mainGrid->ijkFromCellIndex(fracData.reservoirCellIndex, &i, &j, &k);
out << i + 1; // 2. I location grid block, adding 1 to go to eclipse 1-based grid definition
out << j + 1; // 3. J location grid block, adding 1 to go to eclipse 1-based grid definition
out << k + 1; // 4. K location of upper connecting grid block, adding 1 to go to eclipse 1-based grid definition
out << qSetFieldWidth(10);
out << fracData.cellIndex;
out << QString::number(fracData.upscaledStimPlanValue, 'f', 3);
out << "\n";
}
}
return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,8 @@ public:
static bool writeFracturesToTextFile(const QString& fileName, const std::vector<RimFracture*>& fractures, RimEclipseCase* caseToApply);
static void performStimPlanUpscalingAndPrintResults(const std::vector<RimFracture *>& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid);
static void printCOMPDATvalues(QTextStream & out, RigFractureData &fracData, RimFracture* fracture, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid);
static void printBackgroundDataHeaderLine(QTextStream & out);

View File

@ -283,36 +283,27 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(caf::DisplayCoordTransform
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, caf::DisplayCoordTransform* displayCoordTransform)
{
std::vector<double> depthCoordsAtNodes = stimPlanFracTemplate->adjustedDepthCoordsAroundWellPathPosition();
std::vector<double> xCoordsAtNodes = stimPlanFracTemplate->getNegAndPosXcoords();
//To show lines in between nodes instead of between nodes
std::vector<double> xCoords;
for (int i = 0; i < xCoordsAtNodes.size() -1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 1);
std::vector<double> depthCoords;
for (int i = 0; i < depthCoordsAtNodes.size() - 1; i++) depthCoords.push_back((depthCoordsAtNodes[i] + depthCoordsAtNodes[i + 1]) / 1);
//TODO: Get these more generally:
QString resultName = "CONDUCTIVITY";
QString resultUnit = "md-m";
size_t timeStepIndex = 0;
float polygonXmin;
float polygonXmax;
float polygonYmin;
float polygonYmax;
getPolygonBB(polygonXmin, polygonXmax, polygonYmin, polygonYmax);
std::vector<cvf::Vec3f> polygon = m_rimFracture->attachedFractureDefinition()->fracturePolygon(m_rimFracture->fractureUnit);
std::vector<std::vector<cvf::Vec3d> > stimPlanCellsAsPolygons;
std::vector<double> stimPlanParameterValues;
stimPlanFracTemplate->getStimPlanDataAsPolygonsAndValues(stimPlanCellsAsPolygons, stimPlanParameterValues, resultName, resultUnit, timeStepIndex);
std::vector<cvf::Vec3f> stimPlanMeshVertices;
for (int i = 0; i < xCoords.size() - 1; i++)
for (int i = 0; i < stimPlanParameterValues.size(); i++)
{
for (int j = 0; j < depthCoords.size() - 1; j++)
double stimPlanParameterValue = stimPlanParameterValues[i];
if (stimPlanParameterValue > 1e-7)
{
if (stimPlanCellTouchesPolygon(polygon, xCoords[i], xCoords[i + 1], depthCoords[j], depthCoords[j + 1], polygonXmin, polygonXmax, polygonYmin, polygonYmax))
std::vector<cvf::Vec3d> stimPlanCell = stimPlanCellsAsPolygons[i];
for (auto cellCorner : stimPlanCell)
{
stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast<float>(xCoords[i]), static_cast<float>(depthCoords[j]), 0.0f));
stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast<float>(xCoords[i + 1]), static_cast<float>(depthCoords[j]), 0.0f));
stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast<float>(xCoords[i + 1]), static_cast<float>(depthCoords[j + 1]), 0.0f));
stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast<float>(xCoords[i]), static_cast<float>(depthCoords[j + 1]), 0.0f));
stimPlanMeshVertices.push_back(static_cast<cvf::Vec3f>(cellCorner));
}
}
}

View File

@ -502,6 +502,9 @@ void RimFracture::computeTransmissibility(RimEclipseCase* caseToApply)
//--------------------------------------------------------------------------------------------------
void RimFracture::computeUpscaledPropertyFromStimPlan(RimEclipseCase* caseToApply)
{
//TODO: A lot of common code with function for calculating transmissibility...
if (!attachedFractureDefinition()) return;
RimStimPlanFractureTemplate* fracTemplateStimPlan;
@ -559,6 +562,13 @@ void RimFracture::computeUpscaledPropertyFromStimPlan(RimEclipseCase* caseToAppl
for (size_t fracCell : fracCells)
{
if (fracCell == 168690)
{
qDebug() << "Test";
}
bool cellIsActive = activeCellInfo->isActive(fracCell);
cvf::Vec3d localX;
@ -628,10 +638,11 @@ void RimFracture::computeUpscaledPropertyFromStimPlan(RimEclipseCase* caseToAppl
double fractureCellArea = 0.0;
for (double area : areaOfFractureParts) fractureCellArea += area;
double fractureCellAreaXvalue = 0.0;
for (double areaXvalue : areaXvalueOfFractureParts) fractureCellAreaXvalue += area;
double upscaledValue = fractureCellAreaXvalue / fractureCellArea;
for (double areaXvalue : areaXvalueOfFractureParts) fractureCellAreaXvalue += areaXvalue;
double upscaledValueArithmetic = fractureCellAreaXvalue / fractureCellArea;
fracData.upscaledStimPlanValue = upscaledValue;
fracData.upscaledStimPlanValue = upscaledValueArithmetic;
fracData.cellIndex = fracCell;
fracDataVec.push_back(fracData);
}

View File

@ -46,7 +46,9 @@ public:
bool cellIsActive;
//TODO: Used for upscaling - should be moved?
double upscaledStimPlanValue;
size_t cellIndex;
};