diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 9e06907362..5898641c3e 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -1658,27 +1658,31 @@ std::vector RicWellPathExportCompletionDataFeatureImpl::gener CellDirection direction = calculateDirectionInCell(settings.caseToApply, cell.globCellIndex, cell.intersectionLengthsInCellCS); - double transmissibility = calculateTransmissibility(settings.caseToApply, - wellPath, - cell.intersectionLengthsInCellCS, - interval->skinFactor(), - interval->diameter(unitSystem) / 2, - cell.globCellIndex, - settings.useLateralNTG); + const double transmissibilityForCell = calculateTransmissibility(settings.caseToApply, + wellPath, + cell.intersectionLengthsInCellCS, + interval->skinFactor(), + interval->diameter(unitSystem) / 2, + cell.globCellIndex, + settings.useLateralNTG); - double dFactor = calculateDFactor(settings.caseToApply, - cell.intersectionLengthsInCellCS, - interval->diameter(unitSystem) / 2, - cell.globCellIndex, - wellPath->perforationIntervalCollection()->nonDarcyParameters()); + const double krFactor = 1.0; + const double effectiveTransmissibilityForCell = transmissibilityForCell * krFactor; - double kh = calculateKh(settings.caseToApply, cell.intersectionLengthsInCellCS, cell.globCellIndex); + const double dFactor = calculateDFactor(settings.caseToApply, + cell.intersectionLengthsInCellCS, + interval->diameter(unitSystem) / 2, + cell.globCellIndex, + wellPath->perforationIntervalCollection()->nonDarcyParameters(), + transmissibilityForCell); + + const double kh = effectiveTransmissibilityForCell * cell.intersectionLengthsInCellCS.length(); completion.setTransAndWPImultBackgroundDataFromPerforation( - transmissibility, interval->skinFactor(), interval->diameter(unitSystem), dFactor, kh, direction); + transmissibilityForCell, interval->skinFactor(), interval->diameter(unitSystem), dFactor, kh, direction); completion.addMetadata("Perforation Completion", QString("MD In: %1 - MD Out: %2").arg(cell.startMD).arg(cell.endMD) + - QString(" Transmissibility: ") + QString::number(transmissibility)); + QString(" Transmissibility: ") + QString::number(transmissibilityForCell)); completionData.push_back(completion); } } @@ -2360,95 +2364,42 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibility(Rim //-------------------------------------------------------------------------------------------------- double RicWellPathExportCompletionDataFeatureImpl::calculateDFactor(RimEclipseCase* eclipseCase, const cvf::Vec3d& internalCellLengths, - double wellRadius, + const double wellRadius, size_t globalCellIndex, - const RimNonDarcyPerforationParameters* nonDarcyParameters) + const RimNonDarcyPerforationParameters* nonDarcyParameters, + const double effectiveTransmissibilityForCell) { using EQ = RigPerforationTransmissibilityEquations; - // Fetch data - RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); + double porosity = 0.0; + { + RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); - cvf::ref permxAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMX"); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); - cvf::ref permyAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMY"); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); - cvf::ref permzAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMZ"); + eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO"); + cvf::ref poroAccessObject = + RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PORO"); - if (permxAccessObject.isNull() || permyAccessObject.isNull() || permzAccessObject.isNull()) - return std::numeric_limits::infinity(); + if (poroAccessObject.notNull()) + { + porosity = poroAccessObject->cellScalar(globalCellIndex); + } + } - double permx = permxAccessObject->cellScalarGlobIdx(globalCellIndex); - double permy = permyAccessObject->cellScalarGlobIdx(globalCellIndex); - double permz = permzAccessObject->cellScalarGlobIdx(globalCellIndex); - double totalPerm = permx + 0 * permy + 0 * permz; // TODO: Calculate total perm - - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO"); - cvf::ref poroAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PORO"); - - double porosity = poroAccessObject->cellScalar(globalCellIndex); - - // Calculations - double krFactor = 1.0; - double effPerm = EQ::effectivePermeability(totalPerm, krFactor); - - double betaFactor = EQ::betaFactor(nonDarcyParameters->inertialCoefficientBeta0(), - effPerm, - nonDarcyParameters->permeabilityScalingFactor(), - porosity, - nonDarcyParameters->porosityScalingFactor()); + const double betaFactor = EQ::betaFactor(nonDarcyParameters->inertialCoefficientBeta0(), + effectiveTransmissibilityForCell, + nonDarcyParameters->permeabilityScalingFactor(), + porosity, + nonDarcyParameters->porosityScalingFactor()); return EQ::dFactor(nonDarcyParameters->unitConstant(), betaFactor, - effPerm, + effectiveTransmissibilityForCell, internalCellLengths.length(), wellRadius, nonDarcyParameters->relativeGasDensity(), nonDarcyParameters->gasViscosity()); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RicWellPathExportCompletionDataFeatureImpl::calculateKh(RimEclipseCase* eclipseCase, - const cvf::Vec3d& internalCellLengths, - size_t globalCellIndex) -{ - using EQ = RigPerforationTransmissibilityEquations; - - // Fetch data - RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMX"); - cvf::ref permxAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMX"); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMY"); - cvf::ref permyAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMY"); - eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PERMZ"); - cvf::ref permzAccessObject = - RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, 0, RiaDefines::MATRIX_MODEL, 0, "PERMZ"); - - if (permxAccessObject.isNull() || permyAccessObject.isNull() || permzAccessObject.isNull()) - return std::numeric_limits::infinity(); - - double permx = permxAccessObject->cellScalarGlobIdx(globalCellIndex); - double permy = permyAccessObject->cellScalarGlobIdx(globalCellIndex); - double permz = permzAccessObject->cellScalarGlobIdx(globalCellIndex); - double totalPerm = permx + 0 * permy + 0 * permz; // TODO: Calculate total perm - - // Calculations - double krFactor = 1.0; - double effPerm = EQ::effectivePermeability(totalPerm, krFactor); - - return EQ::kh(effPerm, internalCellLengths.length()); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h index 274261881f..7a4e667e7f 100644 --- a/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h +++ b/ApplicationCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h @@ -94,13 +94,10 @@ public: static double calculateDFactor(RimEclipseCase* eclipseCase, const cvf::Vec3d& internalCellLengths, - double wellRadius, + const double wellRadius, size_t globalCellIndex, - const RimNonDarcyPerforationParameters* nonDarcyParameters); - - static double calculateKh(RimEclipseCase* eclipseCase, - const cvf::Vec3d& internalCellLengths, - size_t globalCellIndex); + const RimNonDarcyPerforationParameters* nonDarcyParameters, + const double effectiveTransmissibilityForCell); static void exportCompletions(const std::vector& wellPaths, const std::vector& simWells, diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.cpp b/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.cpp index 8b3c156ddc..d0df5b8a31 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.cpp +++ b/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.cpp @@ -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. // ///////////////////////////////////////////////////////////////////////////////// @@ -25,18 +25,8 @@ const double RigPerforationTransmissibilityEquations::EPSILON = 1.0e-9; - //-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RigPerforationTransmissibilityEquations::effectivePermeability(double permeability, - double krFactor) -{ - return permeability * krFactor; -} - -//-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- double RigPerforationTransmissibilityEquations::betaFactor(double intertialCoefficient, double effectivePermeability, @@ -44,13 +34,14 @@ double RigPerforationTransmissibilityEquations::betaFactor(double intertialCoeff double porosity, double porosityScalingFactor) { - return intertialCoefficient * - std::pow(effectivePermeability, permeabilityScalingFactor) * - std::pow(porosity, porosityScalingFactor); + const double scaledEffectivePermeability = std::pow(effectivePermeability, permeabilityScalingFactor); + const double scaledPorosity = std::pow(porosity, porosityScalingFactor); + + return intertialCoefficient * scaledEffectivePermeability * scaledPorosity; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- double RigPerforationTransmissibilityEquations::dFactor(double unitConstant, double betaFactor, @@ -60,17 +51,19 @@ double RigPerforationTransmissibilityEquations::dFactor(double unitConstant, double gasDenity, double gasViscosity) { - return unitConstant * - betaFactor * - effectivePermeability / perforationLengthInCell * - 1 / wellRadius * - gasDenity / gasViscosity; -} + // clang-format off + // + // Ke 1 gasDensity + // D = alpha * beta * -- * -- * ------------ + // h rw gasViscosity + // + // clang-format on -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RigPerforationTransmissibilityEquations::kh(double effectivePermeability, double perforationLengthInCell) -{ - return effectivePermeability * perforationLengthInCell; + const double keOverH = effectivePermeability / perforationLengthInCell; + const double oneOverRw = 1.0 / wellRadius; + const double gasDensityOverGasViscosity = gasDenity / gasViscosity; + + const double D = unitConstant * betaFactor * keOverH * oneOverRw * gasDensityOverGasViscosity; + + return D; } diff --git a/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.h b/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.h index 8d9d79b078..cc2438ff94 100644 --- a/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.h +++ b/ApplicationCode/ReservoirDataModel/Completions/RigPerforationTransmissibilityEquations.h @@ -24,9 +24,6 @@ class RigPerforationTransmissibilityEquations { public: - static double effectivePermeability(double permeability, - double krFactor); - static double betaFactor(double intertialCoefficient, double effectivePermeability, double permeabilityScalingFactor, @@ -41,9 +38,6 @@ public: double gasDensity, double gasViscosity); - static double kh(double effectivePermeability, - double perforationLengthInCell); - private: static const double EPSILON; };