From a5e3e864fbb45c3095924b334ece27c1ae51cd19 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 25 Apr 2017 16:08:44 +0200 Subject: [PATCH] pre-proto - Cleanups in code. Renamings and adding functions global index in array of RigStimPlanCell for simplified interaction with these --- .../FileInterface/RifEclipseExportTools.cpp | 57 ++++++++++----- .../FileInterface/RifEclipseExportTools.h | 2 +- .../RimStimPlanFractureTemplate.cpp | 72 +++++++++++++++---- .../RimStimPlanFractureTemplate.h | 8 ++- .../ReservoirDataModel/RigFracture.h | 7 +- .../RigFractureTransCalc.cpp | 29 ++++---- .../ReservoirDataModel/RigFractureTransCalc.h | 21 +++--- .../ReservoirDataModel/RigStimPlanCell.cpp | 10 +-- .../ReservoirDataModel/RigStimPlanCell.h | 6 +- 9 files changed, 144 insertions(+), 68 deletions(-) diff --git a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp index dd8b1667ea..04b4eb326b 100644 --- a/ApplicationCode/FileInterface/RifEclipseExportTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseExportTools.cpp @@ -119,7 +119,7 @@ bool RifEclipseExportTools::writeFracturesToTextFile(const QString& fileName, c RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture); //TODO: Check that there is a fracture template available for given fracture.... - transmissibilityCalculator.computeTransmissibility(); + transmissibilityCalculator.computeTransmissibilityFromPolygonWithInfiniteConductivityInFracture(); std::vector fracDataVector = fracture->attachedRigFracture()->fractureData(); for (RigFractureData fracData : fracDataVector) @@ -335,6 +335,8 @@ void RifEclipseExportTools::printStimPlanCellsMatrixTransContributions(const std out << "\n"; } + + //TODO: add RigFractureStimPlanCellData to m_StimPlanCellsFractureData i RigFracture??? } } return; @@ -380,7 +382,7 @@ void RifEclipseExportTools::printStimPlanFractureTrans(const std::vector& fractures, QTextStream &out, RimEclipseCase* caseToApply) { - out << "Transmissibility From Fracture To Well \n"; + out << "-- Transmissibility From Fracture To Well \n"; + + out << qSetFieldWidth(12); + out << "Well name "; + + out << qSetFieldWidth(16); + out << "Fracture name "; + out << "Inflow type "; + + out << qSetFieldWidth(5); + out << " i "; + out << " j "; + + out << "Tw"; + out << "\n"; for (RimFracture* fracture : fractures) { @@ -609,11 +625,10 @@ void RifEclipseExportTools::printTransmissibilityFractureToWell(const std::vecto out << fracture->name().left(15) + " "; - - if (fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::ALONG_WELL_PATH) { out << "Linear inflow"; + out << qSetFieldWidth(5); RimStimPlanFractureTemplate* fracTemplateStimPlan; if (dynamic_cast(fracture->attachedFractureDefinition())) @@ -634,25 +649,24 @@ void RifEclipseExportTools::printTransmissibilityFractureToWell(const std::vecto double perforationLengthVert = fracture->perforationLength * cos(wellDip); double perforationLengthHor = fracture->perforationLength * sin(wellDip); - - RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtWell(); - //TODO: Error in getting the StimPlanWellCell here!!! + + std::pair wellCenterStimPlanCellIJ = fracTemplateStimPlan->getStimPlanCellAtWellCenter(); + out << qSetFieldWidth(5); + out << wellCenterStimPlanCellIJ.first; + out << wellCenterStimPlanCellIJ.second; - out << stimPlanCell->getI(); - out << stimPlanCell->getJ(); - //TODO: Check if perforation length is larger than cell - expand to neightbour cells if needed! + //RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second); + const RigStimPlanCell& stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(fracTemplateStimPlan->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second)); RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture); double RadTransInStimPlanCell = transmissibilityCalculator.computeLinearTransmissibilityToWellinStimPlanCell(stimPlanCell, perforationLengthVert, perforationLengthHor); out << RadTransInStimPlanCell; - + out << "\n"; } - - if (fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH || fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::AZIMUTH) { @@ -665,16 +679,22 @@ void RifEclipseExportTools::printTransmissibilityFractureToWell(const std::vecto } else continue; - RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtWell(); - //TODO: Error in getting the StimPlanWellCell here!!! + std::pair wellCenterStimPlanCellIJ = fracTemplateStimPlan->getStimPlanCellAtWellCenter(); + out << qSetFieldWidth(5); + out << wellCenterStimPlanCellIJ.first; + out << wellCenterStimPlanCellIJ.second; - out << stimPlanCell->getI(); - out << stimPlanCell->getJ(); + //RigStimPlanCell* stimPlanCell = fracTemplateStimPlan->getStimPlanCellAtIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second); + const RigStimPlanCell& stimPlanCell = fracTemplateStimPlan->stimPlanCellFromIndex(fracTemplateStimPlan->getGlobalIndexFromIJ(wellCenterStimPlanCellIJ.first, wellCenterStimPlanCellIJ.second)); + + //TODO: Error - stimPlanCell blir ikke riktig... Har ikke polygon!?! RigFractureTransCalc transmissibilityCalculator(caseToApply, fracture); double RadTransInStimPlanCell = transmissibilityCalculator.computeRadialTransmissibilityToWellinStimPlanCell(stimPlanCell); out << RadTransInStimPlanCell; + out << "\n"; + } @@ -682,4 +702,5 @@ void RifEclipseExportTools::printTransmissibilityFractureToWell(const std::vecto } + out << "\n"; } diff --git a/ApplicationCode/FileInterface/RifEclipseExportTools.h b/ApplicationCode/FileInterface/RifEclipseExportTools.h index 747e240910..90ec1138fb 100644 --- a/ApplicationCode/FileInterface/RifEclipseExportTools.h +++ b/ApplicationCode/FileInterface/RifEclipseExportTools.h @@ -54,6 +54,7 @@ public: static void performStimPlanUpscalingAndPrintResults(const std::vector& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid); static void printStimPlanCellsMatrixTransContributions(const std::vector& fractures, RimEclipseCase* caseToApply, QTextStream &out, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid); static void printStimPlanFractureTrans(const std::vector& fractures, QTextStream &out); + static void printTransmissibilityFractureToWell(const std::vector& fractures, QTextStream &out, RimEclipseCase* caseToApply); static void printCOMPDATvalues(QTextStream & out, RigFractureData &fracData, RimFracture* fracture, RimWellPath* wellPath, RimEclipseWell* simWell, const RigMainGrid* mainGrid); @@ -64,5 +65,4 @@ public: private: - static void printTransmissibilityFractureToWell(const std::vector& fractures, QTextStream &out, RimEclipseCase* caseToApply); }; diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp index 7c039f53b8..278d1ca89e 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.cpp @@ -65,8 +65,10 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate(void) CAF_PDM_InitField(¶meterForPolygon, "parameterForPolyton", QString(""), "Parameter", "", "", ""); CAF_PDM_InitField(&activeTimeStepIndex, "activeTimeStepIndex", 0, "Active TimeStep Index", "", "", ""); - CAF_PDM_InitField(&showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", "") + CAF_PDM_InitField(&showStimPlanMesh, "showStimPlanMesh", true, "Show StimPlan Mesh", "", "", ""); + //TODO: Is this correct way of doing this...? + wellCenterStimPlanCellIJ = std::make_pair(0, 0); } //-------------------------------------------------------------------------------------------------- @@ -818,7 +820,8 @@ void RimStimPlanFractureTemplate::setupStimPlanCells() QString resultUnitFromColors = activeView->stimPlanColors->unit(); std::vector stimPlanCells; - wellCenterStimPlanCell = nullptr; + + bool wellCenterStimPlanCellFound = false; std::vector> displayPropertyValuesAtTimeStep = getMirroredDataAtTimeIndex(resultNameFromColors, resultUnitFromColors, activeTimeStepIndex); @@ -835,20 +838,20 @@ void RimStimPlanFractureTemplate::setupStimPlanCells() std::vector depthCoords; for (int i = 0; i < depthCoordsAtNodes.size() - 1; i++) depthCoords.push_back((depthCoordsAtNodes[i] + depthCoordsAtNodes[i + 1]) / 2); - for (int j = 0; j < xCoords.size() - 1; j++) + for (int i = 0; i < xCoords.size() - 1; i++) { - for (int i = 0; i < depthCoords.size() - 1; i++) + for (int j = 0; j < depthCoords.size() - 1; j++) { std::vector cellPolygon; - cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j]), static_cast(depthCoords[i]), 0.0)); - cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j + 1]), static_cast(depthCoords[i]), 0.0)); - cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j + 1]), static_cast(depthCoords[i + 1]), 0.0)); - cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[j]), static_cast(depthCoords[i + 1]), 0.0)); + cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j]), 0.0)); + cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j]), 0.0)); + cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i + 1]), static_cast(depthCoords[j + 1]), 0.0)); + cellPolygon.push_back(cvf::Vec3d(static_cast(xCoords[i]), static_cast(depthCoords[j + 1]), 0.0)); RigStimPlanCell stimPlanCell(cellPolygon, i, j); if (conductivityValuesAtTimeStep.size() > 0) //Assuming vector to be of correct length, or no values { - stimPlanCell.setConductivityValue(conductivityValuesAtTimeStep[i + 1][j + 1]); + stimPlanCell.setConductivityValue(conductivityValuesAtTimeStep[j + 1][i + 1]); } else { @@ -857,7 +860,7 @@ void RimStimPlanFractureTemplate::setupStimPlanCells() if (displayPropertyValuesAtTimeStep.size() > 0) { - stimPlanCell.setDisplayValue(displayPropertyValuesAtTimeStep[i + 1][j + 1]); + stimPlanCell.setDisplayValue(displayPropertyValuesAtTimeStep[j + 1][i + 1]); } else { @@ -866,9 +869,13 @@ void RimStimPlanFractureTemplate::setupStimPlanCells() if (cellPolygon[0].x() < 0.0 && cellPolygon[1].x() > 0.0) { - if (cellPolygon[1].y() < 0.0 && cellPolygon[2].y() > 0.0) + if (cellPolygon[1].y() > 0.0 && cellPolygon[2].y() < 0.0) { - wellCenterStimPlanCell = &stimPlanCell; + wellCenterStimPlanCellIJ = std::make_pair(stimPlanCell.getI(), stimPlanCell.getJ()); + RiaLogging::debug(QString("Setting wellCenterStimPlanCell at cell %1, %2"). + arg(QString::number(stimPlanCell.getI()), QString::number(stimPlanCell.getJ()))); + + wellCenterStimPlanCellFound = true; } } @@ -876,6 +883,12 @@ void RimStimPlanFractureTemplate::setupStimPlanCells() } } + if (!wellCenterStimPlanCellFound) + { + RiaLogging::error("Did not find stim plan cell at well crossing!"); + } + + m_stimPlanCells = stimPlanCells; } @@ -936,9 +949,40 @@ std::vector RimStimPlanFractureTemplate::getStimPlanColPolygon(size_ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigStimPlanCell* RimStimPlanFractureTemplate::getStimPlanCellAtWell() +std::pair RimStimPlanFractureTemplate::getStimPlanCellAtWellCenter() { - return wellCenterStimPlanCell; + return wellCenterStimPlanCellIJ; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RimStimPlanFractureTemplate::getGlobalIndexFromIJ(size_t i, size_t j) +{ + size_t length_I = stimPlanGridNumberOfRows() - 1; + size_t globIndex = j * length_I + i; + + return globIndex; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigStimPlanCell& RimStimPlanFractureTemplate::stimPlanCellFromIndex(size_t index) const +{ + if (index < m_stimPlanCells.size()) + { + const RigStimPlanCell& cell = m_stimPlanCells[index]; + return cell; + } + else + { + //TODO: Better error handling? + RiaLogging::error("Requesting non-existent StimPlanCell"); + RiaLogging::error("Returning cell 0, results will be invalid"); + const RigStimPlanCell& cell = m_stimPlanCells[0]; + return cell; + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h index 4693bba73d..da5f91838e 100644 --- a/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h +++ b/ApplicationCode/ProjectDataModel/RimStimPlanFractureTemplate.h @@ -81,7 +81,10 @@ public: std::vector getStimPlanRowPolygon(size_t i); std::vector getStimPlanColPolygon(size_t j); - RigStimPlanCell* getStimPlanCellAtWell(); + std::pair getStimPlanCellAtWellCenter(); + + size_t getGlobalIndexFromIJ(size_t i, size_t j); //TODO: should be const? + const RigStimPlanCell& stimPlanCellFromIndex(size_t index) const; //TODO: Functions for finding perforated stimPlanCells //Radial flow: Single cell (at 0,0) @@ -96,6 +99,7 @@ public: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; + protected: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override; @@ -119,5 +123,5 @@ private: caf::PdmField m_stimPlanFileName; cvf::ref m_stimPlanFractureDefinitionData; std::vector m_stimPlanCells; - RigStimPlanCell* wellCenterStimPlanCell; + std::pair wellCenterStimPlanCellIJ; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFracture.h b/ApplicationCode/ReservoirDataModel/RigFracture.h index d5a1eb721d..dcf43489ad 100644 --- a/ApplicationCode/ReservoirDataModel/RigFracture.h +++ b/ApplicationCode/ReservoirDataModel/RigFracture.h @@ -65,6 +65,9 @@ public: void addContributingEclipseCell(size_t eclipseCell, double transmissibility); private: + double performationLenghtVertical; + double performationLenghtHorizontal; + std::vector contributingEclipseCells; std::vector contributingEclipseCellTransmisibilities; @@ -90,10 +93,12 @@ public: std::vector m_fractureData; void addStimPlanCellFractureCell(RigFractureStimPlanCellData fracStimPlanCellData); + private: std::vector m_triangleIndices; std::vector m_nodeCoords; - std::vector m_stimPlanCellsFractureData; + std::vector m_stimPlanCellsFractureData; + std::vector m_perforatedStimPlanCellsIndex; }; diff --git a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp index 69959365db..10c4eb12bc 100644 --- a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp +++ b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.cpp @@ -80,7 +80,7 @@ RigFractureTransCalc::RigFractureTransCalc(RimEclipseCase* caseToApply, RimFract //-------------------------------------------------------------------------------------------------- /// TODO: Document equation //-------------------------------------------------------------------------------------------------- -void RigFractureTransCalc::computeTransmissibility() +void RigFractureTransCalc::computeTransmissibilityFromPolygonWithInfiniteConductivityInFracture() { if (m_fracture->attachedFractureDefinition()->fractureConductivity == RimFractureTemplate::FINITE_CONDUCTIVITY) { @@ -728,21 +728,22 @@ void RigFractureTransCalc::computeUpscaledPropertyFromStimPlan( QString resultNa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigFractureTransCalc::computeStimPlanCellTransmissibilityInFracture(RigStimPlanCell* stimPlanCell) +void RigFractureTransCalc::computeStimPlanCellTransmissibilityInFracture(const RigStimPlanCell& stimPlanCell) { - double verticalSideLength = stimPlanCell->cellSizeX(); - double horisontalSideLength = stimPlanCell->cellSizeZ(); + double verticalSideLength = stimPlanCell.cellSizeX(); + double horisontalSideLength = stimPlanCell.cellSizeZ(); - double verticalTrans = stimPlanCell->getConductivtyValue() * verticalSideLength / (horisontalSideLength / 2); - double horizontalTrans = stimPlanCell->getConductivtyValue() * horisontalSideLength / (verticalSideLength / 2); + double verticalTrans = stimPlanCell.getConductivtyValue() * verticalSideLength / (horisontalSideLength / 2); + double horizontalTrans = stimPlanCell.getConductivtyValue() * horisontalSideLength / (verticalSideLength / 2); - stimPlanCell->setTransmissibilityInFracture(verticalTrans, horizontalTrans); + //TODO: Ta bort const??? +// stimPlanCell.setTransmissibilityInFracture(verticalTrans, horizontalTrans); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigFractureTransCalc::computeRadialTransmissibilityToWellinStimPlanCell(RigStimPlanCell* stimPlanCell) +double RigFractureTransCalc::computeRadialTransmissibilityToWellinStimPlanCell(const RigStimPlanCell& stimPlanCell) { if (m_fracture->attachedFractureDefinition()->orientation == RimFractureTemplate::ALONG_WELL_PATH) return cvf::UNDEFINED_DOUBLE; @@ -753,9 +754,9 @@ double RigFractureTransCalc::computeRadialTransmissibilityToWellinStimPlanCell(R } double ro = 0.14 * cvf::Math::sqrt( - pow(stimPlanCell->cellSizeX(), 2.0) + pow(stimPlanCell->cellSizeZ(), 2)); + pow(stimPlanCell.cellSizeX(), 2.0) + pow(stimPlanCell.cellSizeZ(), 2)); - double Tc = 2 * cvf::PI_D * cDarcy() * stimPlanCell->getConductivtyValue() / + double Tc = 2 * cvf::PI_D * cDarcy() * stimPlanCell.getConductivtyValue() / (log(ro / m_fracture->wellRadius()) + m_fracture->attachedFractureDefinition()->skinFactor() ); Tc = Tc * areaScalingFactor; @@ -766,18 +767,18 @@ double RigFractureTransCalc::computeRadialTransmissibilityToWellinStimPlanCell(R //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigFractureTransCalc::computeLinearTransmissibilityToWellinStimPlanCell(RigStimPlanCell* stimPlanCell, double perforationLengthVertical, double perforationLengthHorizontal) +double RigFractureTransCalc::computeLinearTransmissibilityToWellinStimPlanCell(const RigStimPlanCell& stimPlanCell, double perforationLengthVertical, double perforationLengthHorizontal) { - double TcPrefix = 8 * cDarcy() * stimPlanCell->getConductivtyValue(); + double TcPrefix = 8 * cDarcy() * stimPlanCell.getConductivtyValue(); double DzPerf = perforationLengthVertical * m_fracture->perforationEfficiency(); double DxPerf = perforationLengthHorizontal * m_fracture->perforationEfficiency(); double TcZ = TcPrefix * DzPerf / - (stimPlanCell->cellSizeX() + m_fracture->attachedFractureDefinition()->skinFactor() * DzPerf / cvf::PI_D); + (stimPlanCell.cellSizeX() + m_fracture->attachedFractureDefinition()->skinFactor() * DzPerf / cvf::PI_D); double TcX = TcPrefix * DxPerf / - (stimPlanCell->cellSizeZ() + m_fracture->attachedFractureDefinition()->skinFactor() * DxPerf / cvf::PI_D); + (stimPlanCell.cellSizeZ() + m_fracture->attachedFractureDefinition()->skinFactor() * DxPerf / cvf::PI_D); double Tc = cvf::Math::sqrt(pow(TcX, 2) + pow(TcZ, 2)); return Tc; diff --git a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h index 57fd6cdee4..488f5ed1d5 100644 --- a/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h +++ b/ApplicationCode/ReservoirDataModel/RigFractureTransCalc.h @@ -46,25 +46,23 @@ class RigFractureTransCalc public: explicit RigFractureTransCalc(RimEclipseCase* caseToApply, RimFracture* fracture); - void computeTransmissibility(); + // Calculations based on fracture polygon and eclipse grid cells + void computeTransmissibilityFromPolygonWithInfiniteConductivityInFracture(); bool planeCellIntersectionPolygons(size_t cellindex, std::vector > & polygons, cvf::Vec3d & localX, cvf::Vec3d & localY, cvf::Vec3d & localZ); - + // Functions needed for upscaling from StimPlan grid to Eclipse Grid, for transmissibility calculations on eclipse grid + // Obsolete if final calculations will be done on the stimPlan grid void computeUpscaledPropertyFromStimPlan(QString resultName, QString resultUnit, size_t timeStepIndex); std::pair flowAcrossLayersUpscaling(QString resultName, QString resultUnit, size_t timeStepIndex, RimDefines::UnitSystem unitSystem, size_t eclipseCellIndex); double computeHAupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); double computeAHupscale(RimStimPlanFractureTemplate* fracTemplateStimPlan, std::vector stimPlanCells, std::vector planeCellPolygon, cvf::Vec3d directionAlongLayers, cvf::Vec3d directionAcrossLayers); - static double arithmeticAverage(std::vector values); - double cDarcy(); + // Calculations based on StimPlan grid void calculateStimPlanCellsMatrixTransmissibility(RigStimPlanCell* stimPlanCell, RigFractureStimPlanCellData* fracStimPlanCellData); - - static void computeStimPlanCellTransmissibilityInFracture(RigStimPlanCell* stimPlanCell); - double computeRadialTransmissibilityToWellinStimPlanCell(RigStimPlanCell* stimPlanCell); - double computeLinearTransmissibilityToWellinStimPlanCell(RigStimPlanCell* stimPlanCell, double perforationLengthVertical, double perforationLengthHorizontal); - - + static void computeStimPlanCellTransmissibilityInFracture(const RigStimPlanCell& stimPlanCell); + double computeRadialTransmissibilityToWellinStimPlanCell(const RigStimPlanCell& stimPlanCell); + double computeLinearTransmissibilityToWellinStimPlanCell(const RigStimPlanCell& stimPlanCell, double perforationLengthVertical, double perforationLengthHorizontal); static std::vector getRowOfStimPlanCells(std::vector& allStimPlanCells, size_t i); static std::vector getColOfStimPlanCells(std::vector& allStimPlanCells, size_t j); @@ -77,6 +75,7 @@ private: RimFracture* m_fracture; RimDefines::UnitSystem m_unitForCalculation; - double calculateMatrixTransmissibility(double permX, double NTG, double Ay, double dx, double skinfactor, double fractureAreaWeightedlength); + double calculateMatrixTransmissibility(double permX, double NTG, double Ay, double dx, double skinfactor, double fractureAreaWeightedlength); + double cDarcy(); }; diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp index c9b6ce70b5..857ef5ab29 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.cpp @@ -56,17 +56,19 @@ void RigStimPlanCell::setTransmissibilityInFracture(double valueHorizontal, doub //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigStimPlanCell::cellSizeX() +double RigStimPlanCell::cellSizeX() const { //The polygon corners are always stored in the same order - return (m_polygon[1] - m_polygon[0]).length(); + if (m_polygon.size()>1) return (m_polygon[1] - m_polygon[0]).length(); + return cvf::UNDEFINED_DOUBLE; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RigStimPlanCell::cellSizeZ() +double RigStimPlanCell::cellSizeZ() const { - return (m_polygon[2] - m_polygon[1]).length(); + if (m_polygon.size()>2) return (m_polygon[2] - m_polygon[1]).length(); + return cvf::UNDEFINED_DOUBLE; } diff --git a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h index fe03cf2527..2a7b23d180 100644 --- a/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h +++ b/ApplicationCode/ReservoirDataModel/RigStimPlanCell.h @@ -38,7 +38,7 @@ public: virtual ~RigStimPlanCell(); std::vector getPolygon() { return m_polygon; } - double getConductivtyValue() { return m_concutivityValue; } + double getConductivtyValue() const { return m_concutivityValue; } double getDisplayValue() { return m_displayValue; } size_t getI() { return m_i; } size_t getJ() { return m_j; } @@ -50,8 +50,8 @@ public: void setDisplayValue(double value) { m_displayValue = value; }; void setTransmissibilityInFracture(double valueHorizontal, double valueVertical); - double cellSizeX(); - double cellSizeZ(); + double cellSizeX() const; + double cellSizeZ() const; private: std::vector m_polygon; double m_displayValue;