#7871 StimPlan Model: Add data source ordering for EQLNUM extraction

This commit is contained in:
Kristian Bendiksen 2021-08-16 14:52:09 +02:00
parent 966bcd1e77
commit b69665ce23
7 changed files with 294 additions and 16 deletions

View File

@ -23,6 +23,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.h
${CMAKE_CURRENT_LIST_DIR}/RimFaciesInitialPressureConfig.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureTableItem.h
${CMAKE_CURRENT_LIST_DIR}/RimPressureTable.h
${CMAKE_CURRENT_LIST_DIR}/RimExtractionConfiguration.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -47,6 +48,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimNonNetLayers.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaciesInitialPressureConfig.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureTableItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPressureTable.cpp
${CMAKE_CURRENT_LIST_DIR}/RimExtractionConfiguration.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimExtractionConfiguration.h"
#include "cafAppEnum.h"
namespace caf
{
template <>
void caf::AppEnum<RimExtractionConfiguration::EclipseCaseType>::setUp()
{
addItem( RimExtractionConfiguration::EclipseCaseType::STATIC_CASE, "STATIC_CASE", "Static Case" );
addItem( RimExtractionConfiguration::EclipseCaseType::DYNAMIC_CASE, "DYNAMIC_CASE", "Dynamic Case" );
addItem( RimExtractionConfiguration::EclipseCaseType::INITIAL_PRESSURE_CASE,
"INITIAL_PRESSURE_CASE",
"Initial Pressure Case" );
setDefault( RimExtractionConfiguration::EclipseCaseType::STATIC_CASE );
}
}; // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimExtractionConfiguration::RimExtractionConfiguration( const QString& resultVar,
RiaDefines::ResultCatType resultCat,
EclipseCaseType eclipseCase )
{
resultVariable = resultVar;
resultCategory = resultCat;
eclipseCaseType = eclipseCase;
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaDefines.h"
class RimExtractionConfiguration
{
public:
enum class EclipseCaseType
{
STATIC_CASE,
DYNAMIC_CASE,
INITIAL_PRESSURE_CASE
};
RimExtractionConfiguration( const QString& resultVar, RiaDefines::ResultCatType resultCat, EclipseCaseType eclipseCase );
RiaDefines::ResultCatType resultCategory;
QString resultVariable;
EclipseCaseType eclipseCaseType;
};

View File

@ -40,6 +40,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimExtractionConfiguration.h"
#include "RimFaciesProperties.h"
#include "RimFaultInView.h"
#include "RimFaultInViewCollection.h"
@ -1710,3 +1711,56 @@ QString RimStimPlanModel::pressureDate() const
else
return QString();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::deque<RimExtractionConfiguration>
RimStimPlanModel::extractionConfigurations( RiaDefines::CurveProperty curveProperty ) const
{
if ( curveProperty == RiaDefines::CurveProperty::EQLNUM )
{
return {
RimExtractionConfiguration( "EQLNUM_1",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::INITIAL_PRESSURE_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::INITIAL_PRESSURE_CASE ),
RimExtractionConfiguration( "EQLNUM_1",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::DYNAMIC_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::DYNAMIC_CASE ),
RimExtractionConfiguration( "EQLNUM_1",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::STATIC_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::INPUT_PROPERTY,
RimExtractionConfiguration::EclipseCaseType::STATIC_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::STATIC_NATIVE,
RimExtractionConfiguration::EclipseCaseType::STATIC_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::STATIC_NATIVE,
RimExtractionConfiguration::EclipseCaseType::INITIAL_PRESSURE_CASE ),
RimExtractionConfiguration( "EQLNUM",
RiaDefines::ResultCatType::STATIC_NATIVE,
RimExtractionConfiguration::EclipseCaseType::DYNAMIC_CASE ),
};
}
return std::deque<RimExtractionConfiguration>();
}
RimEclipseCase* RimStimPlanModel::eclipseCaseForType( RimExtractionConfiguration::EclipseCaseType caseType ) const
{
if ( caseType == RimExtractionConfiguration::EclipseCaseType::STATIC_CASE ) return m_staticEclipseCase;
if ( caseType == RimExtractionConfiguration::EclipseCaseType::DYNAMIC_CASE ) return m_eclipseCase;
if ( caseType == RimExtractionConfiguration::EclipseCaseType::INITIAL_PRESSURE_CASE )
return m_initialPressureEclipseCase;
return nullptr;
}

View File

@ -21,6 +21,7 @@
#include "RiaStimPlanModelDefines.h"
#include "RimCheckableNamedObject.h"
#include "RimExtractionConfiguration.h"
#include "RimWellPathComponentInterface.h"
#include "RigWellLogExtractor.h"
@ -178,6 +179,9 @@ public:
RiaDefines::ResultCatType eclipseResultCategory( RiaDefines::CurveProperty curveProperty ) const;
QString eclipseResultVariable( RiaDefines::CurveProperty curveProperty ) const;
std::deque<RimExtractionConfiguration> extractionConfigurations( RiaDefines::CurveProperty curveProperty ) const;
RimEclipseCase* eclipseCaseForType( RimExtractionConfiguration::EclipseCaseType ) const;
static double findFaciesValue( const RimColorLegend& colorLegend, const QString& name );
bool isScaledByNetToGross( RiaDefines::CurveProperty curveProperty ) const;

View File

@ -37,6 +37,7 @@
#include "RimEclipseInputProperty.h"
#include "RimEclipseInputPropertyCollection.h"
#include "RimEclipseResultDefinition.h"
#include "RimExtractionConfiguration.h"
#include "RimModeledWellPath.h"
#include "RimNonNetLayers.h"
#include "RimStimPlanModel.h"
@ -83,23 +84,49 @@ bool RimStimPlanModelWellLogCalculator::calculate( RiaDefines::CurveProperty cur
{
RiaLogging::debug(
QString( "Calculating well log for '%1'." ).arg( caf::AppEnum<RiaDefines::CurveProperty>( curveProperty ).uiText() ) );
std::deque<RimExtractionConfiguration> extractionConfigurations =
stimPlanModel->extractionConfigurations( curveProperty );
std::deque<RimStimPlanModel::MissingValueStrategy> missingValueStratgies =
stimPlanModel->missingValueStrategies( curveProperty );
if ( !extractValuesForProperty( curveProperty, stimPlanModel, timeStep, values, measuredDepthValues, tvDepthValues, rkbDiff ) )
if ( extractionConfigurations.empty() )
{
if ( std::find( missingValueStratgies.begin(),
missingValueStratgies.end(),
RimStimPlanModel::MissingValueStrategy::DEFAULT_VALUE ) != missingValueStratgies.end() )
if ( !extractValuesForProperty( curveProperty, stimPlanModel, timeStep, values, measuredDepthValues, tvDepthValues, rkbDiff ) )
{
RiaLogging::warning( QString( "Extraction failed. Trying fallback" ) );
if ( !replaceMissingValuesWithDefault( curveProperty, stimPlanModel, values, measuredDepthValues, tvDepthValues, rkbDiff ) )
if ( std::find( missingValueStratgies.begin(),
missingValueStratgies.end(),
RimStimPlanModel::MissingValueStrategy::DEFAULT_VALUE ) != missingValueStratgies.end() )
{
RiaLogging::error( "Fallback failed too." );
return false;
RiaLogging::warning( QString( "Extraction failed. Trying fallback" ) );
if ( !replaceMissingValuesWithDefault( curveProperty,
stimPlanModel,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff ) )
{
RiaLogging::error( "Fallback failed too." );
return false;
}
}
}
}
else
{
if ( !extractValuesForPropertyWithConfigurations( curveProperty,
stimPlanModel,
timeStep,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff ) )
{
return false;
}
}
double overburdenHeight = stimPlanModel->overburdenHeight();
if ( overburdenHeight > 0.0 )
@ -388,6 +415,65 @@ void RimStimPlanModelWellLogCalculator::scaleByNetToGross( const RimStimPlanMode
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanModelWellLogCalculator::extractValuesForPropertyWithConfigurations( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
int timeStep,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues,
double& rkbDiff ) const
{
std::deque<RimExtractionConfiguration> extractionConfigurations =
stimPlanModel->extractionConfigurations( curveProperty );
QString curvePropertyName = caf::AppEnum<RiaDefines::CurveProperty>( curveProperty ).uiText();
for ( auto extractionConfig : extractionConfigurations )
{
RiaDefines::ResultCatType resultType = extractionConfig.resultCategory;
QString resultVariable = extractionConfig.resultVariable;
RimExtractionConfiguration::EclipseCaseType eclipseCaseType = extractionConfig.eclipseCaseType;
RiaLogging::info(
QString( "Trying extraction option for '%1': %2 %3 %4" )
.arg( curvePropertyName )
.arg( resultVariable )
.arg( caf::AppEnum<RiaDefines::ResultCatType>( resultType ).uiText() )
.arg( caf::AppEnum<RimExtractionConfiguration::EclipseCaseType>( eclipseCaseType ).uiText() ) );
RimEclipseCase* eclipseCase = stimPlanModel->eclipseCaseForType( eclipseCaseType );
if ( !eclipseCase )
{
RiaLogging::info( "Skipping extraction config due to missing model." );
}
else
{
bool isOk = extractValuesForProperty( curveProperty,
stimPlanModel,
eclipseCase,
resultType,
resultVariable,
timeStep,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff );
if ( isOk )
{
RiaLogging::info( "Extraction succeeded" );
return true;
}
}
}
RiaLogging::info( QString( "Extraction failed. Tried %1 configurations." ).arg( extractionConfigurations.size() ) );
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -400,11 +486,37 @@ bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::Cu
double& rkbDiff ) const
{
RimEclipseCase* eclipseCase = stimPlanModel->eclipseCaseForProperty( curveProperty );
if ( !eclipseCase )
{
return false;
}
if ( !eclipseCase ) return false;
RiaDefines::ResultCatType resultType = stimPlanModel->eclipseResultCategory( curveProperty );
QString resultVariable = stimPlanModel->eclipseResultVariable( curveProperty );
return extractValuesForProperty( curveProperty,
stimPlanModel,
eclipseCase,
resultType,
resultVariable,
timeStep,
values,
measuredDepthValues,
tvDepthValues,
rkbDiff );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
RimEclipseCase* eclipseCase,
RiaDefines::ResultCatType resultCategory,
const QString resultVariable,
int timeStep,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues,
double& rkbDiff ) const
{
if ( !stimPlanModel->thicknessDirectionWellPath() )
{
return false;
@ -428,13 +540,13 @@ bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::Cu
RimEclipseResultDefinition eclipseResultDefinition;
eclipseResultDefinition.setEclipseCase( eclipseCase );
eclipseResultDefinition.setResultType( stimPlanModel->eclipseResultCategory( curveProperty ) );
eclipseResultDefinition.setResultType( resultCategory );
eclipseResultDefinition.setPorosityModel( RiaDefines::PorosityModelType::MATRIX_MODEL );
eclipseResultDefinition.setResultVariable( stimPlanModel->eclipseResultVariable( curveProperty ) );
eclipseResultDefinition.setResultVariable( resultVariable );
eclipseResultDefinition.loadResult();
if ( stimPlanModel->eclipseResultCategory( curveProperty ) != RiaDefines::ResultCatType::DYNAMIC_NATIVE ||
if ( resultCategory != RiaDefines::ResultCatType::DYNAMIC_NATIVE ||
curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
{
timeStep = 0;

View File

@ -29,9 +29,10 @@
#include <vector>
class RigEclipseCaseData;
class RigResultAccessor;
class RimEclipseInputPropertyCollection;
class RimEclipseResultDefinition;
class RigResultAccessor;
class RimEclipseCase;
class RimStimPlanModelWellLogCalculator : public RimStimPlanModelPropertyCalculator
{
@ -87,6 +88,25 @@ protected:
std::vector<double>& tvDepthValues,
double& rkbDiff ) const;
bool extractValuesForProperty( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
RimEclipseCase* eclipseCase,
RiaDefines::ResultCatType resultCategory,
const QString resultVariable,
int timeStep,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues,
double& rkbDiff ) const;
bool extractValuesForPropertyWithConfigurations( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
int timeStep,
std::vector<double>& values,
std::vector<double>& measuredDepthValues,
std::vector<double>& tvDepthValues,
double& rkbDiff ) const;
bool replaceMissingValuesWithDefault( RiaDefines::CurveProperty curveProperty,
const RimStimPlanModel* stimPlanModel,
std::vector<double>& values,