StimPlanModel: avoid crashing on incomplete projects.

This commit is contained in:
Kristian Bendiksen
2022-10-19 11:22:49 +02:00
parent a695edc13a
commit f7a2acc3cf
6 changed files with 41 additions and 11 deletions

View File

@@ -824,7 +824,7 @@ RimAnnotationCollectionBase* RimStimPlanModel::annotationCollection()
//--------------------------------------------------------------------------------------------------
void RimStimPlanModel::updatePerforationInterval()
{
if ( m_thicknessDirectionWellPath )
if ( m_thicknessDirectionWellPath && wellPath() && wellPath()->wellPathGeometry() )
{
if ( !m_perforationInterval )
{
@@ -836,9 +836,6 @@ void RimStimPlanModel::updatePerforationInterval()
if ( m_fractureOrientation == FractureOrientation::ALONG_WELL_PATH )
{
// Adjust perforation interval for longitudinal fractures to correct TVD depth
CAF_ASSERT( wellPath() );
CAF_ASSERT( wellPath()->wellPathGeometry() );
cvf::Vec3d wellPathTangent = wellPath()->wellPathGeometry()->tangentAlongWellPath( m_MD() );
halfPerforationLength =
RigStimPlanModelTools::calculatePerforationLength( wellPathTangent, m_perforationLength() ) * 0.5;

View File

@@ -139,6 +139,11 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength )
return;
}
if ( !eclipseCase->eclipseCaseData() )
{
return;
}
RiaDefines::EclipseUnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if ( eclipseUnitsType == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{

View File

@@ -113,6 +113,12 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
return false;
}
auto eclipseCaseData = eclipseCase->eclipseCaseData();
if ( !eclipseCaseData )
{
return false;
}
RigEclipseWellLogExtractor eclExtractor( eclipseCase->eclipseCaseData(), wellPathGeometry, "fracture model" );
measuredDepthValues = eclExtractor.cellIntersectionMDs();

View File

@@ -74,6 +74,11 @@ bool RimStimPlanModelLayerCalculator::calculate( RiaDefines::CurveProperty curve
return false;
}
if ( !eclipseCase->eclipseCaseData() )
{
return false;
}
if ( !stimPlanModel->thicknessDirectionWellPath() )
{
return false;

View File

@@ -114,7 +114,7 @@ bool RimStimPlanModelStressCalculator::calculate( RiaDefines::CurveProperty curv
addDatapointsForBottomOfLayers( tvDepthValues, values );
}
if ( eclipseCase )
if ( eclipseCase && eclipseCase->eclipseCaseData() )
{
RigEclipseWellLogExtractor eclExtractor( eclipseCase->eclipseCaseData(), wellPathGeometry, "fracture model" );

View File

@@ -563,7 +563,15 @@ bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::Cu
RiaLogging::info( QString( "Extracting values for '%1' from grid '%2'." )
.arg( caf::AppEnum<RiaDefines::CurveProperty>( curveProperty ).uiText() )
.arg( eclipseCase->caseUserDescription() ) );
RigEclipseWellLogExtractor eclExtractor( eclipseCase->eclipseCaseData(), wellPathGeometry, "fracture model" );
auto eclipseCaseData = eclipseCase->eclipseCaseData();
if ( !eclipseCaseData )
{
RiaLogging::error( "Missing eclipse case data." );
return false;
}
RigEclipseWellLogExtractor eclExtractor( eclipseCaseData, wellPathGeometry, "fracture model" );
measuredDepthValues = eclExtractor.cellIntersectionMDs();
tvDepthValues = eclExtractor.cellIntersectionTVDs();
@@ -584,10 +592,7 @@ bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::Cu
}
cvf::ref<RigResultAccessor> resAcc =
RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
0,
timeStep,
&eclipseResultDefinition );
RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, 0, timeStep, &eclipseResultDefinition );
if ( resAcc.notNull() )
{
@@ -635,8 +640,15 @@ bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithDefault( RiaDefi
QString resultVariable = stimPlanModel->eclipseResultVariable( curveProperty );
auto eclipseCaseData = eclipseCase->eclipseCaseData();
if ( !eclipseCaseData )
{
RiaLogging::error( "Missing eclipse case data." );
return false;
}
// Try to locate a backup accessor (e.g. PORO_1 for PORO)
cvf::ref<RigResultAccessor> backupResAcc = findMissingValuesAccessor( eclipseCase->eclipseCaseData(),
cvf::ref<RigResultAccessor> backupResAcc = findMissingValuesAccessor( eclipseCaseData,
eclipseCase->inputPropertyCollection(),
0,
replacementTimeStep,
@@ -780,6 +792,11 @@ bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithOtherKLayer( Ria
const RigMainGrid* mainGrid = eclipseCase->mainGrid();
RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData();
if ( !caseData )
{
RiaLogging::error( "Missing eclipse case data." );
return false;
}
RiaDefines::PorosityModelType porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL;