diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index 7e1c7b22ca..704cd50564 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -302,11 +302,11 @@ std::vector RicExportFractureCompletionsImpl::generateCompdat RigTransmissibilityCondenser scaledCondenser = transCondenser; // 1. Scale matrix to fracture transmissibilities by matrix to fracture pressure std::map originalLumpedMatrixToFractureTrans = - scaledCondenser.scaleMatrixTransmissibilitiesByPressureMatrixFracture(actCellInfo, - currentWellPressure, - *currentMatrixPressures, - pressureDropScaling == - MATRIX_TO_FRACTURE_DP_OVER_AVG_DP); + scaledCondenser.scaleMatrixToFracTransByMatrixFracDP(actCellInfo, + currentWellPressure, + *currentMatrixPressures, + pressureDropScaling == + MATRIX_TO_FRACTURE_DP_OVER_AVG_DP); // 2: Calculate new external transmissibilities scaledCondenser.calculateCondensedTransmissibilities(); @@ -333,7 +333,7 @@ std::vector RicExportFractureCompletionsImpl::generateCompdat // From Høgstøl "Hydraulic Fracturing SoW 2.8 outside contract Fracture Transmissibility Calculations for Differential Depletion": // 1. Scale matrix to fracture transmissibilities by matrix to well pressure std::map originalLumpedMatrixToFractureTrans = - scaledCondenser.scaleMatrixTransmissibilitiesByPressureMatrixWell( + scaledCondenser.scaleMatrixToFracTransByMatrixWellDP( actCellInfo, originalWellPressure, currentWellPressure, *originalMatrixPressures, *currentMatrixPressures); // 2: Calculate new external transmissibilities scaledCondenser.calculateCondensedTransmissibilities(); diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.cpp b/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.cpp index 4fc22fe255..c10e03f720 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.cpp +++ b/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.cpp @@ -45,7 +45,7 @@ double RigFractureTransmissibilityEquations::centerToCenterFractureCellTrans(dou } //-------------------------------------------------------------------------------------------------- -/// T_16 +/// //-------------------------------------------------------------------------------------------------- double RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(double fractureCellConductivity, double fractureCellSizeX, @@ -70,7 +70,7 @@ double RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(doubl } //-------------------------------------------------------------------------------------------------- -/// T_16 +/// //-------------------------------------------------------------------------------------------------- double RigFractureTransmissibilityEquations::fractureCellToWellLinearTrans(double fractureCellConductivity, double fractureCellSizeX, @@ -98,7 +98,7 @@ double RigFractureTransmissibilityEquations::fractureCellToWellLinearTrans(doubl //-------------------------------------------------------------------------------------------------- -/// T_51 +/// //-------------------------------------------------------------------------------------------------- double RigFractureTransmissibilityEquations::matrixToFractureTrans(double perm, double NTG, @@ -123,40 +123,46 @@ double RigFractureTransmissibilityEquations::matrixToFractureTrans(double perm, } //-------------------------------------------------------------------------------------------------- -/// T'_51 +/// //-------------------------------------------------------------------------------------------------- -double RigFractureTransmissibilityEquations::pressureScalingMatrixToFractureTrans(double originalWellPressure, double wellPressure, double originalMatrixPressure, double matrixPressure) +double RigFractureTransmissibilityEquations::pressureScalingMatrixToFractureTransPDDHC(double originalWellPressure, + double wellPressure, + double originalMatrixPressure, + double matrixPressure) { double pressureDelta = originalMatrixPressure - originalWellPressure; if (cvf::Math::abs(pressureDelta) > EPSILON) { return (matrixPressure - wellPressure) / pressureDelta; } + CVF_ASSERT(false); return 0.0; } //-------------------------------------------------------------------------------------------------- -/// T'_16 +/// //-------------------------------------------------------------------------------------------------- -double RigFractureTransmissibilityEquations::effectiveInternalFractureToWellTrans(double scaledMatrixToFractureTrans, double scaledMatrixToWellTrans) +double RigFractureTransmissibilityEquations::effectiveInternalFractureToWellTransPDDHC(double sumScaledMatrixToFractureTrans, + double scaledMatrixToWellTrans) { - double divisor = scaledMatrixToFractureTrans - scaledMatrixToWellTrans; + double divisor = sumScaledMatrixToFractureTrans - scaledMatrixToWellTrans; if (cvf::Math::abs(divisor) > EPSILON) { - return (scaledMatrixToFractureTrans * scaledMatrixToWellTrans) / divisor; + return (sumScaledMatrixToFractureTrans * scaledMatrixToWellTrans) / divisor; } return 0.0; } //-------------------------------------------------------------------------------------------------- -///T^dp_56 +/// //-------------------------------------------------------------------------------------------------- -double RigFractureTransmissibilityEquations::effectiveMatrixToWellTrans(double originalMatrixToFractureTrans, double effectiveInternalFractureToWellTrans) +double RigFractureTransmissibilityEquations::effectiveMatrixToWellTransPDDHC(double sumOriginalMatrixToFractureTrans, + double effectiveInternalFractureToWellTrans) { - double divisor = originalMatrixToFractureTrans + effectiveInternalFractureToWellTrans; + double divisor = sumOriginalMatrixToFractureTrans + effectiveInternalFractureToWellTrans; if (cvf::Math::abs(divisor) > EPSILON) { - return (originalMatrixToFractureTrans * effectiveInternalFractureToWellTrans) / divisor; + return (sumOriginalMatrixToFractureTrans * effectiveInternalFractureToWellTrans) / divisor; } return 0.0; } diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.h b/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.h index 93655f8664..70172139ce 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.h +++ b/ApplicationCode/ReservoirDataModel/Completions/RigFractureTransmissibilityEquations.h @@ -1,26 +1,25 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017- Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- class RigFractureTransmissibilityEquations { @@ -33,49 +32,48 @@ public: double sideLengthNormalTransCell2, double cDarcyForRelevantUnit); - static double fractureCellToWellRadialTrans(double fractureCellConductivity, + static double fractureCellToWellRadialTrans(double fractureCellConductivity, double fractureCellSizeX, double fractureCellSizeZ, - double wellRadius, - double skinFactor, + double wellRadius, + double skinFactor, double cDarcyForRelevantUnit); static double fractureCellToWellLinearTrans(double fractureConductivity, double fractureCellSizeX, double fractureCellSizeZ, - double perforationLengthVertical, - double perforationLengthHorizontal, + double perforationLengthVertical, + double perforationLengthHorizontal, double perforationEfficiency, double skinfactor, double cDarcyForRelevantUnit); - static double matrixToFractureTrans(double permX, - double NTG, - double Ay, - double dx, - double skinfactor, - double fractureAreaWeightedlength, + static double matrixToFractureTrans(double permX, + double NTG, + double Ay, + double dx, + double skinfactor, + double fractureAreaWeightedlength, double cDarcy); - static double pressureScalingMatrixToFractureTrans(double originalWellPressure, - double wellPressure, - double originalMatrixPressure, - double matrixPressure); + // Pressure Differential Depletion Høgstøl-correction (PDDHC) methods. + static double pressureScalingMatrixToFractureTransPDDHC(double originalWellPressure, + double wellPressure, + double originalMatrixPressure, + double matrixPressure); - - static double effectiveInternalFractureToWellTrans(double scaledMatrixToFractureTrans, - double scaledMatrixToWellTrans); + static double effectiveInternalFractureToWellTransPDDHC(double sumScaledMatrixToFractureTrans, + double scaledMatrixToWellTrans); - static double effectiveMatrixToWellTrans(double originalMatrixToFractureTrans, - double effectiveInternalFractureToWellTrans); + static double effectiveMatrixToWellTransPDDHC(double sumOriginalMatrixToFractureTrans, + double effectiveInternalFractureToWellTrans); private: - static double centerToEdgeFractureCellTrans(double conductivity, - double sideLengthParallellTrans, + static double centerToEdgeFractureCellTrans(double conductivity, + double sideLengthParallellTrans, double sideLengthNormalTrans, double cDarcyForRelevantUnit); private: static const double EPSILON; - }; diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp b/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp index ce116c3d95..f2d7ffc80a 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp +++ b/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp @@ -123,7 +123,7 @@ double RigTransmissibilityCondenser::condensedTransmissibility(CellAddress exter //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::map RigTransmissibilityCondenser::scaleMatrixTransmissibilitiesByPressureMatrixWell( +std::map RigTransmissibilityCondenser::scaleMatrixToFracTransByMatrixWellDP( const RigActiveCellInfo* actCellInfo, double originalWellPressure, double currentWellPressure, @@ -148,7 +148,7 @@ std::map RigTransmissibilityCondenser::scaleMatrixTransmissibili originalLumpedMatrixToFractureTrans[globalMatrixCellIdx] += jt->second; - jt->second *= RigFractureTransmissibilityEquations::pressureScalingMatrixToFractureTrans( + jt->second *= RigFractureTransmissibilityEquations::pressureScalingMatrixToFractureTransPDDHC( originalWellPressure, currentWellPressure, originalMatrixPressures[eclipseResultIndex], @@ -164,7 +164,7 @@ std::map RigTransmissibilityCondenser::scaleMatrixTransmissibili //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::map RigTransmissibilityCondenser::scaleMatrixTransmissibilitiesByPressureMatrixFracture(const RigActiveCellInfo* actCellInfo, double currentWellPressure, const std::vector& currentMatrixPressures, bool divideByAverageDP) +std::map RigTransmissibilityCondenser::scaleMatrixToFracTransByMatrixFracDP(const RigActiveCellInfo* actCellInfo, double currentWellPressure, const std::vector& currentMatrixPressures, bool divideByAverageDP) { // Solve for fracture pressures Eigen::VectorXd matrixPressures(m_Tie.cols()); @@ -188,14 +188,14 @@ std::map RigTransmissibilityCondenser::scaleMatrixTransmissibili Eigen::VectorXd fracturePressures = m_TiiInv * (m_Tie * matrixPressures * -1.0); // Extract fracture pressures into a map - std::map fracturePressureMap; + std::map fractureCellToPressureMap; { size_t rowIndex = 0u; for (const ConnectionTransmissibility& connectionTrans : m_neighborTransmissibilities) { if (connectionTrans.first.m_cellIndexSpace == CellAddress::STIMPLAN) { - fracturePressureMap[connectionTrans.first.m_globalCellIdx] = fracturePressures[rowIndex++]; + fractureCellToPressureMap[connectionTrans.first.m_globalCellIdx] = fracturePressures[rowIndex++]; } } } @@ -208,15 +208,17 @@ std::map RigTransmissibilityCondenser::scaleMatrixTransmissibili if (it->first.m_cellIndexSpace == CellAddress::STIMPLAN) { size_t globalFractureCellIdx = it->first.m_globalCellIdx; - double fracturePressure = fracturePressureMap[globalFractureCellIdx]; + double fracturePressure = fractureCellToPressureMap[globalFractureCellIdx]; for (auto jt = it->second.begin(); jt != it->second.end(); ++jt) { if (jt->first.m_cellIndexSpace == CellAddress::ECLIPSE) { size_t globalMatrixCellIdx = jt->first.m_globalCellIdx; + size_t eclipseResultIndex = actCellInfo->cellResultIndex(globalMatrixCellIdx); CVF_ASSERT(eclipseResultIndex < currentMatrixPressures.size()); + double matrixPressure = currentMatrixPressures[eclipseResultIndex]; double pressureDrop = std::abs(matrixPressure - fracturePressure); meanCalculator.addValueAndWeight(pressureDrop, 1.0); @@ -241,15 +243,17 @@ std::map RigTransmissibilityCondenser::scaleMatrixTransmissibili if (it->first.m_cellIndexSpace == CellAddress::STIMPLAN) { size_t globalFractureCellIdx = it->first.m_globalCellIdx; - double fracturePressure = fracturePressureMap[globalFractureCellIdx]; + double fracturePressure = fractureCellToPressureMap[globalFractureCellIdx]; for (auto jt = it->second.begin(); jt != it->second.end(); ++jt) { if (jt->first.m_cellIndexSpace == CellAddress::ECLIPSE) { size_t globalMatrixCellIdx = jt->first.m_globalCellIdx; + size_t eclipseResultIndex = actCellInfo->cellResultIndex(globalMatrixCellIdx); CVF_ASSERT(eclipseResultIndex < currentMatrixPressures.size()); + double matrixPressure = currentMatrixPressures[eclipseResultIndex]; double pressureDrop = std::abs(matrixPressure - fracturePressure); @@ -301,7 +305,7 @@ std::map RigTransmissibilityCondenser::calculateFicticiousFractu double scaledMatrixToWellTrans = condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 }); // T'_fjw fictitiousFractureToWellTrans[globalMatrixCellIdx] = - RigFractureTransmissibilityEquations::effectiveInternalFractureToWellTrans(scaledMatrixToFractureTrans, scaledMatrixToWellTrans); + RigFractureTransmissibilityEquations::effectiveInternalFractureToWellTransPDDHC(scaledMatrixToFractureTrans, scaledMatrixToWellTrans); } } return fictitiousFractureToWellTrans; @@ -331,7 +335,7 @@ std::map RigTransmissibilityCondenser::calculateEffectiveMatrixT double fictitiousFractureToWellTrans = fictitiousFractureToWellIt->second; // T^dp_mw effectiveMatrixToWellTrans[globalMatrixCellIdx] = - RigFractureTransmissibilityEquations::effectiveMatrixToWellTrans(lumpedOriginalMatrixToFractureT, fictitiousFractureToWellTrans); + RigFractureTransmissibilityEquations::effectiveMatrixToWellTransPDDHC(lumpedOriginalMatrixToFractureT, fictitiousFractureToWellTrans); } } return effectiveMatrixToWellTrans; diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.h b/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.h index f9650f8907..9d9f563381 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.h +++ b/ApplicationCode/ReservoirDataModel/Completions/RigTransmissibilityCondenser.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 - Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -23,8 +23,8 @@ #include #include -#include #include +#include class RigActiveCellInfo; class RigMainGrid; @@ -32,7 +32,7 @@ class RimStimPlanFractureTemplate; class RigFractureGrid; //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- class RigTransmissibilityCondenser { @@ -43,38 +43,45 @@ public: class CellAddress { - public: - enum CellIndexSpace { ECLIPSE, STIMPLAN, WELL}; + public: + enum CellIndexSpace + { + ECLIPSE, + STIMPLAN, + WELL + }; - CellAddress(): m_isExternal(false), - m_cellIndexSpace(STIMPLAN), - m_globalCellIdx(-1) - {} - CellAddress(bool isExternal, - CellIndexSpace cellType, - size_t globalCellIdx) - : m_isExternal(isExternal), - m_cellIndexSpace(cellType), - m_globalCellIdx(globalCellIdx) - {} + CellAddress() + : m_isExternal(false) + , m_cellIndexSpace(STIMPLAN) + , m_globalCellIdx(-1) + { + } + CellAddress(bool isExternal, CellIndexSpace cellType, size_t globalCellIdx) + : m_isExternal(isExternal) + , m_cellIndexSpace(cellType) + , m_globalCellIdx(globalCellIdx) + { + } bool m_isExternal; CellIndexSpace m_cellIndexSpace; size_t m_globalCellIdx; - bool operator==(const CellAddress& o) { - return (m_isExternal == o.m_isExternal) && (m_cellIndexSpace == o.m_cellIndexSpace) && (m_globalCellIdx == o.m_globalCellIdx); + return (m_isExternal == o.m_isExternal) && (m_cellIndexSpace == o.m_cellIndexSpace) && + (m_globalCellIdx == o.m_globalCellIdx); } // Ordering external after internal is important for the matrix order internally bool operator<(const CellAddress& other) const { - if (m_isExternal != other.m_isExternal) return !m_isExternal; // Internal cells < External cells - if (m_cellIndexSpace != other.m_cellIndexSpace)return m_cellIndexSpace < other.m_cellIndexSpace; // Eclipse < StimPlan - if (m_globalCellIdx != other.m_globalCellIdx) return m_globalCellIdx < other.m_globalCellIdx; + if (m_isExternal != other.m_isExternal) return !m_isExternal; // Internal cells < External cells + if (m_cellIndexSpace != other.m_cellIndexSpace) + return m_cellIndexSpace < other.m_cellIndexSpace; // Eclipse < StimPlan + if (m_globalCellIdx != other.m_globalCellIdx) return m_globalCellIdx < other.m_globalCellIdx; return false; } }; @@ -83,29 +90,36 @@ public: std::set externalCells(); - double condensedTransmissibility( CellAddress externalCell1, CellAddress externalCell2); + double condensedTransmissibility(CellAddress externalCell1, CellAddress externalCell2); std::string neighborTransDebugOutput(const RigMainGrid* mainGrid, const RigFractureGrid* fractureGrid); std::string condensedTransDebugOutput(const RigMainGrid* mainGrid, const RigFractureGrid* fractureGrid); - std::map scaleMatrixTransmissibilitiesByPressureMatrixWell(const RigActiveCellInfo* actCellInfo, double originalWellPressure, double currentWellPressure, const std::vector& originalMatrixPressures, const std::vector& currentMatrixPressures); - std::map scaleMatrixTransmissibilitiesByPressureMatrixFracture(const RigActiveCellInfo* actCellInfo, double currentWellPressure, const std::vector& currentMatrixPressures, bool divideByAverageDP); + std::map scaleMatrixToFracTransByMatrixWellDP(const RigActiveCellInfo* actCellInfo, + double originalWellPressure, + double currentWellPressure, + const std::vector& originalMatrixPressures, + const std::vector& currentMatrixPressures); + std::map scaleMatrixToFracTransByMatrixFracDP(const RigActiveCellInfo* actCellInfo, + double currentWellPressure, + const std::vector& currentMatrixPressures, + bool divideByAverageDP); std::map calculateFicticiousFractureToWellTransmissibilities(); - std::map calculateEffectiveMatrixToWellTransmissibilities(const std::map& originalLumpedMatrixToFractureTrans, - const std::map& ficticuousFractureToWellTransMap); + std::map + calculateEffectiveMatrixToWellTransmissibilities(const std::map& originalLumpedMatrixToFractureTrans, + const std::map& ficticuousFractureToWellTransMap); void calculateCondensedTransmissibilities(); protected: - typedef std::pair> ConnectionTransmissibility; typedef std::map> ConnectionTransmissibilities; - + ConnectionTransmissibilities m_neighborTransmissibilities; ConnectionTransmissibilities m_condensedTransmissibilities; - std::set m_externalCellAddrSet; + std::set m_externalCellAddrSet; - Eigen::MatrixXd m_TiiInv; - Eigen::MatrixXd m_Tie; + Eigen::MatrixXd m_TiiInv; + Eigen::MatrixXd m_Tie; };