#7729 MSW : Compute initial measured depth once

Avoid computing value of initial MD multiple times
This commit is contained in:
Magne Sjaastad
2021-05-27 14:14:52 +02:00
parent eba78b2660
commit 1f85adecab
3 changed files with 52 additions and 51 deletions

View File

@@ -23,6 +23,8 @@
#include "RimWellPath.h" #include "RimWellPath.h"
#include <cmath>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -250,10 +250,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForPerforations( Rim
if ( !mswParameters ) return; if ( !mswParameters ) return;
double initialMD = 0.0; // Start measured depth location to export MSW data for. Either based on first auto cellIntersections = generateCellSegments( eclipseCase, wellPath );
// intersection with active grid, or user defined value. double initialMD = computeIntitialMeasuredDepth( eclipseCase, wellPath, mswParameters, cellIntersections );
auto cellIntersections = generateCellSegments( eclipseCase, wellPath, mswParameters, &initialMD );
RicMswExportInfo exportInfo( wellPath, RicMswExportInfo exportInfo( wellPath,
unitSystem, unitSystem,
@@ -329,10 +327,8 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFractures( RimEcl
if ( !mswParameters ) return; if ( !mswParameters ) return;
double initialMD = 0.0; // Start measured depth location to export MSW data for. Either based on first auto cellIntersections = generateCellSegments( eclipseCase, wellPath );
// intersection with active grid, or user defined value. double initialMD = computeIntitialMeasuredDepth( eclipseCase, wellPath, mswParameters, cellIntersections );
auto cellIntersections = generateCellSegments( eclipseCase, wellPath, mswParameters, &initialMD );
RicMswExportInfo exportInfo( wellPath, RicMswExportInfo exportInfo( wellPath,
unitSystem, unitSystem,
@@ -404,11 +400,9 @@ void RicWellPathExportMswCompletionsImpl::exportWellSegmentsForFishbones( RimEcl
return; return;
} }
double initialMD = 0.0; // Start measured depth location to export MSW data for. Either based on first
// intersection with active grid, or user defined value.
auto mswParameters = wellPath->mswCompletionParameters(); auto mswParameters = wellPath->mswCompletionParameters();
auto cellIntersections = generateCellSegments( eclipseCase, wellPath, mswParameters, &initialMD ); auto cellIntersections = generateCellSegments( eclipseCase, wellPath );
double initialMD = computeIntitialMeasuredDepth( eclipseCase, wellPath, mswParameters, cellIntersections );
RiaDefines::EclipseUnitSystem unitSystem = eclipseCase->eclipseCaseData()->unitsType(); RiaDefines::EclipseUnitSystem unitSystem = eclipseCase->eclipseCaseData()->unitsType();
@@ -750,15 +744,11 @@ void RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo(
for ( auto childWellPath : connectedWellPaths ) for ( auto childWellPath : connectedWellPaths )
{ {
auto childMswBranch = createChildMswBranch( childWellPath ); auto childMswBranch = createChildMswBranch( childWellPath );
auto mswParameters = childWellPath->mswCompletionParameters(); auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath );
double startOfChildMD = 0.0; // this is currently not used, as the tie-in MD is used
auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath, mswParameters, &startOfChildMD );
auto initialChildMD = childWellPath->wellPathTieIn()->tieInMeasuredDepth();
generateFishbonesMswExportInfo( eclipseCase, generateFishbonesMswExportInfo( eclipseCase,
childWellPath, childWellPath,
initialChildMD, initialMD,
childCellIntersections, childCellIntersections,
enableSegmentSplitting, enableSegmentSplitting,
exportInfo, exportInfo,
@@ -776,11 +766,9 @@ void RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfoForWell(
gsl::not_null<RicMswExportInfo*> exportInfo, gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch ) gsl::not_null<RicMswBranch*> branch )
{ {
double initialMD = 0.0; // Start measured depth location to export MSW data for. Either based on first
// intersection with active grid, or user defined value.
auto mswParameters = wellPath->mswCompletionParameters(); auto mswParameters = wellPath->mswCompletionParameters();
auto cellIntersections = generateCellSegments( eclipseCase, wellPath, mswParameters, &initialMD ); auto cellIntersections = generateCellSegments( eclipseCase, wellPath );
double initialMD = computeIntitialMeasuredDepth( eclipseCase, wellPath, mswParameters, cellIntersections );
RiaDefines::EclipseUnitSystem unitSystem = eclipseCase->eclipseCaseData()->unitsType(); RiaDefines::EclipseUnitSystem unitSystem = eclipseCase->eclipseCaseData()->unitsType();
@@ -848,15 +836,11 @@ bool RicWellPathExportMswCompletionsImpl::generateFracturesMswExportInfo(
for ( auto childWellPath : connectedWellPaths ) for ( auto childWellPath : connectedWellPaths )
{ {
auto childMswBranch = createChildMswBranch( childWellPath ); auto childMswBranch = createChildMswBranch( childWellPath );
auto mswParameters = childWellPath->mswCompletionParameters(); auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath );
double startOfChildMD = 0.0; // this is currently not used, as the tie-in MD is used
auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath, mswParameters, &startOfChildMD );
auto initialChildMD = childWellPath->wellPathTieIn()->tieInMeasuredDepth();
if ( generateFracturesMswExportInfo( eclipseCase, if ( generateFracturesMswExportInfo( eclipseCase,
childWellPath, childWellPath,
initialChildMD, initialMD,
childCellIntersections, childCellIntersections,
exportInfo, exportInfo,
childMswBranch.get() ) ) childMswBranch.get() ) )
@@ -946,16 +930,12 @@ bool RicWellPathExportMswCompletionsImpl::generatePerforationsMswExportInfo(
for ( auto childWellPath : connectedWellPaths ) for ( auto childWellPath : connectedWellPaths )
{ {
auto childMswBranch = createChildMswBranch( childWellPath ); auto childMswBranch = createChildMswBranch( childWellPath );
auto mswParameters = childWellPath->mswCompletionParameters(); auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath );
double startOfChildMD = 0.0; // this is currently not used, as the tie-in MD is used
auto childCellIntersections = generateCellSegments( eclipseCase, childWellPath, mswParameters, &startOfChildMD );
auto initialChildMD = childWellPath->wellPathTieIn()->tieInMeasuredDepth();
if ( generatePerforationsMswExportInfo( eclipseCase, if ( generatePerforationsMswExportInfo( eclipseCase,
childWellPath, childWellPath,
timeStep, timeStep,
initialChildMD, initialMD,
childCellIntersections, childCellIntersections,
exportInfo, exportInfo,
childMswBranch.get() ) ) childMswBranch.get() ) )
@@ -972,9 +952,7 @@ bool RicWellPathExportMswCompletionsImpl::generatePerforationsMswExportInfo(
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> std::vector<WellPathCellIntersectionInfo>
RicWellPathExportMswCompletionsImpl::generateCellSegments( const RimEclipseCase* eclipseCase, RicWellPathExportMswCompletionsImpl::generateCellSegments( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath, const RimWellPath* wellPath )
const RimMswCompletionParameters* mswParameters,
gsl::not_null<double*> initialMD )
{ {
const RigActiveCellInfo* activeCellInfo = const RigActiveCellInfo* activeCellInfo =
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
@@ -998,17 +976,35 @@ std::vector<WellPathCellIntersectionInfo>
std::vector<WellPathCellIntersectionInfo> continuousIntersections = std::vector<WellPathCellIntersectionInfo> continuousIntersections =
RigWellPathIntersectionTools::buildContinuousIntersections( allIntersections, mainGrid ); RigWellPathIntersectionTools::buildContinuousIntersections( allIntersections, mainGrid );
return continuousIntersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicWellPathExportMswCompletionsImpl::computeIntitialMeasuredDepth(
const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const RimMswCompletionParameters* mswParameters,
const std::vector<WellPathCellIntersectionInfo>& allIntersections )
{
if ( allIntersections.empty() ) return 0.0;
const RigActiveCellInfo* activeCellInfo =
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
double candidateMeasuredDepth = 0.0;
if ( mswParameters->referenceMDType() == RimMswCompletionParameters::ReferenceMDType::MANUAL_REFERENCE_MD ) if ( mswParameters->referenceMDType() == RimMswCompletionParameters::ReferenceMDType::MANUAL_REFERENCE_MD )
{ {
*initialMD = mswParameters->manualReferenceMD(); candidateMeasuredDepth = mswParameters->manualReferenceMD();
} }
else else
{ {
for ( const WellPathCellIntersectionInfo& intersection : continuousIntersections ) for ( const WellPathCellIntersectionInfo& intersection : allIntersections )
{ {
if ( activeCellInfo->isActive( intersection.globCellIndex ) ) if ( activeCellInfo->isActive( intersection.globCellIndex ) )
{ {
*initialMD = intersection.startMD; candidateMeasuredDepth = intersection.startMD;
break; break;
} }
} }
@@ -1028,10 +1024,10 @@ std::vector<WellPathCellIntersectionInfo>
// Initial MD is the lowest MD based on grid intersection and start of fracture completions // Initial MD is the lowest MD based on grid intersection and start of fracture completions
// https://github.com/OPM/ResInsight/issues/6071 // https://github.com/OPM/ResInsight/issues/6071
*initialMD = std::min( *initialMD, startOfFirstCompletion ); candidateMeasuredDepth = std::min( candidateMeasuredDepth, startOfFirstCompletion );
} }
return continuousIntersections; return candidateMeasuredDepth;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -111,9 +111,12 @@ private:
gsl::not_null<RicMswBranch*> branch ); gsl::not_null<RicMswBranch*> branch );
static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase, static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath );
static double computeIntitialMeasuredDepth( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath, const RimWellPath* wellPath,
const RimMswCompletionParameters* mswParameters, const RimMswCompletionParameters* mswParameters,
gsl::not_null<double*> initialMD ); const std::vector<WellPathCellIntersectionInfo>& allIntersections );
static std::vector<WellPathCellIntersectionInfo> static std::vector<WellPathCellIntersectionInfo>
filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections, filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,