From a00bfea40baa3e265a1b226da67d3f1cbc91baab Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 3 Sep 2024 15:06:55 +0200 Subject: [PATCH] #11663 Make sure non-Darcy data is computed The computation of non-Darcy properties is expensive, so we cache the results. Make sure that the calling function calls this function before using the properties. --- .../RicExportFractureCompletionsImpl.cpp | 2 ++ .../RicWellPathExportMswCompletionsImpl.cpp | 2 ++ .../ProjectDataModel/Completions/RimFracture.cpp | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp index b707801c30..09338e0413 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp @@ -117,6 +117,8 @@ std::vector { if ( fracture->isChecked() && static_cast( fracture->branchIndex() ) == branchIndex ) { + fracture->ensureValidNonDarcyProperties(); + fractures.push_back( fracture ); } } diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 909c78c5f5..1374c10f8c 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -789,6 +789,8 @@ bool RicWellPathExportMswCompletionsImpl::generateFracturesMswExportInfo( RimEcl // Check if fractures are to be assigned to current main bore segment for ( RimWellPathFracture* fracture : fractures ) { + fracture->ensureValidNonDarcyProperties(); + double fractureStartMD = fracture->fractureMD(); if ( fracture->fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH ) { diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp index bbc536d936..199741a6fe 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp @@ -316,6 +316,10 @@ const NonDarcyData& RimFracture::nonDarcyProperties() const //-------------------------------------------------------------------------------------------------- void RimFracture::ensureValidNonDarcyProperties() { + // The computation of non-Darcy properties is expensive, so we cache the results. + // Make sure that the calling function calls this function before using the properties. + // https://github.com/OPM/ResInsight/issues/11663 + if ( m_cachedFractureProperties.isDirty() ) { NonDarcyData props;