From 28a794cc40250c6217c7f57c873a2dd88e282ccc Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Mon, 20 Mar 2017 10:38:58 +0100 Subject: [PATCH] #1320 - pre-proto - Performing artithmetric upscaling of stimPlan values. --- .../FileInterface/RifEclipseExportTools.cpp | 84 ++++++++++--------- .../FileInterface/RifEclipseExportTools.h | 2 + .../RivWellFracturePartMgr.cpp | 37 ++++---- .../ProjectDataModel/RimFracture.cpp | 17 +++- .../ReservoirDataModel/RigFracture.h | 2 + 5 files changed, 78 insertions(+), 64 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp index 32219bcaef..3a9d366829 100644 --- a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp @@ -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 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& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid) +{ + for (RimFracture* fracture : fractures) //For testing upscaling... + { + fracture->computeUpscaledPropertyFromStimPlan(caseToApply); + std::vector 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; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/FileInterface/RifEclipseExportTools.h b/ApplicationCode/FileInterface/RifEclipseExportTools.h index 96057a026c..9b6dc0935d 100644 --- a/ApplicationCode/FileInterface/RifEclipseExportTools.h +++ b/ApplicationCode/FileInterface/RifEclipseExportTools.h @@ -51,6 +51,8 @@ public: static bool writeFracturesToTextFile(const QString& fileName, const std::vector& fractures, RimEclipseCase* caseToApply); + static void performStimPlanUpscalingAndPrintResults(const std::vector& 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); diff --git a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp index 6fd2baa95e..619d94e892 100644 --- a/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -283,36 +283,27 @@ void RivWellFracturePartMgr::generateStimPlanMeshPart(caf::DisplayCoordTransform //-------------------------------------------------------------------------------------------------- cvf::ref RivWellFracturePartMgr::createStimPlanMeshDrawable(RimStimPlanFractureTemplate* stimPlanFracTemplate, caf::DisplayCoordTransform* displayCoordTransform) { - std::vector depthCoordsAtNodes = stimPlanFracTemplate->adjustedDepthCoordsAroundWellPathPosition(); - std::vector xCoordsAtNodes = stimPlanFracTemplate->getNegAndPosXcoords(); - //To show lines in between nodes instead of between nodes - std::vector xCoords; - for (int i = 0; i < xCoordsAtNodes.size() -1; i++) xCoords.push_back((xCoordsAtNodes[i] + xCoordsAtNodes[i + 1]) / 1); - std::vector 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 polygon = m_rimFracture->attachedFractureDefinition()->fracturePolygon(m_rimFracture->fractureUnit); + std::vector > stimPlanCellsAsPolygons; + std::vector stimPlanParameterValues; + stimPlanFracTemplate->getStimPlanDataAsPolygonsAndValues(stimPlanCellsAsPolygons, stimPlanParameterValues, resultName, resultUnit, timeStepIndex); std::vector 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 stimPlanCell = stimPlanCellsAsPolygons[i]; + for (auto cellCorner : stimPlanCell) { - stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast(xCoords[i]), static_cast(depthCoords[j]), 0.0f)); - stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast(xCoords[i + 1]), static_cast(depthCoords[j]), 0.0f)); - stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast(xCoords[i + 1]), static_cast(depthCoords[j + 1]), 0.0f)); - stimPlanMeshVertices.push_back(cvf::Vec3f(static_cast(xCoords[i]), static_cast(depthCoords[j + 1]), 0.0f)); + stimPlanMeshVertices.push_back(static_cast(cellCorner)); } } } diff --git a/ApplicationCode/ProjectDataModel/RimFracture.cpp b/ApplicationCode/ProjectDataModel/RimFracture.cpp index deae8b2a58..12caab9314 100644 --- a/ApplicationCode/ProjectDataModel/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimFracture.cpp @@ -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); } diff --git a/ApplicationCode/ReservoirDataModel/RigFracture.h b/ApplicationCode/ReservoirDataModel/RigFracture.h index b1b8106d00..5c871f55cc 100644 --- a/ApplicationCode/ReservoirDataModel/RigFracture.h +++ b/ApplicationCode/ReservoirDataModel/RigFracture.h @@ -46,7 +46,9 @@ public: bool cellIsActive; + //TODO: Used for upscaling - should be moved? double upscaledStimPlanValue; + size_t cellIndex; };